39 lines
993 B
C#
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));
|
|
}
|
|
}
|
|
}
|
|
|