|
@@ -0,0 +1,56 @@
|
|
|
+using System;
|
|
|
+
|
|
|
+namespace ET.Server
|
|
|
+{
|
|
|
+ [Invoke(TimerInvokeType.HGHHMainChecker)]
|
|
|
+ public class HGHHMainChecker: ATimer<HGHHMainCheckerComponent>
|
|
|
+ {
|
|
|
+ protected override void Run(HGHHMainCheckerComponent self)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ self.Check();
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Log.Error($"move timer error: {self.Id}\n{e}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [ObjectSystem]
|
|
|
+ public class HGHHMainCheckerComponentAwakeSystem: AwakeSystem<HGHHMainCheckerComponent>
|
|
|
+ {
|
|
|
+ protected override void Awake(HGHHMainCheckerComponent self)
|
|
|
+ {
|
|
|
+ Log.Info($"创建黄冈晃晃主逻辑组件...");
|
|
|
+ self.RepeatedTimer = TimerComponent.Instance.NewRepeatedTimer(1000, TimerInvokeType.HGHHMainChecker, self);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [ObjectSystem]
|
|
|
+ public class HGHHMainCheckerComponentDestroySystem: DestroySystem<HGHHMainCheckerComponent>
|
|
|
+ {
|
|
|
+ protected override void Destroy(HGHHMainCheckerComponent self)
|
|
|
+ {
|
|
|
+ Log.Info($"销毁黄冈晃晃主逻辑组件...");
|
|
|
+ TimerComponent.Instance?.Remove(ref self.RepeatedTimer);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static class HGHHMainCheckerComponentSystem
|
|
|
+ {
|
|
|
+ // 黄冈晃晃牌库
|
|
|
+
|
|
|
+ public static void Check(this HGHHMainCheckerComponent self)
|
|
|
+ {
|
|
|
+ Room room = self.GetParent<Room>();
|
|
|
+ if (room == null)
|
|
|
+ {
|
|
|
+ Log.Error($"黄冈晃晃主逻辑组件获取不到主实体...");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Log.Debug($"检测: 黄冈晃晃-房间号:{room.RoomId}, 状态:{room.State}...");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|