Exemple #1
0
    void OnGUI()
    {
        bool bRepaintUpdate = Event.current.ToString() == "Repaint";

        if (GUI.Button(new Rect(Screen.width - 150, Screen.height - 150, 150, 150), "Save"))
        {
            Global.AllData.Save();
        }

        float StartSelectY = 30;
        float SelectHeight = 30;

        DivisionCombo.Draw(new Rect(20, StartSelectY, Screen.width * .18f, SelectHeight));
        RoundCombo.Draw(new Rect(20 + Screen.width * .2f, StartSelectY, Screen.width * .18f, SelectHeight));

        GUILayout.BeginArea(new Rect(20 + Screen.width * .4f, StartSelectY, Screen.width - Screen.width * .4f - 40, SelectHeight));
        GUILayout.BeginHorizontal();

        List <PoolData> Pools = Global.AllData.AllDivisions[DivisionCombo.GetSelectedItemIndex()].Rounds[RoundCombo.GetSelectedItemIndex()].Pools;

        for (int PoolIndex = 0; PoolIndex < Pools.Count; ++PoolIndex)
        {
            DrawPoolButton("Pool: " + Pools[PoolIndex].PoolName, PoolIndex, SelectHeight);
        }

        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        float RightRectStartY = Screen.height * .02f + SelectHeight + StartSelectY;
        Rect  RightRect       = new Rect(20, RightRectStartY, Screen.width * .3f, Screen.height - RightRectStartY - 20);
        Rect  LeftRect        = new Rect(RightRect.x + RightRect.width + Screen.width * .1f, RightRect.y, RightRect.width, Screen.height * .5f);

        if (CurPoolButtonIndex != -1)
        {
            ResultsData RData = TournamentData.FindResultsData((EDivision)DivisionCombo.GetSelectedItemIndex(), (ERound)RoundCombo.GetSelectedItemIndex(), (EPool)CurPoolButtonIndex);
            if (RData == null)
            {
                RData = new ResultsData((EDivision)DivisionCombo.GetSelectedItemIndex(), (ERound)RoundCombo.GetSelectedItemIndex(), (EPool)CurPoolButtonIndex);
                Pools[CurPoolButtonIndex].JudgersId = RData.Id;

                Global.AllData.ResultsList.Add(RData);
            }
            else if (Pools[CurPoolButtonIndex].JudgersId == -1)
            {
                if (RData.Id == -1)
                {
                    RData.Id = ResultsData.GetUniqueId();
                }

                Pools[CurPoolButtonIndex].JudgersId = RData.Id;
            }


            if (RData != null && Global.AllNameData.AllJudges != null)
            {
                GUILayout.BeginArea(RightRect);
                RightScroll = GUILayout.BeginScrollView(RightScroll);
                GUILayout.BeginVertical();

                string NewFilterStr = GUILayout.TextField(JudgeFilterStr);

                if (NewFilterStr != JudgeFilterStr || AvailableJudges.Count == 0)
                {
                    JudgeFilterStr = NewFilterStr;

                    AvailableJudges.Clear();
                    foreach (NameData pd in Global.AllNameData.AllJudges)
                    {
                        if (!IsPlayingInPool(pd, RData) && !RData.ContainsPlayer(pd))
                        {
                            AvailableJudges.Add(pd);
                        }
                    }

                    FilterAvailableJudges(JudgeFilterStr, ref AvailableJudges);
                }

                GUILayout.Space(20);

                GUIStyle LabelStyle  = new GUIStyle("label");
                GUIStyle PlayerStyle = new GUIStyle("label");
                PlayerStyle.alignment = TextAnchor.MiddleLeft;
                foreach (NameData nd in AvailableJudges)
                {
                    bool bMoving = MovingNameId == nd.Id;
                    PlayerStyle.normal.textColor = bMoving ? Color.grey : LabelStyle.normal.textColor;

                    GUIContent PlayerCont = new GUIContent(nd.DisplayName);
                    Vector2    PlayerSize = PlayerStyle.CalcSize(PlayerCont);
                    if (GUILayout.RepeatButton(PlayerCont, PlayerStyle, GUILayout.Width(RightRect.width * .9f), GUILayout.Height(PlayerSize.y)))
                    {
                        MovingNameId = nd.Id;
                    }
                }

                GUILayout.EndVertical();
                GUILayout.EndScrollView();
                GUILayout.EndArea();


                // Left Rect ------------
                GUILayout.BeginArea(LeftRect);
                GUILayout.BeginVertical();
                GUIStyle JudgeStyle = new GUIStyle("label");
                JudgeStyle.alignment = TextAnchor.MiddleLeft;

                GUILayout.BeginVertical();
                GUILayout.Label("AI Judges:", JudgeStyle);
                for (int PlayerIndex = 0; PlayerIndex < Mathf.Max(RData.AIJudgeIds.Count, 3); ++PlayerIndex)
                {
                    int    PlayerId  = -1;
                    bool   bMoving   = false;
                    string PlayerStr = PlayerIndex < 3 ? (PlayerIndex + 1) + ". " : "";
                    if (PlayerIndex < RData.AIJudgeIds.Count)
                    {
                        PlayerId = RData.AIJudgeIds[PlayerIndex];
                        bMoving  = PlayerId == MovingNameId;

                        PlayerStr += NameDatabase.FindInDatabase(PlayerId).DisplayName;
                    }

                    JudgeStyle.normal.textColor = bMoving ? Color.grey : LabelStyle.normal.textColor;

                    GUIContent JudgeCont = new GUIContent(PlayerStr);
                    Vector2    JudgeSize = JudgeStyle.CalcSize(JudgeCont);
                    if (GUILayout.RepeatButton(JudgeCont, JudgeStyle, GUILayout.Width(LeftRect.width * .6f), GUILayout.Height(JudgeSize.y)) && PlayerIndex < RData.AIJudgeIds.Count)
                    {
                        MovingNameId = PlayerId;
                    }
                }
                GUILayout.EndVertical();
                if (bRepaintUpdate)
                {
                    JudgeRects[0]   = GUILayoutUtility.GetLastRect();
                    JudgeRects[0].x = LeftRect.x;
                    JudgeRects[0].y = LeftRect.y;
                }

                GUILayout.BeginVertical();
                GUILayout.Label("Ex Judges:", JudgeStyle);
                for (int PlayerIndex = 0; PlayerIndex < Mathf.Max(RData.ExJudgeIds.Count, 3); ++PlayerIndex)
                {
                    int    PlayerId  = -1;
                    bool   bMoving   = false;
                    string PlayerStr = PlayerIndex < 3 ? (PlayerIndex + 1) + ". " : "";
                    if (PlayerIndex < RData.ExJudgeIds.Count)
                    {
                        PlayerId = RData.ExJudgeIds[PlayerIndex];
                        bMoving  = PlayerId == MovingNameId;

                        PlayerStr += NameDatabase.FindInDatabase(PlayerId).DisplayName;
                    }

                    JudgeStyle.normal.textColor = bMoving ? Color.grey : LabelStyle.normal.textColor;

                    GUIContent JudgeCont = new GUIContent(PlayerStr);
                    Vector2    JudgeSize = JudgeStyle.CalcSize(JudgeCont);
                    if (GUILayout.RepeatButton(JudgeCont, JudgeStyle, GUILayout.Width(LeftRect.width * .6f), GUILayout.Height(JudgeSize.y)) && PlayerIndex < RData.ExJudgeIds.Count)
                    {
                        MovingNameId = PlayerId;
                    }
                }
                GUILayout.EndVertical();
                if (bRepaintUpdate)
                {
                    JudgeRects[1]    = GUILayoutUtility.GetLastRect();
                    JudgeRects[1].x += LeftRect.x;
                    JudgeRects[1].y += LeftRect.y;
                }

                GUILayout.BeginVertical();
                GUILayout.Label("Diff Judges:", JudgeStyle);
                for (int PlayerIndex = 0; PlayerIndex < Mathf.Max(RData.DiffJudgeIds.Count, 3); ++PlayerIndex)
                {
                    int    PlayerId  = -1;
                    bool   bMoving   = false;
                    string PlayerStr = PlayerIndex < 3 ? (PlayerIndex + 1) + ". " : "";
                    if (PlayerIndex < RData.DiffJudgeIds.Count)
                    {
                        PlayerId = RData.DiffJudgeIds[PlayerIndex];
                        bMoving  = PlayerId == MovingNameId;

                        PlayerStr += NameDatabase.FindInDatabase(PlayerId).DisplayName;
                    }

                    JudgeStyle.normal.textColor = bMoving ? Color.grey : LabelStyle.normal.textColor;

                    GUIContent JudgeCont = new GUIContent(PlayerStr);
                    Vector2    JudgeSize = JudgeStyle.CalcSize(JudgeCont);
                    if (GUILayout.RepeatButton(JudgeCont, JudgeStyle, GUILayout.Width(LeftRect.width * .6f), GUILayout.Height(JudgeSize.y)) && PlayerIndex < RData.DiffJudgeIds.Count)
                    {
                        MovingNameId = PlayerId;
                    }
                }
                GUILayout.EndVertical();
                if (bRepaintUpdate)
                {
                    JudgeRects[2]    = GUILayoutUtility.GetLastRect();
                    JudgeRects[2].x += LeftRect.x;
                    JudgeRects[2].y += LeftRect.y;
                }

                GUILayout.EndVertical();
                GUILayout.EndArea();

                if (MovingNameId != -1)
                {
                    GUI.Label(new Rect(Input.mousePosition.x, Screen.height - Input.mousePosition.y, 500, 30), NameDatabase.FindInDatabase(MovingNameId).DisplayName);
                }
            }
        }

        float BottomRectX = RightRect.x + RightRect.width + 20;
        float BottomRectY = LeftRect.y + LeftRect.height;

        GUILayout.BeginArea(new Rect(BottomRectX, BottomRectY, Screen.width - BottomRectX - 170, Screen.height - BottomRectY - 20));
        GUILayout.Label("All Judges Names");
        AllJudgesTextScrollPos = GUILayout.BeginScrollView(AllJudgesTextScrollPos);
        string NewAllJudgesString = GUILayout.TextArea(AllJudgesString);

        if (NewAllJudgesString != AllJudgesString)
        {
            AllJudgesString = NewAllJudgesString;
            AvailableJudges.Clear();
            Global.AllNameData.AllJudges.Clear();

            StringReader reader = new StringReader(AllJudgesString);
            string       line   = null;
            while ((line = reader.ReadLine()) != null)
            {
                AddJudgersFromString(line);
            }

            Global.AllNameData.Save();
        }
        GUILayout.EndScrollView();
        GUILayout.EndArea();
    }
    void OnGUI()
    {
        float SelectButWidth  = Screen.width * .25f;
        float SelectButHeight = Screen.height * .08f;
        float SelectY         = Screen.height * .04f;

        DivisionCombo.Draw(new Rect(20, SelectY, SelectButWidth, SelectButHeight));
        RoundCombo.Draw(new Rect(20 + SelectButWidth + Screen.width * .02f, SelectY, SelectButWidth, SelectButHeight));

        ResultsData RData = TournamentData.FindResultsData(CurDivision, CurRound, CurPool);

        float    InfoY     = Screen.height * .02f + SelectY + SelectButHeight;
        GUIStyle InfoStyle = new GUIStyle("label");

        InfoStyle.fontSize = 30;
        GUIContent TimeDate     = new GUIContent(DateTime.Now.ToString());
        Vector2    TimeDateSize = InfoStyle.CalcSize(TimeDate);

        GUI.Label(new Rect(20, InfoY, TimeDateSize.x, TimeDateSize.y), TimeDate, InfoStyle);

        bool bValidDivisionRoundSettings = Global.AllData.AllDivisions.Length > (int)CurDivision &&
                                           Global.AllData.AllDivisions[(int)CurDivision].Rounds.Length > (int)CurRound;

        if (bValidDivisionRoundSettings)
        {
            RoundData  Round        = Global.AllData.AllDivisions[(int)CurDivision].Rounds[(int)CurRound];
            int        TotalSeconds = bJudging ? (int)(DateTime.Now - RoutineStartTime).TotalSeconds : 0;
            int        Minutes      = Mathf.FloorToInt(TotalSeconds / 60f);
            int        Seconds      = Mathf.FloorToInt(TotalSeconds) % 60;
            int        RoundMinutes = Mathf.FloorToInt(Round.RoutineLengthMinutes);
            int        RoundSeconds = Mathf.FloorToInt(Round.RoutineLengthMinutes * 60) % 60;
            GUIContent RoutineTime  = new GUIContent(String.Format("{0}:{1:00} / {2}:{3:00}", Minutes, Seconds, RoundMinutes, RoundSeconds));
            Vector2    TimeSize     = InfoStyle.CalcSize(RoutineTime);
            GUI.Label(new Rect(Screen.width - 20 - TimeSize.x, InfoY, TimeSize.x, TimeSize.y), RoutineTime, InfoStyle);

            if (TotalSeconds > Round.RoutineLengthMinutes * 60 && !bRoutineTimeElapsed)
            {
                bRoutineTimeElapsed = true;

                // Send ready to livestream
                TeamData finishedTeam = Global.GetTeamData(CurDivision, CurRound, CurPool, CurTeam);
                SendRestMessageAsync(finishedTeam, LiveStream.TeamStates.Finished);
            }
        }

        if (bFestivalJudging)
        {
            float     PoolButWidth  = Screen.width * .09f;
            RoundData Round         = Global.AllData.AllDivisions[(int)CurDivision].Rounds[(int)CurRound];
            GUIStyle  SelectedStyle = new GUIStyle("button");
            SelectedStyle.normal.textColor = Color.green;
            SelectedStyle.hover.textColor  = Color.green;
            SelectedStyle.fontStyle        = FontStyle.Bold;
            GUIStyle ButtonStyle = new GUIStyle("button");
            if (GUI.Button(new Rect(20 + 2f * SelectButWidth + Screen.width * .1f, SelectY, PoolButWidth, SelectButHeight),
                           "Pool: " + Round.Pools[(int)CurFestivalPool].PoolName, CurPool == CurFestivalPool ? SelectedStyle : ButtonStyle))
            {
                SetCurrentPool(CurFestivalPool);
                InitJudgersNameIds();
                ++Global.CurDataState;
            }

            if (GUI.Button(new Rect(20 + 2f * SelectButWidth + Screen.width * .12f + PoolButWidth, SelectY, PoolButWidth, SelectButHeight),
                           "Pool: " + Round.Pools[(int)CurFestivalPool + 2].PoolName, CurPool == CurFestivalPool + 2 ? SelectedStyle : ButtonStyle))
            {
                SetCurrentPool(CurFestivalPool + 2);
                InitJudgersNameIds();
                ++Global.CurDataState;
            }

            if (GUI.Button(new Rect(20 + 2f * SelectButWidth + Screen.width * .14f + 2f * PoolButWidth, SelectY, PoolButWidth, SelectButHeight),
                           "AI Scores", (CurPool > EPool.Max) ? SelectedStyle : ButtonStyle))
            {
                EPool newPool = EPool.None;
                if (CurPool == EPool.A || CurPool == EPool.C)
                {
                    newPool = EPool.PostScoresAC;
                }
                else if (CurPool == EPool.B || CurPool == EPool.D)
                {
                    newPool = EPool.PostScoresBD;
                }
                else
                {
                    switch (CurPool)
                    {
                    case EPool.PostScoresAC:
                        newPool = EPool.PostScoresCA;
                        break;

                    case EPool.PostScoresCA:
                        newPool = EPool.PostScoresAC;
                        break;

                    case EPool.PostScoresBD:
                        newPool = EPool.PostScoresDB;
                        break;

                    case EPool.PostScoresDB:
                        newPool = EPool.PostScoresBD;
                        break;
                    }
                }

                SetCurrentPool(newPool);
                InitJudgersNameIds();
                ++Global.CurDataState;
            }
        }

        #region Teams
        if (!DivisionCombo.IsPicking && !RoundCombo.IsPicking && bValidDivisionRoundSettings)
        {
            Rect LeftRect = new Rect(20, Screen.height * .22f, Screen.width / 2 - 40, Screen.height * .5f);
            if (CurPool == EPool.None && !bFestivalJudging)
            {
                GUILayout.BeginArea(LeftRect);
                PoolsScrollPos = GUILayout.BeginScrollView(PoolsScrollPos);
                GUILayout.BeginVertical();

                RoundData Round = Global.AllData.AllDivisions[(int)CurDivision].Rounds[(int)CurRound];
                if (Round.Pools.Count <= 2)
                {
                    for (int PoolIndex = 0; PoolIndex < Round.Pools.Count; ++PoolIndex)
                    {
                        PoolData Pool     = Round.Pools[PoolIndex];
                        string   PoolText = "";
                        PoolText += Pool.PoolName + "\n";
                        for (int TeamIndex = 0; TeamIndex < Pool.Teams.Count; ++TeamIndex)
                        {
                            TeamData Team = Pool.Teams[TeamIndex].Data;
                            PoolText += (TeamIndex + 1) + ". " + Team.PlayerNames + "\n";
                        }

                        GUIStyle ButtonStyle = new GUIStyle("button");
                        GUIStyle PoolStyle   = new GUIStyle("button");
                        PoolStyle.alignment        = TextAnchor.UpperLeft;
                        PoolStyle.normal.textColor = (EPool)PoolIndex == CurPool ? Color.green : ButtonStyle.normal.textColor;
                        PoolStyle.hover.textColor  = (EPool)PoolIndex == CurPool ? Color.green : ButtonStyle.hover.textColor;
                        PoolStyle.fontStyle        = (EPool)PoolIndex == CurPool ? FontStyle.Bold : ButtonStyle.fontStyle;
                        Vector2 PoolTextSize = PoolStyle.CalcSize(new GUIContent(PoolText));
                        if (GUILayout.Button(PoolText, PoolStyle, GUILayout.Width(LeftRect.width * .9f), GUILayout.Height(PoolTextSize.y)))
                        {
                            SetCurrentPool((EPool)PoolIndex);
                            InitJudgersNameIds();
                            ++Global.CurDataState;
                            bFestivalJudging = false;
                        }
                    }
                }
                else if (Round.Pools.Count == 4)
                {
                    for (int ButIndex = 0; ButIndex < 2; ++ButIndex)
                    {
                        string PoolText = "";

                        for (int PoolIndex = 0; PoolIndex < 2; ++PoolIndex)
                        {
                            PoolData Pool = Round.Pools[2 * PoolIndex + ButIndex];
                            PoolText += Pool.PoolName + "\n";
                            for (int TeamIndex = 0; TeamIndex < Pool.Teams.Count; ++TeamIndex)
                            {
                                TeamData Team = Pool.Teams[TeamIndex].Data;
                                PoolText += (TeamIndex + 1) + ". " + Team.PlayerNames + "\n";
                            }

                            PoolText += "\n";
                        }

                        GUIStyle ButtonStyle = new GUIStyle("button");
                        GUIStyle PoolStyle   = new GUIStyle("button");
                        PoolStyle.alignment        = TextAnchor.UpperLeft;
                        PoolStyle.normal.textColor = ButIndex == (int)CurPool ? Color.green : ButtonStyle.normal.textColor;
                        PoolStyle.hover.textColor  = ButIndex == (int)CurPool ? Color.green : ButtonStyle.hover.textColor;
                        PoolStyle.fontStyle        = ButIndex == (int)CurPool ? FontStyle.Bold : ButtonStyle.fontStyle;
                        Vector2 PoolTextSize = PoolStyle.CalcSize(new GUIContent(PoolText));
                        if (GUILayout.Button(PoolText, PoolStyle, GUILayout.Width(LeftRect.width * .9f), GUILayout.Height(PoolTextSize.y)))
                        {
                            CurFestivalPool  = (EPool)ButIndex;
                            bFestivalJudging = true;
                        }
                    }
                }

                GUILayout.EndVertical();
                GUILayout.EndScrollView();
                GUILayout.EndArea();
            }
            else if (!bFestivalJudging || CurPool != EPool.None)
            {
                float LeftRectWidth = Screen.width * .45f;
                //new Rect(Screen.width - RightRectWidth - 20, AreaRect.y, RightRectWidth, Screen.height - AreaRect.y - 20);
                GUILayout.BeginArea(LeftRect);
                GUILayout.BeginVertical();

                GUIStyle TeamStyle = new GUIStyle("button");
                TeamStyle.fontSize  = 17;
                TeamStyle.alignment = TextAnchor.MiddleLeft;
                GUIStyle        BackStyle = new GUIStyle(TeamStyle);
                List <PoolData> Pools     = Global.AllData.AllDivisions[(int)CurDivision].Rounds[(int)CurRound].Pools;
                if (CurPool >= 0 && (int)CurPool < Pools.Count)
                {
                    for (int TeamIndex = 0; TeamIndex < Pools[(int)CurPool].Teams.Count; ++TeamIndex)
                    {
                        TeamData Data = Pools[(int)CurPool].Teams[TeamIndex].Data;
                        if (Data != null)
                        {
                            GUIContent TeamContent = new GUIContent((TeamIndex + 1) + ". " + Data.PlayerNames);
                            Vector2    TeamSize    = TeamStyle.CalcSize(TeamContent);
                            TeamStyle.fontStyle = TeamIndex == CurTeam ? FontStyle.Bold : FontStyle.Normal;

                            if (!bLockedForJudging)
                            {
                                TeamStyle.normal.textColor = TeamIndex == CurTeam ? Color.green : new GUIStyle("button").normal.textColor;
                                TeamStyle.hover.textColor  = TeamIndex == CurTeam ? Color.green : new GUIStyle("button").hover.textColor;
                            }
                            else
                            {
                                TeamStyle.normal.textColor = TeamIndex == CurTeam ? Color.green : Color.gray;
                                TeamStyle.hover.textColor  = TeamIndex == CurTeam ? Color.green : Color.gray;
                                TeamStyle.active.textColor = TeamIndex == CurTeam ? Color.green : Color.gray;
                            }

                            if (GUILayout.Button(TeamContent, TeamStyle, GUILayout.Width(LeftRectWidth), GUILayout.Height(TeamSize.y)))
                            {
                                if (!bLockedForJudging)
                                {
                                    CurTeam = TeamIndex;
                                    ++Global.CurDataState;
                                }
                            }
                        }
                    }
                }

                GUILayout.Space(Screen.height * .03f);

                GUIContent BackContent = new GUIContent("<- Back To Pool Selection");
                Vector2    BackSize    = BackStyle.CalcSize(BackContent);
                if (GUILayout.Button(BackContent, BackStyle, GUILayout.Width(LeftRectWidth), GUILayout.Height(BackSize.y)))
                {
                    SetCurrentPool(EPool.None);
                    CurTeam          = -1;
                    bFestivalJudging = false;
                }

                GUILayout.EndVertical();
                GUILayout.EndArea();

                // Ready Buttons
                if (CurTeam >= 0)
                {
                    DrawControlButtons();
                }
            }
        }
        else
        {
            SetCurrentPool(EPool.None);
            bFestivalJudging = false;
        }
        #endregion

        #region Judges
        if (CurPool != EPool.None && RData != null)
        {
            Rect RightRect = new Rect(Screen.width * .5f + 20, Screen.height * .22f, Screen.width / 2 - 40, Screen.height * .88f - 20);
            GUILayout.BeginArea(RightRect);
            GUILayout.BeginVertical();

            GUIStyle CatHeaderStyle = new GUIStyle("label");
            CatHeaderStyle.fontSize  = 17;
            CatHeaderStyle.fontStyle = FontStyle.Bold;


            GUILayout.Label("AI Judges:", CatHeaderStyle);
            foreach (int id in RData.AIJudgeIds)
            {
                DrawJudgeLabel(RData, id);
            }
            GUILayout.Label("Ex Judges:", CatHeaderStyle);
            foreach (int id in RData.ExJudgeIds)
            {
                DrawJudgeLabel(RData, id);
            }
            GUILayout.Label("Diff Judges:", CatHeaderStyle);
            foreach (int id in RData.DiffJudgeIds)
            {
                DrawJudgeLabel(RData, id);
            }

            GUILayout.EndVertical();
            GUILayout.EndArea();
        }
        #endregion
    }
