mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
[+] 接入ET8服务端
[+] 接入ET8服务端
This commit is contained in:
48
DotNet/Loader/ConfigLoader.cs
Normal file
48
DotNet/Loader/ConfigLoader.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace ET
|
||||
{
|
||||
[Invoke]
|
||||
public class GetAllConfigBytes: AInvokeHandler<ConfigComponent.GetAllConfigBytes, Dictionary<Type, byte[]>>
|
||||
{
|
||||
public override Dictionary<Type, byte[]> Handle(ConfigComponent.GetAllConfigBytes args)
|
||||
{
|
||||
Dictionary<Type, byte[]> output = new Dictionary<Type, byte[]>();
|
||||
List<string> startConfigs = new List<string>()
|
||||
{
|
||||
"StartMachineConfigCategory",
|
||||
"StartProcessConfigCategory",
|
||||
"StartSceneConfigCategory",
|
||||
"StartZoneConfigCategory",
|
||||
};
|
||||
HashSet<Type> configTypes = EventSystem.Instance.GetTypes(typeof (ConfigAttribute));
|
||||
foreach (Type configType in configTypes)
|
||||
{
|
||||
string configFilePath;
|
||||
if (startConfigs.Contains(configType.Name))
|
||||
{
|
||||
configFilePath = $"../Config/Excel/s/{Options.Instance.StartConfig}/{configType.Name}.bytes";
|
||||
}
|
||||
else
|
||||
{
|
||||
configFilePath = $"../Config/Excel/s/{configType.Name}.bytes";
|
||||
}
|
||||
output[configType] = File.ReadAllBytes(configFilePath);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
[Invoke]
|
||||
public class GetOneConfigBytes: AInvokeHandler<ConfigComponent.GetOneConfigBytes, byte[]>
|
||||
{
|
||||
public override byte[] Handle(ConfigComponent.GetOneConfigBytes args)
|
||||
{
|
||||
byte[] configBytes = File.ReadAllBytes($"../Config/Excel/s/{args.ConfigName}.bytes");
|
||||
return configBytes;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user