49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 正在使用的工具/材料管理类
|
|
/// </summary>
|
|
public class ToolAndmaterialMgr : BaseManager<ToolAndmaterialMgr>
|
|
{
|
|
//该系统所需要使用的全部工器具和材料
|
|
|
|
public List<D_ToolAndMaterialData> toolAndMaterialList = new List<D_ToolAndMaterialData>();
|
|
|
|
private ToolAndmaterialMgr()
|
|
{
|
|
}
|
|
|
|
public void Init(string toolOrMaterilOrDevice)
|
|
{
|
|
toolAndMaterialList = GameManager.DataMgr.GetCurrentSystemToolAndMaterials(toolOrMaterilOrDevice);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取指定工具
|
|
/// </summary>
|
|
/// <param name="objName"></param>
|
|
/// <returns></returns>
|
|
public D_ToolAndMaterialData GetToolOrMaterialOrDeviceInfoByObjName(string objName)
|
|
{
|
|
for (int i = 0; i < toolAndMaterialList.Count; i++)
|
|
{
|
|
if (toolAndMaterialList[i].objName == objName)
|
|
return toolAndMaterialList[i];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取ItemInfo
|
|
/// </summary>
|
|
/// <param name="objName"></param>
|
|
/// <returns></returns>
|
|
public Tool_SelectComponent GetItemInfoByName(string objName)
|
|
{
|
|
Tool_SelectComponent tmp= GameObject.FindObjectsOfType<Tool_SelectComponent>().ToList().Find(a => a.gameObject.name == objName);
|
|
return tmp;
|
|
}
|
|
} |