Пример #1
0
    private void ShowPanel(string sentence, FontImages fontDictionary)
    {
        ClearSentence();
        for (int i = 0; i < sentence.Length; i++)
        {
            Image  img    = Instantiate(letterPrefab, lettersParent);
            Sprite sprite = fontDictionary.GetSprite(sentence[i]);

            if (sprite == null)
            {
                Debug.LogError("Could not fill panel sentence, did not find " + sentence[i] + " on dictionary");
                ClearSentence();
                return;
            }
            img.sprite = sprite;
        }

        lettersParent.gameObject.SetActive(true);
    }
Пример #2
0
    protected void DisplayString(string displayString)
    {
        TurnOffAllImages();

        List <Sprite> sprites = new List <Sprite>();

        for (int i = displayString.Length - 1; i >= 0; i--)
        {
            Sprite charSprite = fontDictionary.GetSprite(displayString[i]);
            if (charSprite != null)
            {
                sprites.Add(charSprite);
            }
            else
            {
                Debug.LogError("Could not find " + displayString[i] + " sprite on font dictionary");
                return;
            }
        }

        DisplayString(sprites);
    }