1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class PanelStart : MonoBehaviour {
- private Button startBtn;
- private Button setBtn;
- private Button exitBtn;
- // Use this for initialization
- void Start () {
- startBtn = transform.Find("StartBtn").GetComponent<Button>();
- setBtn = transform.Find("SetBtn").GetComponent<Button>();
- exitBtn = transform.Find("ExitBtn").GetComponent<Button>();
- startBtn.onClick.RemoveAllListeners();
- startBtn.onClick.AddListener(startBtnEvent);
- setBtn.onClick.RemoveAllListeners();
- setBtn.onClick.AddListener(setBtnEvent);
- exitBtn.onClick.RemoveAllListeners();
- exitBtn.onClick.AddListener(exitBtnEvent);
- }
- private void exitBtnEvent()
- {
- Application.Quit();
- }
- private void setBtnEvent()
- {
- UIManager.instance.CreatePanel("PanelSet");
- UIManager.instance.DestroyPanel("PanelStart");
- }
- // Update is called once per frame
- void Update () {
-
- }
- void startBtnEvent()
- {
- //点击开始按钮 界面跳转 生成飞机、石头、道具
- UIManager.instance.CreatePanel("PanelGame");
- UIManager.instance.DestroyPanel("PanelStart");
- PlaneManager.instance.CreateAirPlane();
- CreateStone.instance.InvokeRepeating("createStone",1f,1f);
- CreateStone.instance.InvokeRepeating("createProp",1f,3f);
- }
- }
|