Exemple #3
0
    void OnGUI()
    {
        bool bLayoutUpdate  = Event.current.ToString() == "Layout";
        bool bRepaintUpdate = Event.current.ToString() == "Repaint";

        RankingURL = GUI.TextField(new Rect(20, 20, Screen.width - 270, 30), RankingURL);
        //if (!bGetRankings && !bWaitingForRankings)
        //    bGetRankings = GUI.Button(new Rect(20, 70, 200, 40), "Fetch Rankings");
        GUILayout.BeginArea(new Rect(20, 70, 500, 40));
        GUILayout.BeginHorizontal();

        GUILayout.Label("Number of Pools:");
        PoolCountString = GUILayout.TextField(PoolCountString);
        int NewPoolCount = PoolCount;

        if (int.TryParse(PoolCountString, out NewPoolCount) && NewPoolCount != PoolCount)
        {
            PoolCount             = NewPoolCount;
            InputTeamsTextChanged = true;
        }

        GUILayout.Label("Pool Cut:");
        PoolCutString = GUILayout.TextField(PoolCutString);
        if (int.TryParse(PoolCutString, out PoolCut) && GUILayout.Button("Cut"))
        {
            CutPools();
        }

        GUILayout.Label("Routine Minutes:");
        RoutineMinutesString = GUILayout.TextField(RoutineMinutesString);

        GUILayout.Space(20);

        bool bNewSortTeams = GUILayout.Toggle(bSortTeams, "Sort Teams");

        InputTeamsTextChanged |= bNewSortTeams != bSortTeams;
        bSortTeams             = bNewSortTeams;

        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        if (FetchStatus.Length > 0)
        {
            GUI.Label(new Rect(Screen.width - 240, 20, 200, 40), FetchStatus);
        }

        DrawLeftPane();

        if (bFixingNameError)
        {
            Rect AreaRect = new Rect(Screen.width / 2 + 20, 130, Screen.width / 2 - 40, Screen.height - 150 - 50);
            GUILayout.BeginArea(AreaRect);
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();

            ErrorFirstSearchStr = GUILayout.TextField(ErrorFirstSearchStr);
            ErrorLastSearchStr  = GUILayout.TextField(ErrorLastSearchStr);
            GUILayout.EndHorizontal();

            GUILayout.Space(5);

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Add New Player Name"))
            {
                PlayerData NewData = new PlayerData();
                NewData.RankingPoints = 0;
                NewData.Rank          = -1;
                NameData NewName = NameDatabase.TryAddNewName(ErrorFirstSearchStr, ErrorLastSearchStr);
                NewData.NameId = NewName.Id;

                AllPlayers.Add(NewData);
            }

            if (GUILayout.Button("Cancel"))
            {
                bFixingNameError = false;
            }

            GUILayout.EndHorizontal();

            GUILayout.Space(5);

            GUILayout.BeginVertical();
            CloseScrollPos = GUILayout.BeginScrollView(CloseScrollPos);

            List <MatchData> CloseNames = NameDatabase.GetCloseNames(ErrorFirstSearchStr, ErrorLastSearchStr);
            foreach (MatchData md in CloseNames)
            {
                if (GUILayout.Button(md.Name.DisplayName))
                {
                    StringReader InputReader  = new StringReader(InputTeamsText);
                    string       InputLine    = null;
                    string       NewInputText = "";
                    while ((InputLine = InputReader.ReadLine()) != null)
                    {
                        foreach (ErrorLine el in ErrorList)
                        {
                            if (InputLine == el.OriginalLine)
                            {
                                foreach (ErrorData ed in el.ErrorList)
                                {
                                    if (EditingErrorData == ed)
                                    {
                                        InputLine             = ReplaceWholeWord(el.OriginalLine, EditingErrorData.PlayerName, md.Name.DisplayName);
                                        InputTeamsTextChanged = true;

                                        bFixingNameError = false;
                                        break;
                                    }
                                }
                            }
                        }

                        NewInputText += InputLine + "\n";
                    }
                    InputReader.Close();

                    InputTeamsText = NewInputText;
                }
            }

            GUILayout.EndScrollView();
            GUILayout.EndVertical();

            GUILayout.EndVertical();
            GUILayout.EndArea();
        }
        else
        {
            DrawRightPane(bLayoutUpdate, bRepaintUpdate);
        }

        if (MovingTeam != null)
        {
            GUI.Label(new Rect(Input.mousePosition.x, Screen.height - Input.mousePosition.y, 500, 30), MovingTeam.Data.PlayerNames + " : " + MovingTeam.Data.TotalRankPoints);
        }

        DivisionCombo.Draw(new Rect(Screen.width * .57f, 70, Screen.width * .18f, 30));
        RoundCombo.Draw(new Rect(Screen.width * .77f, 70, Screen.width * .18f, 30));

        if (GUI.Button(new Rect(Screen.width / 2 + 20, Screen.height - 50, Screen.width / 2 - 40, 30), "Create Round"))
        {
            CreateRoundData();
        }
    }