调整目录结构

This commit is contained in:
2025-08-29 09:11:08 +08:00
parent efb64ce7bc
commit 1fff9db9ca
351 changed files with 304 additions and 215 deletions

View File

@@ -14,6 +14,8 @@ namespace NBF
public override string UIPackName => "Load";
public override string UIResName => "LoadingPanel";
[AutoFind(Name = "back")]
public GLoader back;
[AutoFind(Name = "Progress")]
public GProgressBar Progress;
[AutoFind(Name = "TextLoading")]

View File

@@ -2,6 +2,7 @@
using UnityEngine;
using NBC;
using NBC.Event;
namespace NBF
{
@@ -17,14 +18,32 @@ namespace NBF
}
}
public class OnLoadingProgressEvent : EventSystem<LoadingProgress>
{
protected override void Handler(LoadingProgress self)
{
LoadingPanel.SetProgress(self.Progress);
}
}
public partial class LoadingPanel : UIPanel
{
public static readonly LoadingTask<LoadingPanel> LoadingTask = new();
private static LoadingPanel _loadingPanel;
public static void SetProgress(float progress)
{
if (_loadingPanel != null)
{
_loadingPanel.Progress.value = progress * 100;
}
}
protected override void OnInit()
{
ContentPane.sortingOrder = UIDef.UIOrder.Loading;
_loadingPanel = this;
Progress.max = 100;
}
protected override void OnShow()

View File

@@ -1,58 +0,0 @@
using Assets.Scripts.Entity;
using Assets.Scripts.Hotfix;
using NBC;
using NBC.Network;
using NBF.Fishing2;
namespace NBF
{
public static class LoginHelper
{
private static Session _session;
public static async FTask Login(string account)
{
_session = Net.CreateSession("127.0.0.1:20001");
_session.Scene.AddComponent<UnitUnityComponent>();
var acc = account;
// 发送登录的请求给服务器
var response = (A2C_LoginResponse)await Net.Call(new C2A_LoginRequest()
{
Username = acc,
Password = acc,
LoginType = 1
});
if (response.ErrorCode != 0)
{
Log.Error($"登录发生错误{response.ErrorCode}");
return;
}
if (!App.Main.GetComponent<JWTParseComponent>().Parse(response.ToKen, out var payload))
{
return;
}
// 根据ToKen返回的Address登录到Gate服务器
_session = Net.CreateSession(payload.Address);
// 发送登录请求到Gate服务器
var loginResponse = (G2C_LoginResponse)await Net.Call(new C2G_LoginRequest()
{
ToKen = response.ToKen
});
if (loginResponse.ErrorCode != 0)
{
Log.Error($"登录发生错误{loginResponse.ErrorCode}");
return;
}
Log.Debug($"登录到Gate服务器成功ErrorCode:{loginResponse.ErrorCode}");
await _session.Scene.EventComponent.PublishAsync(new ChangePosition());
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 031ed023449844cdb9d6c4eb5d7fee90
timeCreated: 1755698636

View File

@@ -27,7 +27,8 @@ namespace NBF
private async FTask OnLoginClick()
{
await LoginHelper.Login(InputAccount.text);
await MapHelper.Enter(99);
await MapHelper.EnterMap(99);
Del();
}
}
}