|
@@ -11,57 +11,29 @@ namespace ET.Server
|
|
|
protected override void Awake(PlayerSkillComponent self)
|
|
|
{
|
|
|
Log.Info($"创建玩家技能组件...");
|
|
|
- self.Player = self.GetParent<WNPlayer>();
|
|
|
- }
|
|
|
- }
|
|
|
+ WNPlayer player = self.GetParent<WNPlayer>();
|
|
|
|
|
|
- public class PlayerSkillComponentDestroySystem: DestroySystem<PlayerSkillComponent>
|
|
|
- {
|
|
|
- protected override void Destroy(PlayerSkillComponent self)
|
|
|
- {
|
|
|
- // todo 暂时去掉数据落地逻辑
|
|
|
- // Log.Debug($"玩家技能数据保存");
|
|
|
- // self?.Save();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 初始化
|
|
|
- /// </summary>
|
|
|
- /// <param name="self"></param>
|
|
|
- public static void Init(this PlayerSkillComponent self)
|
|
|
- {
|
|
|
- self.Data = new PlayerSkillInfo();
|
|
|
- self.Data.Skills = new List<Struct.PlayerSkillBaseData>();
|
|
|
- // 初始化技能数据
|
|
|
- CharacterConfig config = CharacterConfigCategory.Instance.Get(self.Player.GetPro());
|
|
|
- if (config != null && config.InitSkillList.Count > 0)
|
|
|
- {
|
|
|
- foreach (Struct.IntIntData intIntData in config.InitSkillList.Where(intIntData => intIntData != null))
|
|
|
+ self.Data = new PlayerSkillInfo();
|
|
|
+ self.Data.Skills = new List<Struct.PlayerSkillBaseData>();
|
|
|
+ // 初始化技能数据
|
|
|
+ CharacterConfig config = CharacterConfigCategory.Instance.Get(player.GetPro());
|
|
|
+ if (config != null && config.InitSkillList.Count > 0)
|
|
|
{
|
|
|
- self.Data.Skills.Add(new Struct.PlayerSkillBaseData(intIntData.value1, intIntData.value2, true, 0L));
|
|
|
+ foreach (Struct.IntIntData intIntData in config.InitSkillList.Where(intIntData => intIntData != null))
|
|
|
+ {
|
|
|
+ self.Data.Skills.Add(new Struct.PlayerSkillBaseData(intIntData.value1, intIntData.value2, true, 0L));
|
|
|
+ }
|
|
|
}
|
|
|
+ // 初始化战斗服缓存数据
|
|
|
+ self.ToJson4BattleServerSkills = self.ToJson4BattleServerSkills();
|
|
|
}
|
|
|
- // 初始化战斗服缓存数据
|
|
|
- self.ToJson4BattleServerSkills = self.ToJson4BattleServerSkills();
|
|
|
-
|
|
|
- // self?.Save();
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 保存数据
|
|
|
- /// </summary>
|
|
|
- /// <param name="self"></param>
|
|
|
- private static async ETTask Save(this PlayerSkillComponent self)
|
|
|
+ public class PlayerSkillComponentDestroySystem: DestroySystem<PlayerSkillComponent>
|
|
|
{
|
|
|
- if (self.Data == null)
|
|
|
+ protected override void Destroy(PlayerSkillComponent self)
|
|
|
{
|
|
|
- Log.Debug($"保存玩家技能组件数据, Data is null");
|
|
|
- return;
|
|
|
}
|
|
|
-
|
|
|
- self.Data.Id = self.Player.GetId();
|
|
|
- await DBManagerComponent.Instance.GetZoneDB(self.DomainZone()).Save(self.Data);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -75,7 +47,7 @@ namespace ET.Server
|
|
|
|
|
|
foreach (SkillConfig prop in SkillConfigCategory.Instance.GetAll().Values.Where(prop => prop != null))
|
|
|
{
|
|
|
- if (prop.ProId != self.Player.GetPro() || prop.SkillType != (int)SkillType.PLAYER_PASSIVE)
|
|
|
+ if (prop.ProId != self.GetParent<WNPlayer>().GetPro() || prop.SkillType != (int)SkillType.PLAYER_PASSIVE)
|
|
|
{
|
|
|
continue;
|
|
|
}
|