Exemple #1
0
 private void SetHolesLabels()
 {
     holes.SetLabel("Hole");
     holes.SetOutText("Out");
     holes.SetInText("In");
     holes.SetTotalText("Tot");
 }
Exemple #2
0
    public void SetScorecard(Dictionary <int, HoleData> holeData)
    {
        Debug.Log($"Settings Scoreboard: {holeData.ToArrayString()}");

        for (int i = 0; i < 18; i++)
        {
            var holeNum = i + 1;
            holes.SetHoleValue(holeNum, holeNum.ToString());

            if (holeData.TryGetValue(holeNum, out var data))
            {
                // pars
                pars.SetHoleValue(holeNum, data.par.ToString());

                for (int j = 0; j < data.scores.Count; j++)
                {
                    players[j].SetHoleValue(holeNum, data.scores[j].ToString());
                }
            }
            else
            {
                // set values to empty string
                pars.SetHoleValue(holeNum, string.Empty);

                foreach (var p in players)
                {
                    p.SetHoleValue(holeNum, string.Empty);
                }
            }
        }

        // set totals
        pars.SetLabel("Par");
        SetParLabelsAndTotals(holeData.Values.Select(x => x.par).ToList());
        SetPlayersLabelsAndTotals(holeData);
    }