//first thing want to do is load the first question //but before load question need to clear any existing answer button private void DisplayQuestions() { RemoveAnsButton(); questionChosen(); QuestionQuizL1E1 qData = qPool[qIndex]; questionT.text = qData.questionT; //going to reach into our question, from question get string, and display that using text //loop over all of the answers and display those and added buttons as needed for (int i = 0; i < qData.answer.Length; i++) { GameObject ansButGameObject = ansButPool.GetObject(); ansButGameObjects.Add(ansButGameObject); // ansButGameObjects.RemoveAt(qIndex); ansButGameObject.transform.SetParent(ansButParent); AButton ansButton = ansButGameObject.GetComponent <AButton>(); ansButton.SetAnsButton(qData.answer[i]); } }
//初始化棋盘 private void MakeBox(string fn, int N) //产生盒子,N=3,5,8 { mButton = new AButton[N * N]; int i, r, c; int w; Image img; this.Controls.Clear(); //移除之前的所有控件 w = 600 / N; try { img = Image.FromFile(fn); for (i = 0; i < N * N; i++) { r = i / N; c = i % N; mButton[i] = new AButton(i + 1, N, CaptureImage(img, w, w, c * w, r * w)); this.Controls.Add(mButton[i]); } } catch (Exception e) { if (MessageBox.Show(e.ToString() + "\n 错误! 是否继续(Y/N)?", "错误", MessageBoxButtons.YesNo) == DialogResult.No) { Application.Exit(); } } }
public void UpdateButtonUI() { if (AButton == null) return; BattlePlayerBase player = BattlePlayerBase.LocalAuthority; AButton.button.interactable = (player.IsAlive && player.CanPlayAbility && RemainingCooldown <= 0); AButton.UpdateCooldown(RemainingCooldown, cooldown + 1); }
void Start() { joystick = FindObjectOfType <Joystick>(); aButton = FindObjectOfType <AButton>(); bButton = FindObjectOfType <BButton>(); _rigidbody2D = GetComponent <Rigidbody2D>(); _playerAnim = GetComponent <PlayerAnimation>(); _playerSprite = GetComponentInChildren <SpriteRenderer>(); _swordEffectSprite = transform.GetChild(1).GetComponent <SpriteRenderer>(); Health = 4; }
public void Start() { AButton = FindObjectOfType <AButton>(); }
public MenuButtonViewModel(AButton menuButton) { MenuButton = menuButton; }