AkiraPixelWind/Assets/Scripts/Main/CustomsComponent/LubanComponent.cs
2022-12-29 18:20:40 +08:00

39 lines
993 B
C#

using Axibug.Runtime;
using Bright.Serialization;
using System.IO;
using Game.Config;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using static Axibug.Utility;
namespace Game
{
public class LubanComponent : GameComponent
{
public Tables tables = null;
// Start is called before the first frame update
void Start()
{
tables = new Tables(LoadByteBuf);
}
public static string GetConfigBytesPath(string fileName)
{
if (AppEntry.Base.EditorResourceMode)
return Text.Format("Assets/GameAssets/LubanTables/{0}.bytes", fileName);
else
return Text.Format("{0}/Configs/DataTables/{1}.bytes", Application.persistentDataPath, fileName);
}
private static ByteBuf LoadByteBuf(string file)
{
string path = GetConfigBytesPath(file);
return new ByteBuf(File.ReadAllBytes(path));
}
}
}