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.
51 lines
1.1 KiB
51 lines
1.1 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
using System;
|
|
|
|
namespace DisComputer
|
|
{
|
|
public class ActCommandItem : MonoBehaviour
|
|
{
|
|
public string key;
|
|
|
|
private Button btn;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置指令动作按钮
|
|
/// </summary>
|
|
/// <param name="_key"></param>
|
|
/// <param name="onClickHandle"></param>
|
|
public void SetBtn(string _key,Action onClickHandle)
|
|
{
|
|
key = _key;
|
|
btn = this.transform.GetComponent<Button>();
|
|
btn.onClick.AddListener(()=> { onClickHandle?.Invoke(); });
|
|
Text text = btn.GetComponentInChildren<Text>();
|
|
text.text = key;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 对比指令正确与否
|
|
/// </summary>
|
|
/// <param name="val"></param>
|
|
/// <returns></returns>
|
|
public bool CompareCommandAct(string val)
|
|
{
|
|
return string.Equals(key, val);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|