E_ElecCompetition/Electrical_inspectionCompet.../Assets/Adam/Scripts/ToolsItemController.cs

50 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//============================================================
//支持中文文件使用UTF-8编码
//@author YangHua
//@create 20230914
//@company QianHuo
//
//@description:
//============================================================
public class ToolsItemController : MonoSingleton<ToolsItemController>
{
public GameObject toolPanel;
public List<ToolItem> toolItems = new List<ToolItem>();
public ToolItem toolItemPrefab;
public Transform toolsContent;
public Button closeBtn;
private void Start()
{
closeBtn.onClick.AddListener(() => { SwictchToolPanel(false); });
}
public void SwictchToolPanel(bool isActive)
{
toolPanel.SetActive(isActive);
}
public void SwitchToolsState()
{
}
/// <summary>
/// 在工具家生成图标
/// </summary>
/// <param name="toolName"></param>
public void CreatToolItem(GameObject currentModel)
{
ToolItem tTemp = Instantiate(toolItemPrefab, toolsContent);
tTemp.SetValue(currentModel.name, currentModel.transform);
tTemp.SetState(true);
toolItems.Add(tTemp);
}
}