120 lines
3.4 KiB
C#
120 lines
3.4 KiB
C#
using AdamSync;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using static InterfaceManager;
|
|
public class Judgmentstate : MonoBehaviour
|
|
{
|
|
|
|
public Button fanhui1;
|
|
public Button off_btn;
|
|
public Button initiate_btn;//开始按钮
|
|
public Button Pause_btn;//暂停按钮
|
|
public Button finish_btn;//结束按钮
|
|
public Text countdown_text;//倒计时文本
|
|
public bool isp=false;//判断游戏结束
|
|
public float a=5;
|
|
public Competitioncontentpanl competitioncontentpanl;
|
|
public Button content_bton;//训练内容按钮
|
|
public Seatpanl seatpanl;//席位内容页面
|
|
public Button message_btn;//席位训练按钮
|
|
public Modellinkedlistpanl modellinkedlistpanl;//模型页面列表
|
|
public Button model2_btn;//模型列表按钮
|
|
public Button initiate_botn;//开始推演按钮
|
|
|
|
|
|
|
|
|
|
|
|
void Start()
|
|
{
|
|
|
|
fanhui1.onClick.AddListener(() =>
|
|
{
|
|
GameMain.tiao = false;
|
|
GameMain.visit = true;
|
|
//SceneManager.LoadScene("SampleScene");
|
|
OnLeaveRoom();
|
|
});
|
|
Operation();//开始暂停结束方法
|
|
}
|
|
|
|
private void Operation()
|
|
{
|
|
initiate_btn.onClick.AddListener(() =>
|
|
{
|
|
initiate_btn.gameObject.SetActive(false);
|
|
Pause_btn.gameObject.SetActive(true);
|
|
string msg = $"send2room " + "StartDeduction";
|
|
_ = SyncCreateRoom.SendMessageAsync(msg);
|
|
});
|
|
Pause_btn.onClick.AddListener(() =>
|
|
{
|
|
|
|
initiate_btn.gameObject.SetActive(true);
|
|
Pause_btn.gameObject.SetActive(false);
|
|
string msg = $"send2room "+"Stop";
|
|
_ = SyncCreateRoom.SendMessageAsync(msg);
|
|
});
|
|
finish_btn.onClick.AddListener(() =>
|
|
{
|
|
if (Time.timeScale!=0)
|
|
{
|
|
isp = true;
|
|
}
|
|
countdown_text.gameObject.SetActive(true);
|
|
});
|
|
content_bton.onClick.AddListener(() =>
|
|
{
|
|
competitioncontentpanl.gameObject.SetActive(true);
|
|
});
|
|
message_btn.onClick.AddListener(() =>
|
|
{
|
|
seatpanl.gameObject.SetActive(true);
|
|
});
|
|
model2_btn.onClick.AddListener(() =>
|
|
{
|
|
modellinkedlistpanl.gameObject.SetActive(true);
|
|
});
|
|
initiate_botn.onClick.AddListener(() =>
|
|
{
|
|
string msg = $"send2room " + "StartDeduction";
|
|
_ = SyncCreateRoom.SendMessageAsync(msg);
|
|
});
|
|
off_btn.onClick.AddListener(() => {
|
|
//string url = Url_Exit + GlobalFlag.currentUser.login_name;
|
|
//StartCoroutine(GetString(url, data =>
|
|
//{
|
|
// Debug.Log(data);
|
|
|
|
|
|
//}));
|
|
Application.Quit();
|
|
|
|
});
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (isp==true)
|
|
{
|
|
a -= Time.deltaTime;
|
|
countdown_text.text=a.ToString("0");
|
|
if (a<=0)
|
|
{
|
|
countdown_text.gameObject.SetActive(false);
|
|
string msg = $"send2room " + "EndDeduction";
|
|
_ = SyncCreateRoom.SendMessageAsync(msg);
|
|
a = 5;
|
|
isp = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void OnLeaveRoom()
|
|
{
|
|
string _msg = "leaveroom ";
|
|
MyNetMQClient.instance._netMqListener.UnSubtopic(GlobalFlag.roomID);
|
|
_ = AdamSync.SyncCreateRoom.SendMessageAsync(_msg);
|
|
}
|
|
}
|