// Update is called once per frame
    void Update()
    {
        CurCat = (ECategoryView)CatCombo.GetSelectedItemIndex();

        HeadJudger hj = Global.GetHeadJudger();

        if (hj)
        {
            hj.Update();
        }
    }
    public string GetResultsString(int InResultIndex, ECategoryView InCat, bool bInIncludeName, List <RoutineScoreData> sortedScores)
    {
        switch (InCat)
        {
        case ECategoryView.AI:
            if (InResultIndex < AIResults.Count)
            {
                return(System.String.Format((bInIncludeName ? "{6}:  " : "") + "V: {0:0.0}  T: {1:0.0}  M: {2:0.0}  Fw: {3:0.0}  Fm: {4:0.0}  G: {5:0.0}  Total: {7:0.00}",
                                            AIResults[InResultIndex].Variety, AIResults[InResultIndex].Teamwork, AIResults[InResultIndex].Music, AIResults[InResultIndex].Flow,
                                            AIResults[InResultIndex].Form, AIResults[InResultIndex].General,
                                            NameDatabase.FindInDatabase(AIResults[InResultIndex].JudgeNameId).DisplayName, AIResults[InResultIndex].GetTotalPoints()));
            }
            break;

        case ECategoryView.Ex:
            if (InResultIndex < ExResults.Count)
            {
                return(System.String.Format((bInIncludeName ? "{4}:  " : "") + ".1: {0}  .2: {1}  .3: {2}  .5: {3}  Total: {5:0.00}", ExResults[InResultIndex].Point1Count, ExResults[InResultIndex].Point2Count,
                                            ExResults[InResultIndex].Point3Count, ExResults[InResultIndex].Point5Count,
                                            NameDatabase.FindInDatabase(ExResults[InResultIndex].JudgeNameId).DisplayName, ExResults[InResultIndex].GetTotalPoints()));
            }
            break;

        case ECategoryView.Diff:
            if (InResultIndex < DiffResults.Count)
            {
                string Ret = bInIncludeName ? NameDatabase.FindInDatabase(DiffResults[InResultIndex].JudgeNameId).DisplayName + ":  " : "";
                for (int i = 0; i < DiffResults[InResultIndex].NumScores; ++i)
                {
                    Ret += DiffResults[InResultIndex].DiffScores[i].ToString("0.0") + DiffResults[InResultIndex].GetConsecString(i) +
                           ((i < DiffResults[InResultIndex].NumScores - 1) ? ", " : "");
                }
                Ret += "  Total: " + DiffResults[InResultIndex].GetTotalPoints().ToString("0.00");
                return(Ret);
            }
            break;

        case ECategoryView.Overview:
        {
            string Ret      = "";
            float  AIPoints = 0;
            foreach (AIData aid in AIResults)
            {
                AIPoints += aid.GetTotalPoints();
                Ret      += "  AI: " + aid.GetTotalPoints().ToString("0.00");
            }
            float ExPoints = 0;
            foreach (ExData exd in ExResults)
            {
                ExPoints += exd.GetTotalPoints();
                Ret      += "  Ex: " + exd.GetTotalPoints().ToString("0.00");
            }
            float DiffPoints = 0;
            foreach (DiffData dd in DiffResults)
            {
                DiffPoints += dd.GetTotalPoints();
                Ret        += "  Diff: " + dd.GetTotalPoints().ToString("0.00");
            }
            float TotalPoints = AIPoints + ExPoints + DiffPoints;
            if (TotalPoints > 0)
            {
                int resultIndex = 0;
                if (sortedScores != null)
                {
                    foreach (RoutineScoreData score in sortedScores)
                    {
                        if (score == this)
                        {
                            break;
                        }

                        ++resultIndex;
                    }
                }

                Ret += "    Totals:  Diff: " + DiffPoints.ToString("0.00") + " AI: " + AIPoints.ToString("0.00") + " Ex: " +
                       ExPoints.ToString("0.00") + " All: " + TotalPoints.ToString("0.00") + "   Place: " + (resultIndex + 1);
            }

            return(Ret);
        }
        }

        return("");
    }
 public string GetResultsString(int InResultIndex, ECategoryView InCat, bool bInIncludeName)
 {
     return(GetResultsString(InResultIndex, InCat, bInIncludeName, null));
 }
Exemple #4
0
    public void InitButtonTeamsText(int InDiv, int InRound, int InPool, int InJudgeCategoryIndex, ECategoryView InCategoryView)
    {
        CanvasGO.SetActive(true);

        if (InDiv >= 0 && InDiv < Global.AllData.AllDivisions.Length &&
            InRound >= 0 && InRound < Global.AllData.AllDivisions[InDiv].Rounds.Length &&
            InPool >= 0 && InPool < Global.AllData.AllDivisions[InDiv].Rounds[InRound].Pools.Count)
        {
            int buttonIndex = 0;
            foreach (GameObject go in TeamButtons)
            {
                Button button = go.GetComponent <Button>();
                button.onClick.RemoveAllListeners();

                if (buttonIndex < Global.AllData.AllDivisions[InDiv].Rounds[InRound].Pools[InPool].Teams.Count)
                {
                    go.SetActive(true);
                    int localButtonIndex = buttonIndex;
                    button.onClick.AddListener(() => { TeamButtonClicked(localButtonIndex); });

                    RoutineScoreData SData       = Global.AllData.AllDivisions[InDiv].Rounds[InRound].Pools[InPool].Teams[buttonIndex].Data.RoutineScores;
                    string           PlayerNames = Global.AllData.AllDivisions[InDiv].Rounds[InRound].Pools[InPool].Teams[buttonIndex].Data.PlayerNames;
                    if (SData != null)
                    {
                        foreach (Text buttonText in go.GetComponentsInChildren <Text>())
                        {
                            string buttonString = PlayerNames;
                            if (SData.ContainsJudgeScores())
                            {
                                buttonString += ": " + SData.GetResultsString(InJudgeCategoryIndex, InCategoryView, false);
                            }
                            else
                            {
                                buttonString += ": No Data";
                            }

                            buttonText.text = buttonString;
                        }
                    }
                }
                else
                {
                    go.SetActive(false);
                }

                ++buttonIndex;
            }
        }
    }