Exemplo n.º 1
0
    void SkillEnabledChanged()
    {
        bool targetIsBox  = false;
        bool targetIsTrap = false;

        if (!m_mainPlayer.CurrentTargetIsDead)
        {
            if (m_mainPlayer.CurrentTarget.Type == ActorType.enNPC)
            {
                NPC npc = m_mainPlayer.CurrentTarget as NPC;
                if (npc.GetNpcType() == ENNpcType.enBoxNPC)
                {
                    targetIsBox = true;
                }
            }
            if (m_mainPlayer.CurrentTarget.Type == ActorType.enNPCTrap)
            {
                targetIsTrap = true;
            }
        }
        for (int i = 0; i < MaxSkillNumber; ++i)
        {
            GameObject skill = m_sameInfoList[i].m_objSkill;
            if (!skill.activeSelf)
            {
                continue;
            }
            GameObject enabled = FindChild("Enabled", skill);
            UITexture  sprite  = FindChildComponent <UITexture>("skill", skill);

            UISkillCD            uiSkillCD = m_sameInfoList[i].m_uiSkillCD;
            Actor.ActorSkillInfo info      = m_mainPlayer.SkillBag.Find(item => item.SkillTableInfo.ID == uiSkillCD.SkillID);
            if (info == null)
            {
                Debug.LogWarning("skill table is null, index:" + i);
                continue;
            }
            if (info.SkillTableInfo.SkillType == (int)ENSkillType.enSkillNormalType ||
                info.SkillTableInfo.SkillType == (int)ENSkillType.enOpenBox)
            {//普通技能
                if (targetIsBox || targetIsTrap)
                {
                    if (uiSkillCD.SkillID != m_openBoxSkillID)
                    {
                        uiSkillCD.Reset();
                        uiSkillCD.SkillID = m_openBoxSkillID;
                        info = m_mainPlayer.SkillBag.Find(item => item.SkillTableInfo.ID == uiSkillCD.SkillID);
                    }
                }
                else
                {
                    if (uiSkillCD.SkillID == m_openBoxSkillID)
                    {
                        uiSkillCD.SkillID = m_mainPlayer.NormalSkillList[0];
                        info = m_mainPlayer.SkillBag.Find(item => item.SkillTableInfo.ID == uiSkillCD.SkillID);
                    }
                }
                continue;
            }
            IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(info.SkillTableInfo.Icon);
            if (iconInfo == null)
            {
                Debug.LogWarning("icon is null, id:" + info.SkillTableInfo.Icon);
                return;
            }
            else
            {
                sprite.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
            }


            Material curMaterial = sprite.material;

//              List<int> list = (m_mainPlayer.SelfAI as AIPlayer).SkillIDListForFire;
//              if (!info.IsSilence && list.Contains(info.SkillTableInfo.ID))
            {
                enabled.SetActive(false);
                curMaterial = m_normalMaterial;
            }
//              else
//              {
//                  enabled.SetActive(true);
//                 curMaterial = m_diableMaterial;
//              }

            //if (curMaterial != sprite.material)
            {
                sprite.material = curMaterial;
            }
        }
    }
Exemplo n.º 2
0
    void SkillChange()
    {
        int  index      = 0;
        bool isNormaled = false;

        foreach (var item in m_mainPlayer.SkillBag)
        {
            SkillInfo skillInfo = item.SkillTableInfo;
            if (skillInfo.SkillType != (int)ENSkillType.enSkill &&
                skillInfo.SkillType != (int)ENSkillType.enSkillNormalType &&
                skillInfo.SkillType != (int)ENSkillType.enDodge)
            {
                if (skillInfo.SkillType == (int)ENSkillType.enOpenBox)
                {//开宝箱技能
                    m_openBoxSkillID = skillInfo.ID;
                }
                continue;
            }
            if (skillInfo.SkillType == (int)ENSkillType.enSkillNormalType)
            {
                continue;
            }
            if (skillInfo.SkillType == (int)ENSkillType.enDodge)
            {
                if (isNormaled)
                {
                    continue;
                }
                isNormaled = true;
            }

            GameObject skill = m_sameInfoList[index].m_objSkill;
            skill.SetActive(true);
            UITexture sprite = FindChildComponent <UITexture>("skill", skill);

            //设置技能等级
            UILabel skillLabel = FindChildComponent <UILabel>("SkillLevel", skill);
            if (null != skillLabel)
            {
                skillLabel.text = "LV." + item.SkillLevel;
            }

            //icon

            IconInfomation info = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon);
            if (info == null)
            {
                Debug.LogWarning("load icon fail,id:" + skillInfo.Icon);
            }
            else
            {
                sprite.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(info.dirName);
            }

            sprite.material = m_normalMaterial;
            //cd
            UISkillCD cd = m_sameInfoList[index].m_uiSkillCD;
            cd.Reset();
            cd.SkillID = skillInfo.ID;
            if (m_mainPlayer.SkillControl.IsSkillCDRunning(skillInfo.ID, m_mainPlayer))
            {
                cd.ShowSkillCDBtn();
            }

            //uiQteTimeLeft
            //UIQTETimeLeft qteCD = m_sameInfoList[index].m_uiQteTimeLeft;
            //qteCD.Reset();

            ++index;
        }
        for (int i = index; i < MaxSkillNumber; ++i)
        {
            m_sameInfoList[i].m_objSkill.SetActive(false);
        }
        //设置frame的width
        m_spriteFrame.width = index * (int)m_grid.cellWidth;
        if (ActorManager.Singleton.Support != null)
        {
            m_spriteFrame.width += (int)m_grid.cellWidth;
        }
        //设置grid
        m_grid.repositionNow = true;
        //qte

        /*if (m_isQteVisible)
         * {
         *  SetQteVisible(m_isQteVisible);
         * }*/
        //更新是否需要显示加点按钮
        UpdateAddSkillLevel();
        DelHighlight();
        SkillEnabledChanged();
    }