コード例 #1
0
ファイル: Window_Skill.cs プロジェクト: NoeCalmness/CoreFrame
    private void SetIconItem(SkillData info, Transform skill, UpSkillInfo _info, UpSkillInfo _nextInfo, bool isLockNow)
    {
        if (_info == null || moduleSkill.skillInfo == null)
        {
            return;
        }
        skill.gameObject.SetActive(true);
        AtlasHelper.SetSkillIcon(skill.Find("icon/img"), info.skillInfo.skillIcon);

        Transform lvParent = skill.Find("level");

        if (lvParent)
        {
            lvParent.gameObject.SetActive(!isLockNow);
        }
        Transform mask = skill.Find("icon/mask");

        if (mask)
        {
            mask.gameObject.SetActive(isLockNow);
        }

        Transform newLock = skill.Find("newLock");

        if (newLock)
        {
            newLock.gameObject.SetActive(isLockNow && modulePlayer.roleInfo.level >= info.skillInfo.unLockLv);
        }

        if (!isLockNow)
        {
            Transform lv_text = skill.Find("level/bg");
            Transform lv_max  = skill.Find("level/max");
            if (lv_text && lv_max)
            {
                lv_text.gameObject.SetActive(_nextInfo != null);
                lv_max.gameObject.SetActive(_nextInfo == null);
            }
            Util.SetText(skill.Find("level/bg/txt")?.GetComponent <Text>(), _nextInfo != null ? _info.skillLevel.ToString() : "-1");

            Transform up_image     = skill.Find("level/bg/level_up");
            Transform noMoneyImage = skill.Find("level/bg/level_up_02");
            if (!up_image || !noMoneyImage)
            {
                return;
            }
            if (_nextInfo != null)
            {
                int lv   = _nextInfo.needLv;
                int coin = _nextInfo.expendGold;
                int sp   = _nextInfo.expendSp;
                up_image.gameObject.SetActive(modulePlayer.roleInfo.level >= lv && modulePlayer.roleInfo.coin >= coin && moduleSkill.skillInfo.skillPoint >= sp);
                noMoneyImage.gameObject.SetActive(modulePlayer.roleInfo.level >= lv && (modulePlayer.roleInfo.coin < coin || moduleSkill.skillInfo.skillPoint < sp));
            }
            else
            {
                up_image.gameObject.SetActive(false);
                noMoneyImage.gameObject.SetActive(false);
            }
        }
    }
コード例 #2
0
    public void Init(int suitId,
                     int num,
                     bool isDressOn,
                     bool breath = false)
    {
        if (!isDressOn)
        {
            num = 0;
        }

        for (var i = 0; i < activePoints.Length; i++)
        {
            activePoints[i].SafeSetActive(i < num);
        }

        foreach (var go in attributeList)
        {
            GameObject.Destroy(go);
        }

        attributeList.Clear();

        if (suitId <= 0)
        {
            Root.SafeSetActive(false);
            return;
        }

        var suitInfo = ConfigManager.Get <SuitInfo>(suitId);

        if (null == suitInfo)
        {
            Root.SafeSetActive(false);
            return;
        }
        Root.SafeSetActive(true);

        Util.SetText(suitName, $"{ConfigText.GetDefalutString(suitInfo.nameId)}({num}/3)");

        for (var i = 0; i < suitInfo.effectDescs.Length; i++)
        {
            var t = group.AddNewChild(templete);
            t.SafeSetActive(true);
            attributeList.Add(t.gameObject);
            var text = t?.GetComponent <Text>("content");
            Util.SetText(text, suitInfo.effectDescs[i]);
            if (text)
            {
                text.color = ColorGroup.GetColor(ColorManagerType.SuitActive, i < num && isDressOn);
            }

            Util.SetText(t?.GetComponent <Text>("type"),
                         Util.Format(ConfigText.GetDefalutString(TextForMatType.SublimationUI, 0), i + 1));

            var skillIconRoot = t?.GetComponent <Transform>("skill");
            if (null != skillIconRoot)
            {
                //不显示技能图标了
                skillIconRoot.SafeSetActive(false /*suitInfo.skillEffects[i].Length > 0*/);
                if (skillIconRoot.gameObject.activeInHierarchy)
                {
                    var skillInfo = ConfigManager.Get <SkillInfo>(suitInfo.skillEffects[i][0].skillId);
                    AtlasHelper.SetSkillIcon(skillIconRoot.GetComponent <Transform>("frame/icon"), skillInfo?.skillIcon);
                }
            }

            if (!isDressOn)
            {
                continue;
            }

            var tweens = t.GetComponentsInChildren <TweenBase>();
            if (null == tweens || tweens.Length == 0)
            {
                continue;
            }
            if (i == num - 1 && breath)
            {
                for (var index = 0; index < tweens.Length; index++)
                {
                    tweens[index].enabled = true;
                    tweens[index].Play();
                }
            }
            else
            {
                for (var index = 0; index < tweens.Length; index++)
                {
                    tweens[index].enabled = false;
                }
            }
        }
    }