コード例 #1
0
        public bool SendMessageAsync(int groupsend, int groupRece, WarGroupMsg param, bool anonymous)
        {
            bool sent = false;

            if (param == null)
            {
                ConsoleEx.DebugLog("We can't send empty message to other.", ConsoleEx.RED);
                return(sent);
            }

            List <ServerNPC> npcList = null;

            if (groupNpcDic.TryGetValue(groupRece, out npcList))
            {
                int count = npcList.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; ++i)
                    {
                        ServerNPC npc = npcList[i];
                        AsyncSheduleTask(npc, param);
                    }
                    sent = true;
                }
                else
                {
                    sent = false;
                    ConsoleEx.DebugLog("NPC doesn't instanciate yet. Receive Group ID = " + groupRece.ToString(), ConsoleEx.YELLOW);
                }
            }
            else
            {
                sent = false;
                ConsoleEx.DebugLog("NPC doesn't instanciate yet. Receive Group ID = " + groupRece.ToString(), ConsoleEx.YELLOW);
            }

            triMgr.Watching(param);

            return(sent);
        }
コード例 #2
0
        public bool sendMessage(int groupSend, int groupRece, WarGroupMsg param, bool anonymous)
        {
            throw new NotSupportedException();

            /*
             * 所有的消息,都基于异步,不再支持同步方法
             *
             * bool sent = false;
             * if(param == null) {
             *      ConsoleEx.DebugLog("We can't send empty message to other.", ConsoleEx.RED);
             *      return sent;
             * }
             *
             * List<ServerNPC> npcList = null;
             *
             * if(groupNpcDic.TryGetValue(groupRece, out npcList)) {
             *      int count = npcList.Count;
             *      if(count > 0) {
             *              for(int i = 0; i < count; ++ i) {
             *                      ServerNPC npc = npcList[i];
             *                      npc.OnHandleMessage(param);
             *              }
             *              sent = true;
             *      } else {
             *              sent = false;
             *              ConsoleEx.DebugLog("NPC doesn't instanciate yet. Receive Group ID = " + groupRece.ToString(), ConsoleEx.YELLOW);
             *      }
             * } else {
             *      sent = false;
             *      ConsoleEx.DebugLog("NPC doesn't instanciate yet. Receive Group ID = " + groupRece.ToString(), ConsoleEx.YELLOW);
             * }
             *
             * triMgr.Watching(param);
             *
             * return sent;
             */
        }