using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GameManager_Tools : MonoBehaviour { public List tool_Objects_Base = new List(); public GameObject target; //public Button button; public GameObject 工具面板_content; public List 正确工具; //[HideInInspector] public string toolsname; public int 工具选择得分 = 0; // Start is called before the first frame update void Start() { // button.onClick.AddListener(change_toolsbutton); } // Update is called once per frame void Update() { } public void Remove_tool_Objects_Base(GameObject gameObject) { tool_Objects_Base.Remove(gameObject.GetComponent()); } public void change_toolsbutton() { var load = Resources.Load("Prefab/工具按钮"); GameObject 工具按钮 = Instantiate(load) as GameObject; 工具按钮.transform.SetParent(工具面板_content.transform); 工具按钮.transform.localScale = new Vector3(1, 1, 1); 工具按钮.transform.localPosition = new Vector3(0, 0, 0); 工具按钮.transform.localEulerAngles = new Vector3(0, 0, 0); 工具按钮.GetComponent().sprite_name = toolsname; 工具按钮.GetComponent().targetobject = target; target = null; Debug.Log(工具按钮.GetComponent().sprite_name); 工具按钮.GetComponent().UI_name = toolsname; 工具按钮.GetComponent().change(); } public void fenshu_check() { for (int i = 0; i < 正确工具.Count; i++) { for (int g = 0; g < tool_Objects_Base.Count; g++) { tool_Objects_Base[g] = 正确工具[i]; 工具选择得分 += 1; } } } public void ResToolsUI() { } }