- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.EventSystems;
-
- public class chufa : MonoBehaviour
- {
- public GameObject Stick, changeStick;
- public GameObject btn1, btn2;
- public GameObject btn_stick1, btn_stick2;
- public Image sr;
- public Sprite[] pic;
-
- void Start () {
- sr = GetComponent
(); - Button btn = Stick.GetComponentInChildren
- btn.onClick.AddListener (OnStartButtonClick);
- }
-
- public void OnStartButtonClick()
- {
- Debug.Log("哈哈哈哈!看,你好像是个憨憨!!");
- changeStick.GetComponent
().sprite = pic[0]; -
- btn_stick1.SetActiveRecursively(false);
- btn_stick2.SetActiveRecursively(false);
-
- btn1.SetActiveRecursively(true);
- btn2.SetActiveRecursively(true);
- }
-
- public void TransRoad()
- {
- //...
- }
- }