|
@@ -11,7 +11,16 @@ namespace ET.Server
|
|
protected override void Awake(PlayerTempDataComponent self)
|
|
protected override void Awake(PlayerTempDataComponent self)
|
|
{
|
|
{
|
|
Log.Info($"创建玩家临时数据组件...");
|
|
Log.Info($"创建玩家临时数据组件...");
|
|
- self.Player = self.GetParent<WNPlayer>();
|
|
|
|
|
|
+ self.MapData = new PlayerMapInfo();
|
|
|
|
+
|
|
|
|
+ self.MapData.mapId = 10098;
|
|
|
|
+ self.MapData.x = 230;
|
|
|
|
+ self.MapData.y = 100;
|
|
|
|
+ self.MapData.direction = System.MathF.PI / 2;
|
|
|
|
+ self.MapData.hp = PLAYER.initHp;
|
|
|
|
+ self.MapData.mp = PLAYER.initMp;
|
|
|
|
+
|
|
|
|
+ self.ToJson4BattleServerTempData = self.GetBattleServerTempData();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -19,41 +28,7 @@ namespace ET.Server
|
|
{
|
|
{
|
|
protected override void Destroy(PlayerTempDataComponent self)
|
|
protected override void Destroy(PlayerTempDataComponent self)
|
|
{
|
|
{
|
|
- // todo 暂时去掉数据落地逻辑
|
|
|
|
- // Log.Debug($"玩家临时数据保存");
|
|
|
|
- // self?.Save();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /// <summary>
|
|
|
|
- /// 初始化
|
|
|
|
- /// </summary>
|
|
|
|
- /// <param name="self"></param>
|
|
|
|
- public static void Init(this PlayerTempDataComponent self)
|
|
|
|
- {
|
|
|
|
- self.MapData = new PlayerMapInfo();
|
|
|
|
-
|
|
|
|
- self.MapData.mapId = 10098;
|
|
|
|
- self.MapData.x = 230;
|
|
|
|
- self.MapData.y = 100;
|
|
|
|
- self.MapData.direction = System.MathF.PI / 2;
|
|
|
|
- self.MapData.hp = PLAYER.initHp;
|
|
|
|
- self.MapData.mp = PLAYER.initMp;
|
|
|
|
-
|
|
|
|
- self.ToJson4BattleServerTempData = self.GetBattleServerTempData();
|
|
|
|
- // self?.Save();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private static async ETTask Save(this PlayerTempDataComponent self)
|
|
|
|
- {
|
|
|
|
- if (self.MapData == null)
|
|
|
|
- {
|
|
|
|
- Log.Debug($"保存玩家临时数据组件数据, Data is null");
|
|
|
|
- return;
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
- self.MapData.Id = self.Player.GetId();
|
|
|
|
- await DBManagerComponent.Instance.GetZoneDB(self.DomainZone()).Save(self.Player.GetId(), self.MapData);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/** 同步场景出生数据 **/
|
|
/** 同步场景出生数据 **/
|
|
@@ -97,7 +72,7 @@ namespace ET.Server
|
|
data.Add("x", self.MapData.x);
|
|
data.Add("x", self.MapData.x);
|
|
data.Add("y", self.MapData.y);
|
|
data.Add("y", self.MapData.y);
|
|
data.Add("direction", self.MapData.direction);
|
|
data.Add("direction", self.MapData.direction);
|
|
- data.Add("hp", self.MapData.hp > 0 ? self.MapData.hp : self.Player.GetComponent<PlayerBtlComponent>().GetAllInflus(PlayerBtlData.MaxHP));
|
|
|
|
|
|
+ data.Add("hp", self.MapData.hp > 0 ? self.MapData.hp : self.GetParent<WNPlayer>().GetComponent<PlayerBtlComponent>().GetAllInflus(PlayerBtlData.MaxHP));
|
|
data.Add("mp", self.MapData.mp);
|
|
data.Add("mp", self.MapData.mp);
|
|
return data;
|
|
return data;
|
|
}
|
|
}
|