示例#1
0
        public void Select(PromptInstruction instruction, object selection)
        {
            var entry = _stack.Peek();

            entry.WaitCount--;
            instruction.OnSelected(this, selection);
        }
示例#2
0
        public void Dismiss(PromptInstruction instruction)
        {
            var entry = _stack.Peek();

            entry.WaitCount--;
            instruction.OnDismissed(this);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
            }
        }
示例#6
0
        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);
                }
            }
        }
示例#7
0
        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;
            }
        }
示例#8
0
 protected abstract void OnPrompt(PromptInstruction instruction, object data, InstructionContext context);