using Cfg; using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using Bright.Serialization; using Cfg.Config; using System.IO; using UnityEngine.Networking; using UnityEngine.Events; using CaoCao.Runtime; using Game.HotFix; public class LubanComponent : GameComponent { public Tables tables = null; public static string GetConfigBytesPath(string fileName) { return string.Format($"Assets/GameAssets/LubanTables/{fileName}.bytes", fileName); } public void Init() { LoadLocal(); } private void LoadLocal() { tables = new Tables(LoadByteBuf); } private ByteBuf LoadByteBuf(string file) { string path = GetConfigBytesPath(file); var ta = HotfixEntry.Resources.Load(path); if (ta == null) return null; //return new ByteBuf(File.ReadAllBytes(path)); return new ByteBuf(ta.bytes); } //数据详情获取 public TestData GetMonster(int id) { if (tables.TbTestMap.DataMap.ContainsKey(id)) return tables.TbTestMap.Get(id); Debug.LogError($"the TbTestMap is not contain id({id})"); return null; } public Dictionary GetTestMap() { return tables.TbTestMap.DataMap; } }