Example #1
0
    private IEnumerator UpdateProfileInfo(int dbid)
    {
        string[] data = new string[12] {
            defaultName, "", "1", "0", "0", "0", "0", "0", "0", "0", "2500", "0"
        };
        if (dbid > -1)
        {
            WWWForm newForm = new WWWForm();
            newForm.AddField("id", dbid);
            WWW request = new WWW(infoRequest, newForm);

            yield return(request);

            if (string.IsNullOrEmpty(request.error))
            {
                data = request.text.Split(new string[] { "-" }, StringSplitOptions.None);
            }
        }
        else
        {
            yield return(new WaitForSeconds(0.2f));
        }

        if (data.Length < 12)
        {
            Logout();
            yield break;
        }

        profileData.username = data[0];
        profileData.clan     = data[1];
        profileData.rank     = Mathf.Clamp(int.Parse(data[2]), 1, 75);
        profileData.curXP    = int.Parse(data[3]);
        float targXP = (float)AccountManager.GetTargetExperienceForRank(profileData.rank);

        float kills  = float.Parse(data[4]);
        float deaths = float.Parse(data[5]);

        profileData.deaths      = (int)deaths;
        profileData.kills       = (int)kills;
        profileData.assists     = int.Parse(data[6]);
        profileData.matchesWon  = int.Parse(data[8]);
        profileData.matchesLost = int.Parse(data[9]);

        float xpPercent = (float)profileData.curXP / targXP;

        profileInfo.username.text     = "Welcome, " + ((profileData.clan != "") ? DarkRef.ClanColor(false) + "[" + profileData.clan + "] [-][D99677]" : "[D99677]") + profileData.username + "[-]";
        profileInfo.profileStats.text = "GENERAL" + "\n" + "  [BC8F76]Rank:[-] " + profileData.rank.ToString() + " [A0A0A0][Rookie]"; //Placeholder for rank names.
        profileInfo.xpText.text       = "[BC8F76]XP:[-] " + profileData.curXP.ToString() + ((dbid <= -1) ? "" : "/" + targXP.ToString() + " (" + (xpPercent * 100f).ToString("F1") + "%)");
        profileInfo.xpBar.value       = (dbid <= -1) ? 1f : xpPercent;
        profileInfo.combatStats.text  = "COMBAT" + "\n" + "  [BC8F76]Kills:[-] " + kills.ToString() + "\n" + "  [BC8F76]Deaths:[-] " + deaths.ToString() + "\n" + "  [BC8F76]Assists:[-] " + profileData.assists.ToString() + "\n" + "  [BC8F76]K/D Ratio:[-] " + (deaths > 0f ? (kills / deaths) : kills).ToString("F2") + "\n" + "  [BC8F76]Headshots:[-] " + int.Parse(data[7]);
        profileInfo.matchStats.text   = "MATCHES" + "\n" + "  [BC8F76]Matches Played:[-] " + (profileData.matchesWon + profileData.matchesLost).ToString() + "\n" + "  [BC8F76]Matches Won:[-] " + profileData.matchesWon.ToString() + "\n" + "  [BC8F76]Matches Lost:[-] " + profileData.matchesLost.ToString();

        profileData.currency     = int.Parse(data[10]);
        profileData.premCurrency = int.Parse(data[11]);
    }
