123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- namespace ET.Server
- {
- [FriendOf(typeof (MapEventComponent))]
- [FriendOf(typeof (Map))]
- public static class MapEventComponentSystem
- {
- public class MapEventComponentAwakeSystem: AwakeSystem<MapEventComponent>
- {
- /// <summary>
- /// 场景事件组件创建
- /// </summary>
- /// <param name="self"></param>
- protected override void Awake(MapEventComponent self)
- {
- Log.Info($"创建战斗服事件组件...");
- }
- }
- public class MapEventComponentDestroySystem: DestroySystem<MapEventComponent>
- {
- /// <summary>
- /// 场景事件组件销毁
- /// </summary>
- /// <param name="self"></param>
- protected override void Destroy(MapEventComponent self)
- {
- Log.Info($"销毁战斗服事件组件...");
- }
- }
- /// <summary>
- /// 副本消息
- /// </summary>
- /// <param name="self"></param>
- /// <param name="msg"></param>
- public static void OnMessage(this MapEventComponent self, JObject msg)
- {
- string str = Convert.ToString(msg.SelectToken("msg"));
- string[] parames = str.Split(":");
- switch (parames[0])
- {
- case "Dead":
- {
- if ("Tower1".Equals(parames[1]))
- {
- Log.Debug($"塔1死亡事件...");
- }
- else if ("Tower2".Equals(parames[1]))
- {
- Log.Debug($"塔2死亡事件...");
- }
- else if ("Tower3".Equals(parames[1]))
- {
- Log.Debug($"塔3死亡事件...");
- }
- else
- {
- int objId = int.Parse(parames[1]);
- Log.Debug($"场景单位死亡...objId:{objId}");
- }
- break;
- }
- case "Revive":
- {
- int objId = int.Parse(parames[1]);
- if (objId > 0)
- {
- Log.Debug($"场景单位复活...objId:{objId}");
- }
- break;
- }
- }
- }
- /// <summary>
- /// 场景结算事件
- /// </summary>
- /// <param name="self"></param>
- public static void OnGameOver(this MapEventComponent self)
- {
- Map map = self.GetParent<Map>();
- if (map == null)
- {
- return;
- }
- Log.Debug($"场景结算事件...");
- }
- /// <summary>
- /// 拾取道具
- /// </summary>
- /// <param name="self"></param>
- /// <param name="msg"></param>
- public static void OnPickItem(this MapEventComponent self, JObject msg)
- {
- }
- /// <summary>
- /// 击杀boss
- /// </summary>
- /// <param name="self"></param>
- /// <param name="msg"></param>
- public static void OnKillBoss(this MapEventComponent self, JObject msg)
- {
- }
- /// <summary>
- /// 战报统计
- /// </summary>
- /// <param name="self"></param>
- /// <param name="msg"></param>
- public static void OnBattleReport(this MapEventComponent self, JObject msg)
- {
- }
- }
- }
|