diff --git a/FunGame.Desktop.sln b/FunGame.Desktop.sln index bc9c6d9..ccedaae 100644 --- a/FunGame.Desktop.sln +++ b/FunGame.Desktop.sln @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Desktop", "FunGame. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Implement", "FunGame.Implement\FunGame.Implement.csproj", "{0E1E1C6C-8DB1-40C7-8503-505C4D99BA12}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FunGame.Core", "..\FunGame.Core\FunGame.Core.csproj", "{0FD11F7A-7D64-4B1F-8D45-9D9CFF050C4A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {0E1E1C6C-8DB1-40C7-8503-505C4D99BA12}.Debug|Any CPU.Build.0 = Debug|Any CPU {0E1E1C6C-8DB1-40C7-8503-505C4D99BA12}.Release|Any CPU.ActiveCfg = Release|Any CPU {0E1E1C6C-8DB1-40C7-8503-505C4D99BA12}.Release|Any CPU.Build.0 = Release|Any CPU + {0FD11F7A-7D64-4B1F-8D45-9D9CFF050C4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0FD11F7A-7D64-4B1F-8D45-9D9CFF050C4A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0FD11F7A-7D64-4B1F-8D45-9D9CFF050C4A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0FD11F7A-7D64-4B1F-8D45-9D9CFF050C4A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/FunGame.Desktop/Controller/LoginController.cs b/FunGame.Desktop/Controller/LoginController.cs index eb38d11..8c01240 100644 --- a/FunGame.Desktop/Controller/LoginController.cs +++ b/FunGame.Desktop/Controller/LoginController.cs @@ -4,8 +4,6 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Common.Event; using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Core.Library.Exception; -using Milimoe.FunGame.Core.Library.SQLScript.Common; -using Milimoe.FunGame.Core.Library.SQLScript.Entity; using Milimoe.FunGame.Desktop.Library.Component; using Milimoe.FunGame.Desktop.Model; using Milimoe.FunGame.Desktop.UI; @@ -21,14 +19,13 @@ namespace Milimoe.FunGame.Desktop.Controller UIForm = form; } - public async Task LoginAccountAsync(string username, string password, string autokey = "", bool encrypt = true) + public async Task LoginAccountAsync(string username, string password, string autokey = "") { bool result = false; string msg = ""; try { - if (encrypt) password = password.Encrypt(username); LoginEventArgs args = new(username, password, autokey); if (OnBeforeLoginEvent(args)) @@ -98,12 +95,12 @@ namespace Milimoe.FunGame.Desktop.Controller try { DataRequest request = RunTime.NewLongRunningDataRequest(DataRequestType.Login_GetFindPasswordVerifyCode); - request.AddRequestData(ForgetVerifyCodes.Column_Username, username); - request.AddRequestData(ForgetVerifyCodes.Column_Email, email); + request.AddRequestData("username", username); + request.AddRequestData("email", email); if (verifycode.Trim() == "") { // 未发送verifycode,说明需要系统生成一个验证码 - request.AddRequestData(ForgetVerifyCodes.Column_ForgetVerifyCode, ""); + request.AddRequestData("forgetverifycode", ""); await request.SendRequestAsync(); if (request.Result == RequestResult.Success) { @@ -114,7 +111,7 @@ namespace Milimoe.FunGame.Desktop.Controller else { // 发送verifycode,需要验证 - request.AddRequestData(ForgetVerifyCodes.Column_ForgetVerifyCode, verifycode); + request.AddRequestData("forgetverifycode", verifycode); await request.SendRequestAsync(); if (request.Result == RequestResult.Success) { @@ -139,8 +136,8 @@ namespace Milimoe.FunGame.Desktop.Controller try { DataRequest request = RunTime.NewLongRunningDataRequest(DataRequestType.Login_UpdatePassword); - request.AddRequestData(UserQuery.Column_Username, username); - request.AddRequestData(UserQuery.Column_Password, password.Encrypt(username)); + request.AddRequestData("username", username); + request.AddRequestData("password", password); await request.SendRequestAsync(); if (request.Result == RequestResult.Success) { diff --git a/FunGame.Desktop/Controller/MainController.cs b/FunGame.Desktop/Controller/MainController.cs index 6576456..a5e87bf 100644 --- a/FunGame.Desktop/Controller/MainController.cs +++ b/FunGame.Desktop/Controller/MainController.cs @@ -222,13 +222,13 @@ namespace Milimoe.FunGame.Desktop.Controller try { - CreateRoomRequest.AddRequestData("roomtype", roomType); - CreateRoomRequest.AddRequestData("gamemoduleserver", gameModuleServer); - CreateRoomRequest.AddRequestData("gamemap", gameMap); + CreateRoomRequest.AddRequestData("roomType", roomType); + CreateRoomRequest.AddRequestData("gameModuleServer", gameModuleServer); + CreateRoomRequest.AddRequestData("gameMap", gameMap); CreateRoomRequest.AddRequestData("master", Usercfg.LoginUser); CreateRoomRequest.AddRequestData("password", password); - CreateRoomRequest.AddRequestData("isrank", isRank); - CreateRoomRequest.AddRequestData("maxusers", maxUsers); + CreateRoomRequest.AddRequestData("isRank", isRank); + CreateRoomRequest.AddRequestData("maxUsers", maxUsers); await CreateRoomRequest.SendRequestAsync(); if (CreateRoomRequest.Result == RequestResult.Success) { @@ -249,9 +249,9 @@ namespace Milimoe.FunGame.Desktop.Controller try { - MatchRoomRequest.AddRequestData("roomtype", roomType); + MatchRoomRequest.AddRequestData("roomType", roomType); MatchRoomRequest.AddRequestData("matcher", Usercfg.LoginUser); - MatchRoomRequest.AddRequestData("iscancel", isCancel); + MatchRoomRequest.AddRequestData("isCancel", isCancel); await MatchRoomRequest.SendRequestAsync(); if (MatchRoomRequest.Result == RequestResult.Success) { diff --git a/FunGame.Desktop/Controller/RegisterController.cs b/FunGame.Desktop/Controller/RegisterController.cs index d1e706f..ff6c275 100644 --- a/FunGame.Desktop/Controller/RegisterController.cs +++ b/FunGame.Desktop/Controller/RegisterController.cs @@ -24,7 +24,6 @@ namespace Milimoe.FunGame.Desktop.Controller try { - password = password.Encrypt(username); RegisterEventArgs RegEventArgs = new(username, password, email); Register.OnBeforeRegEvent(Register, RegEventArgs); RunTime.PluginLoader?.OnBeforeRegEvent(Register, RegEventArgs); diff --git a/FunGame.Desktop/FunGame.Desktop.csproj b/FunGame.Desktop/FunGame.Desktop.csproj index 6e4ff67..2a0db86 100644 --- a/FunGame.Desktop/FunGame.Desktop.csproj +++ b/FunGame.Desktop/FunGame.Desktop.csproj @@ -20,6 +20,7 @@ 1.0 1.0 Milimoe.$(MSBuildProjectName.Replace(" ", "_")) + True @@ -35,15 +36,10 @@ + - - - ..\..\FunGame.Core\bin\Debug\net9.0\FunGame.Core.dll - - - Component diff --git a/FunGame.Desktop/UI/Main/Main.Designer.cs b/FunGame.Desktop/UI/Main/Main.Designer.cs index 4dd061a..2597974 100644 --- a/FunGame.Desktop/UI/Main/Main.Designer.cs +++ b/FunGame.Desktop/UI/Main/Main.Designer.cs @@ -89,7 +89,7 @@ namespace Milimoe.FunGame.Desktop.UI // // Exit // - Exit.Anchor = AnchorStyles.None; + Exit.Anchor = AnchorStyles.Top | AnchorStyles.Right; Exit.BackColor = Color.White; Exit.BackgroundImage = Properties.Resources.exit; Exit.FlatAppearance.BorderColor = Color.White; @@ -110,7 +110,7 @@ namespace Milimoe.FunGame.Desktop.UI // // MinForm // - MinForm.Anchor = AnchorStyles.None; + MinForm.Anchor = AnchorStyles.Top | AnchorStyles.Right; MinForm.BackColor = Color.White; MinForm.BackgroundImage = Properties.Resources.min; MinForm.BackgroundImageLayout = ImageLayout.Center; @@ -131,6 +131,7 @@ namespace Milimoe.FunGame.Desktop.UI // // Connection // + Connection.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; Connection.BackColor = Color.Transparent; Connection.Font = new Font("LanaPixel", 12F); Connection.Location = new Point(649, 424); @@ -143,6 +144,7 @@ namespace Milimoe.FunGame.Desktop.UI // // Light // + Light.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; Light.BackColor = Color.Transparent; Light.Image = Properties.Resources.yellow; Light.Location = new Point(777, 426); @@ -152,7 +154,7 @@ namespace Milimoe.FunGame.Desktop.UI // // SendTalkText // - SendTalkText.Anchor = AnchorStyles.None; + SendTalkText.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; SendTalkText.BackColor = Color.Transparent; SendTalkText.BackgroundImage = Properties.Resources.send; SendTalkText.BackgroundImageLayout = ImageLayout.Center; @@ -172,6 +174,7 @@ namespace Milimoe.FunGame.Desktop.UI // TalkText // TalkText.AllowDrop = true; + TalkText.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; TalkText.Font = new Font("LanaPixel", 12.75F); TalkText.ForeColor = Color.DarkGray; TalkText.Location = new Point(317, 422); @@ -187,6 +190,7 @@ namespace Milimoe.FunGame.Desktop.UI // // StartMatch // + StartMatch.Anchor = AnchorStyles.Top | AnchorStyles.Right; StartMatch.Font = new Font("LanaPixel", 12F); StartMatch.Location = new Point(665, 214); StartMatch.Name = "StartMatch"; @@ -198,6 +202,7 @@ namespace Milimoe.FunGame.Desktop.UI // // RoomSetting // + RoomSetting.Anchor = AnchorStyles.Top | AnchorStyles.Right; RoomSetting.Font = new Font("LanaPixel", 12F); RoomSetting.Location = new Point(665, 254); RoomSetting.Name = "RoomSetting"; @@ -210,6 +215,7 @@ namespace Milimoe.FunGame.Desktop.UI // // Login // + Login.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; Login.Font = new Font("LanaPixel", 15.75F); Login.Location = new Point(665, 380); Login.Name = "Login"; @@ -221,6 +227,7 @@ namespace Milimoe.FunGame.Desktop.UI // // NowAccount // + NowAccount.Anchor = AnchorStyles.Top | AnchorStyles.Right; NowAccount.BackColor = Color.Transparent; NowAccount.Font = new Font("LanaPixel", 12F); NowAccount.Location = new Point(551, 9); @@ -232,6 +239,7 @@ namespace Milimoe.FunGame.Desktop.UI // // AccountSetting // + AccountSetting.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; AccountSetting.Font = new Font("LanaPixel", 12F); AccountSetting.Location = new Point(665, 342); AccountSetting.Name = "AccountSetting"; @@ -242,6 +250,7 @@ namespace Milimoe.FunGame.Desktop.UI // // About // + About.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; About.Font = new Font("LanaPixel", 12F); About.Location = new Point(733, 341); About.Name = "About"; @@ -252,6 +261,7 @@ namespace Milimoe.FunGame.Desktop.UI // // Room // + Room.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; Room.BackColor = Color.Transparent; Room.Font = new Font("LanaPixel", 12F); Room.Location = new Point(665, 293); @@ -264,6 +274,7 @@ namespace Milimoe.FunGame.Desktop.UI // RoomText // RoomText.AllowDrop = true; + RoomText.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; RoomText.Font = new Font("LanaPixel", 12F); RoomText.ForeColor = Color.DarkGray; RoomText.Location = new Point(6, 226); @@ -279,7 +290,7 @@ namespace Milimoe.FunGame.Desktop.UI // // PresetText // - PresetText.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + PresetText.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; PresetText.DropDownStyle = ComboBoxStyle.DropDownList; PresetText.Font = new Font("LanaPixel", 11.25F); PresetText.FormattingEnabled = true; @@ -292,13 +303,13 @@ namespace Milimoe.FunGame.Desktop.UI // // RoomBox // - RoomBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + RoomBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; RoomBox.BackColor = Color.Transparent; + RoomBox.Controls.Add(RoomList); RoomBox.Controls.Add(NowRoomID); RoomBox.Controls.Add(CopyRoomID); - RoomBox.Controls.Add(RoomList); - RoomBox.Controls.Add(RoomText); RoomBox.Controls.Add(QueryRoom); + RoomBox.Controls.Add(RoomText); RoomBox.Font = new Font("LanaPixel", 12F); RoomBox.Location = new Point(3, 56); RoomBox.Name = "RoomBox"; @@ -310,6 +321,7 @@ namespace Milimoe.FunGame.Desktop.UI // NowRoomID // NowRoomID.AllowDrop = true; + NowRoomID.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; NowRoomID.Font = new Font("LanaPixel", 12F); NowRoomID.ForeColor = Color.DarkGray; NowRoomID.Location = new Point(6, 226); @@ -323,6 +335,7 @@ namespace Milimoe.FunGame.Desktop.UI // // CopyRoomID // + CopyRoomID.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; CopyRoomID.Font = new Font("LanaPixel", 12F); CopyRoomID.Location = new Point(126, 225); CopyRoomID.Name = "CopyRoomID"; @@ -335,10 +348,9 @@ namespace Milimoe.FunGame.Desktop.UI // // RoomList // - RoomList.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + RoomList.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; RoomList.BorderStyle = BorderStyle.FixedSingle; RoomList.FormattingEnabled = true; - RoomList.ItemHeight = 19; RoomList.Location = new Point(0, 26); RoomList.Name = "RoomList"; RoomList.Size = new Size(186, 192); @@ -347,6 +359,7 @@ namespace Milimoe.FunGame.Desktop.UI // // QueryRoom // + QueryRoom.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; QueryRoom.Font = new Font("LanaPixel", 12F); QueryRoom.Location = new Point(126, 225); QueryRoom.Name = "QueryRoom"; @@ -358,6 +371,7 @@ namespace Milimoe.FunGame.Desktop.UI // // RefreshRoomList // + RefreshRoomList.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; RefreshRoomList.Font = new Font("LanaPixel", 12F); RefreshRoomList.Image = Properties.Resources.refresh; RefreshRoomList.Location = new Point(162, 248); @@ -369,7 +383,7 @@ namespace Milimoe.FunGame.Desktop.UI // // Notice // - Notice.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + Notice.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; Notice.BackColor = Color.Transparent; Notice.Controls.Add(NoticeText); Notice.Font = new Font("LanaPixel", 12F); @@ -382,7 +396,7 @@ namespace Milimoe.FunGame.Desktop.UI // // NoticeText // - NoticeText.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + NoticeText.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; NoticeText.BorderStyle = BorderStyle.None; NoticeText.EmptyTextTip = null; NoticeText.Location = new Point(6, 24); @@ -394,6 +408,7 @@ namespace Milimoe.FunGame.Desktop.UI // // InfoBox // + InfoBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; InfoBox.BackColor = Color.Transparent; InfoBox.Controls.Add(TransparentRectControl); InfoBox.Font = new Font("LanaPixel", 12F); @@ -435,8 +450,9 @@ namespace Milimoe.FunGame.Desktop.UI // // QuitRoom // + QuitRoom.Anchor = AnchorStyles.Top | AnchorStyles.Right; QuitRoom.Font = new Font("LanaPixel", 12F); - QuitRoom.Location = new Point(665, 212); + QuitRoom.Location = new Point(665, 213); QuitRoom.Name = "QuitRoom"; QuitRoom.Size = new Size(132, 35); QuitRoom.TabIndex = 9; @@ -447,6 +463,7 @@ namespace Milimoe.FunGame.Desktop.UI // // CreateRoom // + CreateRoom.Anchor = AnchorStyles.Top | AnchorStyles.Right; CreateRoom.Font = new Font("LanaPixel", 12F); CreateRoom.Location = new Point(666, 253); CreateRoom.Name = "CreateRoom"; @@ -458,6 +475,7 @@ namespace Milimoe.FunGame.Desktop.UI // // Logout // + Logout.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; Logout.Font = new Font("LanaPixel", 15.75F); Logout.Location = new Point(665, 380); Logout.Name = "Logout"; @@ -470,6 +488,7 @@ namespace Milimoe.FunGame.Desktop.UI // // CheckHasPass // + CheckHasPass.Anchor = AnchorStyles.Top | AnchorStyles.Right; CheckHasPass.BackColor = Color.Transparent; CheckHasPass.Font = new Font("LanaPixel", 12F); CheckHasPass.Location = new Point(737, 181); @@ -482,6 +501,7 @@ namespace Milimoe.FunGame.Desktop.UI // // Stock // + Stock.Anchor = AnchorStyles.Top | AnchorStyles.Right; Stock.Font = new Font("LanaPixel", 12F); Stock.Location = new Point(661, 56); Stock.Name = "Stock"; @@ -492,6 +512,7 @@ namespace Milimoe.FunGame.Desktop.UI // // Store // + Store.Anchor = AnchorStyles.Top | AnchorStyles.Right; Store.Font = new Font("LanaPixel", 12F); Store.Location = new Point(732, 56); Store.Name = "Store"; @@ -503,7 +524,7 @@ namespace Milimoe.FunGame.Desktop.UI // Copyright // Copyright.ActiveLinkColor = Color.FromArgb(0, 64, 64); - Copyright.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + Copyright.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; Copyright.BackColor = Color.Transparent; Copyright.Font = new Font("LanaPixel", 10.5F); Copyright.LinkArea = new LinkArea(6, 8); @@ -521,6 +542,7 @@ namespace Milimoe.FunGame.Desktop.UI // // StopMatch // + StopMatch.Anchor = AnchorStyles.Top | AnchorStyles.Right; StopMatch.Font = new Font("LanaPixel", 12F); StopMatch.Location = new Point(665, 213); StopMatch.Name = "StopMatch"; @@ -535,6 +557,7 @@ namespace Milimoe.FunGame.Desktop.UI // // CheckIsRank // + CheckIsRank.Anchor = AnchorStyles.Top | AnchorStyles.Right; CheckIsRank.BackColor = Color.Transparent; CheckIsRank.Enabled = false; CheckIsRank.Font = new Font("LanaPixel", 12F); @@ -548,7 +571,7 @@ namespace Milimoe.FunGame.Desktop.UI // // ComboRoomType // - ComboRoomType.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + ComboRoomType.Anchor = AnchorStyles.Top | AnchorStyles.Right; ComboRoomType.DropDownStyle = ComboBoxStyle.DropDownList; ComboRoomType.Font = new Font("LanaPixel", 11.25F); ComboRoomType.FormattingEnabled = true; @@ -561,7 +584,7 @@ namespace Milimoe.FunGame.Desktop.UI // // ComboGameModule // - ComboGameModule.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + ComboGameModule.Anchor = AnchorStyles.Top | AnchorStyles.Right; ComboGameModule.DropDownStyle = ComboBoxStyle.DropDownList; ComboGameModule.Font = new Font("LanaPixel", 11.25F); ComboGameModule.FormattingEnabled = true; @@ -574,7 +597,7 @@ namespace Milimoe.FunGame.Desktop.UI // // ComboGameMap // - ComboGameMap.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + ComboGameMap.Anchor = AnchorStyles.Top | AnchorStyles.Right; ComboGameMap.DropDownStyle = ComboBoxStyle.DropDownList; ComboGameMap.Font = new Font("LanaPixel", 11.25F); ComboGameMap.FormattingEnabled = true; @@ -589,21 +612,17 @@ namespace Milimoe.FunGame.Desktop.UI AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleMode = AutoScaleMode.Font; BackgroundImage = Properties.Resources.back; + BackgroundImageLayout = ImageLayout.Stretch; ClientSize = new Size(800, 450); Controls.Add(ComboGameMap); Controls.Add(ComboGameModule); Controls.Add(ComboRoomType); Controls.Add(CheckIsRank); Controls.Add(RefreshRoomList); - Controls.Add(StopMatch); Controls.Add(Copyright); Controls.Add(Store); Controls.Add(Stock); - Controls.Add(Logout); - Controls.Add(RoomSetting); - Controls.Add(QuitRoom); Controls.Add(InfoBox); - Controls.Add(CreateRoom); Controls.Add(Notice); Controls.Add(RoomBox); Controls.Add(PresetText); @@ -613,25 +632,36 @@ namespace Milimoe.FunGame.Desktop.UI Controls.Add(About); Controls.Add(AccountSetting); Controls.Add(NowAccount); - Controls.Add(Login); Controls.Add(CheckHasPass); - Controls.Add(StartMatch); Controls.Add(Light); Controls.Add(Connection); Controls.Add(MinForm); Controls.Add(Exit); + Controls.Add(Logout); + Controls.Add(Login); + Controls.Add(StartMatch); + Controls.Add(StopMatch); + Controls.Add(QuitRoom); + Controls.Add(RoomSetting); + Controls.Add(CreateRoom); Icon = (Icon)resources.GetObject("$this.Icon"); + MinimumSize = new Size(800, 450); Name = "Main"; StartPosition = FormStartPosition.CenterScreen; Text = "FunGame"; + Controls.SetChildIndex(CreateRoom, 0); + Controls.SetChildIndex(RoomSetting, 0); + Controls.SetChildIndex(QuitRoom, 0); + Controls.SetChildIndex(StopMatch, 0); + Controls.SetChildIndex(StartMatch, 0); + Controls.SetChildIndex(Login, 0); + Controls.SetChildIndex(Logout, 0); Controls.SetChildIndex(Exit, 0); Controls.SetChildIndex(Title, 0); Controls.SetChildIndex(MinForm, 0); Controls.SetChildIndex(Connection, 0); Controls.SetChildIndex(Light, 0); - Controls.SetChildIndex(StartMatch, 0); Controls.SetChildIndex(CheckHasPass, 0); - Controls.SetChildIndex(Login, 0); Controls.SetChildIndex(NowAccount, 0); Controls.SetChildIndex(AccountSetting, 0); Controls.SetChildIndex(About, 0); @@ -641,15 +671,10 @@ namespace Milimoe.FunGame.Desktop.UI Controls.SetChildIndex(PresetText, 0); Controls.SetChildIndex(RoomBox, 0); Controls.SetChildIndex(Notice, 0); - Controls.SetChildIndex(CreateRoom, 0); Controls.SetChildIndex(InfoBox, 0); - Controls.SetChildIndex(QuitRoom, 0); - Controls.SetChildIndex(RoomSetting, 0); - Controls.SetChildIndex(Logout, 0); Controls.SetChildIndex(Stock, 0); Controls.SetChildIndex(Store, 0); Controls.SetChildIndex(Copyright, 0); - Controls.SetChildIndex(StopMatch, 0); Controls.SetChildIndex(RefreshRoomList, 0); Controls.SetChildIndex(CheckIsRank, 0); Controls.SetChildIndex(ComboRoomType, 0); diff --git a/FunGame.Desktop/UI/Main/Main.cs b/FunGame.Desktop/UI/Main/Main.cs index cdc6a2e..890e1fb 100644 --- a/FunGame.Desktop/UI/Main/Main.cs +++ b/FunGame.Desktop/UI/Main/Main.cs @@ -35,6 +35,18 @@ namespace Milimoe.FunGame.Desktop.UI private int _MatchSeconds = 0; // 记录匹配房间的秒数 private bool _InGame = false; + private const int WM_NCHITTEST = 0x0084; + private const int HTCAPTION = 0x0002; + private const int HTLEFT = 0x000A; + private const int HTRIGHT = 0x000B; + private const int HTTOP = 0x000C; + private const int HTTOPLEFT = 0x000D; + private const int HTTOPRIGHT = 0x000E; + private const int HTBOTTOM = 0x000F; + private const int HTBOTTOMLEFT = 0x0010; + private const int HTBOTTOMRIGHT = 0x0011; + private const int borderWidth = 5; + public Main() { InitializeComponent(); @@ -46,8 +58,9 @@ namespace Milimoe.FunGame.Desktop.UI /// public void Init() { - Copyright.Text = FunGameInfo.FunGame_CopyRight; + Copyright.Text = FunGameInfo.FunGame_CopyRight_Desktop; RunTime.Main = this; + DoubleBuffered = true; SetButtonEnabled(false, ClientState.WaitConnect); SetRoomid(Usercfg.InRoom); // 房间号初始化 ShowFunGameInfo(); // 显示FunGame信息 @@ -332,6 +345,41 @@ namespace Milimoe.FunGame.Desktop.UI #region 实现 + protected override void WndProc(ref Message m) + { + base.WndProc(ref m); + + if (m.Msg == WM_NCHITTEST) + { + Point pos = new(m.LParam.ToInt32() & 0xffff, m.LParam.ToInt32() >> 16); + pos = this.PointToClient(pos); + + if (pos.X > borderWidth && pos.X < Width - borderWidth && pos.Y > borderWidth && pos.Y < Height - borderWidth) + { + // 鼠标在窗体内部,允许拖动 + m.Result = (IntPtr)HTCAPTION; + return; + } + + if (pos.X <= borderWidth && pos.Y <= borderWidth) + m.Result = (IntPtr)HTTOPLEFT; + else if (pos.X >= Width - borderWidth && pos.Y <= borderWidth) + m.Result = (IntPtr)HTTOPRIGHT; + else if (pos.X <= borderWidth && pos.Y >= Height - borderWidth) + m.Result = (IntPtr)HTBOTTOMLEFT; + else if (pos.X >= Width - borderWidth && pos.Y >= Height - borderWidth) + m.Result = (IntPtr)HTBOTTOMRIGHT; + else if (pos.X <= borderWidth) + m.Result = (IntPtr)HTLEFT; + else if (pos.X >= Width - borderWidth) + m.Result = (IntPtr)HTRIGHT; + else if (pos.Y <= borderWidth) + m.Result = (IntPtr)HTTOP; + else if (pos.Y >= Height - borderWidth) + m.Result = (IntPtr)HTBOTTOM; + } + } + /// /// 获取FunGame配置文件设定 /// @@ -496,10 +544,10 @@ namespace Milimoe.FunGame.Desktop.UI await Task.Delay(1000); } WritelnGameInfo("房间 [ " + room.Roomid + " (" + PlayerCount + "人" + RoomSet.GetTypeString(room.RoomType) + ") ] 的游戏正式开始!"); - if (RunTime.GameModuleLoader?.Modules.ContainsKey(room.GameModule) ?? false) + if (RunTime.GameModuleLoader != null && RunTime.GameModuleLoader.Modules.TryGetValue(room.GameModule, out GameModule? value) && value is GameModule module) { - RunTime.Gaming = Core.Model.Gaming.StartGame(RunTime.GameModuleLoader[room.GameModule], room, RunTime.Session.LoginUser, users, RunTime.GameModuleLoader); - Visible = false; // 隐藏主界面 + RunTime.Gaming = Core.Model.Gaming.StartGame(module, room, RunTime.Session.LoginUser, users, RunTime.GameModuleLoader); + Visible = !module.HideMain; // 隐藏主界面 } else { @@ -1004,7 +1052,7 @@ namespace Milimoe.FunGame.Desktop.UI private void ShowFunGameInfo() { WritelnGameInfo(FunGameInfo.GetInfo(Constant.FunGameType)); - Title.Text = FunGameInfo.FunGame_Desktop + " " + FunGameInfo.FunGame_Version + " " + FunGameInfo.FunGame_VersionPatch; + Title.Text = FunGameInfo.FunGame_Desktop + " v" + FunGameInfo.FunGame_Version; } /// diff --git a/FunGame.Desktop/UI/Main/Main.resx b/FunGame.Desktop/UI/Main/Main.resx index 20fd9d4..046f374 100644 --- a/FunGame.Desktop/UI/Main/Main.resx +++ b/FunGame.Desktop/UI/Main/Main.resx @@ -1,7 +1,7 @@