Last active
April 27, 2016 11:07
-
-
Save tetya/1a8d1b1f4f616d7a2c4ce711f30aef17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AddButton(QuestionDB.QuestionData DataRow, int answerID, int i){ | |
//子オブジェクトとして追加 | |
RectTransform item = GameObject.Instantiate(buttonPrefab) as RectTransform; | |
//ボタンの表示を割り当てる | |
item.GetComponentInChildren<Text> ().text = DataRow.answer; | |
//コンテンツの子オブジェクトにする | |
item.SetParent(transform, false); | |
//ボタンに呼び出すメソッドを割り当てる | |
if(DataRow.id == answerID){ | |
item.GetComponent<Button> ().onClick.AddListener(Correct); | |
}else{ | |
item.GetComponent<Button> ().onClick.AddListener(Inorrect); | |
} | |
//時間差表示演出 | |
item.GetComponent<AnswerItem> ().Show(0.1f * i); | |
} | |
void Correct(){ | |
sManager.Correct (); | |
} | |
void Inorrect(){ | |
sManager.Incorrect (); | |
} | |
void AddInputField(QuestionDB.QuestionData DataRow, int i){ | |
//子オブジェクトとして追加 | |
RectTransform item = GameObject.Instantiate(inputFieldPrefab) as RectTransform; | |
//コンテンツの子オブジェクトにする | |
item.SetParent(transform, false); | |
InputField input = item.GetComponent<InputField> (); | |
input.onEndEdit.AddListener (delegate{CheckTextBox(input);}); | |
//時間差表示演出 | |
item.GetComponent<AnswerItem> ().Show(0.1f * i); | |
} | |
void CheckTextBox(InputField input){ | |
sManager.CheckTextBox (input.text); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment