當前位置: 首頁>>代碼示例>>C#>>正文


C# PlayerInfo.GetClassyName方法代碼示例

本文整理匯總了C#中fCraft.PlayerInfo.GetClassyName方法的典型用法代碼示例。如果您正苦於以下問題:C# PlayerInfo.GetClassyName方法的具體用法?C# PlayerInfo.GetClassyName怎麽用?C# PlayerInfo.GetClassyName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fCraft.PlayerInfo的用法示例。


在下文中一共展示了PlayerInfo.GetClassyName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PrintPlayerInfo

        public static void PrintPlayerInfo( Player player, PlayerInfo info ) {
            Player target = Server.FindPlayerExact( info.Name );

            // hide online status when hidden
            if( target != null && !player.CanSee( target ) ) {
                target = null;
            }

            if( info.LastIP.Equals( IPAddress.None ) ) {
                player.Message( "About {0}&S: Never seen before.", info.GetClassyName() );

            } else {
                if( target != null ) {
                    if( target.IsHidden ) {
                        if( player.Can( Permission.ViewPlayerIPs ) ) {
                            player.Message( "About {0}&S: HIDDEN. Online from {1}",
                                            info.GetClassyName(),
                                            info.LastIP );
                        } else {
                            player.Message( "About {0}&S: HIDDEN.",
                                            info.GetClassyName() );
                        }
                    } else {
                        if( player.Can( Permission.ViewPlayerIPs ) ) {
                            player.Message( "About {0}&S: Online now from {1}",
                                            info.GetClassyName(),
                                            info.LastIP );
                        } else {
                            player.Message( "About {0}&S: Online now.",
                                            info.GetClassyName() );
                        }
                    }
                } else {
                    if( player.Can( Permission.ViewPlayerIPs ) ) {
                        player.Message( "About {0}&S: Last seen {1} ago from {2}",
                                        info.GetClassyName(),
                                        info.TimeSinceLastSeen.ToMiniString(),
                                        info.LastIP );
                    } else {
                        player.Message( "About {0}&S: Last seen {1} ago.",
                                        info.GetClassyName(),
                                        info.TimeSinceLastSeen.ToMiniString() );
                    }
                }
                // Show login information
                player.Message( "  Logged in {0} time(s) since {1:d MMM yyyy}.",
                                info.TimesVisited,
                                info.FirstLoginDate );
            }


            // Show ban information
            IPBanInfo ipBan = IPBanList.Get( info.LastIP );
            if( ipBan != null && info.Banned ) {
                player.Message( "  Both name and IP are {0}BANNED&S. See &H/baninfo", Color.Red );
            } else if( ipBan != null ) {
                player.Message( "  IP is {0}BANNED&S (but nick isn't). See &H/baninfo", Color.Red );
            } else if( info.Banned ) {
                player.Message( "  Nick is {0}BANNED&S (but IP isn't). See &H/baninfo", Color.Red );
            }


            if( info.LastIP.ToString() != IPAddress.None.ToString() ) {
                // Show alts
                List<PlayerInfo> altNames = new List<PlayerInfo>();
                int bannedAltCount = 0;
                foreach( PlayerInfo playerFromSameIP in PlayerDB.FindPlayers( info.LastIP, 25 ) ) {
                    if( playerFromSameIP != info ) {
                        altNames.Add( playerFromSameIP );
                        if( playerFromSameIP.Banned ) {
                            bannedAltCount++;
                        }
                    }
                }

                if( altNames.Count > 0 ) {
                    if( bannedAltCount > 0 ) {
                        player.Message( "  {0} accounts ({1} banned) share this IP: {2}",
                                        altNames.Count,
                                        bannedAltCount,
                                        altNames.ToArray().JoinToClassyString() );
                    } else {
                        player.Message( "  {0} accounts share this IP: {1}",
                                        altNames.Count,
                                        altNames.ToArray().JoinToClassyString() );
                    }
                }
            }


            // Stats
            if( info.BlocksDrawn > 500000000 ) {
                player.Message( "  Built {0} and deleted {1} blocks, drew {2}M blocks, wrote {3} messages.",
                                info.BlocksBuilt,
                                info.BlocksDeleted,
                                info.BlocksDrawn / 1000000,
                                info.LinesWritten );
            } else if( info.BlocksDrawn > 500000 ) {
                player.Message( "  Built {0} and deleted {1} blocks, drew {2}K blocks, wrote {3} messages.",
                                info.BlocksBuilt,
//.........這裏部分代碼省略.........
開發者ID:fragmer,項目名稱:fCraft,代碼行數:101,代碼來源:InfoCommands.cs


注:本文中的fCraft.PlayerInfo.GetClassyName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。