示例#1
0
        /// <summary>
        /// 数据初始化
        /// </summary>
        private void Initialization()
        {
            ActionTable.Add(WebSocketTypeEnum.Publish, (data) =>
            {
                Task.Run(() =>
                {
                    MessageQueue.Publish(data.Channel, data.Data);
                });
            });

            ActionTable.Add(WebSocketTypeEnum.Subscribe, (data) =>
            {
                Task.Run(() =>
                {
                    MessageQueue.Subscribe <object>(data.Channel, (result) =>
                    {
                        Publish(data.UserInfo, data.Channel, result);
                    });
                });
            });

            ActionTable.Add(WebSocketTypeEnum.Submit, (data) =>
            {
                Task.Run(() =>
                {
                    Publish(data.UserInfo, data.Channel, MessageQueue.PublishAsync(data.Channel, data.Data).Result);
                });
            });
        }
示例#2
0
        public void AddKeyEvent(KeyTable table, UnityAction action)
        {
            if (!actionTable.ContainsKey(table))
            {
                actionTable.Add(table, new List <UnityAction>());
            }

            actionTable[table].Add(action);
        }
示例#3
0
 /// <summary>
 ///     Adds a shift command to the action table at the position between the given element and given currentState, with the
 ///     given actions as the values.
 /// </summary>
 /// <param name="element"></param>
 /// <param name="currentState"></param>
 /// <param name="actions"></param>
 private void addAction(Terminal <T> element, int currentState, params ParserAction <T>[] actions)
 {
     //if the column already exists
     if (ActionTable.ContainsKey(currentState, element))
     {
         //add the actions
         ActionTable[currentState, element].AddRange(actions);
     }
     //otherwise, create new
     else
     {
         ActionTable.Add(currentState, element, actions.ToList());
     }
 }