天津23维预案
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.
 
 
 
 
 
 

91 lines
2.7 KiB

using AX.MessageSystem;
using AX.TrackRecord;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using System;
public class ShuSanDianSetCtrl : MonoBehaviour {
private GameObject selectedSsry;
public List<Vector3> ShuSanDians = new List<Vector3>();
private bool isOn;
private GameObject ResetButton;
private GameObject sureButton;
private RaycastHit hit;//射线
private Ray ray;
private LayerMask ground_layerMask = -1;
private int dropDownIndex;
// Use this for initialization
void Start () {
MessageDispatcher.AddListener("BANGDINGSSRY", BangDingGuanSsry);
ResetButton = transform.Find("ResetButton").gameObject;
ResetButton.GetComponent<Button>().onClick.AddListener(ResetGCD);
sureButton = transform.Find("sureButton").gameObject;
sureButton.GetComponent<Button>().onClick.AddListener(SureGCDSet);
transform.Find("closeButton").GetComponent<Button>().onClick.AddListener(CloseWindow);
}
private void CloseWindow()
{
MessageDispatcher.SendMessage("CLOSE", (object)this.name, "CUBE");
}
private void BangDingGuanSsry(IMessage obj)
{
selectedSsry = (GameObject)obj.Data;
ShuSanDians = selectedSsry.GetComponent<ShuSanRYCtrl>().PosList;
}
private void ResetGCD()
{
ShuSanDians.Clear();
selectedSsry.GetComponent<ShuSanRYCtrl>().index = 0;
selectedSsry.GetComponent<ShuSanRYCtrl>().flag = false;
}
private void SureGCDSet()
{
selectedSsry.GetComponent<ShuSanRYCtrl>().flag = true;
dropDownIndex = transform.Find("Dropdown").GetComponent<Dropdown>().value;
selectedSsry.GetComponent<ShuSanRYCtrl>().value = int.Parse(transform.Find("Dropdown").GetComponent<Dropdown>().options[dropDownIndex].text);
MessageDispatcher.SendMessage("CLOSE", (object)transform.name, "CUBE");
if (RecordManager.Instance.IsRecording)
{
//记录疏散人员
TrackRecordHelpClass.RecordEditGCS_SSRYEvent(selectedSsry);
}
}
// Update is called once per frame
void Update () {
isOn = transform.Find("Toggle").GetComponent<Toggle>().isOn;
if (isOn)
{
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, Mathf.Infinity, ground_layerMask) && Input.GetMouseButtonDown(0) &&
!EventSystem.current.IsPointerOverGameObject())
{
ShuSanDians.Add(hit.point);
}
}
}
private void OnDestroy()
{
MessageDispatcher.RemoveListener("BANGDINGSSRY", BangDingGuanSsry);
}
}