|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class AccidentWindow2 : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private int taskCount = 0;
|
|
|
|
|
|
|
|
|
|
public Button ChuLiBtn_police;
|
|
|
|
|
public Button ChuLiBtn_hospital;
|
|
|
|
|
|
|
|
|
|
public GameObject ChuliWnd;
|
|
|
|
|
public GameObject ChuliWnd_hospital;
|
|
|
|
|
|
|
|
|
|
public GameObject policeone;
|
|
|
|
|
public GameObject policetwo;
|
|
|
|
|
public GameObject hospitalone;
|
|
|
|
|
public GameObject hospitaltwo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Button policeAction1;
|
|
|
|
|
public Button policeAction2;
|
|
|
|
|
public Button hospitalAction1;
|
|
|
|
|
public Button hospitalAction2;
|
|
|
|
|
public Button closeBtn;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Text stateTxt;
|
|
|
|
|
public GameObject succeedTxt;
|
|
|
|
|
|
|
|
|
|
public GameObject RescueInfoWnd;
|
|
|
|
|
public GameObject threeDcamera;
|
|
|
|
|
public Text policeRescue;
|
|
|
|
|
public Text hospitalRescue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Init()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ChuLiBtn_police.onClick.AddListener(OpenChuLiWnd);
|
|
|
|
|
ChuLiBtn_hospital.onClick.AddListener(OpenChuliWnd_hospital);
|
|
|
|
|
|
|
|
|
|
policeAction1.onClick.AddListener(() => { PoliceAction(policeone,21f); } ); //22
|
|
|
|
|
policeAction2.onClick.AddListener(() => { PoliceAction(policetwo,21f); });//18.5
|
|
|
|
|
hospitalAction1.onClick.AddListener(() => {HospitalAction(hospitalone,21f); });//29.5
|
|
|
|
|
hospitalAction2.onClick.AddListener(() => {HospitalAction(hospitaltwo, 21f); });//14,5
|
|
|
|
|
|
|
|
|
|
closeBtn.onClick.AddListener(() => { this.gameObject.SetActive(false); });
|
|
|
|
|
this.gameObject.SetActive(false);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OpenChuLiWnd()
|
|
|
|
|
{
|
|
|
|
|
ChuliWnd.gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
public void OpenChuliWnd_hospital()
|
|
|
|
|
{
|
|
|
|
|
ChuliWnd_hospital.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OpenRescueInfoWnd()
|
|
|
|
|
{
|
|
|
|
|
RescueInfoWnd.gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PoliceAction(GameObject police,float time)
|
|
|
|
|
{
|
|
|
|
|
police.gameObject.SetActive(true);
|
|
|
|
|
police.GetComponent<Animator>().CrossFade("policecar", 0.5f);
|
|
|
|
|
|
|
|
|
|
// this.gameObject.SetActive(false);
|
|
|
|
|
ChuLiBtn_police.interactable=false;
|
|
|
|
|
stateTxt.text = " 处理中";
|
|
|
|
|
ChuliWnd.SetActive(false);
|
|
|
|
|
taskCount += 1;
|
|
|
|
|
if (taskCount >= 2)
|
|
|
|
|
{
|
|
|
|
|
this.gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
GameRoot.Instance.pt.AddTimeTask((int tc) => {
|
|
|
|
|
policeRescue.text = "已到达";
|
|
|
|
|
policeRescue.color = Color.green;
|
|
|
|
|
if (taskCount >= 2)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
GameRoot.Instance.menuWnd.finalCamera.SetActive(true);
|
|
|
|
|
succeedTxt.SetActive(true);
|
|
|
|
|
GameRoot.Instance.ClearUI();
|
|
|
|
|
GameOver();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}, time, PETimeUnit.Second, 1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void HospitalAction(GameObject hospital, float time)
|
|
|
|
|
{
|
|
|
|
|
hospital.gameObject.SetActive(true);
|
|
|
|
|
hospital.GetComponent<Animator>().CrossFade("hospitalcar", 0.5f);
|
|
|
|
|
////if////
|
|
|
|
|
ChuLiBtn_hospital.interactable = false;
|
|
|
|
|
stateTxt.text = " 处理中";
|
|
|
|
|
ChuliWnd_hospital.SetActive(false);
|
|
|
|
|
taskCount += 1;
|
|
|
|
|
if (taskCount >= 2)
|
|
|
|
|
{
|
|
|
|
|
this.gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
GameRoot.Instance.pt.AddTimeTask((int td) => {
|
|
|
|
|
hospitalRescue.text = "已到达";
|
|
|
|
|
policeRescue.color = Color.green;
|
|
|
|
|
if (taskCount >= 2)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
GameRoot.Instance.menuWnd.finalCamera.SetActive(true);
|
|
|
|
|
GameRoot.Instance.ClearUI();
|
|
|
|
|
|
|
|
|
|
GameOver();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}, time, PETimeUnit.Second, 1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void GameOver()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
GameRoot.Instance.pt.AddTimeTask((int tg) => { Time.timeScale = 0;
|
|
|
|
|
succeedTxt.gameObject.SetActive(true);
|
|
|
|
|
EduCoderTool.WebConnecter.Singleton.SendResultToWeb(true);
|
|
|
|
|
}, 0.1f, PETimeUnit.Second);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|