From 2f8251fe630eb30d9c74c558ff591e9f0bd282d7 Mon Sep 17 00:00:00 2001 From: BobSong <605277374@qq.com> Date: Wed, 20 Aug 2025 23:57:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=92=8C=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Resources/Fgui/Common/Common_fui.bytes | Bin 33663 -> 34279 bytes Assets/Resources/Fgui/Main/Main_fui.bytes | Bin 14301 -> 14732 bytes .../Dispatcher/Interface/IMessageHandler.cs | 1 + .../Dispatcher/MessageDispatcherComponent.cs | 61 -------------- Assets/Scripts/Net/Net.cs | 75 ++++++++++++++++++ Assets/Scripts/Net/Net.cs.meta | 3 + Assets/Scripts/Net/NetExtends.cs | 12 +++ Assets/Scripts/Net/NetExtends.cs.meta | 3 + Assets/Scripts/Startup/Init.cs | 6 +- Assets/Scripts/UI/Binders/CommonBinder.cs | 1 + .../Scripts/UI/Common/CommonInput.Designer.cs | 29 +++++++ .../UI/Common/CommonInput.Designer.cs.meta | 2 + Assets/Scripts/UI/Common/CommonInput.cs | 47 +++++++++++ Assets/Scripts/UI/Common/CommonInput.cs.meta | 2 + Assets/Scripts/UI/Login.meta | 3 + Assets/Scripts/UI/Login/LoginHelper.cs | 54 +++++++++++++ Assets/Scripts/UI/Login/LoginHelper.cs.meta | 3 + .../Scripts/UI/Login/LoginPanel.Designer.cs | 32 ++++++++ .../UI/Login/LoginPanel.Designer.cs.meta | 2 + Assets/Scripts/UI/Login/LoginPanel.cs | 25 ++++++ Assets/Scripts/UI/Login/LoginPanel.cs.meta | 2 + .../assets/Common/Com/Buttons/BtnCommon.xml | 16 ++-- .../assets/Common/Com/Inputs/CommonInput.xml | 16 ++++ FGUIProject/assets/Common/package.xml | 3 +- FGUIProject/assets/Main/LoginPanel.xml | 15 ++++ FGUIProject/assets/Main/package.xml | 1 + .../settings/whoot/6hgkvlau9zboma.json | 1 + .../settings/whoot/hxr7rc7p9zbo1g.json | 1 + 28 files changed, 346 insertions(+), 70 deletions(-) create mode 100644 Assets/Scripts/Net/Net.cs create mode 100644 Assets/Scripts/Net/Net.cs.meta create mode 100644 Assets/Scripts/Net/NetExtends.cs create mode 100644 Assets/Scripts/Net/NetExtends.cs.meta create mode 100644 Assets/Scripts/UI/Common/CommonInput.Designer.cs create mode 100644 Assets/Scripts/UI/Common/CommonInput.Designer.cs.meta create mode 100644 Assets/Scripts/UI/Common/CommonInput.cs create mode 100644 Assets/Scripts/UI/Common/CommonInput.cs.meta create mode 100644 Assets/Scripts/UI/Login.meta create mode 100644 Assets/Scripts/UI/Login/LoginHelper.cs create mode 100644 Assets/Scripts/UI/Login/LoginHelper.cs.meta create mode 100644 Assets/Scripts/UI/Login/LoginPanel.Designer.cs create mode 100644 Assets/Scripts/UI/Login/LoginPanel.Designer.cs.meta create mode 100644 Assets/Scripts/UI/Login/LoginPanel.cs create mode 100644 Assets/Scripts/UI/Login/LoginPanel.cs.meta create mode 100644 FGUIProject/assets/Common/Com/Inputs/CommonInput.xml create mode 100644 FGUIProject/assets/Main/LoginPanel.xml create mode 100644 FGUIProject/settings/whoot/6hgkvlau9zboma.json create mode 100644 FGUIProject/settings/whoot/hxr7rc7p9zbo1g.json diff --git a/Assets/Resources/Fgui/Common/Common_fui.bytes b/Assets/Resources/Fgui/Common/Common_fui.bytes index c3a454bfd0983000bbca3847893011692cc537b3..b3599cc62344c6ce087b8f4bd8e374e2cd110740 100644 GIT binary patch delta 5673 zcma)=d3aPs*2e2p<#s1@mJTH8Y@G$TNuWa#60#v72@0~4utQkVAqip2f{CDxLtIhg zf}D{-MU4(B;)X^Abx;&h+z^~`#BB_2$S8`Vj;LtQTeolW@IBx6$9H+Ee{a2YZq=#f z-tG{%S|0C`o6d=u9Ve`7WowZ5-2d2&?GYRHE3r`2h(&?l3Eqt;Lr`c(C_cqtlw6c4 za5keb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BwbZdRN* zQR3IaL@*R`u1Zf&=QNy%mtTT>Awq==f*qKlg zF&RJjqsGaG2gQNxLljUznN@^2Km-Nl%Wp+t^ZOf=F9p%nw=Zh=gYhQsb8nvWoaa3` z=iHtJ$GZALT4@X9M#=e4jh0G3KI z9d+u898aT5VaP@;ZbB4u(SjBe){5kHSWn%#VKzkDas$dUg6YGvbRxHk4`7IV_N%kg z+;VIHc)9qR0vfqOBePwVf?m6qZ^R}VwU-NvG?8j!R z%qusDvY?|ur<;27Y}V3SHxz zDH}H?8t2as(gvr?upK*u`mnR{lE@8wCtjs{^CN7RG|l694ZANRTj7eZJ^#pF#~YWC zZMiDK_NHaVERKD6lZxFjHcI^kGiZ<7A}`-5=XpDS3;QWta4~v|+=;PEb|O9bi^|5d z)d3v*5355s{J*TCivDhnxA6{T6vf!PvaAJ~%HPBLG*%RGe1Lj6lWP$|7&B0V8WTPg zm3)Mc$?GX$M`(_xK>0*4pW-NW3+5P&c&)VEV=<@MaZCu@Cr%xedE7h`pUJrDwJ2$y z&+!EXy|bjlm-vdhy%p?hq3}rN8+=O>g8A-W=6n1=)xHY$qjY)Dr}Ce0oYwdn_zC<> z7ksy|U#QIFGEU(*iBq(wIL1%o3>_(su(LF**Z8majb@cZbvQ?>OH@71<00Bw(x}Jp zxImUt5%@z+tBK=JOw!WQ7*8>XKPgBqzeO|yOegknRY5s*`t9i{F)pUm;}3DY*!wb5 z{*|!lnIScqnq)>g>9;Zi83P`H0f|wGizTj=cqmZFl;oK}t-)bv3*A>0L}q - /// 处理路由消息,将消息分发给相应的路由消息处理器。 - /// - /// 会话对象 - /// 消息类型 - /// 实体对象 - /// 消息对象 - /// RPC标识 - public async FTask RouteMessageHandler(Session session, Type type, Entity entity, object message, uint rpcId) - { - if (!_routeMessageHandlers.TryGetValue(type, out var routeMessageHandler)) - { - Log.Warning($"Scene:{session.Scene.Id} Found Unhandled RouteMessage: {message.GetType()}"); - - if (message is IRouteRequest request) - { - FailRouteResponse(session, request.GetType(), InnerErrorCode.ErrEntityNotFound, rpcId); - } - - return; - } - - var runtimeId = entity.RuntimeId; - var sessionRuntimeId = session.RuntimeId; - - if (entity is Scene) - { - // 如果是Scene的话、就不要加锁了、如果加锁很一不小心就可能会造成死锁 - await routeMessageHandler.Handle(session, entity, rpcId, message); - return; - } - - // 使用协程锁来确保多线程安全 - using (await _receiveRouteMessageLock.Wait(runtimeId)) - { - if (sessionRuntimeId != session.RuntimeId) - { - return; - } - - if (runtimeId != entity.RuntimeId) - { - if (message is IRouteRequest request) - { - FailRouteResponse(session, request.GetType(), InnerErrorCode.ErrEntityNotFound, rpcId); - } - - return; - } - - await routeMessageHandler.Handle(session, entity, rpcId, message); - } - } - - internal bool GetCustomRouteType(long protocolCode, out int routeType) - { - return _customRouteMap.TryGetValue(protocolCode, out routeType); - } -#endif internal void FailRouteResponse(Session session, Type requestType, uint error, uint rpcId) { var response = CreateRouteResponse(requestType, error); diff --git a/Assets/Scripts/Net/Net.cs b/Assets/Scripts/Net/Net.cs new file mode 100644 index 000000000..f488db1e7 --- /dev/null +++ b/Assets/Scripts/Net/Net.cs @@ -0,0 +1,75 @@ +using Assets.Scripts.Entity; +using Assets.Scripts.Hotfix; +using NBC; +using NBC.Network; +using NBC.Network.Interface; + +namespace NBF +{ + public class Net : EventDispatcher + { + public static Session Session { get; private set; } + + public const int HeartbeatInterval = 5000; + + #region 单例 + + private static Net _inst; + + public static Net Inst => _inst ??= new Net(); + + public Net() + { + } + + #endregion + + #region 连接创建和回调 + + public static Session CreateSession(string address) + { + var session = SessionHelper.CreateSession(App.Main, address, OnConnectComplete, + OnConnectFail, + OnConnectDisconnect); + + Session = session; + return session; + } + + private static void OnConnectComplete() + { + Log.Debug("连接成功"); + Session.AddComponent().Start(HeartbeatInterval); + } + + private static void OnConnectFail() + { + Log.Debug("连接失败"); + // SetLoginState(false); + } + + private static void OnConnectDisconnect() + { + Log.Debug("连接断开"); + // SetLoginState(false); + } + + #endregion + + #region 消息收发 + + public static FTask Call(IRequest request, long routeId = 0) + { + // var response = await Session.Call(request, routeId); + // response.DispatchMessage(); + return Session.Call(request, routeId);; + } + + public static void Send(IMessage message, uint rpcId = 0, long routeId = 0) + { + Session.Send(message, rpcId, routeId); + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Net/Net.cs.meta b/Assets/Scripts/Net/Net.cs.meta new file mode 100644 index 000000000..901c251c4 --- /dev/null +++ b/Assets/Scripts/Net/Net.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1fe56eeffd614eaea7055d1c65f6859f +timeCreated: 1755701226 \ No newline at end of file diff --git a/Assets/Scripts/Net/NetExtends.cs b/Assets/Scripts/Net/NetExtends.cs new file mode 100644 index 000000000..01a66a128 --- /dev/null +++ b/Assets/Scripts/Net/NetExtends.cs @@ -0,0 +1,12 @@ +using NBC.Network.Interface; + +namespace NBF +{ + public static class NetExtends + { + public static void DispatchMessage(this IResponse response) + { + Net.Inst.DispatchEventWith(response.OpCode().ToString(), response); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Net/NetExtends.cs.meta b/Assets/Scripts/Net/NetExtends.cs.meta new file mode 100644 index 000000000..bca84f9d5 --- /dev/null +++ b/Assets/Scripts/Net/NetExtends.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 25d56f7c87744a199e926365a516b85f +timeCreated: 1755702255 \ No newline at end of file diff --git a/Assets/Scripts/Startup/Init.cs b/Assets/Scripts/Startup/Init.cs index 67364d641..39da618d1 100644 --- a/Assets/Scripts/Startup/Init.cs +++ b/Assets/Scripts/Startup/Init.cs @@ -132,9 +132,11 @@ namespace NBF // UI.Inst.OpenUI(); LoadData(); CommonTopPanel.Show(); + LoginPanel.Show(); // FishingPanel.Show(); - PreviewPanel.Show(); - Fishing.Inst.Go(1); + // PreviewPanel.Show(); + + // Fishing.Inst.Go(1); // HomePanel.Show(); // ChatTestPanel.Show(); diff --git a/Assets/Scripts/UI/Binders/CommonBinder.cs b/Assets/Scripts/UI/Binders/CommonBinder.cs index 0972390c5..07b121422 100644 --- a/Assets/Scripts/UI/Binders/CommonBinder.cs +++ b/Assets/Scripts/UI/Binders/CommonBinder.cs @@ -12,6 +12,7 @@ namespace NBF UIObjectFactory.SetPackageItemExtension(SelectPages.URL, typeof(SelectPages)); UIObjectFactory.SetPackageItemExtension(ModelTexture.URL, typeof(ModelTexture)); UIObjectFactory.SetPackageItemExtension(BottomMenu.URL, typeof(BottomMenu)); + UIObjectFactory.SetPackageItemExtension(CommonInput.URL, typeof(CommonInput)); UIObjectFactory.SetPackageItemExtension(ClassifyList.URL, typeof(ClassifyList)); UIObjectFactory.SetPackageItemExtension(CommonMenu.URL, typeof(CommonMenu)); UIObjectFactory.SetPackageItemExtension(MarqueeTag.URL, typeof(MarqueeTag)); diff --git a/Assets/Scripts/UI/Common/CommonInput.Designer.cs b/Assets/Scripts/UI/Common/CommonInput.Designer.cs new file mode 100644 index 000000000..9b4d5a314 --- /dev/null +++ b/Assets/Scripts/UI/Common/CommonInput.Designer.cs @@ -0,0 +1,29 @@ +/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/ + + +using FairyGUI; +using FairyGUI.Utils; +using NBC; + +namespace NBF +{ + public partial class CommonInput + { + public const string URL = "ui://6hgkvlau9zboma"; + + public Controller FocusState; + public GTextInput Input; + public GImage bottomBack; + + public override void ConstructFromXML(XML xml) + { + base.ConstructFromXML(xml); + + FocusState = GetController("FocusState"); + Input = (GTextInput)GetChild("Input"); + bottomBack = (GImage)GetChild("bottomBack"); + OnInited(); + UILanguage.TrySetComponentLanguage(this); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/CommonInput.Designer.cs.meta b/Assets/Scripts/UI/Common/CommonInput.Designer.cs.meta new file mode 100644 index 000000000..ba80ab955 --- /dev/null +++ b/Assets/Scripts/UI/Common/CommonInput.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: fb776407f4f25e64a8e803ba135bddef \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/CommonInput.cs b/Assets/Scripts/UI/Common/CommonInput.cs new file mode 100644 index 000000000..5a310ba36 --- /dev/null +++ b/Assets/Scripts/UI/Common/CommonInput.cs @@ -0,0 +1,47 @@ +// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 + +using UnityEngine; +using FairyGUI; +using NBC; + +namespace NBF +{ + public partial class CommonInput : GComponent + { + public EventListener onChanged => Input.onChanged; + + public override string text + { + get => Input.text; + set => Input.text = value; + } + + public string title + { + get => text; + set => text = value; + } + + public string promptText + { + get => Input.promptText; + set => Input.promptText = value; + } + + private void OnInited() + { + onFocusIn.Add(OnInputFocusIn); + onFocusOut.Add(OnInputFocusOut); + } + + private void OnInputFocusIn() + { + FocusState.selectedIndex = 1; + } + + private void OnInputFocusOut() + { + FocusState.selectedIndex = 0; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/CommonInput.cs.meta b/Assets/Scripts/UI/Common/CommonInput.cs.meta new file mode 100644 index 000000000..11e371554 --- /dev/null +++ b/Assets/Scripts/UI/Common/CommonInput.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c7adc7972d1d401489dc796fb27d1eaa \ No newline at end of file diff --git a/Assets/Scripts/UI/Login.meta b/Assets/Scripts/UI/Login.meta new file mode 100644 index 000000000..38f4f0677 --- /dev/null +++ b/Assets/Scripts/UI/Login.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 12482424a8714a5fb52ce23312a0a0f6 +timeCreated: 1755697902 \ No newline at end of file diff --git a/Assets/Scripts/UI/Login/LoginHelper.cs b/Assets/Scripts/UI/Login/LoginHelper.cs new file mode 100644 index 000000000..0763a30f7 --- /dev/null +++ b/Assets/Scripts/UI/Login/LoginHelper.cs @@ -0,0 +1,54 @@ +using Assets.Scripts.Entity; +using Assets.Scripts.Hotfix; +using NBC; +using NBC.Network; + +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"); + + 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().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}"); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Login/LoginHelper.cs.meta b/Assets/Scripts/UI/Login/LoginHelper.cs.meta new file mode 100644 index 000000000..c2ec3022e --- /dev/null +++ b/Assets/Scripts/UI/Login/LoginHelper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 031ed023449844cdb9d6c4eb5d7fee90 +timeCreated: 1755698636 \ No newline at end of file diff --git a/Assets/Scripts/UI/Login/LoginPanel.Designer.cs b/Assets/Scripts/UI/Login/LoginPanel.Designer.cs new file mode 100644 index 000000000..adde27e5f --- /dev/null +++ b/Assets/Scripts/UI/Login/LoginPanel.Designer.cs @@ -0,0 +1,32 @@ +/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/ + +using FairyGUI; +using FairyGUI.Utils; +using NBC; +using System.Collections.Generic; + +namespace NBF +{ + /// + public partial class LoginPanel + { + public GObject this[string aKey] => ContentPane.GetChild(aKey); + public override string UIPackName => "Main"; + public override string UIResName => "LoginPanel"; + + [AutoFind(Name = "Back")] + public GLabel Back; + [AutoFind(Name = "InputAccount")] + public CommonInput InputAccount; + [AutoFind(Name = "BtnLogin")] + public GButton BtnLogin; + public override string[] GetDependPackages(){ return new string[] {"Common"}; } + + public static void Show(object param = null){ App.UI.OpenUI(param); } + + public static void Hide(){ App.UI.HideUI(); } + + public static void Del(){ App.UI.DestroyUI(); } + + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Login/LoginPanel.Designer.cs.meta b/Assets/Scripts/UI/Login/LoginPanel.Designer.cs.meta new file mode 100644 index 000000000..c674924f4 --- /dev/null +++ b/Assets/Scripts/UI/Login/LoginPanel.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3b11ed3a4a10a3549a06d7845c9c4cfd \ No newline at end of file diff --git a/Assets/Scripts/UI/Login/LoginPanel.cs b/Assets/Scripts/UI/Login/LoginPanel.cs new file mode 100644 index 000000000..5569c677c --- /dev/null +++ b/Assets/Scripts/UI/Login/LoginPanel.cs @@ -0,0 +1,25 @@ +// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖 + +using FairyGUI; +using UnityEngine; +using NBC; +using UIPanel = NBC.UIPanel; + +namespace NBF +{ + public partial class LoginPanel : UIPanel + { + protected override void OnInit() + { + this.AutoAddClick(OnClick); + } + + private void OnClick(GComponent btn) + { + if (btn == BtnLogin) + { + LoginHelper.Login(InputAccount.text).Coroutine(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Login/LoginPanel.cs.meta b/Assets/Scripts/UI/Login/LoginPanel.cs.meta new file mode 100644 index 000000000..0775b510a --- /dev/null +++ b/Assets/Scripts/UI/Login/LoginPanel.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b2d32e54ef5680541959b782ee8d0c7a \ No newline at end of file diff --git a/FGUIProject/assets/Common/Com/Buttons/BtnCommon.xml b/FGUIProject/assets/Common/Com/Buttons/BtnCommon.xml index 1e7527056..63b95d17d 100644 --- a/FGUIProject/assets/Common/Com/Buttons/BtnCommon.xml +++ b/FGUIProject/assets/Common/Com/Buttons/BtnCommon.xml @@ -1,11 +1,15 @@ - - + + - - - + + + + + + + -