using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; using UnityEngine.UI; namespace DisComputer { /// /// 运算设置 /// 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("运算符:{0}", "+"); break; case CommandType.Div: option_txt.text = string.Format("运算符:{0}", "÷"); break; case CommandType.Mul: option_txt.text = string.Format("运算符:{0}", "x"); break; case CommandType.Sub: option_txt.text = string.Format("运算符:{0}", "-"); 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(); } } } } }