You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.6 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AccidentWindow : MonoBehaviour
{
public Button ChuLiBtn;
public GameObject ChuliWnd;
public GameObject pocileOne;
public GameObject pocileTwo;
public GameObject HuoDongChe;
public Button policeAction1;
public Button policeAction2;
public Button closeBtn;
public Text stateTxt;
public Text succeedTxt;
public void Init()
{
ChuLiBtn.onClick.AddListener(OpenChuLiWnd);
policeAction1.onClick.AddListener(PoliceActionOne);
policeAction2.onClick.AddListener(PoliceActionTwo);
closeBtn.onClick.AddListener(() => { this.gameObject.SetActive(false); });
this.gameObject.SetActive(false);
}
public void OpenChuLiWnd()
{
ChuliWnd.gameObject.SetActive(true);
}
public void PoliceActionTwo()
{
pocileTwo.gameObject.SetActive(true);
pocileTwo.GetComponent<Animator>().CrossFade("policecar2", 0.5f);
this.gameObject.SetActive(false);
ChuLiBtn.gameObject.SetActive(false);
stateTxt.text = " 处理中";
ChuliWnd.SetActive(false);
GameRoot.Instance.pt.AddTimeTask((int t) => {
GameRoot.Instance.menuWnd.threeDcamera.SetActive(false);
GameRoot.Instance.menuWnd.twoDcamera.SetActive(false);
GameRoot.Instance.ClearUI();
GameRoot.Instance.menuWnd.finalCamera.SetActive(true);
HuoDongChe.GetComponent<Animator>().CrossFade("HuoDongChe1", 0.1f);
GameOver();
}, 18.5f, PETimeUnit.Second, 1);
}
public void PoliceActionOne()
{
pocileOne.gameObject.SetActive(true);
pocileOne.GetComponent<Animator>().CrossFade("policecar1", 0.5f);
this.gameObject.SetActive(false);
ChuLiBtn.gameObject.SetActive(false);
stateTxt.text = " 处理中";
ChuliWnd.SetActive(false);
GameRoot.Instance.pt.AddTimeTask((int t) => {
GameRoot.Instance.menuWnd.threeDcamera.SetActive(false);
GameRoot.Instance.menuWnd.twoDcamera.SetActive(false);
GameRoot.Instance.ClearUI();
GameRoot.Instance.menuWnd.finalCamera.SetActive(true);
HuoDongChe.GetComponent<Animator>().CrossFade("HuoDongChe1", 0.1f);
GameOver();
}, 22f, PETimeUnit.Second, 1);
}
private void GameOver()
{
GameRoot.Instance.pt.AddTimeTask((int t) => { Time.timeScale = 0;
succeedTxt.gameObject.SetActive(true);
}, 6, PETimeUnit.Second);
}
}