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.
91 lines
2.4 KiB
91 lines
2.4 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using DG.Tweening;
|
|
using UnityEngine.UI;
|
|
|
|
|
|
namespace DisComputer
|
|
{
|
|
/// <summary>
|
|
/// 运算设置
|
|
/// </summary>
|
|
public class OptionsView : MonoBehaviour,CommondUnitInterface
|
|
{
|
|
|
|
public Button enter_btn;
|
|
|
|
//运算
|
|
public Text option_txt;
|
|
|
|
//数字A
|
|
public InputField numA_input;
|
|
|
|
//数字B
|
|
public InputField numB_input;
|
|
|
|
public CommandControl command;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
enter_btn.onClick.AddListener(OnclickEnter);
|
|
}
|
|
|
|
|
|
|
|
public void OnShow()
|
|
{
|
|
CommandRegist();
|
|
this.transform.DOLocalMoveY(-0,0.58f);
|
|
}
|
|
|
|
public void OnHide()
|
|
{
|
|
this.transform.DOLocalMoveY(185, 0.58f);
|
|
}
|
|
|
|
public void CommandRegist()
|
|
{
|
|
CommandData data = VonNeumann.data;
|
|
switch (data.command)
|
|
{
|
|
case CommandType.Add:
|
|
option_txt.text = string.Format("运算符:<color=red>{0}</color>", "+");
|
|
break;
|
|
case CommandType.Div:
|
|
option_txt.text = string.Format("运算符:<color=red>{0}</color>", "÷");
|
|
break;
|
|
case CommandType.Mul:
|
|
option_txt.text = string.Format("运算符:<color=red>{0}</color>", "x");
|
|
break;
|
|
case CommandType.Sub:
|
|
option_txt.text = string.Format("运算符:<color=red>{0}</color>", "-");
|
|
break;
|
|
}
|
|
}
|
|
|
|
void OnclickEnter()
|
|
{
|
|
if(!string.IsNullOrEmpty(numA_input.text) && !string.IsNullOrEmpty(numB_input.text))
|
|
{
|
|
int numA = int.Parse(numA_input.text);
|
|
int numB = int.Parse(numB_input.text);
|
|
VonNeumann.data.num01 = numA;
|
|
VonNeumann.data.num02 = numB;
|
|
OnHide();
|
|
if (command != null)
|
|
{
|
|
command.OnHideButtonRoot();
|
|
|
|
command.ShowLoadCommandBtn();
|
|
Debug.LogFormat(">>>>>>>>>>> {0}", VonNeumannControll.Instance.gameObject.activeSelf);
|
|
VonNeumannControll.Instance.Rewind();
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|