//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 ); } } }
/// <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 }