大连中石油电子沙盘
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.
 
 
 
 

116 lines
3.8 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class YingJiuData
{
public string name;
public string areaname;
}
public class YingJiuPanel : ResourceLoadPanel<YingJiuPanel>
{
public Button CloseBtn;
public Button SureBtn;
public Dropdown AreaDropdown;
private List<Transform> AQQY;
private GameObject NowClickPerson;
//private Transform NowAQQY;
private string AQQYName;
private void Start()
{
CloseBtn.onClick.AddListener(CloseBtn_Click);
SureBtn.onClick.AddListener(SureBtn_Click);
AreaDropdown.onValueChanged.AddListener(AreaDropdown_valueChanged);
}
private void AreaDropdown_valueChanged(int value)
{
// NowAQQY = AQQY[value];
AQQYName = value == 0 ? "安全区域1" : "安全区域2";
}
public void AddRecordEventYingJiu(GameObject obj, YingJiuData data)
{
if (ReplaySetting.PlayStatus == PlayStatus.isEditor && RecordManager.Instance.recordStatus == RecordStatus.normal)
{
var eventData = new EventData();
eventData.time = RecordManager.Instance.RecordTimer;
eventData.cloneObjType = obj.GetComponent<CloneGameObjInfo>().gameObjType;
eventData.eventType = RecordEventType.YingJiu;
eventData.json = JsonUtility.ToJson(data);
RecordManager.Instance.jsonData.eventDataList.Add(eventData);
}
}
public void SureBtn_Click()
{
if (NowClickPerson != null)
{
Debug.Log(NowClickPerson.name);
YingJiuData data = new YingJiuData();
data.name = NowClickPerson.name;
//data.areaname = AreaDropdown.captionText.text.Split('-')[1];
data.areaname = AreaDropdown.captionText.text;
AddRecordEventYingJiu(NowClickPerson, data);
if (NowClickPerson.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.Wounded)
{
ResourceLoadWindow.Instance.LoadTextHintWindow("伤员被营救到" + data.areaname, 1f);
}
else
{
ResourceLoadWindow.Instance.LoadTextHintWindow("被困人员被营救到" + data.areaname, 1f);
}
//TODO:将人员移动到安全区域(上一版本播放动画)
NowClickPerson.GetComponent<WoundedControl>().HaveFinish = true;
NowClickPerson.GetComponent<WoundedControl>().AreaName = data.areaname;
NowClickPerson.gameObject.SetActive(false);
NowClickPerson = null;
}
CloseBtn_Click();
}
private void CloseBtn_Click()
{
gameObject.SetActive(false);
}
public void YingJiu(GameObject obj, string areaname = "")
{
NowClickPerson = obj;
//SetAQQY(areaname);
if (!string.IsNullOrEmpty(areaname))
AreaDropdown.captionText.text = areaname;
}
private void SetAQQY(string areaname)
{
if (AQQY == null)
AQQY = new List<Transform>();
AQQY.Clear();
AreaDropdown.options.Clear();
if (string.IsNullOrEmpty(areaname))
{
//TODO:得到安全区域
foreach (Transform item in GameObject.Find("P_Tool").transform.Find("P_StagingArea"))
{
AQQY.Add(item);
Dropdown.OptionData data = new Dropdown.OptionData
{
text = "安全区-" + item.name
};
AreaDropdown.options.Add(data);
}
if (AQQY.Count == 0)
{
ResourceLoadWindow.Instance.LoadTextHintWindow("尚未设置安全区域!", 0.5f);
gameObject.SetActive(false);
}
}
else
{
//TODO:回放安全区域设置
}
}
}