38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using MotionFramework;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace ToolsPack
|
|
{
|
|
/// <summary>
|
|
/// 工具窗口管理器
|
|
/// </summary>
|
|
public class ToolsPackWindowManager : MonoBehaviour
|
|
{
|
|
private List<string> _toolsNames;
|
|
|
|
[SerializeField] private Transform content;
|
|
|
|
public void OnEnable()
|
|
{
|
|
int count = content.childCount;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
Destroy(content.GetChild(i).gameObject);
|
|
}
|
|
|
|
//初始化工具集
|
|
_toolsNames = MotionEngine.GetModule<ToolsPackManager>().GetToolsPack();
|
|
|
|
GameObject bt = MotionEngine.GetModule<ToolsPackManager>().GetToolsPackWindowBt();
|
|
foreach (var v in _toolsNames)
|
|
{
|
|
ToolsPackWindowItemBtComponent btComponent= Instantiate(bt, content, false).GetComponent<ToolsPackWindowItemBtComponent>();
|
|
btComponent.name = v;
|
|
btComponent.Init(v);
|
|
}
|
|
}
|
|
}
|
|
} |