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.
48 lines
1.0 KiB
48 lines
1.0 KiB
4 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using AX.MessageSystem;
|
||
|
using System;
|
||
|
using AX.InputSystem;
|
||
|
|
||
|
[RequireComponent(typeof(CloneButtonTest))]
|
||
|
public class CancelCloneBtnSelected : MonoBehaviour {
|
||
|
|
||
|
private CloneButtonTest cloneButton;
|
||
|
// Use this for initialization
|
||
|
void Start () {
|
||
|
cloneButton = this.GetComponent<CloneButtonTest>();
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update () {
|
||
|
|
||
|
}
|
||
|
|
||
|
void OnEnable()
|
||
|
{
|
||
|
MessageDispatcher.AddListener("CANCEL_CLONEBTN_SELECTED_COMMAND", Execute);
|
||
|
}
|
||
|
|
||
|
void OnDisable()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("CANCEL_CLONEBTN_SELECTED_COMMAND", Execute);
|
||
|
}
|
||
|
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("CANCEL_CLONEBTN_SELECTED_COMMAND", Execute);
|
||
|
}
|
||
|
|
||
|
private void Execute(IMessage obj)
|
||
|
{
|
||
|
cloneButton.isOn = false;
|
||
|
|
||
|
var arg = (CloneCmdArgs)obj.Data;
|
||
|
if (cloneButton.isOn)
|
||
|
{
|
||
|
cloneButton.Select(arg);
|
||
|
}
|
||
|
}
|
||
|
}
|