1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using System.Collections.Generic;
- using System.Linq;
- namespace ET.Server
- {
- [FriendOf(typeof (PlayerSkillComponent))]
- public static class PlayerSkillComponentSystem
- {
- public class PlayerSkillComponentAwakeSystem: AwakeSystem<PlayerSkillComponent>
- {
- protected override void Awake(PlayerSkillComponent self)
- {
- Log.Info($"创建玩家技能组件...");
- WNPlayer player = self.GetParent<WNPlayer>();
- 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)
- {
- 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.GetBattleServerSkills();
- }
- }
- public class PlayerSkillComponentDestroySystem: DestroySystem<PlayerSkillComponent>
- {
- protected override void Destroy(PlayerSkillComponent self)
- {
- }
- }
-
-
-
-
-
- private static IEnumerable<Struct.SkillInfo> GetPassiveSkillInfoBS(this PlayerSkillComponent self)
- {
- List<Struct.SkillInfo> list = new List<Struct.SkillInfo>();
- foreach (SkillConfig prop in SkillConfigCategory.Instance.GetAll().Values.Where(prop => prop != null))
- {
- if (prop.ProId != self.GetParent<WNPlayer>().GetPro() || prop.SkillType != (int)SkillType.PLAYER_PASSIVE)
- {
- continue;
- }
- Struct.SkillInfo info = new ();
- info.type = prop.SkillType;
- info.id = prop.Id;
- info.level = 1;
- info.skillTime = 0L;
- info.cdTime = 0;
- info.flag = 0;
- info.autoLaunch = false;
- list.Add(info);
- }
- return list;
- }
-
-
-
-
-
- public static List<Struct.SkillInfo> GetBattleServerSkills(this PlayerSkillComponent self)
- {
- List<Struct.SkillInfo> skills = new List<Struct.SkillInfo>();
- foreach (Struct.PlayerSkillBaseData skill in self.Data.Skills.Where(skill => skill != null))
- {
- if (!skill.unlock)
- {
- continue;
- }
- SkillConfig prop = SkillConfigCategory.Instance.Get(skill.id);
- if (prop != null && !SkillHelper.IsPassive(prop))
- {
- skills.Add(SkillHelper.NewSkillInfo(skill));
- }
- }
-
- skills.AddRange(self.GetPassiveSkillInfoBS());
- return skills;
- }
- }
- }
|