public void Select(PromptInstruction instruction, object selection) { var entry = _stack.Peek(); entry.WaitCount--; instruction.OnSelected(this, selection); }
public void Dismiss(PromptInstruction instruction) { var entry = _stack.Peek(); entry.WaitCount--; instruction.OnDismissed(this); }
public void Prompt(PromptInstruction instruction, object data, InstructionContext context) { Debug.Assert(_instruction == null && _data == null && _context == null, "a listener cannot receive multiple prompts at once", this); _instruction = instruction; _data = data; _context = context; OnPrompt(instruction, data, context); }
public void Finish(PromptInstruction instruction) { if (_listeners != null) { foreach (var listener in _listeners) { listener.Finish(); } _listeners = null; } }
protected override void OnPrompt(PromptInstruction instruction, object data, InstructionContext context) { var message = instruction as MessagePrompt; if (message) { Debug.Log(message.Message); } var selection = instruction as SelectionInstruction; if (selection) { _options = data as object[]; Debug.Log(selection.Message); Debug.Log(_options); } }
protected override void OnPrompt(PromptInstruction instruction, object data, InstructionContext context) { var message = instruction as MessagePrompt; if (message) { if (TextControl) { TextControl.Activate(this, message.Message.GetString(context)); TextControl.gameObject.SetActive(true); } else { Debug.LogFormat("UIDialogListener for catagory {0} must have a TextControl to respond to messages.", Category); } } var selection = instruction as SelectionInstruction; if (selection) { if (SelectionControl) { SelectionControl.Activate(this, data as object[]); if (TextControl) { TextControl.Activate(this, SelectionControl, selection.Message.GetString(context)); TextControl.gameObject.SetActive(true); } else { Debug.LogFormat("UIDialogListener for catagory {0} must have a TextControl to respond to selections with messages.", Category); } } else { Debug.LogFormat("UIDialogListener for catagory {0} must have a SelectionControl to respond to selections.", Category); } } }
public void Prompt(PromptInstruction instruction, object data) { var listeners = GetListeners(instruction.Category); var entry = _stack.Peek(); if (listeners == null || listeners.Count == 0) { instruction.OnIgnored(this); } else { foreach (var listener in listeners) { listener.Prompt(instruction, data, this); } entry.WaitCount = listeners.Count; _listeners = listeners; } }
protected abstract void OnPrompt(PromptInstruction instruction, object data, InstructionContext context);