71 lines
2.6 KiB
C#
71 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using MotionFramework;
|
|
using ToolsPack;
|
|
using UnityEngine;
|
|
|
|
namespace DefaultNamespace
|
|
{
|
|
public class CharacterEquipWindowManager : MonoBehaviour
|
|
{
|
|
private Dictionary<string, List<GameObject>> _toolsNames;
|
|
|
|
[SerializeField] private Transform content;
|
|
[SerializeField] private List<GameObject> 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<ToolsPackManager>().GetToolsPack();
|
|
|
|
GameObject bt = CharacterEquipManager.Instance.GetEquipBt();
|
|
|
|
foreach (var v in _toolsNames)
|
|
{
|
|
List<string> li = MotionEngine.GetModule<DataConfigManager>().GetToolsPackData(v.Key);
|
|
|
|
if (li == null)
|
|
{
|
|
foreach (var b in v.Value)
|
|
{
|
|
if (b.GetComponent<ToolsPackGameObjectComponent>().GetModelTypeEnum() == windw)
|
|
{
|
|
CharacterEquipBtOnClick btComponent = Instantiate(bt, content, false).GetComponent<CharacterEquipBtOnClick>();
|
|
btComponent.name = v.Key;
|
|
// btComponent.Init(v.Key, v.Key, b.GetComponent<ToolsPackGameObjectComponent>().GetIndex());
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
foreach (var lis in v.Value)
|
|
{
|
|
if (lis.GetComponent<ToolsPackGameObjectComponent>().GetModelTypeEnum() == windw)
|
|
{
|
|
foreach (var to in li)
|
|
{
|
|
CharacterEquipBtOnClick btComponent = Instantiate(bt, content, false).GetComponent<CharacterEquipBtOnClick>();
|
|
btComponent.name = to;
|
|
// btComponent.Init(to, v.Key, lis.GetComponent<ToolsPackGameObjectComponent>().GetIndex());
|
|
// MotionEngine.GetModule<ToolsPackManager>().AddToolsPackWindowItemBts(btComponent.gameObject);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |