using System; using System.Collections.Generic; using MotionFramework; using ToolsPack; using UnityEngine; namespace DefaultNamespace { public class CharacterEquipWindowManager : MonoBehaviour { private Dictionary> _toolsNames; [SerializeField] private Transform content; [SerializeField] private List equipPeopleInfo; 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); } //初始化工具集 _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) { CharacterEquipBtOnClick btComponent = Instantiate(bt, content, false).GetComponent(); btComponent.name = v.Key; // 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); } } } } } } } }