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.
143 lines
3.2 KiB
143 lines
3.2 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using DG.Tweening;
|
|
using UnityEngine.UI;
|
|
|
|
|
|
namespace DisComputer
|
|
{
|
|
/// <summary>
|
|
/// 面板指令控制器
|
|
/// </summary>
|
|
public class CommandControl : MonoBehaviour
|
|
{
|
|
|
|
public GameObject buttonRootGo;
|
|
|
|
public Button command_btn;
|
|
|
|
//加载按钮
|
|
public Button load_btn;
|
|
|
|
//加号
|
|
public Button add_btn;
|
|
//减号
|
|
public Button sub_btn;
|
|
//乘号
|
|
public Button mul_btn;
|
|
//除号
|
|
public Button div_btn;
|
|
|
|
//选项
|
|
public OptionsView optionsView;
|
|
|
|
//指令集
|
|
public ProgressView progressView;
|
|
|
|
//硬盘
|
|
public GameObject yingPanGo;
|
|
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
command_btn.onClick.AddListener(OnClickCommand);
|
|
|
|
add_btn.onClick.AddListener(OnClickAdd);
|
|
|
|
sub_btn.onClick.AddListener(OnClickSub);
|
|
|
|
mul_btn.onClick.AddListener(OnClickMul);
|
|
|
|
div_btn.onClick.AddListener(OnClickDiv);
|
|
|
|
load_btn.onClick.AddListener(OnClickLoadCommand);
|
|
|
|
HideLoadCommandBtn();
|
|
}
|
|
|
|
private bool isOnshow;
|
|
public void OnClickCommand()
|
|
{
|
|
isOnshow = !isOnshow;
|
|
if (isOnshow)
|
|
{
|
|
buttonRootGo.transform.DOLocalMoveX(0,0.58f);
|
|
VonNeumann.data = new CommandData();
|
|
progressView.ClearItem();
|
|
HideLoadCommandBtn();
|
|
}
|
|
else
|
|
{
|
|
buttonRootGo.transform.DOLocalMoveX(155, 0.58f);
|
|
optionsView.OnHide();
|
|
}
|
|
}
|
|
|
|
public void OnHideButtonRoot()
|
|
{
|
|
buttonRootGo.transform.DOLocalMoveX(155, 0.58f);
|
|
isOnshow = false;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 显示加载按钮
|
|
/// </summary>
|
|
public void ShowLoadCommandBtn()
|
|
{
|
|
load_btn.gameObject.SetActive(true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 隐藏加载按钮
|
|
/// </summary>
|
|
public void HideLoadCommandBtn()
|
|
{
|
|
load_btn.gameObject.SetActive(false);
|
|
}
|
|
|
|
|
|
|
|
void OnClickAdd()
|
|
{
|
|
|
|
VonNeumann.data.command = CommandType.Add;
|
|
optionsView.OnShow();
|
|
|
|
}
|
|
|
|
void OnClickSub()
|
|
{
|
|
VonNeumann.data.command = CommandType.Sub;
|
|
optionsView.OnShow();
|
|
}
|
|
|
|
void OnClickDiv()
|
|
{
|
|
VonNeumann.data.command = CommandType.Div;
|
|
optionsView.OnShow();
|
|
}
|
|
|
|
void OnClickMul()
|
|
{
|
|
VonNeumann.data.command = CommandType.Mul;
|
|
optionsView.OnShow();
|
|
}
|
|
|
|
//点击加载指令
|
|
void OnClickLoadCommand()
|
|
{
|
|
HideLoadCommandBtn();
|
|
yingPanGo.transform.DOPunchScale(new Vector3(0.5f,.5f,.5f),0.5f,2,0.25f).OnComplete(()=>
|
|
{
|
|
VonNeumannControll.Instance.InitCommandMap();
|
|
});
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|