zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Server/Hotfix/Game/SkillSystem/NewSkill/System/SkillConfigComponentSystem.cs

67 lines
1.9 KiB
C#
Executable File

using Cal;
using MongoDB.Bson.Serialization;
using System;
using System.Collections.Generic;
using System.IO;
namespace ET
{
public class SkillConfigComponentAwakeSystem : AwakeSystem<SkillConfigComponent>
{
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<SkillConfigComponent>
{
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<SkillLogicConfigCollection>(skillLogicConfig);
Log.Info($"加载技能配置成功");
}
}
}