From b6292f1d4d56e66056d9775f790165a8b03c29b6 Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Fri, 13 Dec 2024 17:28:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=88=90=E5=8A=9F=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs | 2 ++ .../Assets/Script/AppMain/Event/EEvent.cs | 12 ++++++++++++ .../Assets/Script/AppMain/Manager/AppLogin.cs | 9 ++++++++- .../Assets/Script/AppMain/Manager/AppRoom.cs | 9 ++++++++- .../Assets/Script/AppMain/Manager/UserDataManager.cs | 3 +++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs index 6c0c45d..b08b0c1 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs @@ -43,6 +43,8 @@ namespace AxibugEmuOnline.Client.ClientCore #endif public static void Init(Initer initer, bool isTest = false, string testSrvIP = "") { + PlayerPrefs.DeleteAll(); + settings = new AppSettings(); log = new LogManager(); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs index c296d94..cdecf0b 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs @@ -3,6 +3,18 @@ public enum EEvent { // 添加你自己需要的事件类型 + + + /// + /// 登录成功 + /// + OnLoginSucceed, + + /// + /// 登录失败 + /// + OnLoginFailed, + OnChatMsg, //自己的信息更新(比如改名更新) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppLogin.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppLogin.cs index 1286aaa..f2aa251 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppLogin.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppLogin.cs @@ -1,5 +1,6 @@ using AxibugEmuOnline.Client.ClientCore; using AxibugEmuOnline.Client.Common; +using AxibugEmuOnline.Client.Event; using AxibugEmuOnline.Client.Network; using AxibugProtobuf; using System; @@ -50,15 +51,21 @@ namespace AxibugEmuOnline.Client.Manager { App.log.Info("登录成功"); App.user.InitMainUserData(App.user.userdata.Account, msg.UID); + OverlayManager.PopTip("登录成功"); + App.log.Info("获取Room列表"); App.roomMgr.SendGetRoomList(); App.log.Info("获取在线玩家列表"); App.user.Send_GetUserList(); + + Eventer.Instance.PostEvent(EEvent.OnLoginSucceed); } else { - App.log.Info("登录失败"); + App.log.Info("登录失败"); + OverlayManager.PopTip("登录失败"); + Eventer.Instance.PostEvent(EEvent.OnLoginFailed); } #if UNITY_EDITOR //TestCreate(); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs index 2f76372..fb9ac45 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs @@ -295,7 +295,10 @@ namespace AxibugEmuOnline.Client.Manager Protobuf_Room_Join_RESP msg = ProtoBufHelper.DeSerizlize(reqData); mineRoomMiniInfo = msg.RoomMiniInfo; InitRePlay(); - Eventer.Instance.PostEvent(EEvent.OnMineJoinRoom); + { + OverlayManager.PopTip($"已进入[{msg.RoomMiniInfo.GetHostNickName()}]的房间"); + Eventer.Instance.PostEvent(EEvent.OnMineJoinRoom); + } } /// @@ -322,6 +325,7 @@ namespace AxibugEmuOnline.Client.Manager ReleaseRePlay(); mineRoomMiniInfo = null; Eventer.Instance.PostEvent(EEvent.OnMineLeavnRoom); + OverlayManager.PopTip($"已经离开房间"); } void RecvRoomMyRoomStateChange(byte[] reqData) @@ -341,7 +345,10 @@ namespace AxibugEmuOnline.Client.Manager { Eventer.Instance.PostEvent(EEvent.OnOtherPlayerLeavnRoom, i, OldPlayer); if (NewPlayer > 0)//而且害换了一个玩家 + { Eventer.Instance.PostEvent(EEvent.OnOtherPlayerJoinRoom, i, NewPlayer); + OverlayManager.PopTip($"其他人进入了房间"); + } } else //之前没人 Eventer.Instance.PostEvent(EEvent.OnOtherPlayerJoinRoom, i, NewPlayer); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/UserDataManager.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/UserDataManager.cs index b308e36..3298cbb 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/UserDataManager.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/UserDataManager.cs @@ -163,7 +163,10 @@ namespace AxibugEmuOnline.Client.Manager Protobuf_UserJoin_RESP msg = ProtoBufHelper.DeSerizlize(reqData); UpdateOrAddUser(msg.UserInfo, out bool isNewUser); if (isNewUser) + { Eventer.Instance.PostEvent(EEvent.OnUserLogin, msg.UserInfo.UID, msg.UserInfo.NickName); + OverlayManager.PopTip($"玩家[{msg.UserInfo.NickName}]上线了"); + } } public void RecvGetUserLeave(byte[] reqData)