Example #1
0
    public void ShowScore(SnakeHead snakeHead)
    {
        //Debug.Log($"killcount {KillCount} lenth {Lenth} coins {CoinsEarned} energy {EnergyErned}");
        //Debug.Log($"killcountscore {KillCountScore()} lenthscore {LenthScore()}");
        RectTransform scoretransform = ScoreManager.instance.ScoreTransform;

        scoretransform.gameObject.SetActive(true);

        HorizontalLayoutGroup RowTransform;

        RowTransform = Extentions.CreateHorizontalLayoutElement("description", scoretransform, true, true, ScoreManager.instance.UILayer, new Rect());
        PrintScore((RectTransform)RowTransform.transform, new string[3] {
            "Values", "Count", "Score"
        });

        if (Lenth > 0)
        {
            RowTransform = Extentions.CreateHorizontalLayoutElement("Lenth", scoretransform, true, true, ScoreManager.instance.UILayer, new Rect());
            PrintScore((RectTransform)RowTransform.transform, new string[3] {
                "lenth", Lenth.ToString(), string.Format(format, LenthScore())
            });
        }

        if (KillCount > 0)
        {
            RowTransform = Extentions.CreateHorizontalLayoutElement("killCount", scoretransform, true, true, ScoreManager.instance.UILayer, new Rect());
            PrintScore((RectTransform)RowTransform.transform, new string[3] {
                "KillCount", KillCount.ToString(), string.Format(format, KillCountScore())
            });
        }

        CalculateScore();
        if (score > 0)
        {
            RowTransform = Extentions.CreateHorizontalLayoutElement("Score", scoretransform, true, true, ScoreManager.instance.UILayer, new Rect());
            PrintScore((RectTransform)RowTransform.transform, new string[2] {
                "Score", string.Format(format, score)
            });
        }
    }