using Cal; using MongoDB.Bson.Serialization; using System; using System.Collections.Generic; using System.IO; namespace ET { public class SkillConfigComponentAwakeSystem : AwakeSystem { public override void Awake(SkillConfigComponent self) { { SkillConfigComponent.Instance = self; BsonHelper.Init(); Type[] types = typeof(Game).Assembly.GetTypes(); foreach (Type type in types) { if ( !type.IsSubclassOf(typeof(SelectTargetBase)) && !type.IsSubclassOf(typeof(SkillOptionBase)) ) { continue; } if (type.IsGenericType) { continue; } try { BsonClassMap.LookupClassMap(type); } catch (Exception e) { Log.Error($"11: {type.Name} {e}"); } } } self.Load(); } } public class SkillConfigComponentLoadSystem : LoadSystem { public override void Load(SkillConfigComponent self) { self.Load(); } } public static class SkillConfigComponentSystem { public static void Load(this SkillConfigComponent self) { string path = "../Config/Skill/SkillLogicConfig.bytes"; byte[] skillLogicConfig =File.ReadAllBytes(path); //Utility.Encryption.GetSelfXorBytes(skillLogicConfig, CryptionHelper.GetXorKey()); self.skillLogic = MongoHelper.FromBson(skillLogicConfig); Log.Info($"加载技能配置成功"); } } }