Esempio n. 1
0
    void OnShowRightChange()
    {
        var iter = m_dicRightItem.GetEnumerator();

        while (iter.MoveNext())
        {
            var            dic  = iter.Current;
            RightSkillItem item = dic.Value;
            if (m_bRightChange)
            {
                uint level = item.GetUnLockLevel();
                if (level > MainPlayerHelper.GetPlayerLevel())
                {
                    item.SetItemState(RightLearnSkillItemState.Lock);
                }
                else
                {
                    item.SetItemState(RightLearnSkillItemState.SetRightCanChange);
                }
            }
            else
            {
                item.ResetState();
            }
        }
    }
Esempio n. 2
0
    //void SetItemLocation(UnityEngine.GameObject go , string parentName)
    //{
    //    if ( string.IsNullOrEmpty( parentName ) )
    //        return;
    //    Transform trans = m_widget_SkillContainer.transform.Find( parentName );
    //    if ( trans != null )
    //    {
    //        NGUITools.DestroyChildren( trans );
    //        if ( go != null )
    //        {
    //            go.transform.parent = trans;
    //            go.transform.localPosition = Vector3.zero;
    //            go.transform.localScale = Vector3.one;
    //            go.transform.localRotation = Quaternion.identity;
    //        }

    //    }
    //}
    void ClearSettingItem()
    {
        int count = m_widget_SkillContainer.transform.childCount;

        for (int i = 0; i < count; i++)
        {
            string    parentName = "skill_" + i;
            Transform trans      = m_widget_SkillContainer.transform.Find(parentName);
            if (trans != null)
            {
                RightSkillItem item = trans.GetComponent <RightSkillItem>();
                if (item == null)
                {
                    item = trans.gameObject.AddComponent <RightSkillItem>();
                }
                if (i == 0)
                {
                    uint          common = skilldataManager.GetCommonSkillIDByJob();
                    SkillDatabase db     = GameTableManager.Instance.GetTableItem <SkillDatabase>(common, 1);
                    item.InitItem(db);
                }
                else
                {
                    item.ResetState();
                    //  item.InitItem(null);
                }

                if (!m_dicRightItem.ContainsKey(i))
                {
                    m_dicRightItem.Add(i, item);
                }
                //NGUITools.DestroyChildren( trans );
            }
        }
    }
Esempio n. 3
0
    /// <summary>
    /// 设置右边的设置面板
    /// </summary>
    public void SetAllSkillSettingItem()
    {
        ClearSettingItem();
        SortedDictionary <int, uint> stateDic = skilldataManager.GetSkillSettingState();

        if (stateDic != null)
        {
            foreach (var dic in stateDic)
            {
                int  location = dic.Key;
                uint skillID  = dic.Value;
                if (skillID == 0)
                {
                    continue;
                }
                string    name  = skilldataManager.GetParentNameByLocation(location);
                Transform trans = m_widget_SkillContainer.transform.Find(name);
                if (trans != null)
                {
                    SkillDatabase  db   = GameTableManager.Instance.GetTableItem <SkillDatabase>(skillID, 1);
                    RightSkillItem item = trans.GetComponent <RightSkillItem>();
                    if (item != null)
                    {
                        item.InitItem(db);
                    }
                }
            }
        }
        UpdateCurStateLabel();
        //ShowAutoAttack();
        #region drag code
        //ClearSettingItem();
        //SortedDictionary<int , uint> stateDic = skilldataManager.GetSkillSettingState();
        //if ( stateDic != null )
        //{
        //    foreach ( var dic in stateDic )
        //    {
        //        int location = dic.Key;
        //        uint skillID = dic.Value;
        //        if ( skillID == 0 )
        //            continue;
        //        string name = skilldataManager.GetParentNameByLocation( location );
        //        GameObject go = GetSelectPrefab( skillID );
        //        if ( go != null )
        //        {
        //            if ( go.GetComponent<SkillDragDropItem>() == null )
        //            {
        //                SkillDragDropItem item = go.AddComponent<SkillDragDropItem>();
        //                item.cloneOnDrag = false;
        //            }

        //        }
        //        SetItemLocation( go , name );
        //    }
        //}
        //UpdateCurStateLabel();
        //ShowAutoAttack();
        #endregion
    }
Esempio n. 4
0
    void OnRightItemClick(GameObject go)
    {
        int  loc   = skilldataManager.GetLocation(go.name);
        uint level = skilldataManager.GetUnLockLevelByLoc((uint)loc);

        if (level > MainPlayerHelper.GetPlayerLevel())
        {
            return;
        }
        if (!BRightChange && !BLeftChange)
        {
            BLeftChange = true;
        }
        RightSkillItem rightItem = go.GetComponent <RightSkillItem>();

        if (rightItem != null)
        {
            m_nLoction = loc;
            if (BRightChange)
            {
                if (m_uWillSetSkillID == 0)
                {
                    TipsManager.Instance.ShowTips(LocalTextType.Skill_Commond_qingxuanzhongyigekeyitihuandejineng);
                    return;
                }
                BRightChange = false;

                SendSetSkillMessage();
            }
            if (BLeftChange)
            {
                rightItem.SetItemState(RightLearnSkillItemState.SetRightSelect);
            }
        }
        //string name = go.name;
        //int index = -1;
        //int len = name.Length - 1;
        //string indexStr = name[len].ToString();
        //if ( int.TryParse( indexStr , out index ) )
        //{

        //}
    }