Example #2
0
    void Awake()
    {
        countToNextRound        = 10;
        vignetting.intensity    = 0f;
        blackStuff.alpha        = 0f;
        Screen.lockCursor       = false;
        UICamera.selectedObject = null;

        sortedPlayers = new List <NetPlayerInfo>();

        for (int i = 0; i < Topan.Network.connectedPlayers.Length; i++)
        {
            Topan.NetworkPlayer curPlayer = Topan.Network.connectedPlayers[i];

            NetPlayerInfo npi = new NetPlayerInfo();
            npi.realPlayer = curPlayer;
            npi.myKills    = (int)((UInt16)curPlayer.GetPlayerData("k", (UInt16)0));
            npi.myDeaths   = (int)((UInt16)curPlayer.GetPlayerData("d", (UInt16)0));
            npi.myHeads    = (int)((UInt16)curPlayer.GetPlayerData("h", (UInt16)0));
            npi.myScore    = (int)curPlayer.GetPlayerData("sc", 0);
            sortedPlayers.Add(npi);
        }

        if (GeneralVariables.gameModeHasTeams)
        {
            teamBasedRoot.SetActive(true);
            Destroy(individualBasedRoot);

            int redIndex  = 0;
            int blueIndex = 0;

            sortedPlayers = new List <NetPlayerInfo>();
            for (int i = 0; i < Topan.Network.connectedPlayers.Length; i++)
            {
                Topan.NetworkPlayer curPlayer = Topan.Network.connectedPlayers[i];

                NetPlayerInfo npi = new NetPlayerInfo();
                npi.realPlayer = curPlayer;
                npi.myKills    = (int)((UInt16)curPlayer.GetPlayerData("k", (UInt16)0));
                npi.myDeaths   = (int)((UInt16)curPlayer.GetPlayerData("d", (UInt16)0));
                npi.myHeads    = (int)((UInt16)curPlayer.GetPlayerData("h", (UInt16)0));
                npi.myScore    = (int)curPlayer.GetPlayerData("sc", 0);
                sortedPlayers.Add(npi);
            }

            BotPlayer[] redBots = NetworkingGeneral.GetBotParticipants(0);
            for (int i = 0; i < redBots.Length; i++)
            {
                BotStats hisStats = BotManager.GetBotStats(redBots[i].index);

                NetPlayerInfo npi = new NetPlayerInfo();
                npi.botPlayer = redBots[i];
                npi.myKills   = hisStats.kills;
                npi.myDeaths  = hisStats.deaths;
                npi.myHeads   = hisStats.headshots;
                npi.myScore   = hisStats.score;
                sortedPlayers.Add(npi);
            }

            BotPlayer[] blueBots = NetworkingGeneral.GetBotParticipants(1);
            for (int i = 0; i < blueBots.Length; i++)
            {
                BotStats hisStats = BotManager.GetBotStats(blueBots[i].index);

                NetPlayerInfo npi = new NetPlayerInfo();
                npi.botPlayer = blueBots[i];
                npi.myKills   = hisStats.kills;
                npi.myDeaths  = hisStats.deaths;
                npi.myHeads   = hisStats.headshots;
                npi.myScore   = hisStats.score;
                sortedPlayers.Add(npi);
            }

            if (NetworkingGeneral.currentGameType.sortPlayersBy == SortPlayersBy.Kills)
            {
                sortedPlayers.Sort((p1, p2) => p2.myKills.CompareTo(p1.myKills));
            }
            else if (NetworkingGeneral.currentGameType.sortPlayersBy == SortPlayersBy.Score)
            {
                sortedPlayers.Sort((p1, p2) => p2.myScore.CompareTo(p1.myScore));
            }

            for (int i = 0; i < sortedPlayers.Count; i++)
            {
                NetPlayerInfo current = sortedPlayers[i];
                if (current.botPlayer == null && current.realPlayer == null)
                {
                    continue;
                }

                if (current.myInfo == null)
                {
                    continue;
                }

                int   kills  = current.myKills;
                int   deaths = current.myDeaths;
                int   score  = current.myScore;
                float kd     = (deaths > 0) ? ((float)kills / (float)deaths) : kills;

                UserStatsGUI usg = null;
                if (current.myTeam == 0)
                {
                    UserStatsGUI instance = (UserStatsGUI)Instantiate(scoreboardPrefab);
                    instance.transform.parent        = redStart;
                    instance.transform.localPosition = Vector3.down * (redIndex * statsSpacing);
                    instance.transform.localScale    = Vector3.one;
                    usg = instance;
                    redIndex++;
                }
                else
                {
                    UserStatsGUI instance = (UserStatsGUI)Instantiate(scoreboardPrefab);
                    instance.transform.parent        = blueStart;
                    instance.transform.localPosition = Vector3.down * (blueIndex * statsSpacing);
                    instance.transform.localScale    = Vector3.one;
                    usg = instance;
                    blueIndex++;
                }

                int thisListIndex = (current.myTeam == 0) ? redIndex : blueIndex;

                string clanNameFinal = (current.myInfo.clan != "") ? ((current.thisPlayerIsBot) ? DarkRef.ClanColor(true) + "(" + current.myInfo.clan + ")[-] " : DarkRef.ClanColor(false) + "[" + current.myInfo.clan + "][-] ") : "";
                usg.SetInfo(((current.myInfo != null) ? current.myInfo.rank : 1).ToString(),
                            clanNameFinal + current.myInfo.username,
                            kills.ToString(),
                            deaths.ToString(),
                            kd.ToString("F2"),
                            current.myHeads.ToString(),
                            score.ToString(),
                            ((current.thisPlayerIsBot) ? Topan.Network.server.GetPlayerData("ping", 0).ToString() : current.realPlayer.GetPlayerData("ping", 0)).ToString(),
                            (!current.thisPlayerIsBot && current.realPlayer == Topan.Network.player),
                            (thisListIndex % 2 == 0));
            }
        }
        else
        {
            Destroy(teamBasedRoot);
            individualBasedRoot.SetActive(true);

            int currentIndex = 0;

            for (int i = 0; i < BotManager.allBotPlayers.Length && i < GeneralVariables.Networking.botCount; i++)
            {
                BotStats hisStats = BotManager.GetBotStats(i);

                NetPlayerInfo npi = new NetPlayerInfo();
                npi.botPlayer = BotManager.allBotPlayers[i];
                npi.myKills   = hisStats.kills;
                npi.myDeaths  = hisStats.deaths;
                npi.myHeads   = hisStats.headshots;
                npi.myScore   = hisStats.score;
                sortedPlayers.Add(npi);
            }

            if (NetworkingGeneral.currentGameType.sortPlayersBy == SortPlayersBy.Kills)
            {
                sortedPlayers.Sort((p1, p2) => p2.myKills.CompareTo(p1.myKills));
            }
            else if (NetworkingGeneral.currentGameType.sortPlayersBy == SortPlayersBy.Score)
            {
                sortedPlayers.Sort((p1, p2) => p2.myScore.CompareTo(p1.myScore));
            }

            for (int i = 0; i < sortedPlayers.Count; i++)
            {
                NetPlayerInfo current = sortedPlayers[i];
                if (current.botPlayer == null && current.realPlayer == null)
                {
                    continue;
                }

                if (current.myInfo == null)
                {
                    continue;
                }

                int   kills  = current.myKills;
                int   deaths = current.myDeaths;
                int   score  = current.myScore;
                float kd     = (deaths > 0) ? ((float)kills / (float)deaths) : kills;

                if (currentIndex >= 16)
                {
                    continue;
                }

                UserStatsGUI instance = (UserStatsGUI)Instantiate(scoreboardPrefab);
                instance.transform.parent        = individualStart;
                instance.transform.localPosition = Vector3.down * (currentIndex * statsSpacing);
                instance.transform.localScale    = Vector3.one;

                currentIndex++;

                string clanNameFinal = (current.myInfo.clan != "") ? ((current.thisPlayerIsBot) ? DarkRef.ClanColor(true) + "(" + current.myInfo.clan + ")[-] " : DarkRef.ClanColor(false) + "[" + current.myInfo.clan + "][-] ") : "";
                instance.SetInfo(((current.myInfo != null) ? current.myInfo.rank : 1).ToString(),
                                 clanNameFinal + current.myInfo.username,
                                 kills.ToString(),
                                 deaths.ToString(),
                                 kd.ToString("F2"),
                                 current.myHeads.ToString(),
                                 score.ToString(),
                                 ((current.thisPlayerIsBot) ? Topan.Network.server.GetPlayerData("ping", 0).ToString() : current.realPlayer.GetPlayerData("ping", 0)).ToString(),
                                 (!current.thisPlayerIsBot && current.realPlayer == Topan.Network.player),
                                 (currentIndex % 2 == 0));
            }
        }

        if (GeneralVariables.gameModeHasTeams)
        {
            roundLabel.cachedTrans.localPosition    = new Vector3(0f, 245f, -7f);
            spectatorList.cachedTrans.localPosition = new Vector3(-395f, -316f, 0f);
            panelRoot.localPosition = Vector3.zero;
            statsBackground.SetDimensions(270, 530);
            statsOutline.SetDimensions(278, 540);
        }
        else
        {
            roundLabel.cachedTrans.localPosition    = new Vector3(0f, 225f, -7f);
            spectatorList.cachedTrans.localPosition = new Vector3(-395f, -261f, 0f);
            panelRoot.localPosition = Vector3.up * -20f;
            statsBackground.SetDimensions(270, 440);
            statsOutline.SetDimensions(278, 450);
        }

        int roundScore = (int)Topan.Network.player.GetPlayerData("sc", 0);
        int targetExp  = AccountManager.GetTargetExperienceForRank(AccountManager.profileData.rank);

        startExp             = AccountManager.profileData.curXP;
        currentExpValue      = startExp;
        earnedExp            = roundScore;
        earnedCurrency       = Mathf.RoundToInt(roundScore * UnityEngine.Random.Range(0.95f, 1.05f) * 0.237f);
        expBaseAnimationTime = Mathf.Max(0.01f, expBaseAnimationTime);
        animationSpeed       = (float)earnedExp / expBaseAnimationTime;
        expSlowdownTime      = Mathf.Clamp(expSlowdownTime, 0f, 0.99f);

        expAccumulateSound.volume = 0f;
        expProgressBar.value      = (float)startExp / (float)targetExp;
        xpLabel.text        = startExp.ToString() + " XP / " + targetExp.ToString() + " XP";
        xpLeftLabel.text    = (targetExp - startExp).ToString() + " XP REMAINING";
        currencyLabel.alpha = 0f;
        currencyLabel.text  = "+0 CREDITS";
        rankLabel.text      = "[u]" + AccountManager.profileData.username + "[/u]" + "\n" + "RANK " + AccountManager.profileData.rank.ToString() + " [ROOKIE]";
        nextRankLabel.text  = "RANK " + (AccountManager.profileData.rank + 1).ToString() + " [ROOKIE]";

        StartCoroutine(ProcessData());
    }
