| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using Sirenix.OdinInspector;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class OpToolReplacement : MonoBehaviour
- {
- public List<ToolReplacement> replaceData;
- [Button("修改工器具名称")]
- public void ReplaceTool()
- {
- OpTrigger_ToolPack[] tmpToolPacks = FindObjectsOfType<OpTrigger_ToolPack>();
- foreach (var toolPackItem in tmpToolPacks)
- {
- if (toolPackItem.useTool)
- {
- for(int i = 0; i< toolPackItem.choseToolNames.Count; i++)
- {
- foreach(ToolReplacement tp in replaceData)
- if (toolPackItem.choseToolNames[i].Equals(tp.beforeTool))
- {
- toolPackItem.choseToolNames[i] = tp.afterTool;
- continue;
- }
- }
- }
- }
- OPTrigger_SelectToolElemet[] tmpToolSelect = FindObjectsOfType<OPTrigger_SelectToolElemet>();
- if (tmpToolSelect[0] != null)
- tmpToolSelect[0].SearchTools();
- }
- }
- [Serializable]
- public class ToolReplacement
- {
- [LabelText("要修改的名称")]
- public string beforeTool;
- [LabelText("修改之后的名称")]
- public string afterTool;
- }
|