2024-12-20 10:10:19 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using UnityEngine.SceneManagement;
|
2024-12-27 23:12:22 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
|
2024-12-20 10:10:19 +08:00
|
|
|
|
public class Status : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
private Button button;
|
|
|
|
|
private Text type;//<2F><><EFBFBD><EFBFBD>״̬<D7B4>ı<EFBFBD>
|
|
|
|
|
private GameObject three;//<2F>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
private GameObject down;
|
|
|
|
|
public bool isParticipate;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public bool isEnd=false;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public bool isOngoing = false;//<2F>Ƿ<EFBFBD><C7B7>ڽ<EFBFBD><DABD><EFBFBD>
|
|
|
|
|
public bool isScheduled=false;//<2F>Ƿ<EFBFBD>Ԥ<EFBFBD><D4A4>
|
|
|
|
|
private Image pop;
|
|
|
|
|
private Image arrow;
|
|
|
|
|
private float time = 3f;
|
|
|
|
|
private float await = 0;
|
|
|
|
|
private Button Assessmentreport;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>水ť
|
|
|
|
|
private Button Review;//<2F><><EFBFBD>̰<EFBFBD>ť;
|
|
|
|
|
private Button repair;//<2F><EFBFBD><DEB8><EFBFBD>ť
|
|
|
|
|
private Button cancelbooking;//ȡ<><C8A1>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>ť
|
|
|
|
|
private bool eventAdded = false; // <20><>ֹ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
2024-12-27 16:29:07 +08:00
|
|
|
|
private bool isadministrator;//<2F>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>Ա
|
2024-12-20 10:10:19 +08:00
|
|
|
|
public Drill drill;
|
|
|
|
|
|
|
|
|
|
private string scenename;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
private string accidenttype;//<2F>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD>
|
2024-12-27 23:12:22 +08:00
|
|
|
|
public Text text;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¹<EFBFBD><C2B9><EFBFBD><EFBFBD>͵<EFBFBD><CDB5>ı<EFBFBD>
|
|
|
|
|
public Text timetext;//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ı<EFBFBD>
|
2024-12-20 10:10:19 +08:00
|
|
|
|
|
|
|
|
|
private gameRoomList gameRoomListInstance; // <20><><EFBFBD><EFBFBD> gameRoomList <20>ű<EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
private List<GameRoomListData> roomDataList; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD>б<EFBFBD>
|
2024-12-27 23:12:22 +08:00
|
|
|
|
public JSONReader JSONReader;
|
2024-12-20 10:10:19 +08:00
|
|
|
|
public string RoomId;
|
|
|
|
|
public string status;
|
|
|
|
|
public string TemplateId;
|
|
|
|
|
public string SceneId;
|
|
|
|
|
public string SubjectId;
|
|
|
|
|
// Start is called before the first frame update
|
2024-12-27 23:12:22 +08:00
|
|
|
|
void Awake()
|
2024-12-20 10:10:19 +08:00
|
|
|
|
{
|
|
|
|
|
button=GetComponent<Button>();
|
|
|
|
|
button.onClick.AddListener(OnClickBtn);
|
|
|
|
|
type=transform.Find("up/type").GetComponent<Text>();
|
|
|
|
|
down = transform.Find("down").gameObject;
|
|
|
|
|
Assessmentreport = transform.Find("down/end/repair ").GetComponent<Button>();
|
|
|
|
|
Assessmentreport.gameObject.SetActive(false);
|
|
|
|
|
Review = transform.Find("down/end/Cancel").GetComponent<Button>();
|
|
|
|
|
Review.gameObject.SetActive(false);
|
|
|
|
|
repair = transform.Find("down/Reserve/repair ").GetComponent<Button>();
|
|
|
|
|
repair.gameObject.SetActive(false);
|
|
|
|
|
cancelbooking = transform.Find("down/Reserve/Cancel").GetComponent<Button>();
|
|
|
|
|
cancelbooking.gameObject.SetActive(false);
|
|
|
|
|
three = transform.Find("down/Schedule").gameObject;
|
|
|
|
|
three.SetActive(false);
|
|
|
|
|
pop=transform.Find("down/Schedule/pop").GetComponent<Image>();
|
|
|
|
|
arrow=transform.Find("down/Schedule/arrowhead ").GetComponent<Image>();
|
|
|
|
|
drill=GameObject.Find("Panel").GetComponent<Drill>();
|
|
|
|
|
drill.OnBoolAChanged += OnBoolAChanged;
|
|
|
|
|
text=transform.Find("down/detail").GetComponent<Text>();
|
2024-12-27 23:12:22 +08:00
|
|
|
|
|
2024-12-20 10:10:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>е<EFBFBD> gameRoomList <20>ű<EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
gameRoomListInstance = FindObjectOfType<gameRoomList>();
|
|
|
|
|
|
2024-12-27 16:29:07 +08:00
|
|
|
|
isadministrator = ReadRoom.instance.isadministrator;
|
2024-12-20 10:10:19 +08:00
|
|
|
|
}
|
2024-12-27 23:12:22 +08:00
|
|
|
|
public void SetRoomData(string roomId, string sceneId, string subjectId, string templateId, string statu,string time)
|
2024-12-20 10:10:19 +08:00
|
|
|
|
{
|
|
|
|
|
RoomId = roomId;
|
|
|
|
|
SceneId = sceneId;
|
|
|
|
|
SubjectId = subjectId;
|
|
|
|
|
TemplateId = templateId;
|
|
|
|
|
status = statu;
|
2024-12-27 23:12:22 +08:00
|
|
|
|
Debug.Log(sceneId);
|
|
|
|
|
Debug.Log(subjectId);
|
|
|
|
|
|
|
|
|
|
DateTime currentDate = Convert.ToDateTime(time);
|
|
|
|
|
timetext.text = $"{currentDate.Month}<7D><>{currentDate.Day}<7D><>";
|
|
|
|
|
|
2024-12-20 10:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>Է<EFBFBD><D4B7><EFBFBD>
|
|
|
|
|
public void PrintRoomData()
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"<22><><EFBFBD><EFBFBD>: {RoomId}, <20><><EFBFBD><EFBFBD>: {SceneId}, <20><>Ŀ: {SubjectId}, ģ<><C4A3>: {TemplateId}, ״̬: {status}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OnBoolAChanged(bool value)
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> bool <20><>ֵ
|
|
|
|
|
isadministrator = value;
|
|
|
|
|
}
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
if(type.text=="<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
|
|
|
|
|
{
|
|
|
|
|
isOngoing=true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (type.text == "<22>ѽ<EFBFBD><D1BD><EFBFBD>")
|
|
|
|
|
{
|
|
|
|
|
isEnd = true;
|
|
|
|
|
three.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
if(type.text=="<22><>Ԥ<EFBFBD><D4A4>")
|
|
|
|
|
{
|
|
|
|
|
isScheduled=true;
|
|
|
|
|
if(isParticipate)
|
|
|
|
|
{
|
|
|
|
|
three.SetActive(true);
|
|
|
|
|
await += Time.deltaTime;
|
|
|
|
|
if (await >= time)
|
|
|
|
|
{
|
|
|
|
|
pop.gameObject.SetActive(false);
|
|
|
|
|
arrow.gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
three.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void OnClickBtn()
|
|
|
|
|
{
|
|
|
|
|
if(isOngoing)
|
|
|
|
|
{
|
|
|
|
|
//Reserve.SetActive(true);
|
|
|
|
|
Debug.Log("<22><><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
//return;
|
|
|
|
|
}
|
|
|
|
|
if (isEnd)
|
|
|
|
|
{
|
|
|
|
|
if (isadministrator)
|
|
|
|
|
{
|
|
|
|
|
Assessmentreport.gameObject.SetActive(true);
|
|
|
|
|
Review.gameObject.SetActive(true);
|
|
|
|
|
if (!eventAdded)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-12-28 15:48:01 +08:00
|
|
|
|
Assessmentreport.onClick.AddListener(OnClickAssessmentreport);
|
2024-12-20 10:10:19 +08:00
|
|
|
|
Review.onClick.AddListener(OnClickReviewBtn);
|
|
|
|
|
eventAdded = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(isScheduled)
|
|
|
|
|
{
|
|
|
|
|
if (isadministrator)
|
|
|
|
|
{
|
|
|
|
|
repair.gameObject.SetActive(true);
|
|
|
|
|
cancelbooking.gameObject.SetActive(true);
|
|
|
|
|
if (!eventAdded)
|
|
|
|
|
{
|
|
|
|
|
repair.onClick.AddListener(OnClickrepairBtn);
|
|
|
|
|
cancelbooking.onClick.AddListener(OnClickCancelBtn);
|
|
|
|
|
eventAdded = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void OnClickAssessmentreport()
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
Game.uiManager.ShowUI<Image>("Panelreport");
|
|
|
|
|
UIClose();
|
|
|
|
|
}
|
|
|
|
|
void OnClickReviewBtn()
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD>");
|
|
|
|
|
SceneManager.LoadScene("yhj 1");
|
|
|
|
|
}
|
|
|
|
|
void OnClickrepairBtn()
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("<22><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
void OnClickCancelBtn()
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("ȡ<><C8A1>Ԥ<EFBFBD><D4A4>");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void OnDestroy()
|
|
|
|
|
{
|
|
|
|
|
// ȡ<><C8A1><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD>ڴ<EFBFBD>й©
|
|
|
|
|
if (drill != null)
|
|
|
|
|
{
|
|
|
|
|
drill.OnBoolAChanged -= OnBoolAChanged;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
async void UIClose()
|
|
|
|
|
{
|
|
|
|
|
await Task.Delay(3000);
|
|
|
|
|
Game.uiManager.CloseUI("Panelreport");
|
|
|
|
|
}
|
|
|
|
|
}
|