mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
48 lines
1.7 KiB
C#
48 lines
1.7 KiB
C#
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;
|
|
}
|
|
}
|
|
} |