//奈河桥的模式 public void NeheQiaoModeComplete(MsgParam msg, WarServerNpcMgr npcMgr) { NeHeQiaoNpcMgr mgr = npcMgr as NeHeQiaoNpcMgr; if (mgr != null) { ServerNPC selfBase = mgr.SelfMilitaryBase; ServerNPC enemyBase = mgr.EnemyMilitaryBase; WarAnimParam warMsg = msg as WarAnimParam; if (warMsg != null && warMsg.described != null) { int deadNpcId = warMsg.described.srcEnd.param2; WarMsg_Type enemyRes = WarMsg_Type.Lose; WarMsg_Type selfRes = WarMsg_Type.Lose; if (deadNpcId == selfBase.UniqueID) { //我方基地死亡 enemyRes = WarMsg_Type.Win; } else if (deadNpcId == enemyBase.UniqueID) { //敌方基地死亡 selfRes = WarMsg_Type.Win; } /// /// ------ 确实是基地死亡了 ----------- /// if (enemyRes != WarMsg_Type.Lose || selfRes != WarMsg_Type.Lose) { WarCampMsg eParam = new WarCampMsg(); eParam.SendCamp = CAMP.Enemy; eParam.ReceCamp = CAMP.Enemy; eParam.cmdType = enemyRes; mgr.SendMessageAsync(CAMP.Enemy, CAMP.Enemy, eParam, false); WarCampMsg sParam = new WarCampMsg(); sParam.SendCamp = CAMP.Player; sParam.ReceCamp = CAMP.Player; sParam.cmdType = selfRes; mgr.SendMessageAsync(CAMP.Player, CAMP.Player, sParam, false); } } } }
public bool SendMessageAsync(CAMP sender, CAMP receiver, WarCampMsg 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 (campNicDic.TryGetValue(receiver, 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.", ConsoleEx.YELLOW); } } else { sent = false; ConsoleEx.DebugLog("NPC doesn't instanciate yet.", ConsoleEx.YELLOW); } triMgr.Watching(param); return(sent); }
public bool sendMessage(CAMP sender, CAMP receiver, WarCampMsg 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(campNicDic.TryGetValue(receiver, 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 Camp = " + receiver.ToString(), ConsoleEx.YELLOW); * } * } else { * sent = false; * ConsoleEx.DebugLog("NPC doesn't instanciate yet. Receive Camp = " + receiver.ToString(), ConsoleEx.YELLOW); * } * * triMgr.Watching(param); * * return sent; */ }