示例#1
0
        private void ProcessProtocol(object state)
        {
            HoxisProtocol proto = (HoxisProtocol)state;

            OnProtocolEntry(proto);
            switch (proto.type)
            {
            case ProtocolType.Response:
                ReqHandle handle = FF.JsonToObject <ReqHandle>(proto.handle);
                // todo 消除等待
                if (proto.err != C.RESP_SUCCESS)
                {
                    OnResponseError(proto.err, proto.desc); return;
                }
                respCbTable[proto.action.method](proto.action.args);

                break;

            case ProtocolType.Synchronization:
                HoxisAgent agent = GetAgent(proto.sender.aid);
                if (agent != null)
                {
                    agent.CallBehaviour(proto.action);
                }
                break;

            case ProtocolType.Proclamation:

                break;
            }
        }
示例#2
0
        /// <summary>
        /// Add an agent to searcher
        /// </summary>
        /// <param name="agent"></param>
        /// <param name="ret"></param>
        public void Register(HoxisAgent agent, out Ret ret)
        {
            HoxisAgentID hid = agent.id;

            if (_agentSearcher.ContainsKey(hid))
            {
                ret = new Ret(LogLevel.Warning, RET_HID_EXISTS, "HoxisID:" + hid.group + "," + hid.id + " already exists");
                return;
            }
            _agentSearcher.Add(hid, agent);
            ret = Ret.ok;
        }
示例#3
0
        public void Remove(HoxisAgent agent, out Ret ret)
        {
            HoxisAgentID hid = agent.id;

            Remove(hid, out ret);
        }