调整目录结构
This commit is contained in:
@@ -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")]
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 031ed023449844cdb9d6c4eb5d7fee90
|
||||
timeCreated: 1755698636
|
||||
@@ -27,7 +27,8 @@ namespace NBF
|
||||
private async FTask OnLoginClick()
|
||||
{
|
||||
await LoginHelper.Login(InputAccount.text);
|
||||
await MapHelper.Enter(99);
|
||||
await MapHelper.EnterMap(99);
|
||||
Del();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user