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