using System; using System.Collections.Generic; using MotionFramework; using ToolsPack; using UnityEngine; namespace DefaultNamespace { /// /// 创建检查的背包工具UI /// [ScriptDescription("人物装备窗口管理类,打开窗口左侧物品栏通过背包获取")] public class CharacterEquipWindowManager : MonoBehaviour { private Dictionary> _toolsNames; [SerializeField] private Transform content; private Dictionary _toolsNameTemp; private void OnEnable() { ChangePage(ModelTypeEnum.工具); } public void ChangePage(ModelTypeEnum windw) { int count = content.childCount; for (int i = 0; i < count; i++) { Destroy(content.GetChild(i).gameObject); } _toolsNameTemp = new Dictionary(); //初始化工具集 _toolsNames = MotionEngine.GetModule().GetToolsPack(); GameObject bt = CharacterEquipManager.Instance.GetEquipBt(); foreach (var v in _toolsNames) { List li = MotionEngine.GetModule().GetToolsPackData(v.Key); if (li == null) { foreach (var b in v.Value) { if (b.GetComponent().GetModelTypeEnum() == windw) { if (!_toolsNameTemp.ContainsKey(v.Key)) { CharacterEquipBtOnClick btComponent = Instantiate(bt, content, false).GetComponent(); btComponent.name = v.Key; _toolsNameTemp.Add(v.Key, btComponent); List wearToolsTemp = MotionEngine.GetModule().wearTools; if (wearToolsTemp.Contains(v.Key)) { CharacterEquipInfoManager.Instance.Equipment(v.Key, true);//HQB装备复原 btComponent.SetState(true); } } // btComponent.Init(v.Key, v.Key, b.GetComponent().GetIndex()); } } } else { // foreach (var lis in v.Value) // { // if (lis.GetComponent().GetModelTypeEnum() == windw) // { // foreach (var to in li) // { // CharacterEquipBtOnClick btComponent = Instantiate(bt, content, false).GetComponent(); // btComponent.name = to; // // btComponent.Init(to, v.Key, lis.GetComponent().GetIndex()); // // MotionEngine.GetModule().AddToolsPackWindowItemBts(btComponent.gameObject); // } // } // } } } } } }