Example #3
0
    public void RefreshPlayerInfo()
    {
        redIndex        = 0;
        blueIndex       = 0;
        unassignedIndex = 0;

        RefreshPlayers();

        if (Topan.Network.isConnected)
        {
            if (Topan.Network.HasServerInfo("m"))
            {
                mapID = (byte)Topan.Network.GetServerInfo("m");
            }
            else
            {
                mapID = -1;
            }

            serverInfo.text = "";
            if (Topan.Network.HasServerInfo("wnr"))
            {
                int winnerteam = ((byte)Topan.Network.GetServerInfo("wnr")) - 1;
                if (winnerteam > -1)
                {
                    serverInfo.text += ((winnerteam == 0) ? "[[C44524]Red Team[-]" : "[[377FB2]Blue Team[-]");
                    serverInfo.text += " Won] \n";
                }
                else
                {
                    serverInfo.text += "[Draw Match] \n";
                }
            }

            int serverDuration = 0;
            if (Topan.Network.HasServerInfo("dur") && Topan.Network.GetServerInfo("dur") != null)
            {
                serverDuration = (byte)Topan.Network.GetServerInfo("dur") * 60;
            }
            else if (Topan.Network.isServer)
            {
                Topan.Network.SetServerInfo("dur", (byte)gameDurationSlider.currentDuration);
            }

            CombatantInfo serverProfile = (CombatantInfo)Topan.Network.server.GetInitialData("dat");
            serverInfo.text += "[D77A39]Room Name:[-] " + Topan.Network.GameName;
            int botsDisp = Mathf.Clamp(GeneralVariables.Networking.botCount, 0, Topan.Network.MaxPlayers - Topan.Network.connectedPlayers.Length);
            serverInfo.text += "\n" + "[D77A39]Players:[-] " + Topan.Network.connectedPlayers.Length + ((botsDisp > 0) ? " [AEBF95][+" + botsDisp.ToString() + "][-]" : "") + "/" + Topan.Network.MaxPlayers;
            serverInfo.text += "\n" + "[D77A39]Host:[-] " + ((serverProfile.clan != "") ? DarkRef.ClanColor(false) + "[" + serverProfile.clan + "][-] " : "") + serverProfile.username;
            serverInfo.text += "\n" + "[D77A39]Game Mode:[-] " + NetworkingGeneral.currentGameType.typeName;
            serverInfo.text += "\n" + "[D77A39]Round Duration:[-] " + (serverDuration / 60).ToString() + " minutes";

            if (mapID > -1)
            {
                serverInfo.text += "\n" + "[D77A39]Map Name:[-] " + StaticMapsList.mapsArraySorted[mapID].mapName;
                serverMapScreenshot.mainTexture = StaticMapsList.mapsArraySorted[mapID].previewIcon;
            }
        }
        else
        {
            serverInfo.text = "Not connected to a network";
            serverMapScreenshot.mainTexture = null;
            mapID = -1;
        }
    }
