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.
121 lines
4.9 KiB
121 lines
4.9 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using AX.MessageSystem;
|
||
|
using AX.TrackRecord;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine.EventSystems;
|
||
|
|
||
|
public class PoChaiDianMessage : MonoBehaviour {
|
||
|
|
||
|
// Use this for initialization
|
||
|
void Start ()
|
||
|
{
|
||
|
//if (!LoadManager.Instance.IsPlayBacking)
|
||
|
//{
|
||
|
// this.gameObject.transform.LookAt(GameObject.Find("Main Camera").transform);
|
||
|
// float X = this.gameObject.transform.localEulerAngles.x;
|
||
|
// this.gameObject.transform.localEulerAngles = new Vector3(0, this.gameObject.transform.localEulerAngles.y, this.gameObject.transform.localEulerAngles.z);
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update ()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
bool Flag = false;
|
||
|
public Texture mouseTexture;
|
||
|
void OnMouseDown()
|
||
|
{
|
||
|
if (!EventSystem.current.IsPointerOverGameObject())
|
||
|
if (LineamentEvent.LastObj != null && LineamentEvent.LastObj.name.Contains("xiaofangyuan"))
|
||
|
{
|
||
|
if (LineamentEvent.LastObj.transform.Find("info/Function").GetComponent<TextMesh>().text.Equals("破拆"))
|
||
|
{
|
||
|
bool CanPoChai = false;
|
||
|
foreach (string key in LineamentEvent.LastObj.GetComponent<Bag>().unCostSelectedEquips.Keys)
|
||
|
{
|
||
|
if (key.Contains("手持式钢筋速断器") || key.Contains("无齿锯") || key.Contains("机动链锯") || key.Contains("液压破拆工具"))
|
||
|
{
|
||
|
CanPoChai = true;
|
||
|
}
|
||
|
}
|
||
|
if (!CanPoChai)
|
||
|
{
|
||
|
if (RecordManager.Instance.IsRecording)
|
||
|
{
|
||
|
NoEquip equip = new NoEquip();
|
||
|
equip.Name = LineamentEvent.LastObj.transform.Find("info/Name").GetComponent<TextMesh>().text;
|
||
|
TrackRecordHelpClass.RecordNoEquipEvent(equip);
|
||
|
}
|
||
|
MessageDispatcher.SendMessage("Operatinghints", (object)"请选择破拆工具");
|
||
|
return;
|
||
|
}
|
||
|
float distance = Vector3.Distance(LineamentEvent.LastObj.transform.position,
|
||
|
this.gameObject.transform.position);
|
||
|
if (distance < 2f)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("OPEN", (object)"PoChaiUI", "CUBE");
|
||
|
PoChaiUI.instance.SetPoChaiUI(this.gameObject);
|
||
|
if (RecordManager.Instance.IsRecording /*&& ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.MakeScore*/)
|
||
|
{
|
||
|
foreach (Transform area in this.transform)
|
||
|
{
|
||
|
Bounds bounds = area.GetComponent<MeshRenderer>().bounds;
|
||
|
if (bounds.Contains(new Vector3(LineamentEvent.LastObj.transform.position.x, bounds.center.y, LineamentEvent.LastObj.transform.position.z)))
|
||
|
{
|
||
|
if (area.name.Contains("RightArea"))
|
||
|
{
|
||
|
Debug.Log("正确");
|
||
|
}
|
||
|
else if (area.name.Contains("WrongArea"))
|
||
|
{
|
||
|
PoChaiStanceAttri attri = new PoChaiStanceAttri();
|
||
|
attri.Right = false;
|
||
|
attri.Trouble = "破拆站位错误";
|
||
|
TrackRecordHelpClass.RecordPoChaiStanceEvent(attri);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("Operatinghints", (object)"请靠近破拆");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Texture2D cursorTexture;
|
||
|
public CursorMode cursorMode = CursorMode.Auto;
|
||
|
public Vector2 hotSpot = Vector2.zero;
|
||
|
void OnMouseEnter()
|
||
|
{
|
||
|
if (!EventSystem.current.IsPointerOverGameObject())
|
||
|
if (LineamentEvent.LastObj != null && LineamentEvent.LastObj.name.Contains("xiaofangyuan"))
|
||
|
{
|
||
|
if (LineamentEvent.LastObj.transform.Find("info/Function").GetComponent<TextMesh>().text.Equals("破拆"))
|
||
|
{
|
||
|
Cursor.SetCursor(cursorTexture, hotSpot, cursorMode);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
void OnMouseExit()
|
||
|
{
|
||
|
if (LineamentEvent.LastObj != null && LineamentEvent.LastObj.name.Contains("xiaofangyuan"))
|
||
|
{
|
||
|
if (LineamentEvent.LastObj.transform.Find("info/Function").GetComponent<TextMesh>().text.Equals("破拆"))
|
||
|
{
|
||
|
Cursor.SetCursor(null, Vector2.zero, cursorMode);
|
||
|
}
|
||
|
}
|
||
|
if (LineamentEvent.LastObj != null)
|
||
|
{
|
||
|
Cursor.SetCursor(null, Vector2.zero, cursorMode);
|
||
|
}
|
||
|
}
|
||
|
}
|