Пример #1
0
        public SkillIconItem(Transform Parent, BaseSkill Skill, RectTransform CancelObj, bool IsRect /*temp*/)
        {
            this.Skill = Skill;

            IconTransform = AssetManager.CreatePrefabSync(new AssetUri(IsRect ? "prefabs/skillicon.prefab" : "prefabs/newskillIcon.prefab")).transform;
            IconTransform.SetParent(Parent, false);
            UIHelper.GetComponent <Image>(IconTransform, "BG/Icon").sprite = AssetManager.CreateAssetSync <Sprite>(new AssetUri(Skill.Icon));
            UIHelper.GetComponent <Image>(IconTransform, "BG/Mask").sprite = AssetManager.CreateAssetSync <Sprite>(new AssetUri(Skill.Icon));

            Mask_            = IconTransform.Find("BG/Mask").GetComponent <Image>();
            Mask_.fillAmount = 1;

            CDText_ = IconTransform.Find("CD").GetComponent <Text>();
            CDText_.gameObject.SetActive(false);

            NameText_      = IconTransform.Find("Name").GetComponent <Text>();
            NameText_.text = Skill.Name;

            Selector_ = SkillLibrary.Get(Skill.SkillID).Selector.Clone();
            var Args = new SkillArgs(Skill)
            {
                CancelObj = CancelObj
            };

            Selector_.BindCarrier(IconTransform, Args, (SArgs) =>
            {
                Skill.Master.Skill.UseSkill(SArgs);
            });
        }