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.
133 lines
3.4 KiB
133 lines
3.4 KiB
using AX.MessageSystem; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using System; |
|
|
|
public class ErrorEventInfo |
|
{ |
|
public string Time; |
|
/// <summary> |
|
/// 事件触发时操作消防员的用户或者用户本人 |
|
/// </summary> |
|
public string UserName; |
|
public ErrorOperation Erroeoperation; |
|
/// <summary> |
|
/// 事件描述 |
|
/// </summary> |
|
public string EventInfo; |
|
} |
|
|
|
/// <summary> |
|
/// 错误列表 |
|
/// </summary> |
|
public enum ErrorOperation |
|
{ |
|
装备选择错误, |
|
破拆错误, |
|
危险品处置错误, |
|
杂物堆处置错误, |
|
水泡灭火错误, |
|
询问知情人错误, |
|
营救伤员错误, |
|
营救被困人员错误, |
|
灭火超时, |
|
牺牲消防员过多 |
|
} |
|
/// <summary> |
|
/// 暂时挂在Canvas上 |
|
/// </summary> |
|
public class EventReportController : MonoBehaviour |
|
{ |
|
/// <summary> |
|
/// 是否演练开始 |
|
/// </summary> |
|
public bool DrillBegin; |
|
/// <summary> |
|
/// 设置的伤员/被困人员总数 |
|
/// </summary> |
|
public int SetWonderedNum; |
|
/// <summary> |
|
/// 演练开始后运行时间 |
|
/// </summary> |
|
public float SpendTime; |
|
/// <summary> |
|
/// 触发事件集合 |
|
/// </summary> |
|
public List<ErrorEventInfo> EventReportList = new List<ErrorEventInfo>(); |
|
/// <summary> |
|
/// 火灾蔓延面积 |
|
/// </summary> |
|
public float FireArea; |
|
/// <summary> |
|
/// 牺牲消防员 |
|
/// </summary> |
|
public int DieFireMen = 0; |
|
/// <summary> |
|
/// 火超过多少时间未熄灭 |
|
/// </summary> |
|
public int OverTime = 0; |
|
/// <summary> |
|
/// 已经拯救的被困人员/伤员 |
|
/// </summary> |
|
public int WonderedSaved = 0; |
|
/// <summary> |
|
/// 判断是否已经触发火灾超时 |
|
/// </summary> |
|
private bool isovertimeaccound = false; |
|
private static EventReportController instance; |
|
|
|
public static EventReportController Instance |
|
{ |
|
get |
|
{ |
|
if (instance == null) |
|
{ |
|
instance = GameObject.Find("Canvas").GetComponent<EventReportController>(); |
|
} |
|
return instance; |
|
} |
|
} |
|
|
|
|
|
void Start() |
|
{ |
|
Transform pdisater = GameObject.Find("P_AllParent").transform.Find("P_Disasters"); |
|
SetWonderedNum = pdisater.Find("P_Wounded").transform.childCount + pdisater.Find("P_TrappedPerson").transform.childCount; |
|
Debug.Log(SecondToHMS(7631)); |
|
DrillBegin = GameSettings.othersSettings.isStartDrill; |
|
} |
|
|
|
void Update() |
|
{ |
|
if (DrillBegin) |
|
{ |
|
SpendTime += Time.deltaTime; |
|
} |
|
if (isovertimeaccound == false) |
|
{ |
|
if (Mathf.Floor(SpendTime) > OverTime) |
|
{ |
|
ErrorEventInfo info = new ErrorEventInfo |
|
{ |
|
Time = SecondToHMS(OverTime), |
|
UserName = "无", |
|
Erroeoperation = ErrorOperation.灭火超时, |
|
EventInfo = "超出设置时间仍未扑灭火灾" |
|
|
|
}; |
|
EventReportList.Add(info); |
|
isovertimeaccound = true; |
|
} |
|
} |
|
|
|
} |
|
public string SecondToHMS(int second) |
|
{ |
|
int h = (int)(second / 3600); |
|
int m = (int)(second - h * 3600) / 60; |
|
int s = (int)(second - h * 3600 - m * 60); |
|
return string.Format("{0:D2}:{1:D2}:{2:D2}", h, m, s); |
|
} |
|
|
|
}
|
|
|