Ejemplo n.º 1
0
        void HandleCommand(RemoteKeymasterCommand command)
        {
            //Debug.LogFormat("#COMMAND# {0}| received raw command packet {1}", this, command.ToString());
            SetActivePage(command.page);
            List <KeyToken> list = null;

            bool success = keyCommandMap.TryGetValue(currentActivePage, out list);

            if (success)
            {
                foreach (var item in list)
                {
                    //Debug.LogFormat("#COMMAND# comparing label {0} to received command.label {1}", item.label, command.label);
                    if (item.label == command.label)
                    {
                        Debug.LogFormat("#KEYMASTER# invoking: {0}| label {1} method {2} object: {3}", this, command.label, item.action?.Method.Name, item.action?.Target);
                        item.action?.Invoke();
                        break;
                    }
                    else
                    {
                        //Debug.LogFormat("#COMMAND# {0}| failed to find registered method for page {1} label {2}", this, command.page, command.label);
                    }
                }
            }
            else
            {
                Debug.LogFormat("#COMMAND# {0}| failed to find any registered commands for page {1}", this, command.page);
            }
        }
Ejemplo n.º 2
0
 public void HandleRemoteCommand(RemoteKeymasterCommand command)
 {
     remoteKeeper?.Enqueue(() => HandleCommand(command));
 }