public Question(string pText, QuestionCallback pFunction, object obj = null) { Text = pText; Function = pFunction; Answers = new List <string>(); Object = obj; }
public Question(string pText, QuestionCallback pFunction, object obj = null) { this.Text = pText; Function = pFunction; Answers = new List<string>(); Object = obj; }
private static void ShowQuestionPrompt(string question, QuestionCallback onAnswered) { NewMessage(" >>" + question, Color.Cyan); activeQuestionCallback += onAnswered; #if CLIENT if (listBox != null && listBox.children.Count > 0) { activeQuestionText = listBox.children[listBox.children.Count - 1]; } #endif }
public static void ExecuteCommand(string command, GameMain game) { if (activeQuestionCallback != null) { #if CLIENT activeQuestionText = null; #endif NewMessage(command, Color.White); //reset the variable before invoking the delegate because the method may need to activate another question var temp = activeQuestionCallback; activeQuestionCallback = null; temp(command); return; } if (string.IsNullOrWhiteSpace(command)) { return; } string[] splitCommand = SplitCommand(command); if (!splitCommand[0].ToLowerInvariant().Equals("admin")) { NewMessage(command, Color.White); } #if !DEBUG && CLIENT if (GameMain.Client != null && !IsCommandPermitted(splitCommand[0].ToLowerInvariant(), GameMain.Client)) { ThrowError("You're not permitted to use the command \"" + splitCommand[0].ToLowerInvariant() + "\"!"); return; } #endif bool commandFound = false; foreach (Command c in commands) { if (c.names.Contains(splitCommand[0].ToLowerInvariant())) { c.Execute(splitCommand.Skip(1).ToArray()); commandFound = true; break; } } if (!commandFound) { ThrowError("Command \"" + splitCommand[0] + "\" not found."); } }