Exemple #1
0
    private void InfoCardInit()
    {
        Transform info = transform.Find("Info/Content");

        info.Find("CardNameText").GetComponent <TextMeshPro>().text = unit.unitName;
        info.Find("CardText").GetComponent <TextMeshPro>().text     = SText.Format(unit.cardText);
    }
    private void GenerateConstraintCard(Constraint constraint)
    {
        RectTransform constraintCard = Instantiate(constraintInfoPrototype, transform);

        constraintCard.transform.position  = constraintInfoPrototype.transform.position;
        constraintCard.transform.position -= Vector3.up * (constraintCard.rect.height) * constraintInfos.Count;
        constraintCard.gameObject.SetActive(true);
        constraintInfos.Add(constraintCard);

        // Set Letter
        TextMeshProUGUI constraintLetter = constraintCard.transform.Find("ConstraintLetter").GetComponent <TextMeshProUGUI>();

        constraintLetter.text = SText.Format($"{constraint.letter}");

        // Set Text
        TextMeshProUGUI constraintText = constraintCard.transform.Find("ConstraintText").GetComponent <TextMeshProUGUI>();

        constraintText.text = SText.Format($"{constraint.GetDescription()}");
    }
Exemple #3
0
    private void GenerateKeywordCard(Keyword keyword)
    {
        RectTransform        prototype = keyword.basic ? abilityInfoCardPrefab : keywordInfoCardPrefab;
        List <RectTransform> list      = keyword.basic ? ref abilityCards : ref keywordCards;

        RectTransform keywordCard = Instantiate(prototype, transform);

        keywordCard.transform.position  = prototype.transform.position;
        keywordCard.transform.position -= Vector3.up * (keywordCard.rect.height + 15f) * list.Count;
        keywordCard.gameObject.SetActive(true);
        list.Add(keywordCard);

        // Set Sprite
        Image image = keywordCard.transform.Find("KeywordIcon").GetComponent <Image>();

        image.sprite = keyword.GetSprite();

        // Set Text
        TextMeshProUGUI keywordText = keywordCard.transform.Find("KeywordText").GetComponent <TextMeshProUGUI>();

        keywordText.text = SText.Format($"<b>{keyword.keywordName}:</b> {keyword.keywordText}");
    }