using AX.MessageSystem;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class ErrorEventInfo
{
public string Time;
///
/// 事件触发时操作消防员的用户或者用户本人
///
public string UserName;
public ErrorOperation Erroeoperation;
///
/// 事件描述
///
public string EventInfo;
}
///
/// 错误列表
///
public enum ErrorOperation
{
装备选择错误,
破拆错误,
危险品处置错误,
杂物堆处置错误,
水泡灭火错误,
询问知情人错误,
营救伤员错误,
营救被困人员错误,
灭火超时,
牺牲消防员过多
}
///
/// 暂时挂在Canvas上
///
public class EventReportController : MonoBehaviour
{
///
/// 是否演练开始
///
public bool DrillBegin;
///
/// 设置的伤员/被困人员总数
///
public int SetWonderedNum;
///
/// 演练开始后运行时间
///
public float SpendTime;
///
/// 触发事件集合
///
public List EventReportList = new List();
///
/// 火灾蔓延面积
///
public float FireArea;
///
/// 牺牲消防员
///
public int DieFireMen = 0;
///
/// 火超过多少时间未熄灭
///
public int OverTime = 0;
///
/// 已经拯救的被困人员/伤员
///
public int WonderedSaved = 0;
///
/// 判断是否已经触发火灾超时
///
private bool isovertimeaccound = false;
private static EventReportController instance;
public static EventReportController Instance
{
get
{
if (instance == null)
{
instance = GameObject.Find("Canvas").GetComponent();
}
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);
}
}