private static ColorCode ButtonSendPressed(TaskEntryManager.ButtonPressedEvent evt) { var msg = GameEventBuilder.AnswerQuestion(evt.Sender.VariableName, GetRealValue(evt.Sender.Text, evt.Sender.VariableType)); foreach (var inp in evt.ComponentGroup.InputFields) { var val = GetRealValue(inp.GUIField.text, inp.FBField.VariableType); msg.Add( GameEventBuilder.AnswerQuestion(inp.FBField.VariableName, val) ); } foreach (var inp in evt.ComponentGroup.DropDowns) { var val = GetRealValue(inp.GUIDropdown.options[inp.GUIDropdown.value].text, inp.FBDropdown.VariableType); msg.Add( GameEventBuilder.AnswerQuestion(inp.FBDropdown.VariableName, val) ); } foreach (var inp in evt.ComponentGroup.Toggles) { var val = GetRealValue(inp.GUIToggle.isOn.ToString(), inp.FBToggle.VariableType); msg.Add( GameEventBuilder.AnswerQuestion(inp.FBToggle.VariableName, val) ); } var fb = Send(msg); ShowFeedback(fb); return(fb.Any(e => e.ColorCode == ColorCode.Mistake) ? ColorCode.Mistake : fb.Any(e => e.ColorCode == ColorCode.Hint) ? ColorCode.Hint : ColorCode.Success); }
private static FeedbackEntry[] Send <T>(string name, T value) { return(Send(GameEventBuilder.AnswerQuestion(name, value))); }