123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- using System;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- namespace ET.Server
- {
- /// <summary>
- /// 战斗服事件工具类
- /// </summary>
- public static class BattleServerEventHelper
- {
- /// <summary>
- /// area related battleServerEvent
- /// </summary>
- /// <param name="msg"></param>
- public static void AreaBattleServerEvent(JObject msg)
- {
- //Log.Debug($"AreaBattleServerEvent msg: {JsonConvert.SerializeObject(msg, Formatting.Indented)}");
- long instanceId = Convert.ToInt64(msg.SelectToken("instanceId"));
- Map map = GameMapComponent.Instance.Get(instanceId);
- if (map == null)
- {
- Log.Warning($"areaBattleServerEvent no area: {msg}");
- return;
- }
- switch (Convert.ToString(msg.SelectToken("eventName")))
- {
- case "message":
- {
- map.GetComponent<MapEventComponent>().OnMessage(msg);
- return;
- }
- case "gameOver":
- {
- map.GetComponent<MapEventComponent>().OnGameOver();
- return;
- }
- case "pickItem":
- {
- map.GetComponent<MapEventComponent>().OnPickItem(msg);
- return;
- }
- case "KillBossEventB2R":
- {
- map.GetComponent<MapEventComponent>().OnKillBoss(msg);
- return;
- }
- case "BattleReportEventB2R":
- {
- map.GetComponent<MapEventComponent>().OnBattleReport(msg);
- return;
- }
- default:
- {
- Log.Error($"unknown area event: {msg}");
- return;
- }
- }
- }
- /// <summary>
- /// player related battleServerEvent
- /// </summary>
- /// <param name="msg"></param>
- public static void PlayerBattleServerEvent(JObject msg)
- {
- Log.Debug($"PlayerBattleServerEvent msg: {JsonConvert.SerializeObject(msg, Formatting.Indented)}");
- switch (Convert.ToString(msg.SelectToken("eventName")))
- {
- case "ConsumeItemEventB2R":
- {
- return;
- }
- case "interActiveItem":
- {
- return;
- }
- case "changeSceneProgress":
- {
- return;
- }
- case "TransUnitEventB2R":
- {
- return;
- }
- case "SummonMountEventB2R":
- {
- return;
- }
- case "ShowRebirthDialogueB2R":
- {
- return;
- }
- case "TriggerSceneEventB2R":
- {
- return;
- }
- case "PlayerExceptionEventB2R":
- {
- return;
- }
- }
- }
- /// <summary>
- /// task related battleServerEvent
- /// </summary>
- /// <param name="msg"></param>
- public static void TaskBattleServerEvent(JObject msg)
- {
- Log.Debug($"TaskBattleServerEvent msg: {JsonConvert.SerializeObject(msg, Formatting.Indented)}");
- }
- public static void MapNotifyEvent(JObject msg)
- {
- Log.Debug($"MapNotifyEvent msg: {JsonConvert.SerializeObject(msg, Formatting.Indented)}");
- }
- }
- }
|