Beispiel #1
0
    void OnLoadPVPSkillItem(GameObject resItem, object param)
    {
        if (null == resItem)
        {
            LogModule.ErrorLog("load pvp skill item fail");
            return;
        }

        Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

        Utils.CleanGrid(m_PVPSkillListGrid);
        m_ItemInfo.Clear();
        if (_mainPlayer)
        {
            m_ObjCurSkillInfo.SetActive(false);
            //普攻和XP不可升级
            int nIndex = 0;
            for (int i = 0; i < _mainPlayer.OwnSkillInfo.Length; i++)
            {
                int         nSkillId = _mainPlayer.OwnSkillInfo[i].SkillId;
                Tab_SkillEx _skillEx = TableManager.GetSkillExByID(nSkillId, 0);
                if (_skillEx != null)
                {
                    Tab_SkillBase _skillBase = TableManager.GetSkillBaseByID(_skillEx.BaseId, 0);
                    if (_skillBase != null &&
                        (_skillBase.SkillClass & (int)SKILLCLASS.AUTOREPEAT) == 0 &&
                        (_skillBase.SkillClass & (int)SKILLCLASS.XP) == 0)
                    {
                        PVPSkillListItem _skillItem = PVPSkillListItem.CreateItem(m_PVPSkillListGrid, resItem, nIndex.ToString(), this, _skillBase.Name, "LV:" + _skillEx.Level.ToString(), nSkillId);
                        if (_skillItem != null)
                        {
                            m_ItemInfo.Add(nIndex.ToString(), _skillItem);
                            nIndex++;
                        }
                    }
                }
            }
            m_PVPSkillListGrid.GetComponent <UIGrid>().Reposition();
            m_PVPSkillListGrid.GetComponent <UITopGrid>().Recenter(false);
            if (m_curItemIndexName == "" && m_ItemInfo.ContainsKey("0"))
            {
                ShowCurSkill(m_ItemInfo["0"]);
            }
            else if (m_ItemInfo.ContainsKey(m_curItemIndexName))
            {
                ShowCurSkill(m_ItemInfo[m_curItemIndexName]);
            }
        }
    }
Beispiel #2
0
    public static PVPSkillListItem CreateItem(GameObject grid, GameObject resItem, string name, PVPPowerWindow parent, string SkillName, string SkillLev, int nSkillId)
    {
        GameObject curItem = Utils.BindObjToParent(resItem, grid, name);

        if (null != curItem)
        {
            PVPSkillListItem curItemComponent = curItem.GetComponent <PVPSkillListItem>();
            if (null != curItemComponent)
            {
                curItemComponent.SetData(parent, SkillName, SkillLev, nSkillId);
            }
            return(curItemComponent);
        }

        return(null);
    }
Beispiel #3
0
    public void ShowCurSkill(PVPSkillListItem item)
    {
        if (null == item)
        {
            return;
        }
        m_ObjCurSkillInfo.SetActive(true);
        m_curItemIndexName = item.name;
        item.EnableHighlight(true);

        m_LabelCurSkillName.text = item.m_LabelName.text;
        m_LabelCurSkillLeve.text = item.m_LabelLev.text;
        m_nCurSkillId            = item.SkillId;
        Tab_SkillEx _CurskillEx           = TableManager.GetSkillExByID(item.SkillId, 0);
        int         nCurSkillCombatValue  = 0;
        int         nNextSkillCombatValue = 0;

        if (_CurskillEx != null)
        {
            m_LableCurSkillInfo.text = _CurskillEx.SkillDesc;
            nCurSkillCombatValue     = _CurskillEx.CombatValue;
        }
        Tab_SkillLevelUp _skillLevUp = TableManager.GetSkillLevelUpByID(m_nCurSkillId, 0);

        if (_skillLevUp != null)
        {
            if (_skillLevUp.NextSkillId != -1)
            {
                m_LabelEnergyCost.text = _skillLevUp.NeedConsume.ToString();
                Tab_SkillEx _NextskillEx = TableManager.GetSkillExByID(_skillLevUp.NextSkillId, 0);
                if (_NextskillEx != null)
                {
                    m_LableNextSkillInfo.text = _NextskillEx.SkillDesc;
                    nNextSkillCombatValue     = _NextskillEx.CombatValue;
                }
                int nCombatValueAdd = nNextSkillCombatValue - nCurSkillCombatValue;
                m_LabelPowerAdd.text = nCombatValueAdd.ToString();
            }
            else
            {
                m_LabelEnergyCost.text    = "0";
                m_LableNextSkillInfo.text = "";
                m_LabelPowerAdd.text      = "0";
            }
        }
    }