From fe616214a9479d167020cd9f753b74aff167e5ae Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Fri, 13 Dec 2024 18:36:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=88=BF=E9=97=B4=E9=80=BB=E8=BE=91=20Tips?= =?UTF-8?q?=20=E8=87=AA=E5=8A=A8=E8=B5=B7=E6=98=B5=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/UIPrefabs/PopTipsUI.prefab | 2 +- .../NesEmulator/NesEmulator_Screen.mat | 10 +- .../AppMain/UI/OverlayUI/PopTipsItem.cs | 2 +- .../Script/AppMain/UI/OverlayUI/PopTipsUI.cs | 2 +- .../Manager/LoginManager.cs | 231 +++++++++++++++++- 5 files changed, 238 insertions(+), 9 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/PopTipsUI.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/PopTipsUI.prefab index 890ac8c9..965b0b82 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/PopTipsUI.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/PopTipsUI.prefab @@ -56,7 +56,7 @@ MonoBehaviour: m_msgText: {fileID: 4253545256053581529} OutTime: 0.5 OutEase: 9 - StandTime: 5 + StandTime: 2 InTime: 0.5 InEase: 28 --- !u!114 &7081568093111909217 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat index eed7c2bf..d581fae5 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat @@ -2,20 +2,24 @@ %TAG !u! tag:unity3d.com,2011: --- !u!21 &2100000 Material: - serializedVersion: 6 + serializedVersion: 8 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: NesEmulator_Screen m_Shader: {fileID: 4800000, guid: b351396ff606116478d7f4412abe4e2e, type: 3} - m_ShaderKeywords: + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 m_CustomRenderQueue: -1 stringTagMap: {} disabledShaderPasses: [] + m_LockedProperties: m_SavedProperties: serializedVersion: 3 m_TexEnvs: @@ -59,6 +63,7 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + m_Ints: [] m_Floats: - _BumpScale: 1 - _ColorMask: 15 @@ -87,3 +92,4 @@ Material: - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/PopTipsItem.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/PopTipsItem.cs index b503eff7..f24d2b33 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/PopTipsItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/PopTipsItem.cs @@ -22,7 +22,7 @@ namespace AxibugEmuOnline.Client m_msgText.text = msg; Canvas.ForceUpdateCanvases(); - var targetPos = new Vector2(-RectTransform.rect.width,RectTransform.anchoredPosition.y); + var targetPos = new Vector2(-RectTransform.rect.width - 20 , RectTransform.anchoredPosition.y); DOTween.To( () => RectTransform.anchoredPosition, (value) => RectTransform.anchoredPosition = value, diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/PopTipsUI.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/PopTipsUI.cs index df1d4ee5..743cc28c 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/PopTipsUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OverlayUI/PopTipsUI.cs @@ -12,7 +12,7 @@ namespace AxibugEmuOnline.Client List m_runtimeItems = new List(); const float StartY = -108f; - const float StepY = -120; + const float StepY = -140f; private void Awake() { diff --git a/AxibugEmuOnline.Server/Manager/LoginManager.cs b/AxibugEmuOnline.Server/Manager/LoginManager.cs index 44314852..12a325e2 100644 --- a/AxibugEmuOnline.Server/Manager/LoginManager.cs +++ b/AxibugEmuOnline.Server/Manager/LoginManager.cs @@ -78,8 +78,7 @@ namespace AxibugEmuOnline.Server.Manager { // 设置参数值 command.Parameters.AddWithValue("?uid", _c.UID); - command.Parameters.AddWithValue("?uid", msg.NickName); - + command.Parameters.AddWithValue("?nikename", msg.NickName); if (command.ExecuteNonQuery() > 0) { bDone = true; @@ -145,7 +144,7 @@ namespace AxibugEmuOnline.Server.Manager } else { - query = "INSERT INTO `haoyue_emu`.`users` (`nikename`, `regdate`, `lastlogindate`) VALUES (NULL,now(),now());SELECT LAST_INSERT_ID(); "; + query = "INSERT INTO `haoyue_emu`.`users` (`nikename`, `regdate`,`lastlogindate`) VALUES (NULL,now(),now());SELECT LAST_INSERT_ID(); "; using (var command = new MySqlCommand(query, conn)) { // 设置参数值 @@ -159,6 +158,19 @@ namespace AxibugEmuOnline.Server.Manager } } + //设置默认名字 + query = "update users set nikename = ?nikename where uid = ?uid "; + using (var command = new MySqlCommand(query, conn)) + { + // 设置参数值 + command.Parameters.AddWithValue("?uid", uid); + command.Parameters.AddWithValue("?nikename", GetRandomNickName(uid)); + if (command.ExecuteNonQuery() < 1) + { + bDone = false; + } + } + query = "INSERT INTO `haoyue_emu`.`user_devices` (`device`, `devicetype`, `uid`) VALUES (?deviceStr, ?DeviceType, ?uid);"; using (var command = new MySqlCommand(query, conn)) { @@ -201,7 +213,7 @@ namespace AxibugEmuOnline.Server.Manager { _c.Account = reader.IsDBNull(0) ? string.Empty : reader.GetString(0); - _c.NickName = reader.IsDBNull(1) ? string.Empty:reader.GetString(1); + _c.NickName = reader.IsDBNull(1) ? string.Empty : reader.GetString(1); _c.LogInDT = DateTime.Now; _c.RegisterDT = reader.IsDBNull(2) ? DateTime.Now : reader.GetDateTime(2); _c.LastLogInDT = reader.IsDBNull(3) ? DateTime.Now : reader.GetDateTime(3); @@ -222,5 +234,216 @@ namespace AxibugEmuOnline.Server.Manager Haoyue_SQLPoolManager.EnqueueSQLConn(conn); } + public string GetRandomNickName(long uid) + { + int Idx = new Random((int)DateTime.Now.TimeOfDay.TotalMilliseconds).Next(0, RandomNickName.Length - 1); + return $"{RandomNickName[Idx]}_{uid}"; + } + + static string[] RandomNickName = + [ +"马里奥", +"路易基", +"碧琪公主", +"库巴", +"耀西", +"瓦里奥", +"瓦路易吉", +"奇诺比奥", +"罗塞塔公主", +"布斯特", +"凯萨琳/凯瑟琳", +"盖拉库巴", +"黛西", +"保罗","马里奥先锋", + "塞尔达勇士", + "银河猎人", + "主手柄", + "8-bit英雄", + "像素战士", + "魂斗罗精英", + "城堡征服者", + "塔特博尔打击", + "奇迹神庙", + "勇者斗恶龙", + "龟速侠", + "拳皇大师", + "无敌破坏王", + "时空之刃", + "跳跃达人", + "炸弹超人", + "复古玩家", + "混沌骑士", + "传说之翼", + "火箭骑士", + "像素魔法师", + "超级马车手", + "冒险之星", + "银河护卫", + "弹跳英雄", + "红白机战神", + "像素忍者", + "激战霸主", + "挑战之王", + "像素巫师", + "红白机复仇者", + "马里奥兄弟", + "赛博战士", + "像素传说", + "红白机神话", + "复古传承者", + "街头霸王", + "合金装备", + "像素英雄", + "打砖块大师", + "复活节彩蛋", + "8-bit传奇", + "炸弹达人", + "原子战士", + "猎天使魔女", + "探险家", + "奇异探险", + "像素大师", + "星际狂热", + "点阵图王", + "掘地者", + "街机勇士", + "极速赛车手", + "星际旅行者", + "红白机守护者", + "扭曲像素", + "冒险家俱乐部", + "像素方块", + "时空探险者", + "红白机奇迹", + "战士之魂", + "复古英雄", + "超级星战士", + "跳跃精灵", + "时空旅行者", + "银河征服者", + "奇妙世界", + "无敌小子", + "打怪达人", + "复古王者", + "超级马拉松", + "银河守护者", + "街机传奇", + "像素探险家", + "红白机战士", + "复活小队", + "时间扭曲者", + "像素骑士", + "复古探索者", + "超级跳跃者", + "银河冒险者", + "复古时代", + "超级英雄", + "街机探险者", + "红白机大师", + "时间旅行者", + "星际战士", + "冒险之子", + "红白机复仇", + "像素探索者", + "超级宇航员", + "复古复仇者", + "时间守护者", + "银河之子", + "超级格斗家", + "时空征服者", + "复古之星", + "超级战斗机", + "时间冒险者", + "银河神话", + "超级星际", + "冒险之魂", + "复古传奇", + "超级街机", + "像素英雄王", + "红白机探险", + "超级复仇者", + "时间征服者", + "银河之王", + "超级探险家", + "复古守护者", + "超级跳跃王", + "冒险之王", + "超级像素", + "复古战斗", + "超级复古", + "时间之神", + "银河征服", + "超级传奇", + "冒险战士", + "红白机冒险", + "超级复仇", + "复古之神", + "超级时间", + "银河守护", + "超级银河", + "冒险守护", + "红白机战斗", + "超级探险", + "超级星际战士", + "时间之子", + "银河之神", + "超级复古战士", + "红白机之魂", + "超级时间旅行者", + "冒险之神", + "复古探险家", + "超级银河探险", + "时间复仇者", + "银河战斗机", + "超级复古探险", + "红白机战士王", + "超级冒险家", + "复古之王", + "超级像素战士", + "时间战士", + "银河探险家", + "超级红白机", + "复古复仇者王", + "超级时间之神", + "银河冒险家", + "超级复古传奇", + "超级冒险王", + "复古之魂", + "超级银河战士", + "时间探险者", + "银河战士之神", + "超级复古冒险", + "红白机探险王", + "超级时间之子", + "冒险战士王", + "复古战士王", + "超级像素传奇", + "时间探险王", + "银河之魂", + "超级复古神话", + "超级冒险传奇", + "复古战士之神", + "超级银河探险家", + "时间战士之神", + "银河战士传奇", + "超级复古之神", + "超级冒险神话", + "复古探险传奇", + "超级像素神话", + "时间探险之神", + "银河冒险传奇", + "超级复古探险家", + "超级时间探险者", + "复古战士传奇", + "超级银河之神", + "时间冒险传奇", + "银河探险传奇", + "超级红白机神话", + "超级银河战士之神", + "超级复古探险之神", + "红白机战士之魂", + "超级时间探险家" + ]; } } \ No newline at end of file From 183ec611e1df1ccb30aeccc67d9972b42e33d511 Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Fri, 13 Dec 2024 19:10:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AE=A2=E6=88=B7=E7=AB=AF=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/AppMain/Manager/AppRoom.cs | 20 +++++++++++++++++++ .../Script/AppMain/Manager/UserDataManager.cs | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs index a5ff4b06..5f14db93 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs @@ -5,6 +5,7 @@ using AxibugEmuOnline.Client.Network; using AxibugProtobuf; using AxiReplay; using Google.Protobuf; +using System; using System.Collections.Generic; using System.Linq; @@ -451,6 +452,25 @@ namespace AxibugEmuOnline.Client.Manager //解压 byte[] data = Helper.DecompressByteArray(msg.RawBitmap.ToArray()); } + + public void ChangeCurrRoomPlayerName(long uid) + { + UserDataBase userdata = App.user.GetUserByUid(uid); + if (userdata == null) + return; + + if (mineRoomMiniInfo == null) + { + if (mineRoomMiniInfo.Player1UID == uid) + mineRoomMiniInfo.Player1NickName = userdata.NickName; + else if (mineRoomMiniInfo.Player2UID == uid) + mineRoomMiniInfo.Player2NickName = userdata.NickName; + else if (mineRoomMiniInfo.Player3UID == uid) + mineRoomMiniInfo.Player3NickName = userdata.NickName; + else if (mineRoomMiniInfo.Player4UID == uid) + mineRoomMiniInfo.Player4NickName = userdata.NickName; + } + } } public static class RoomEX diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/UserDataManager.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/UserDataManager.cs index 3298cbb9..e59935aa 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/UserDataManager.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/UserDataManager.cs @@ -207,7 +207,9 @@ namespace AxibugEmuOnline.Client.Manager if (userdata == null) return; userdata.NickName = msg.UserInfo.NickName; - //TODO其他 + + App.roomMgr.ChangeCurrRoomPlayerName(msg.UID); + Eventer.Instance.PostEvent(EEvent.OnOtherUserInfoUpdate, msg.UID); } From 30dd2ee9aa925c4d173034bd10abd8fc755e9f77 Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Fri, 13 Dec 2024 19:19:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=85=B6=E4=BB=96=E7=8E=A9=E5=AE=B6?= =?UTF-8?q?=E4=B8=8B=E7=BA=BF=20=E6=B8=85=E7=90=86=E5=85=B6=E6=89=8B?= =?UTF-8?q?=E6=9F=84=E4=BD=8D=E7=9A=84=E9=94=AE=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manager/LoginManager.cs | 1 + AxibugEmuOnline.Server/Manager/RoomManager.cs | 19 +++---------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/AxibugEmuOnline.Server/Manager/LoginManager.cs b/AxibugEmuOnline.Server/Manager/LoginManager.cs index 12a325e2..1cb7aa21 100644 --- a/AxibugEmuOnline.Server/Manager/LoginManager.cs +++ b/AxibugEmuOnline.Server/Manager/LoginManager.cs @@ -103,6 +103,7 @@ namespace AxibugEmuOnline.Server.Manager { UserInfo = miniinfo, }; + //回执给自己 AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdUpdateSelfUserInfo, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(infodata)); diff --git a/AxibugEmuOnline.Server/Manager/RoomManager.cs b/AxibugEmuOnline.Server/Manager/RoomManager.cs index 7c9b8db9..69f9467b 100644 --- a/AxibugEmuOnline.Server/Manager/RoomManager.cs +++ b/AxibugEmuOnline.Server/Manager/RoomManager.cs @@ -557,7 +557,6 @@ namespace AxibugEmuOnline.Server public Google.Protobuf.ByteString? NextStateRaw { get; private set; } public Google.Protobuf.ByteString? ScreenRaw { get; private set; } public bool[] PlayerReadyState { get; private set; } - public List SynUIDs; //public RoomPlayerState PlayerState => getPlayerState(); private RoomGameState mGameState; @@ -587,13 +586,10 @@ namespace AxibugEmuOnline.Server } } } - /// /// 服务器提前帧数 /// public uint SrvForwardFrames { get; set; } - - bool IsAllReady() { bool Ready = true; @@ -611,7 +607,6 @@ namespace AxibugEmuOnline.Server } return Ready; } - public void Init(int roomID, int gameRomID, string roomHash, long hostUId, bool bloadState = false) { RoomID = roomID; @@ -630,7 +625,6 @@ namespace AxibugEmuOnline.Server mInputQueue = new Queue<(uint, ServerInputSnapShot)>(); mDictPlayerIdx2SendQueue = new Dictionary>(); } - public void SetPlayerUID(int PlayerIdx, ClientInfo _c) { long oldUID = -1; @@ -647,7 +641,6 @@ namespace AxibugEmuOnline.Server AppSrv.g_Log.Debug($"SetPlayerUID RoomID->{RoomID} _c.UID->{_c.UID} PlayerIdx->{PlayerIdx}"); _c.RoomState.SetRoomData(this.RoomID, PlayerIdx); } - public void RemovePlayer(ClientInfo _c) { int PlayerIdx = GetPlayerIdx(_c); @@ -660,7 +653,6 @@ namespace AxibugEmuOnline.Server } _c.RoomState.ClearRoomData(); } - int GetPlayerIdx(ClientInfo _c) { if (Player1_UID == _c.UID) return 0; @@ -669,7 +661,6 @@ namespace AxibugEmuOnline.Server if (Player4_UID == _c.UID) return 3; return -1; } - public bool GetPlayerUIDByIdx(int Idx, out long UID) { switch (Idx) @@ -693,7 +684,6 @@ namespace AxibugEmuOnline.Server return true; } - public List GetAllPlayerUIDs() { List list = new List(); @@ -703,7 +693,6 @@ namespace AxibugEmuOnline.Server if (Player4_UID > 0) list.Add(Player4_UID); return list; } - public List GetAllPlayerClientList() { List list = new List(); @@ -720,7 +709,6 @@ namespace AxibugEmuOnline.Server return list; } - public void SetPlayerInput(int PlayerIdx, long mFrameID, ServerInputSnapShot allinput) { switch (PlayerIdx) @@ -731,9 +719,9 @@ namespace AxibugEmuOnline.Server case 3: mCurrInputData.p4_byte = allinput.p1_byte; break; } } - - public void ClearPlayerInput(int PlayerIdx) + public void ClearPlayerInput(ClientInfo _c) { + int PlayerIdx = GetPlayerIdx(_c); switch (PlayerIdx) { case 0: mCurrInputData.p1_byte = 0; break; @@ -742,7 +730,6 @@ namespace AxibugEmuOnline.Server case 3: mCurrInputData.p4_byte = 0; break; } } - public int GetPlayerCount() { int count = 0; @@ -752,7 +739,6 @@ namespace AxibugEmuOnline.Server if (Player4_UID > 0) count++; return count; } - void StartNewTick() { mInputQueue.Clear(); @@ -902,6 +888,7 @@ namespace AxibugEmuOnline.Server { int oldPlayerCount = GetPlayerCount(); RemovePlayer(_c); + ClearPlayerInput(_c); int newPlayerCount = GetPlayerCount(); errcode = ErrorCode.ErrorOk; bHadRoomStateChange = CheckRoomStateChange(oldPlayerCount, newPlayerCount);