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.
97 lines
2.4 KiB
97 lines
2.4 KiB
4 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.InputSystem;
|
||
|
|
||
|
[RequireComponent(typeof(BaseGameObjInfo))]
|
||
|
public class EditorModeBtn : Toggle
|
||
|
{
|
||
|
// Use this for initialization
|
||
|
protected override void Start()
|
||
|
{
|
||
|
base.Start();
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update () {
|
||
|
|
||
|
}
|
||
|
|
||
|
protected override void OnEnable()
|
||
|
{
|
||
|
base.OnEnable();
|
||
|
//#if !UNITY_EDITOR
|
||
|
this.onValueChanged.AddListener(OnSelected);
|
||
|
//#endif
|
||
|
}
|
||
|
|
||
|
protected override void OnDisable()
|
||
|
{
|
||
|
base.OnDisable();
|
||
|
this.onValueChanged.RemoveListener(OnSelected);
|
||
|
}
|
||
|
|
||
|
protected override void OnDestroy()
|
||
|
{
|
||
|
base.OnDestroy();
|
||
|
this.onValueChanged.RemoveListener(OnSelected);
|
||
|
}
|
||
|
|
||
|
public void OnSelected(bool selected)
|
||
|
{
|
||
|
var arg = new EditorModeCtrlArgs();
|
||
|
arg.selected = selected;
|
||
|
arg.currentCursorPos = Input.mousePosition;
|
||
|
|
||
|
Select(arg);
|
||
|
}
|
||
|
|
||
|
public void Select(CmdArgs arg)
|
||
|
{
|
||
|
if (gameObject.name == "RotateEditorModeBtn")
|
||
|
{
|
||
|
if (((EditorModeCtrlArgs)arg).selected)
|
||
|
{
|
||
|
transform.Find("Image").gameObject.SetActive(true);
|
||
|
//InputManager.isRotateEditorMode = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
transform.Find("Image").gameObject.SetActive(false);
|
||
|
|
||
|
this.InstantClearState();
|
||
|
|
||
|
//InputManager.isRotateEditorMode = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (gameObject.name == "DragEditorModeBtn")
|
||
|
{
|
||
|
if (((EditorModeCtrlArgs)arg).selected)
|
||
|
{
|
||
|
transform.Find("Image").gameObject.SetActive(true);
|
||
|
// InputManager.isDragEditorMode = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
transform.Find("Image").gameObject.SetActive(false);
|
||
|
|
||
|
this.InstantClearState();
|
||
|
|
||
|
//InputManager.isDragEditorMode = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
RegisterUIInputEvent.RegisterUIInputHistory(gameObject, this.GetType().Name, "Select", arg);
|
||
|
|
||
|
if (GameSettings.othersSettings.playState != PlayState.None)
|
||
|
{
|
||
|
if (GameSettings.othersSettings.playState == PlayState.Playing)
|
||
|
{
|
||
|
CursorManager.GetInstance.SetClick(arg);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|