Esempio n. 1
0
    protected override void Awake()
    {
        base.Awake();
        TextMesh[] componentsInChildren = this.descriptionText.GetComponentsInChildren <TextMesh>(true);
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            TextMeshLocale component = componentsInChildren[i].GetComponent <TextMeshLocale>();
            if (!(component == null))
            {
                component.RefreshTranslation(componentsInChildren[i].text);
                component.enabled = false;
                float value = Singleton <GameConfigurationManager> .Instance.GetValue <float>("cake_race", "kings_favorite_bonus");

                int num = 0;
                if (!Mathf.Approximately(value, 0f))
                {
                    num = Mathf.RoundToInt((value - 1f) * 100f);
                }
                componentsInChildren[i].text = string.Format(componentsInChildren[i].text, num.ToString());
                if (TextMeshHelper.UsesKanjiCharacters())
                {
                    TextMeshHelper.Wrap(componentsInChildren[i], this.maxKanjiCharacterInLine, false);
                }
                else
                {
                    TextMeshHelper.Wrap(componentsInChildren[i], this.maxCharactersInLine, false);
                }
            }
        }
    }
Esempio n. 2
0
    private void Start()
    {
        string arg = string.Format("{0:0%}", this.CalculatePercentage());

        for (int i = 0; i < this.textMeshes.Length; i++)
        {
            TextMeshLocale component = this.textMeshes[i].gameObject.GetComponent <TextMeshLocale>();
            component.RefreshTranslation(null);
            component.enabled       = false;
            this.textMeshes[i].text = string.Format(this.textMeshes[i].text, arg);
        }
    }
Esempio n. 3
0
 protected virtual void Start()
 {
     for (int i = 0; i < this.texts.Length; i++)
     {
         this.texts[i].textMesh.text = this.texts[i].localizationKey;
         TextMeshLocale component = this.texts[i].textMesh.gameObject.GetComponent <TextMeshLocale>();
         if (component != null)
         {
             component.RefreshTranslation(null);
             component.enabled = false;
             TextMeshHelper.Wrap(this.texts[i].textMesh, (!TextMeshHelper.UsesKanjiCharacters()) ? this.maxCharactersInLine : this.maxKanjiCharacterInLine, false);
         }
     }
 }
Esempio n. 4
0
    private void ChangeButtonText()
    {
        if (this.okButton == null)
        {
            return;
        }
        TextMesh       component  = this.okButton.GetComponent <TextMesh>();
        TextMeshLocale component2 = this.okButton.GetComponent <TextMeshLocale>();

        if (component == null || component2 == null)
        {
            return;
        }
        component2.RefreshTranslation(component.text);
        component2.enabled = false;
        component.text     = string.Format(component.text, this.reward);
    }
Esempio n. 5
0
 private void Localize(Transform texts)
 {
     if (texts == null)
     {
         return;
     }
     TextMesh[] componentsInChildren = texts.GetComponentsInChildren <TextMesh>();
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         TextMeshLocale component = componentsInChildren[i].GetComponent <TextMeshLocale>();
         if (!(component == null))
         {
             component.RefreshTranslation(componentsInChildren[i].text);
             component.enabled            = false;
             componentsInChildren[i].text = string.Format(componentsInChildren[i].text, Singleton <DoubleRewardManager> .Instance.FormattedRewardTime);
             this.Wrap(componentsInChildren[i]);
         }
     }
 }
Esempio n. 6
0
 private void RefreshTexts(GameObject target, string text, bool updateLocale, bool updateSprites)
 {
     TextMesh[] componentsInChildren = target.GetComponentsInChildren <TextMesh>(true);
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         componentsInChildren[i].text = text;
         if (updateLocale)
         {
             TextMeshLocale textMeshLocale = componentsInChildren[i].GetComponent <TextMeshLocale>();
             if (textMeshLocale == null)
             {
                 textMeshLocale = componentsInChildren[i].gameObject.AddComponent <TextMeshLocale>();
             }
             textMeshLocale.RefreshTranslation(null);
             textMeshLocale.enabled = false;
         }
         if (updateSprites)
         {
             TextMeshSpriteIcons.EnsureSpriteIcon(componentsInChildren[i]);
         }
     }
 }
Esempio n. 7
0
 public static void UpdateTextMeshes(TextMesh[] textMeshes, string text, bool refreshTranslations = false)
 {
     if (textMeshes == null || textMeshes.Length == 0)
     {
         return;
     }
     for (int i = 0; i < textMeshes.Length; i++)
     {
         if (textMeshes[i] != null)
         {
             textMeshes[i].text = ((!string.IsNullOrEmpty(text)) ? text : string.Empty);
         }
         if (refreshTranslations)
         {
             TextMeshLocale component = textMeshes[i].GetComponent <TextMeshLocale>();
             if (component != null)
             {
                 component.RefreshTranslation(null);
             }
         }
     }
 }
Esempio n. 8
0
    private void RefreshLocalization()
    {
        for (int i = 0; i < this.texts.Length; i++)
        {
            this.texts[i].textMesh.text = this.texts[i].localizationKey;
            TextMeshLocale component = this.texts[i].textMesh.gameObject.GetComponent <TextMeshLocale>();
            if (component != null)
            {
                component.RefreshTranslation(null);
                string text = this.texts[i].textMesh.text;
                if (this.texts[i].textMesh.name.Equals("ScrapLabel") && text.Contains("{0}") && text.Contains("{1}"))
                {
                    string arg = string.Empty;
                    switch (this.partTier)
                    {
                    case BasePart.PartTier.Common:
                        arg = "[common_star]";
                        break;

                    case BasePart.PartTier.Rare:
                        arg = "[rare_star][rare_star]";
                        break;

                    case BasePart.PartTier.Epic:
                        arg = "[epic_star][epic_star][epic_star]";
                        break;

                    case BasePart.PartTier.Legendary:
                        arg = "[legendary_icon]";
                        break;
                    }
                    this.texts[i].textMesh.text = string.Format(text, this.buyScrapAmount, arg);
                }
                component.enabled = false;
                TextMeshSpriteIcons.EnsureSpriteIcon(this.texts[i].textMesh);
                TextMeshHelper.Wrap(this.texts[i].textMesh, (!TextMeshHelper.UsesKanjiCharacters()) ? this.maxCharactersInLine : this.maxKanjiCharacterInLine, false);
            }
        }
    }
Esempio n. 9
0
    private void UpdateTextMeshLocale(TextMesh textMesh, string localeKey, int maxRowCharacters = -1, string postfix = "")
    {
        if (textMesh == null)
        {
            return;
        }
        textMesh.text = localeKey;
        TextMeshLocale component = textMesh.GetComponent <TextMeshLocale>();

        if (component != null)
        {
            component.RefreshTranslation(null);
            if (TextMeshHelper.UsesKanjiCharacters() && localeKey.Equals("REWARD_DAY"))
            {
                component.Postfix = string.Empty;
                textMesh.text     = string.Format(textMesh.text, postfix.Replace(" ", string.Empty));
            }
            else
            {
                component.Postfix = ((!string.IsNullOrEmpty(postfix)) ? postfix : string.Empty);
            }
        }
        TextMeshHelper.Wrap(textMesh, maxRowCharacters, false);
    }