Exemplo n.º 1
0
    void SetSkillItemInfo(GameObject go, SkillDatabase db)
    {
        LeftSkillItem item = go.GetComponent <LeftSkillItem>();

        if (item == null)
        {
            item = go.AddComponent <LeftSkillItem>();
        }
        if (!m_dicLeftItem.ContainsKey(db.wdID))
        {
            m_dicLeftItem.Add(db.wdID, item);
        }
        item.InitItem(db);
        #region drag code
        //if(go.GetComponent<LearnSkillItem>() == null)
        //{
        //    go.AddComponent<LearnSkillItem>().InitItem( db );
        //}
        //else
        //{
        //    LearnSkillItem item = go.GetComponent<LearnSkillItem>();
        //    item.InitItem( db );
        //}
        //if(go.GetComponent<SkillDragDropItem>() == null)
        //{
        //    SkillDragDropItem item = go.AddComponent<SkillDragDropItem>();
        //    item.cloneOnDrag = true;
        //}
        #endregion
    }
Exemplo n.º 2
0
    void skilldataManager_ValueUpdateEvent(object sender, ValueUpdateEventArgs e)
    {
        if (e != null)
        {
            if (e.key == LearnSkillDispatchEvents.SkillLevelUP.ToString())
            {
                SkillInfo newInfo = (SkillInfo)e.newValue;
                SortedDictionary <uint, LeftSkillItem> .Enumerator itemIter = m_dicLeftItem.GetEnumerator();
                while (itemIter.MoveNext())
                {
                    if (itemIter.Current.Key == newInfo.skillID)
                    {
                        LeftSkillItem skillItem = itemIter.Current.Value;
                        SkillDatabase db        = GameTableManager.Instance.GetTableItem <SkillDatabase>(newInfo.skillID, (int)newInfo.level);
                        if (db != null)
                        {
                            skillItem.InitItem(db);
                            skillItem.AddEffectInSkillPanel();
                        }
                    }
                }

                //页签红点提示
                UpdateRedPoint();
            }
        }
    }
Exemplo n.º 3
0
    void OnItemClick(GameObject go)
    {
        LeftSkillItem item = go.GetComponent <LeftSkillItem>();

        if (item == null)
        {
            return;
        }
        m_uWillSetSkillID = item.ItemDataBase.wdID;
        CurDataBase       = item.ItemDataBase;
        if (!skilldataManager.IsSettingPanel)
        {
            SkillDatabase bseDataBase = GameTableManager.Instance.GetTableItem <SkillDatabase>(CurDataBase.wdID, (int)1);
            if (MainPlayerHelper.GetPlayerLevel() < bseDataBase.dwNeedLevel)
            {
                item.SetItemState(LeftLearnSkillItemState.LockSelect);
            }
            else
            {
                item.SetItemState(LeftLearnSkillItemState.OpenNotSetAndSelect);
            }

            return;
        }
        if (!BRightChange && !BLeftChange)
        {
            BRightChange = true;
        }
        if (BRightChange)
        {
            ResetLeftItem();
            if (item.ItemState == LeftLearnSkillItemState.OpenNotSetAndNotSelect)
            {
                item.SetItemState(LeftLearnSkillItemState.OpenNotSetAndSelect);
            }
            else
            {
                BRightChange      = false;
                m_uWillSetSkillID = 0;
            }
        }
        if (BLeftChange)
        {
            if (item.ItemState == LeftLearnSkillItemState.OpenNotSetAndCanSet)
            {
                BLeftChange = false;
                SendSetSkillMessage();
            }
        }
        #region dragcode
        //LearnSkillItem item = go.GetComponent<LearnSkillItem>();
        //if ( item == null )
        //    return;
        #endregion
    }
Exemplo n.º 4
0
    void OnShowLeftChange()
    {
        var iter = m_dicLeftItem.GetEnumerator();

        while (iter.MoveNext())
        {
            var           dic  = iter.Current;
            LeftSkillItem item = dic.Value;
            if (m_bLeftChange)
            {
                if (item.ItemState == LeftLearnSkillItemState.OpenNotSetAndNotSelect || item.ItemState == LeftLearnSkillItemState.OpenNotSetAndSelect)
                {
                    item.SetItemState(LeftLearnSkillItemState.OpenNotSetAndCanSet);
                }
            }
            else
            {
                item.ResetState();
            }
        }
    }
Exemplo n.º 5
0
    void ShowShengjiItemState()
    {
        List <uint> keyList = m_dicLeftItem.Keys.ToList <uint>();

        for (int i = 0; i < keyList.Count; i++)
        {
            uint          keyID   = keyList[i];
            LeftSkillItem item    = m_dicLeftItem[keyID];
            SkillDatabase skillDb = GameTableManager.Instance.GetTableItem <SkillDatabase>(item.ItemDataBase.wdID, 1);
            if (skillDb == null)
            {
                return;
            }
            if (MainPlayerHelper.GetPlayerLevel() < skillDb.dwNeedLevel)
            {//未解锁
                if (i == 0)
                {
                    item.SetItemState(LeftLearnSkillItemState.LockSelect);
                }
                else
                {
                    item.SetItemState(LeftLearnSkillItemState.Lock);
                }
            }
            else
            {
                if (i == 0)
                {
                    item.SetItemState(LeftLearnSkillItemState.OpenNotSetAndSelect);
                }
                else
                {
                    item.SetItemState(LeftLearnSkillItemState.OpenNotSetAndNotSelect);
                }
            }
        }
    }