Example #4
0
    private void AddPlayerToList(int team, Topan.NetworkPlayer player, BotPlayer bot = null)
    {
        int realTeamNum = team;

        if (player != null && !player.HasPlayerData("team"))
        {
            allSuccess = false;
            return;
        }

        bool thisIsBot = (player == null && bot != null);

        if (thisIsBot && team < 2)
        {
            realTeamNum = (int)bot.team;
        }

        GameObject info = GetAvailableSlot();

        if (info == null)
        {
            return;
        }

        bool showInfo = true;
        int  index    = 0;

        if (!GeneralVariables.gameModeHasTeams)
        {
            index = unassignedIndex;

            if (realTeamNum == 2)
            {
                if (index < 8)
                {
                    info.transform.parent = redPanel;
                }
                else
                {
                    info.transform.parent = bluePanel;
                }
            }
            else
            {
                showInfo = false;
            }

            info.transform.localPosition = new Vector3(0f, -(index % 8) * spacing, 0f);
        }
        else
        {
            if (realTeamNum == 0 && redIndex < 8)
            {
                index = redIndex;
                info.transform.parent = redPanel;
            }
            else if (realTeamNum == 1 && blueIndex < 8)
            {
                index = blueIndex;
                info.transform.parent = bluePanel;
            }
            else
            {
                showInfo = false;
            }

            info.transform.localPosition = new Vector3(0f, -index * spacing, 0f);
        }

        info.SetActive(showInfo);
        info.transform.localRotation = Quaternion.identity;
        info.transform.localScale    = Vector3.one;

        PlayerLobbyGUI plg = info.GetComponent <PlayerLobbyGUI>();

        CombatantInfo pInfo = null;

        if (thisIsBot)
        {
            pInfo = bot.botInfo;
        }
        else
        {
            pInfo = (CombatantInfo)player.GetInitialData("dat");
        }

        plg.rankIcon.enabled   = true;
        plg.usernameLabel.text = ((pInfo.clan != "") ? (((thisIsBot) ? (DarkRef.ClanColor(true) + "(" + pInfo.clan + ")") : (DarkRef.ClanColor(false) + "[" + pInfo.clan + "]")) + "[-] ") : "") + pInfo.username;
        plg.rankLabel.text     = pInfo.rank.ToString();

        index++;
        if (!GeneralVariables.gameModeHasTeams)
        {
            if (realTeamNum == 2)
            {
                unassignedIndex = index;
            }
        }
        else
        {
            if (realTeamNum == 0)
            {
                redIndex = index;
            }
            else if (realTeamNum == 1)
            {
                blueIndex = index;
            }
        }
    }
