コード例 #1
0
 protected virtual void SetIcon(Icon icon)
 {
     Icon = icon;
     ValueChanged?.Invoke(icon);
     image.sprite = IconSpriteRetriever.GetIconSprite(EncounterSelectedListener.CurrentValue.Encounter, icon);
     if (icon != null)
     {
         image.color = icon.Color;
     }
 }
コード例 #2
0
        protected virtual void OnEncounterSelected(object sender, EncounterSelectedEventArgs e)
        {
            Characters = e.Encounter.Content.NonImageContent.Characters;
            Dropdown.ClearOptions();
            CharacterKeys = new string[Characters.Count];
            var options = new List <TMP_Dropdown.OptionData>();

            for (int i = 0; i < Characters.Count; i++)
            {
                var character = Characters[i];
                CharacterKeys[i] = character.Key;
                var sprite = IconSpriteRetriever.GetIconSprite(e.Encounter, character.Value.Icon);
                options.Add(new TMP_Dropdown.OptionData(character.Value.Role, sprite));
            }
            Dropdown.AddOptions(options);

            if (InitialValue != null)
            {
                SetValue(InitialValue);
            }
        }