Skip to content

Commit b7adb70

Browse files
committed
[修改]1. 修改配置表的打印
1 parent 9705526 commit b7adb70

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

Assets/Hotfix/HotfixLauncher.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
using GameFrameX.Runtime;
1212
using GameFrameX.UI.Runtime;
1313
using Hotfix.Config;
14+
using Hotfix.Config.item;
1415
using Hotfix.UI;
16+
#if ENABLE_BINARY_CONFIG
17+
using LuBan.Runtime;
18+
#endif
1519

1620
namespace Hotfix
1721
{
@@ -33,20 +37,46 @@ private static async void LoadUI()
3337
#elif ENABLE_UI_UGUI
3438
await GameApp.UI.OpenUIFormAsync<UILogin>(Utility.Asset.Path.GetUIPath(nameof(UILogin)), UIGroupConstants.Floor.Name);
3539
#endif
40+
41+
var item = GameApp.Config.GetConfig<TbSounds>().FirstOrDefault;
42+
Log.Info(item);
3643
}
3744

3845
static async void LoadConfig()
3946
{
4047
var tablesComponent = new TablesComponent();
4148
tablesComponent.Init(GameApp.Config);
49+
#if ENABLE_BINARY_CONFIG
50+
// 使用二进制配置表
51+
await tablesComponent.LoadAsync(ConfigBufferLoader);
52+
#else
53+
// 使用JSON配置表
4254
await tablesComponent.LoadAsync(ConfigLoader);
55+
#endif
4356
}
4457

58+
#if ENABLE_BINARY_CONFIG
59+
/// <summary>
60+
/// 加载二进制配置表
61+
/// </summary>
62+
/// <param name="file"></param>
63+
/// <returns></returns>
64+
private static async Task<ByteBuf> ConfigBufferLoader(string file)
65+
{
66+
var assetHandle = await GameApp.Asset.LoadAssetAsync<TextAsset>(Utility.Asset.Path.GetConfigPath(file, Utility.Const.FileNameSuffix.Binary));
67+
return ByteBuf.Wrap(assetHandle.GetAssetObject<TextAsset>().bytes);
68+
}
69+
#else
70+
/// <summary>
71+
/// 加载json配置表
72+
/// </summary>
73+
/// <param name="file"></param>
74+
/// <returns></returns>
4575
private static async Task<JSONNode> ConfigLoader(string file)
4676
{
4777
var assetHandle = await GameApp.Asset.LoadAssetAsync<TextAsset>(Utility.Asset.Path.GetConfigPath(file, Utility.Const.FileNameSuffix.Json));
48-
4978
return JSON.Parse(assetHandle.GetAssetObject<TextAsset>().text);
5079
}
80+
#endif
5181
}
5282
}

Assets/Hotfix/UI/Logic/UILogin/UILogin.Logic.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ private void OnLoginClick()
5353

5454
private async void Login()
5555
{
56-
var item = GameApp.Config.GetConfig<TbSounds>().Get(1);
57-
Log.Info(item);
5856
if (m_UserName.text.IsNullOrWhiteSpace() || m_Password.text.IsNullOrWhiteSpace())
5957
{
6058
m_ErrorText.text = "用户名或密码不能为空";

0 commit comments

Comments
 (0)