using HighlightingSystem;
using System.Collections;
using System.Collections.Generic;
using UnityEditor.SceneManagement;
using UnityEditor.SearchService;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
//============================================================
//支持中文,文件使用UTF-8编码
//@author #AUTHOR#
//@create #CREATEDATE#
//@company #COMPANY#
//
//@description:
//============================================================
public enum Attribute
{
///
/// 默认
///
defaultModel,
///
/// 安全工器具
///
SafetyToolsAndInstruments,
///
/// 工器具
///
ToolsAndInstruments
}
public enum RightAndWrong
{
///
/// 默认
///
defaultModel,
///
/// 对
///
right,
///
/// 错
///
wrong
}
public class ToolModelClick : MonoBehaviour
{
public Attribute attribute = Attribute.defaultModel;
public RightAndWrong rightAndWrong = RightAndWrong.defaultModel;
public UnityEvent onEnter = new UnityEvent();
public UnityEvent onDown = new UnityEvent();
public UnityEvent onDrag = new UnityEvent();
public UnityEvent onExit = new UnityEvent();
public GameObject line;
public GameObject Higth;
public Highlighter selfHighlighter;
private void Awake()
{
if (line != null)
line.SetActive(false);
if (Higth != null)
{
Higth.SetActive(false);
}
selfHighlighter = GetComponent();
selfHighlighter.ConstantOn();
}
private void OnMouseEnter()
{
if (EventSystem.current.IsPointerOverGameObject())
return;
onEnter?.Invoke();
var current = SceneManager.GetActiveScene();
if (current.name == "工具间场景")
UIManager.Instance.SetThreeDTip(gameObject.name);
}
private void OnMouseDown()
{
if (EventSystem.current.IsPointerOverGameObject())
return;
var current = SceneManager.GetActiveScene();
if (current.name != "工具间场景") return;
onDown?.Invoke();
ToolsItemManager.Instance.CreatToolItem(gameObject);
UIManager.Instance.SetThreeDTip("");
Destroy(gameObject);
}
private void OnMouseDrag()
{
if (EventSystem.current.IsPointerOverGameObject())
return;
onDrag?.Invoke();
}
private void OnMouseExit()
{
if (EventSystem.current.IsPointerOverGameObject())
return;
onExit?.Invoke();
UIManager.Instance.SetThreeDTip("");
}
}