From d5a5425fcc211c27d4fb85df833b24aff2a36423 Mon Sep 17 00:00:00 2001 From: milimoe <110188673+milimoe@users.noreply.github.com> Date: Wed, 13 Sep 2023 21:27:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E9=A6=96=E9=A1=B5=E4=B8=8A=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E4=B8=80=E4=B8=AA=E5=88=B7=E6=96=B0=E6=88=BF?= =?UTF-8?q?=E9=97=B4=E7=9A=84=E5=9B=BE=E6=A0=87=20(#17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FunGame.Desktop/Images/refresh.png | Bin 0 -> 1966 bytes .../Properties/Resources.Designer.cs | 10 +++ FunGame.Desktop/Properties/Resources.resx | 33 +++++----- FunGame.Desktop/UI/Main/Main.Designer.cs | 53 ++++++++++------ FunGame.Desktop/UI/Main/Main.cs | 29 +++++++-- FunGame.Desktop/UI/Main/Main.resx | 60 ++++++++++++++++++ 6 files changed, 145 insertions(+), 40 deletions(-) create mode 100644 FunGame.Desktop/Images/refresh.png diff --git a/FunGame.Desktop/Images/refresh.png b/FunGame.Desktop/Images/refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..0aa9cb39f239b8b34269cb6104a81a56dc56553a GIT binary patch literal 1966 zcmcIleQXnD94=^qZ2@CI1*7piFtEV&K6~w*D=^xPRoBs!0%JGZR0M+}24)7BMHeSQGrtmMkm!4DSBU}KKVEWo@4fHy zKELPp@&0aWxMtk4q<|$LnN(6W`HTLFAwzSO>CT36leB zvJz{a3^WwtgQ{r>ssw@o9|}de6h-DKw-9(sEn_mx&=?bg50Rn(MgfZRa1sz>Am=4yTV*Kl z!-f`9l5oL{tXzQvEBq|Uu`EWpNW1Kz3@ETlF=39I z^9N})XvmL}3X-i(UXbiV;X@_68UPfOn^vw9=E*sf+n-JVNP3eh$-zu5W~BuKl*eI8 z{<8}48;LiCrkhKjT!s9P((_@J5`r2Bu*2f0?F?@BqFhq&f9ET^c1_=!fWu~J4+~uw zeiZsRP$9JeyY$ZD&IcThDN-;{9GIny&vx%mfuV|yNBN1 zweyu1kk)z5!Pb(C(LOJ8VRy8_yt85NqS4_EMS~;Tqt7nQEI5C4?5Z(#;ZWz<-qg_N zYhU}Tq`mW=t)F&xE(yrW;2um z!RH5@W#@X1%cu7^jywC?AN=k7eY2h({cz7bW%l6UlLMuDCH|$8#&gR0%WU1;r=*Se zf?(vfqd&jH>^iaL%dyM&7UacS4i3x< + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap refresh { + get { + object obj = ResourceManager.GetObject("refresh", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// diff --git a/FunGame.Desktop/Properties/Resources.resx b/FunGame.Desktop/Properties/Resources.resx index f2aec2b..525f73a 100644 --- a/FunGame.Desktop/Properties/Resources.resx +++ b/FunGame.Desktop/Properties/Resources.resx @@ -118,31 +118,34 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Images\back.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Images\exit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Images\green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\LanaPixel.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Images\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Images\min.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Images\red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Images\send.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Images\green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\back.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Images\yellow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\LanaPixel.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Images\min.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\refresh.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/FunGame.Desktop/UI/Main/Main.Designer.cs b/FunGame.Desktop/UI/Main/Main.Designer.cs index 3a325d2..45a3cf9 100644 --- a/FunGame.Desktop/UI/Main/Main.Designer.cs +++ b/FunGame.Desktop/UI/Main/Main.Designer.cs @@ -55,6 +55,7 @@ namespace Milimoe.FunGame.Desktop.UI CopyRoomID = new Button(); RoomList = new ListBox(); QueryRoom = new Button(); + RefreshRoomList = new Button(); Notice = new GroupBox(); NoticeText = new TextArea(); InfoBox = new GroupBox(); @@ -100,7 +101,7 @@ namespace Milimoe.FunGame.Desktop.UI Exit.Name = "Exit"; Exit.RelativeForm = null; Exit.Size = new Size(47, 47); - Exit.TabIndex = 15; + Exit.TabIndex = 16; Exit.TextAlign = ContentAlignment.TopLeft; Exit.UseVisualStyleBackColor = false; Exit.Click += Exit_Click; @@ -122,7 +123,7 @@ namespace Milimoe.FunGame.Desktop.UI MinForm.Name = "MinForm"; MinForm.RelativeForm = this; MinForm.Size = new Size(47, 47); - MinForm.TabIndex = 14; + MinForm.TabIndex = 15; MinForm.TextAlign = ContentAlignment.TopLeft; MinForm.UseVisualStyleBackColor = false; // @@ -161,7 +162,7 @@ namespace Milimoe.FunGame.Desktop.UI SendTalkText.Location = new Point(608, 421); SendTalkText.Name = "SendTalkText"; SendTalkText.Size = new Size(51, 27); - SendTalkText.TabIndex = 3; + SendTalkText.TabIndex = 4; SendTalkText.TextAlign = ContentAlignment.TopLeft; SendTalkText.UseVisualStyleBackColor = false; SendTalkText.Click += SendTalkText_Click; @@ -174,7 +175,7 @@ namespace Milimoe.FunGame.Desktop.UI TalkText.Location = new Point(317, 422); TalkText.Name = "TalkText"; TalkText.Size = new Size(289, 26); - TalkText.TabIndex = 2; + TalkText.TabIndex = 3; TalkText.Text = "向消息队列发送消息..."; TalkText.WordWrap = false; TalkText.Click += TalkText_ClickAndFocused; @@ -200,7 +201,7 @@ namespace Milimoe.FunGame.Desktop.UI CheckMix.Location = new Point(675, 94); CheckMix.Name = "CheckMix"; CheckMix.Size = new Size(123, 24); - CheckMix.TabIndex = 6; + CheckMix.TabIndex = 7; CheckMix.Text = "混战模式房间"; CheckMix.TextAlign = ContentAlignment.BottomLeft; CheckMix.UseVisualStyleBackColor = false; @@ -213,7 +214,7 @@ namespace Milimoe.FunGame.Desktop.UI CheckTeam.Location = new Point(675, 124); CheckTeam.Name = "CheckTeam"; CheckTeam.Size = new Size(123, 24); - CheckTeam.TabIndex = 7; + CheckTeam.TabIndex = 8; CheckTeam.Text = "团队模式房间"; CheckTeam.TextAlign = ContentAlignment.BottomLeft; CheckTeam.UseVisualStyleBackColor = false; @@ -225,7 +226,7 @@ namespace Milimoe.FunGame.Desktop.UI RoomSetting.Location = new Point(665, 225); RoomSetting.Name = "RoomSetting"; RoomSetting.Size = new Size(132, 35); - RoomSetting.TabIndex = 10; + RoomSetting.TabIndex = 11; RoomSetting.Text = "房间设置"; RoomSetting.UseVisualStyleBackColor = true; RoomSetting.Visible = false; @@ -259,7 +260,7 @@ namespace Milimoe.FunGame.Desktop.UI AccountSetting.Location = new Point(665, 317); AccountSetting.Name = "AccountSetting"; AccountSetting.Size = new Size(65, 32); - AccountSetting.TabIndex = 11; + AccountSetting.TabIndex = 12; AccountSetting.Text = "设置"; AccountSetting.UseVisualStyleBackColor = true; // @@ -269,7 +270,7 @@ namespace Milimoe.FunGame.Desktop.UI About.Location = new Point(732, 317); About.Name = "About"; About.Size = new Size(65, 32); - About.TabIndex = 12; + About.TabIndex = 13; About.Text = "关于"; About.UseVisualStyleBackColor = true; // @@ -310,7 +311,7 @@ namespace Milimoe.FunGame.Desktop.UI PresetText.Location = new Point(195, 422); PresetText.Name = "PresetText"; PresetText.Size = new Size(121, 26); - PresetText.TabIndex = 1; + PresetText.TabIndex = 2; PresetText.SelectedIndexChanged += PresetText_SelectedIndexChanged; // // RoomBox @@ -339,10 +340,10 @@ namespace Milimoe.FunGame.Desktop.UI NowRoomID.Name = "NowRoomID"; NowRoomID.ReadOnly = true; NowRoomID.Size = new Size(114, 25); - NowRoomID.TabIndex = 3; + NowRoomID.TabIndex = 1; NowRoomID.Text = "1919810"; - NowRoomID.WordWrap = false; NowRoomID.Visible = false; + NowRoomID.WordWrap = false; // // CopyRoomID // @@ -350,10 +351,10 @@ namespace Milimoe.FunGame.Desktop.UI CopyRoomID.Location = new Point(126, 225); CopyRoomID.Name = "CopyRoomID"; CopyRoomID.Size = new Size(51, 27); - CopyRoomID.TabIndex = 4; + CopyRoomID.TabIndex = 2; CopyRoomID.Text = "复制"; - CopyRoomID.Visible = false; CopyRoomID.UseVisualStyleBackColor = true; + CopyRoomID.Visible = false; CopyRoomID.Click += CopyRoomID_Click; // // RoomList @@ -379,6 +380,17 @@ namespace Milimoe.FunGame.Desktop.UI QueryRoom.UseVisualStyleBackColor = true; QueryRoom.Click += QueryRoom_Click; // + // RefreshRoomList + // + RefreshRoomList.Font = new Font("LanaPixel", 12F, FontStyle.Regular, GraphicsUnit.Point); + RefreshRoomList.Image = Properties.Resources.refresh; + RefreshRoomList.Location = new Point(162, 248); + RefreshRoomList.Name = "RefreshRoomList"; + RefreshRoomList.Size = new Size(24, 24); + RefreshRoomList.TabIndex = 1; + RefreshRoomList.UseVisualStyleBackColor = true; + RefreshRoomList.Click += RefreshRoomList_Click; + // // Notice // Notice.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; @@ -474,7 +486,7 @@ namespace Milimoe.FunGame.Desktop.UI Logout.Location = new Point(665, 380); Logout.Name = "Logout"; Logout.Size = new Size(132, 39); - Logout.TabIndex = 13; + Logout.TabIndex = 14; Logout.Text = "退出登录"; Logout.UseVisualStyleBackColor = true; Logout.Visible = false; @@ -487,7 +499,7 @@ namespace Milimoe.FunGame.Desktop.UI CheckHasPass.Location = new Point(675, 154); CheckHasPass.Name = "CheckHasPass"; CheckHasPass.Size = new Size(123, 24); - CheckHasPass.TabIndex = 8; + CheckHasPass.TabIndex = 9; CheckHasPass.Text = "带密码的房间"; CheckHasPass.TextAlign = ContentAlignment.BottomLeft; CheckHasPass.UseVisualStyleBackColor = false; @@ -499,7 +511,7 @@ namespace Milimoe.FunGame.Desktop.UI Stock.Location = new Point(661, 56); Stock.Name = "Stock"; Stock.Size = new Size(65, 32); - Stock.TabIndex = 4; + Stock.TabIndex = 5; Stock.Text = "库存"; Stock.UseVisualStyleBackColor = true; // @@ -509,7 +521,7 @@ namespace Milimoe.FunGame.Desktop.UI Store.Location = new Point(732, 56); Store.Name = "Store"; Store.Size = new Size(65, 32); - Store.TabIndex = 5; + Store.TabIndex = 6; Store.Text = "商店"; Store.UseVisualStyleBackColor = true; // @@ -538,7 +550,7 @@ namespace Milimoe.FunGame.Desktop.UI StopMatch.Location = new Point(665, 184); StopMatch.Name = "StopMatch"; StopMatch.Size = new Size(132, 35); - StopMatch.TabIndex = 9; + StopMatch.TabIndex = 10; StopMatch.Text = "停止匹配"; StopMatch.UseVisualStyleBackColor = true; StopMatch.Visible = false; @@ -550,6 +562,7 @@ namespace Milimoe.FunGame.Desktop.UI AutoScaleMode = AutoScaleMode.Font; BackgroundImage = Properties.Resources.back; ClientSize = new Size(800, 450); + Controls.Add(RefreshRoomList); Controls.Add(StopMatch); Controls.Add(Copyright); Controls.Add(Store); @@ -609,6 +622,7 @@ namespace Milimoe.FunGame.Desktop.UI Controls.SetChildIndex(Store, 0); Controls.SetChildIndex(Copyright, 0); Controls.SetChildIndex(StopMatch, 0); + Controls.SetChildIndex(RefreshRoomList, 0); RoomBox.ResumeLayout(false); RoomBox.PerformLayout(); Notice.ResumeLayout(false); @@ -655,5 +669,6 @@ namespace Milimoe.FunGame.Desktop.UI private Library.Component.TransparentRect TransparentRectControl; private TextBox NowRoomID; private Button CopyRoomID; + private Button RefreshRoomList; } } \ No newline at end of file diff --git a/FunGame.Desktop/UI/Main/Main.cs b/FunGame.Desktop/UI/Main/Main.cs index e2ea379..224da55 100644 --- a/FunGame.Desktop/UI/Main/Main.cs +++ b/FunGame.Desktop/UI/Main/Main.cs @@ -456,6 +456,7 @@ namespace Milimoe.FunGame.Desktop.UI AccountSetting.Enabled = isLogon; Stock.Enabled = isLogon; Store.Enabled = isLogon; + RefreshRoomList.Enabled = isLogon; } /// @@ -1004,7 +1005,7 @@ namespace Milimoe.FunGame.Desktop.UI /// private void QueryRoom_Click(object sender, EventArgs e) { - TaskUtility.StartAndAwaitTask(async() => await JoinRoom(false, RoomText.Text)); + TaskUtility.StartAndAwaitTask(async () => await JoinRoom(false, RoomText.Text)); } /// @@ -1056,7 +1057,7 @@ namespace Milimoe.FunGame.Desktop.UI { if (RoomList.SelectedItem != null) { - TaskUtility.StartAndAwaitTask(async() => await JoinRoom(true, RoomList.SelectedItem.ToString() ?? "")); + TaskUtility.StartAndAwaitTask(async () => await JoinRoom(true, RoomList.SelectedItem.ToString() ?? "")); } } @@ -1128,7 +1129,7 @@ namespace Milimoe.FunGame.Desktop.UI if (e.KeyCode.Equals(Keys.Enter)) { // 按下回车加入房间 - TaskUtility.StartAndAwaitTask(async() => await JoinRoom(false, RoomText.Text)); + TaskUtility.StartAndAwaitTask(async () => await JoinRoom(false, RoomText.Text)); } } @@ -1178,8 +1179,8 @@ namespace Milimoe.FunGame.Desktop.UI /// private void Copyright_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - // Copyright 2023 mili.cyou - Process.Start(new ProcessStartInfo("https://mili.cyou/fungame") { UseShellExecute = true }); + // Copyright 2023 milimoe + Process.Start(new ProcessStartInfo("https://github.com/milimoe") { UseShellExecute = true }); } /// @@ -1199,6 +1200,22 @@ namespace Milimoe.FunGame.Desktop.UI } } + /// + /// 刷新房间列表 + /// + /// + /// + private void RefreshRoomList_Click(object sender, EventArgs e) + { + TaskUtility.StartAndAwaitTask(async () => + { + if (MainController != null) + { + await MainController.UpdateRoomAsync(); + } + }); + } + /// /// 关闭主界面 /// @@ -1341,7 +1358,7 @@ namespace Milimoe.FunGame.Desktop.UI { // 先退出登录再断开连接 bool SuccessLogOut = false; - TaskUtility.StartAndAwaitTask(async() => + TaskUtility.StartAndAwaitTask(async () => { if (await LogOut()) SuccessLogOut = true; }).OnCompleted(() => diff --git a/FunGame.Desktop/UI/Main/Main.resx b/FunGame.Desktop/UI/Main/Main.resx index 59b2420..149e115 100644 --- a/FunGame.Desktop/UI/Main/Main.resx +++ b/FunGame.Desktop/UI/Main/Main.resx @@ -1,4 +1,64 @@ + +