public ComputeNumSystem() { ((ISupportInitialize)(FirstNumeric)).BeginInit(); TBLayout.SuspendLayout(); ((ISupportInitialize)(SecondNumeric)).BeginInit(); ((ISupportInitialize)(AnswerNumeric)).BeginInit(); SuspendLayout(); TBLayout.SuspendLayout(); Controls.Add(ButtonAnswer); Controls.Add(FirstNumeric); Controls.Add(FirstLabel); Controls.Add(FirstTextBox); Controls.Add(TBLayout); Controls.Add(SecondNumeric); Controls.Add(SecondLabel); Controls.Add(SecondTextBox); Controls.Add(LabelAnswer); Controls.Add(AnswerNumeric); Controls.Add(AnswerTextBox); Name = "ComputeNumSystem"; ButtonAnswer.AddColor1(); ButtonAnswer.Click += new EventHandler(EnterAnswer); ButtonPlus.AddColor1(); ButtonPlus.Click += new EventHandler(InsertSymbol); ButtonMinus.AddColor1(); ButtonMinus.Click += new EventHandler(InsertSymbol); ButtonDevide.AddColor1(); ButtonDevide.Click += new EventHandler(InsertSymbol); ButtonMultiple.AddColor1(); ButtonMultiple.Click += new EventHandler(InsertSymbol); TBLayout.Controls.AddRange(new Control[] { ButtonPlus, ButtonMinus, ButtonDevide, ButtonMultiple }); ((ISupportInitialize)(FirstNumeric)).EndInit(); TBLayout.ResumeLayout(false); ((ISupportInitialize)(SecondNumeric)).EndInit(); ((ISupportInitialize)(AnswerNumeric)).EndInit(); }
void ReleaseDesignerOutlets() { if (ButtonAnswer != null) { ButtonAnswer.Dispose(); ButtonAnswer = null; } if (ButtonCancel != null) { ButtonCancel.Dispose(); ButtonCancel = null; } if (LabelAwesome != null) { LabelAwesome.Dispose(); LabelAwesome = null; } if (LabelCongrats != null) { LabelCongrats.Dispose(); LabelCongrats = null; } if (LabelHint != null) { LabelHint.Dispose(); LabelHint = null; } if (LabelQuestNumber != null) { LabelQuestNumber.Dispose(); LabelQuestNumber = null; } }
private void Awake() { buttonAnswer = FindObjectOfType <ButtonAnswer>(); secondsText = this.GetComponent <Text>(); currentSeconds = maxSeconds; sourceFSX = GameObject.FindGameObjectWithTag("FSX").GetComponent <AudioSource>(); }
void ReleaseDesignerOutlets() { if (ButtonAnswer != null) { ButtonAnswer.Dispose(); ButtonAnswer = null; } if (FieldForPredict != null) { FieldForPredict.Dispose(); FieldForPredict = null; } if (LabelAnswer != null) { LabelAnswer.Dispose(); LabelAnswer = null; } if (LabelLinear != null) { LabelLinear.Dispose(); LabelLinear = null; } if (LabelMainInfo != null) { LabelMainInfo.Dispose(); LabelMainInfo = null; } if (SwitchExp != null) { SwitchExp.Dispose(); SwitchExp = null; } if (SwitchLinear != null) { SwitchLinear.Dispose(); SwitchLinear = null; } if (SwitchPower != null) { SwitchPower.Dispose(); SwitchPower = null; } }
internal void PlayAnswerSound(ButtonAnswer _buttonAnswer) { if (_buttonAnswer.score.Equals(0)) { sourceFSX.PlayOneShot(wrongAnswer); } else if (_buttonAnswer.score.Equals(5)) { sourceFSX.PlayOneShot(rightAnswer); } else if (_buttonAnswer.score.Equals(10)) { sourceFSX.PlayOneShot(rightAnswer); } }
void InstanceButtons() { foreach (Transform child in transform) { if (child.CompareTag("Answer Button")) { ButtonAnswer buttonAnswer = child.GetComponent <ButtonAnswer>(); if (buttonAnswer) { buttons.Remove(buttonAnswer); } Destroy(child.gameObject); } } // Instance Buttons in its correct position float offsetX = -((answersSeparation * ((float)GameManager.instance.maxAnswers - 1f)) * 0.5f); Vector2 position = new Vector2(offsetX, 0); for (int i = 0; i < GameManager.instance.maxAnswers; ++i) { // Instantiate Button Back GameObject buttonBack = Instantiate(buttonBackPrefab, transform); buttonBack.GetComponent <RectTransform>().anchoredPosition = position; // Instantiate Button ButtonAnswer button = Instantiate(buttonPrefab, transform).GetComponent <ButtonAnswer>(); button.answersPanel = this; button.GetComponent <RectTransform>().anchoredPosition = position; button.ChangeText(GameManager.instance.answersList[i].ToString()); buttons.Add(button); position.x += answersSeparation; if (i == GameManager.instance.correctAnswerIndex) { correctButton = button; } } }
partial void ButtonAnswer_TouchUpInside(UIButton sender) { if (ViewModel.QuestComplete) { DismissViewControllerAsync(true); return; } messages.AskQuestions("Question:", ViewModel.Quest.Question, (answer) => { ViewModel.CheckAnswer(answer); if (ViewModel.QuestComplete) { ButtonCancel.Hidden = true; ButtonAnswer.SetTitle("Continue", UIControlState.Normal); LabelHint.Text = "Are you ready to continue with the next quest, thrill-seeker?"; LabelAwesome.Text = "That's it!"; LabelCongrats.Text = "You answered the question correctly, noble one."; Settings.QuestDone = true; } }); }
private ButtonAnswer DrawLabeledIconButtons(GUIContent name, GUIStyle style, bool labelOnRight, int iconSize, int buttonsSize, params ButtonAnswer[] buttons) { EditorGUILayout.BeginHorizontal(); ButtonAnswer result = ButtonAnswer.NoButton; if (!labelOnRight) { EditorGUILayout.LabelField(name, style, GUILayout.Height(iconSize)); } for (int i = 0; i < buttons.Length; i++) { if (GUILayout.Button(GetButtonContent(buttons[i]), GUILayout.Height(buttonsSize), GUILayout.Width(buttonsSize * 1.8f))) { result = buttons[i]; } } if (labelOnRight) { EditorGUILayout.LabelField(name, style, GUILayout.Height(iconSize)); } EditorGUILayout.EndHorizontal(); return(result); }
private IEnumerator ColorButtonCO(ButtonAnswer _buttonAnswer) { yield return(new WaitForSecondsRealtime(0.8f)); Color newColor = Color.white; if (_buttonAnswer.score.Equals(0)) { newColor = Color.red; } else if (_buttonAnswer.score.Equals(5)) { newColor = Color.yellow; } else if (_buttonAnswer.score.Equals(10)) { newColor = Color.green; } Image buttonImage = _buttonAnswer.GetComponent <Image>(); Color startColor = buttonImage.color; buttonImage.color = newColor; yield return(new WaitForSecondsRealtime(3f)); float step = 0; while (step < 1) { step += Time.deltaTime / 2; buttonImage.color = Color.Lerp(newColor, startColor, step); yield return(null); } }
private GUIContent GetButtonContent(ButtonAnswer button) { return(new GUIContent(m_buttonIcons[button], m_buttonTooltips[button])); }
private void AddButtonInfo(ButtonAnswer buttonAnswer, string iconName, string tooltip) { m_buttonIcons.Add(buttonAnswer, LoadIcon(iconName)); m_buttonTooltips.Add(buttonAnswer, tooltip); }