Example #5
0
    public void Refresh()
    {
        if (!Topan.Network.isConnected)
        {
            return;
        }

        sortedPlayers = new List <NetPlayerInfo>();

        for (int i = 0; i < Topan.Network.connectedPlayers.Length; i++)
        {
            Topan.NetworkPlayer curPlayer = Topan.Network.connectedPlayers[i];
            NetPlayerInfo       npi       = new NetPlayerInfo();

            npi.realPlayer = curPlayer;
            npi.myKills    = (int)((UInt16)curPlayer.GetPlayerData("k", (UInt16)0));
            npi.myDeaths   = (int)((UInt16)curPlayer.GetPlayerData("d", (UInt16)0));
            npi.myHeads    = (int)((UInt16)curPlayer.GetPlayerData("h", (UInt16)0));
            npi.myScore    = (int)curPlayer.GetPlayerData("sc", 0);
            sortedPlayers.Add(npi);

            if (curPlayer.id == Topan.Network.player.id)
            {
                yourPlayer = npi;
            }
        }

        if (GeneralVariables.gameModeHasTeams)
        {
            int redIndex       = 0;
            int blueIndex      = 0;
            int redTotalScore  = 0;
            int blueTotalScore = 0;

            waitingForRed  = true;
            waitingForBlue = true;

            BotPlayer[] redBots = NetworkingGeneral.GetBotParticipants(0);
            for (int i = 0; i < redBots.Length; i++)
            {
                BotStats hisStats = BotManager.GetBotStats(redBots[i].index);

                NetPlayerInfo npi = new NetPlayerInfo();
                npi.botPlayer = redBots[i];
                npi.myKills   = hisStats.kills;
                npi.myDeaths  = hisStats.deaths;
                npi.myHeads   = hisStats.headshots;
                npi.myScore   = hisStats.score;
                sortedPlayers.Add(npi);
            }

            BotPlayer[] blueBots = NetworkingGeneral.GetBotParticipants(1);
            for (int i = 0; i < blueBots.Length; i++)
            {
                BotStats hisStats = BotManager.GetBotStats(blueBots[i].index);

                NetPlayerInfo npi = new NetPlayerInfo();
                npi.botPlayer = blueBots[i];
                npi.myKills   = hisStats.kills;
                npi.myDeaths  = hisStats.deaths;
                npi.myHeads   = hisStats.headshots;
                npi.myScore   = hisStats.score;
                sortedPlayers.Add(npi);
            }

            if (NetworkingGeneral.currentGameType.sortPlayersBy == SortPlayersBy.Kills)
            {
                sortedPlayers.Sort((p1, p2) => p2.myKills.CompareTo(p1.myKills));
            }
            else if (NetworkingGeneral.currentGameType.sortPlayersBy == SortPlayersBy.Score)
            {
                sortedPlayers.Sort((p1, p2) => p2.myScore.CompareTo(p1.myScore));
            }

            tdmSubheader.text = NetworkingGeneral.currentGameType.typeName + " [" + Topan.Network.GameName + "]";
            for (int i = 0; i < sortedPlayers.Count; i++)
            {
                NetPlayerInfo current = sortedPlayers[i];
                if (current.botPlayer == null && current.realPlayer == null)
                {
                    continue;
                }

                if (current.myInfo == null)
                {
                    continue;
                }

                int   kills  = current.myKills;
                int   deaths = current.myDeaths;
                int   score  = current.myScore;
                float kd     = (deaths > 0) ? ((float)kills / (float)deaths) : kills;

                UserStatsGUI usg = null;
                if (current.myTeam == 0)
                {
                    if (redIndex >= 8)
                    {
                        continue;
                    }

                    waitingForRed = false;
                    usg           = redTeam[redIndex];
                    usg.gameObject.SetActive(true);
                    redTotalScore += score;
                    redIndex++;
                }
                else if (current.myTeam == 1)
                {
                    if (blueIndex >= 8)
                    {
                        continue;
                    }

                    waitingForBlue = false;
                    usg            = blueTeam[blueIndex];
                    usg.gameObject.SetActive(true);
                    blueTotalScore += score;
                    blueIndex++;
                }

                int thisListIndex = (current.myTeam == 0) ? redIndex : blueIndex;

                string clanNameFinal = (current.myInfo.clan != "") ? ((current.thisPlayerIsBot) ? DarkRef.ClanColor(true) + "(" + current.myInfo.clan + ")[-] " : DarkRef.ClanColor(false) + "[" + current.myInfo.clan + "][-] ") : "";
                usg.SetInfo(current.myInfo.rank.ToString(),
                            clanNameFinal + current.myInfo.username,
                            kills.ToString(),
                            deaths.ToString(),
                            kd.ToString("F2"),
                            current.myHeads.ToString(),
                            score.ToString(),
                            ((current.thisPlayerIsBot) ? Topan.Network.server.GetPlayerData("ping", 0).ToString() : current.realPlayer.GetPlayerData("ping", 0)).ToString(),
                            (!current.thisPlayerIsBot && current.realPlayer == Topan.Network.player),
                            (thisListIndex % 2 == 0));
            }

            if (redIndex < 7)
            {
                for (int i = redIndex; i < 8; i++)
                {
                    redTeam[i].gameObject.SetActive(false);
                }
            }

            if (blueIndex < 7)
            {
                for (int i = blueIndex; i < 8; i++)
                {
                    blueTeam[i].gameObject.SetActive(false);
                }
            }

            try
            {
                tkRed  = (UInt16)Topan.Network.GetServerInfo("rTK");
                tkBlue = (UInt16)Topan.Network.GetServerInfo("bTK");
                tdRed  = (UInt16)Topan.Network.GetServerInfo("rTD");
                tdBlue = (UInt16)Topan.Network.GetServerInfo("bTD");
            }
            catch
            {
                tkRed  = 0;
                tkBlue = 0;
                tdRed  = 0;
                tdBlue = 0;
            }

            string redTotal = "Total Kills: " + tkRed;
            redTotal += "\n" + "Total Deaths: " + tdRed;
            float redKD = (tdRed > 0) ? ((float)tkRed / (float)tdRed) : tkRed;
            redTotal += "\n" + "Total K/D: " + redKD.ToString("F2");
            redTotal += "\n" + "Team Score: " + redTotalScore.ToString();
            redTotal += "\n----------------";
            redTotal += "\n" + "Team Captures: 0"; //Placeholder, captures if capture the flag, defuses if demolition.

            string blueTotal = "Total Kills: " + tkBlue;
            blueTotal += "\n" + "Total Deaths: " + tdBlue;
            float blueKD = (tdBlue > 0) ? ((float)tkBlue / (float)tdBlue) : tkBlue;
            blueTotal += "\n" + "Total K/D: " + blueKD.ToString("F2");
            blueTotal += "\n" + "Team Score: " + blueTotalScore.ToString();
            blueTotal += "\n----------------";
            blueTotal += "\n" + "Team Captures: 0"; //Placeholder, captures if capture the flag, defuses if demolition.

            totalStatsRed.text  = redTotal;
            totalStatsBlue.text = blueTotal;

            roundVictoryStats.text = "[CE1C1C](RED)[-] " + (byte)Topan.Network.GetServerInfo("rVic") + " [A0A0A0]|[-] " + (byte)Topan.Network.GetServerInfo("bVic") + " [2546A5](BLUE)[-]";
        }
        else
        {
            int currentIndex = 0;
            int yourIndex    = 1;

            for (int i = 0; i < BotManager.allBotPlayers.Length && i < GeneralVariables.Networking.botCount; i++)
            {
                BotStats hisStats = BotManager.GetBotStats(i);

                NetPlayerInfo npi = new NetPlayerInfo();
                npi.botPlayer = BotManager.allBotPlayers[i];
                npi.myKills   = hisStats.kills;
                npi.myDeaths  = hisStats.deaths;
                npi.myHeads   = hisStats.headshots;
                npi.myScore   = hisStats.score;
                sortedPlayers.Add(npi);
            }

            if (NetworkingGeneral.currentGameType.sortPlayersBy == SortPlayersBy.Kills)
            {
                sortedPlayers.Sort((p1, p2) => p2.myKills.CompareTo(p1.myKills));
            }
            else if (NetworkingGeneral.currentGameType.sortPlayersBy == SortPlayersBy.Score)
            {
                sortedPlayers.Sort((p1, p2) => p2.myScore.CompareTo(p1.myScore));
            }

            dmSubheader.text = NetworkingGeneral.currentGameType.typeName + " [" + Topan.Network.GameName + "]";
            for (int i = 0; i < sortedPlayers.Count; i++)
            {
                NetPlayerInfo current = sortedPlayers[i];
                if (current.botPlayer == null && current.realPlayer == null)
                {
                    continue;
                }

                if (current.myInfo == null)
                {
                    continue;
                }

                int   kills  = current.myKills;
                int   deaths = current.myDeaths;
                int   score  = current.myScore;
                float kd     = (deaths > 0) ? ((float)kills / (float)deaths) : kills;

                UserStatsGUI usg = null;

                if (currentIndex >= 16)
                {
                    continue;
                }

                usg = individuals[currentIndex];
                usg.gameObject.SetActive(true);
                currentIndex++;

                if (!current.thisPlayerIsBot && current.realPlayer == Topan.Network.player)
                {
                    yourIndex = i;
                }

                string clanNameFinal = (current.myInfo.clan != "") ? ((current.thisPlayerIsBot) ? DarkRef.ClanColor(true) + "(" + current.myInfo.clan + ")[-] " : DarkRef.ClanColor(false) + "[" + current.myInfo.clan + "][-] ") : "";
                usg.SetInfo(current.myInfo.rank.ToString(),
                            clanNameFinal + current.myInfo.username,
                            kills.ToString(),
                            deaths.ToString(),
                            kd.ToString("F2"),
                            current.myHeads.ToString(),
                            score.ToString(),
                            ((current.thisPlayerIsBot) ? Topan.Network.server.GetPlayerData("ping", 0).ToString() : current.realPlayer.GetPlayerData("ping", 0)).ToString(),
                            (!current.thisPlayerIsBot && current.realPlayer == Topan.Network.player),
                            (currentIndex % 2 == 0));
            }

            if (currentIndex < 15)
            {
                for (int i = currentIndex; i < 16; i++)
                {
                    individuals[i].gameObject.SetActive(false);
                }
            }

            tkRed  = 0;
            tkBlue = 0;
            tdRed  = 0;
            tdBlue = 0;

            yourPlace.text = "You're in " + DarkRef.OrdinalIndicatorFormat(yourIndex + 1) + " place";
        }

        refreshTimer += refreshTime;
    }