From 1d3a602dd67ae2ceaac4b6381cdb99ac930b8e15 Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Fri, 13 Dec 2024 17:55:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=BF=E9=97=B4=E4=BA=8B=E4=BB=B6=E5=AE=8C?= =?UTF-8?q?=E5=96=84=20=E5=92=8C=20=E6=8F=90=E7=A4=BATips?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/UIPrefabs/PopTipsUI.prefab | 109 +++++++++++++++++- .../Assets/Script/AppMain/Event/EEvent.cs | 4 + .../Assets/Script/AppMain/Manager/AppRoom.cs | 41 ++++++- .../Assets/Script/AppMain/Manager/AppShare.cs | 4 +- 4 files changed, 144 insertions(+), 14 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/PopTipsUI.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/PopTipsUI.prefab index 13c8371..890ac8c 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/PopTipsUI.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/PopTipsUI.prefab @@ -32,6 +32,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 7161016329433304235} + - {fileID: 5931284345598511} - {fileID: 3567888507220032771} m_Father: {fileID: 8635669497356860973} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -71,10 +72,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: 120 - m_Right: 100 - m_Top: 80 - m_Bottom: 80 + m_Left: 20 + m_Right: 20 + m_Top: 20 + m_Bottom: 20 m_ChildAlignment: 5 m_Spacing: 0 m_ChildForceExpandWidth: 1 @@ -227,6 +228,102 @@ MonoBehaviour: m_VerticalOverflow: 1 m_LineSpacing: 1 m_Text: Make XMB Great Again ! +--- !u!1 &8254882995022780247 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5931284345598511} + - component: {fileID: 5412679746312716758} + - component: {fileID: 1280590479212552220} + - component: {fileID: 3616330448914434996} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5931284345598511 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8254882995022780247} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 3702320671699488055} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5412679746312716758 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8254882995022780247} + m_CullTransparentMesh: 1 +--- !u!114 &1280590479212552220 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8254882995022780247} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 85c3a144c43eab24bab8825879258327, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &3616330448914434996 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8254882995022780247} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: 80 + m_PreferredHeight: 80 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 --- !u!1 &8986536818905873058 GameObject: m_ObjectHideFlags: 0 @@ -306,14 +403,14 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0.13207549, g: 0.13207549, b: 0.13207549, a: 1} + m_Color: {r: 0.21698111, g: 0.21698111, b: 0.21698111, a: 0.6666667} m_RaycastTarget: 0 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 21300000, guid: b12ca21105df97a469be3cf97a4f5fc1, type: 3} + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs index cdecf0b..6f8fdf1 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Event/EEvent.cs @@ -36,6 +36,10 @@ OnRoomListSingleClose,//房间关闭 OnRoomGetRoomScreen,//获取到房间数据 + /// + /// 我的房间创建成功 + /// + OnMineRoomCreated, /// /// 我进入房间 /// diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs index fb9ac45..a5ff4b0 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs @@ -269,6 +269,9 @@ namespace AxibugEmuOnline.Client.Manager Protobuf_Room_Create_RESP msg = ProtoBufHelper.DeSerizlize(reqData); mineRoomMiniInfo = msg.RoomMiniInfo; InitRePlay(); + Eventer.Instance.PostEvent(EEvent.OnMineRoomCreated); + OverlayManager.PopTip($"房间创建成功"); + } /// @@ -281,7 +284,7 @@ namespace AxibugEmuOnline.Client.Manager { _Protobuf_Room_Join.RoomID = RoomID; _Protobuf_Room_Join.PlayerNum = JoinPlayerIdx; - App.log.Info($"创建房间"); + App.log.Info($"加入房间"); App.network.SendToServer((int)CommandID.CmdRoomJoin, ProtoBufHelper.Serizlize(_Protobuf_Room_Join)); } @@ -296,8 +299,8 @@ namespace AxibugEmuOnline.Client.Manager mineRoomMiniInfo = msg.RoomMiniInfo; InitRePlay(); { - OverlayManager.PopTip($"已进入[{msg.RoomMiniInfo.GetHostNickName()}]的房间"); Eventer.Instance.PostEvent(EEvent.OnMineJoinRoom); + OverlayManager.PopTip($"已进入[{msg.RoomMiniInfo.GetHostNickName()}]的房间"); } } @@ -325,7 +328,7 @@ namespace AxibugEmuOnline.Client.Manager ReleaseRePlay(); mineRoomMiniInfo = null; Eventer.Instance.PostEvent(EEvent.OnMineLeavnRoom); - OverlayManager.PopTip($"已经离开房间"); + OverlayManager.PopTip($"你已经离开房间"); } void RecvRoomMyRoomStateChange(byte[] reqData) @@ -344,14 +347,22 @@ namespace AxibugEmuOnline.Client.Manager if (OldPlayer > 0) { Eventer.Instance.PostEvent(EEvent.OnOtherPlayerLeavnRoom, i, OldPlayer); + UserDataBase oldplayer = App.user.GetUserByUid(OldPlayer); + string oldPlayName = oldplayer != null ? oldplayer.NickName : "Player"; + OverlayManager.PopTip($"[{oldPlayName}]离开房间,手柄位:P{i}"); if (NewPlayer > 0)//而且害换了一个玩家 - { + { Eventer.Instance.PostEvent(EEvent.OnOtherPlayerJoinRoom, i, NewPlayer); - OverlayManager.PopTip($"其他人进入了房间"); + mineRoomMiniInfo.GetPlayerNameByPlayerIdx((uint)i, out string PlayerName); + OverlayManager.PopTip($"[{PlayerName}]进入房间,手柄位:P{i}"); } } else //之前没人 + { Eventer.Instance.PostEvent(EEvent.OnOtherPlayerJoinRoom, i, NewPlayer); + mineRoomMiniInfo.GetPlayerNameByPlayerIdx((uint)i, out string PlayerName); + OverlayManager.PopTip($"[{PlayerName}]进入房间,手柄位:P{i}"); + } } } @@ -460,5 +471,25 @@ namespace AxibugEmuOnline.Client.Manager freeSlots = temp.ToArray(); return freeSlots.Length > 0; } + + /// + /// 按照房间玩家下标获取昵称 + /// + /// + /// + /// + /// + public static bool GetPlayerNameByPlayerIdx(this Protobuf_Room_MiniInfo roomMiniInfo,uint PlayerIndex, out string PlayerName) + { + PlayerName = string.Empty; + switch (PlayerIndex) + { + case 0: PlayerName = roomMiniInfo.Player1UID > 0 ? roomMiniInfo.Player1NickName : null; break; + case 1: PlayerName = roomMiniInfo.Player2UID > 0 ? roomMiniInfo.Player2NickName : null; break; + case 2: PlayerName = roomMiniInfo.Player3UID > 0 ? roomMiniInfo.Player3NickName : null; break; + case 3: PlayerName = roomMiniInfo.Player4UID > 0 ? roomMiniInfo.Player4NickName : null; break; + } + return string.IsNullOrEmpty(PlayerName); + } } } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppShare.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppShare.cs index 993722e..304c1f7 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppShare.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppShare.cs @@ -26,19 +26,17 @@ namespace AxibugEmuOnline.Client.Manager RomID = RomID, PlatformType = Platform }; - App.log.Info($"LeavnRoom"); App.network.SendToServer((int)CommandID.CmdGameMark, ProtoBufHelper.Serizlize(req)); } /// - /// 离开房间成功 + /// 收藏 /// /// void RecvGameStar(byte[] reqData) { Protobuf_Game_Mark_RESP msg = ProtoBufHelper.DeSerizlize(reqData); - Eventer.Instance.PostEvent(EEvent.OnDoStars, msg.PlatformType, msg.RomID); }