private void Awake() { panelCore = GetComponentInParent <PanelCore>(); if (selectable is Button) { (selectable as Button).onClick.AddListener(OpenClosePanel); } else if (selectable is Toggle) { (selectable as Toggle).onValueChanged.AddListener(OpenClosePanel); } else if (selectable is InputField) { (selectable as InputField).onEndEdit.AddListener(OpenClosePanel); } }
// ゲーム中の処理 // パネルをクリックした時の処理:この関数をパネルに渡しておく public void PanelClickAction(PanelCore panelCore) { addScore.gameObject.SetActive(false); downTime.gameObject.SetActive(false); string nextWord = NextWord(panelCore.PanelData); if (string.IsNullOrEmpty(nextWord)) { messagePanel.UpdateMessage(wrongAnswer); timer.Penalty(6); downTime.gameObject.SetActive(true); downTime.text = "-6"; SoundManager.instance.PlaySE(SoundManager.SE.Wrong); } else if (nextWord.EndsWith("ん")) { timer.StopTime(); panelCore.HidePanel(hideSprite); ShowResult(nextWord); lastWord = nextWord; scoreManager.ScoreUp(lastWord.Length); return; } else { anim.Rewind(); anim.Play(); lastWord = nextWord; panelCore.HidePanel(hideSprite); messagePanel.UpdateMessage("「" + nextWord + "」なのか!!"); scoreManager.ScoreUp(lastWord.Length); addScore.gameObject.SetActive(true); addScore.text = "+" + lastWord.Length; SoundManager.instance.PlaySE(SoundManager.SE.Correct); } StopAllCoroutines(); StartCoroutine(CorrectText()); }