Exemple #1
0
    public void InitOption(SelectableTarget target, int index)
    {
        this.target = target;
        this.index  = index;

        SelectionProfile profile = target.TargetSelectionProfile;

        optionText.text    = profile.selectionName;
        optionImage.sprite = profile.selectionPortraitSprite;

        Rect rect = profile.selectionPortraitSprite.rect;

        optionImage.GetComponent <RectTransform>().sizeDelta = new Vector2(rect.width, rect.height);
    }
    public void SetSelection(SelectionProfile newProfile)
    {
        if (newProfile != null)
        {
            selectionBarContainer.SetActive(true);

            selectionPortraitImage.rectTransform.sizeDelta = new Vector2(newProfile.selectionPortraitSprite.rect.width, newProfile.selectionPortraitSprite.rect.height) * 10;

            selectionPortraitImage.sprite = newProfile.selectionPortraitSprite;

            selectionNameText.text = newProfile.selectionName;
        }
        else
        {
            selectionBarContainer.SetActive(false);
        }
    }