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.
128 lines
4.4 KiB
128 lines
4.4 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using AX.MessageSystem; |
|
using UnityEngine.UI; |
|
using AX.TrackRecord; |
|
using Video; |
|
using DevelopEngine; |
|
|
|
public class YingjiuRenYuan : SingletonMono<YingjiuRenYuan> |
|
{ |
|
|
|
// Use this for initialization |
|
GameObject renyuan; |
|
Transform binancengDian; |
|
Transform shiwaiDian; |
|
List<Dropdown.OptionData> listOptions; |
|
void Start() |
|
{ |
|
binancengDian = GameObject.Find("AllYingJiuDian/BiNanCengDian").transform; |
|
shiwaiDian = GameObject.Find("AllYingJiuDian/ShiWaiDian").transform; |
|
listOptions = new List<Dropdown.OptionData>(); |
|
MessageDispatcher.AddListener("SHOW_YINGJIU", open); |
|
gameObject.SetActive(false); |
|
} |
|
|
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
|
|
} |
|
void open(IMessage message) |
|
{ |
|
renyuan = (GameObject)message.Data; |
|
gameObject.SetActive(true); |
|
setOptions(); |
|
gameObject.transform.Find("Dropdown").GetComponent<Dropdown>().options = listOptions; |
|
gameObject.transform.Find("Dropdown").GetComponent<Dropdown>().value = 0; |
|
} |
|
void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("SHOW_YINGJIU", open); |
|
} |
|
private void setOptions() |
|
{ |
|
listOptions.Clear(); |
|
if (renyuan.name.Contains("sy2")) |
|
{ |
|
foreach (Transform child in binancengDian) |
|
{ |
|
var optionName = "避难层" + child.name.Replace("BiNanCeng", ""); |
|
Dropdown.OptionData OptionData = new Dropdown.OptionData(); |
|
OptionData.text = optionName; |
|
listOptions.Add(OptionData); |
|
} |
|
|
|
} |
|
|
|
foreach (Transform child in shiwaiDian) |
|
{ |
|
var optionName = "室外安全区" + child.name.Replace("ShiWai", ""); |
|
Dropdown.OptionData OptionData = new Dropdown.OptionData(); |
|
OptionData.text = optionName; |
|
listOptions.Add(OptionData); |
|
} |
|
} |
|
public void OKSubmit() |
|
{ |
|
//isfage = false; |
|
if (LineamentEvent.gameobj == null) |
|
{ |
|
return; |
|
} |
|
Transform mubiao=null; |
|
string pName = TrackRecordHelpClass.GetParentName(LineamentEvent.gameobj.name); |
|
var index = gameObject.transform.Find("Dropdown").GetComponent<Dropdown>().value; |
|
var optionName=gameObject.transform.Find("Dropdown").GetComponent<Dropdown>().options[index].text; |
|
if (optionName.Contains("避难层")) |
|
{ |
|
optionName = "BiNanCeng" + optionName.Replace("避难层", ""); |
|
mubiao = GameObject.Find("AllYingJiuDian/BiNanCengDian/" + optionName).transform; |
|
} |
|
else if (optionName.Contains("室外安全区")) |
|
{ |
|
optionName = "ShiWai" + optionName.Replace("室外安全区", ""); |
|
mubiao = GameObject.Find("AllYingJiuDian/ShiWaiDian/" + optionName).transform; |
|
} |
|
var offset = mubiao.GetComponent<YingjiudianOffset>().getOffset(); |
|
|
|
if (renyuan.name.Contains("sy1")) |
|
{ |
|
renyuan.transform.localPosition = mubiao.transform.position + mubiao.transform.right * 0 + mubiao.transform.up * 0.2f + mubiao.transform.forward * offset; |
|
} |
|
else |
|
{ |
|
renyuan.transform.localPosition = mubiao.transform.position + mubiao.transform.right * 0 + mubiao.transform.up * 1 + mubiao.transform.forward * offset; |
|
} |
|
renyuan.GetComponent<WoundedControl>().havefinished = true; |
|
//MessageDispatcher.SendMessage(pName, "DestroyObj", (object)this.name); |
|
TrackRecordHelpClass.RecordRescueWoundedEvent(renyuan.name); |
|
PlayVideo(renyuan.name); |
|
gameObject.SetActive(false); |
|
} |
|
|
|
public void PlayVideo(string syName) |
|
{ |
|
string mov; |
|
if (syName.Contains("sy1")) |
|
{ |
|
//mov = "背.mov"; |
|
mov = "抬担架.mp4"; |
|
} |
|
else |
|
{ |
|
mov = "跟随跑.mov"; |
|
} |
|
VCR._videoFiles = ExamInfoHelpClass.VideoFilePath + mov; |
|
|
|
VCR.Instance().StartPlayer(); |
|
if (LoadManager.Instance.IsPlayBacking) |
|
{ |
|
//VCR._mediaPlayer.m_PlaybackRate = LoadManager.Instance.LoadSpeed; |
|
VCR._mediaPlayer.Control.SetPlaybackRate(LoadManager.Instance.LoadSpeed); |
|
} |
|
GameObject.Find("Canvas").transform.Find("Panel_Video 1").GetComponent<RectTransform>().localScale = new Vector3(0.5f, 0.5f, 1); |
|
|
|
} |
|
}
|
|
|