コード例 #1
0
    public void ShowData(float _farthestShot, int _bestStreak, int _holesScore, int _highScore, int _timeBonus, Dictionary <Trophy, int> _trophyData)
    {
        farthestShotText.text = _farthestShot.ToString();
        bestStreakText.text   = _bestStreak.ToString();
        holesScoreText.text   = _holesScore.ToString();
        timeBonusText.text    = _timeBonus.ToString();

        int numTrophyTypes = Enum.GetNames(typeof(Trophy)).Length;

        var rootPosition = trophyPrefab.transform.localPosition;

        int numTrophies = 0;

        for (int i = 0; i < numTrophyTypes; i++)
        {
            Trophy trophy = (Trophy)i;

            if (_trophyData[trophy] > 0)
            {
                var trophyText = Instantiate(trophyPrefab, transform).GetComponent <Text>();

                trophyText.gameObject.SetActive(true);
                trophyText.text = trophy.ToString() + " x" + _trophyData[trophy];

                trophyText.transform.localPosition = rootPosition - new Vector3(0, numTrophies * lineHeight, 0);
                numTrophies++;
            }
        }

        int finalScore = _holesScore + _timeBonus;

        highScoreText.text  = _highScore == -1 ? "0" : _highScore.ToString();
        finalScoreText.text = (_holesScore + _timeBonus).ToString();

        if (finalScore > _highScore)
        {
            newHighScoreAlert.gameObject.SetActive(true);
        }
    }
コード例 #2
0
            public override string ToString()
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();

                if (!String.IsNullOrEmpty(description))
                {
                    sb.AppendLine(description.ClearHtmlTags());
                }

                if (armor != null)
                {
                    sb.Append(armor.ToString());
                }

                // do nohting if item is a bag
                //if (bag != null)
                //sb.Append(bag.ToString());

                if (consumable != null)
                {
                    sb.Append(consumable.ToString());
                }

                // do nohting if item is a container
                //if (container != null)
                //sb.Append(container.ToString());

                if (crafting_material != null)
                {
                    sb.Append(crafting_material.ToString());
                }

                if (gizmo != null)
                {
                    sb.Append(gizmo.ToString());
                }

                if (trinket != null)
                {
                    sb.Append(trinket.ToString());
                }


                if (trophy != null)
                {
                    sb.Append(trophy.ToString());
                }

                if (upgrade_component != null)
                {
                    sb.Append(upgrade_component.ToString());
                }

                if (weapon != null)
                {
                    sb.Append(weapon.ToString());
                }

                //sb.AppendLine();

                if (!String.IsNullOrEmpty(rarity))
                {
                    sb.AppendLine(Config.GetLocalizedName(Data.Rarity.GetRatity(rarity)));
                }

                if (!String.IsNullOrEmpty(level))
                {
                    sb.Append(String.Format("{0}: {1}", Properties.Resources.ItemDescriptionRequiredLevelLabel, level));
                }

                return(sb.ToString());
            }