在首页上添加了一个刷新房间的图标 (#17)

This commit is contained in:
milimoe 2023-09-13 21:27:36 +08:00 committed by GitHub
parent 09862b47fc
commit d5a5425fcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 145 additions and 40 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -130,6 +130,16 @@ namespace Milimoe.FunGame.Desktop.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap refresh {
get {
object obj = ResourceManager.GetObject("refresh", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>

View File

@ -118,31 +118,34 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="back" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\back.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="exit" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\exit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="green" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="LanaPixel" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LanaPixel.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="min" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\min.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="send" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\send.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="green" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="back" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\back.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="yellow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\yellow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="LanaPixel" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LanaPixel.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="min" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\min.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="refresh" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\refresh.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -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;
}
}

View File

@ -456,6 +456,7 @@ namespace Milimoe.FunGame.Desktop.UI
AccountSetting.Enabled = isLogon;
Stock.Enabled = isLogon;
Store.Enabled = isLogon;
RefreshRoomList.Enabled = isLogon;
}
/// <summary>
@ -1004,7 +1005,7 @@ namespace Milimoe.FunGame.Desktop.UI
/// <param name="e"></param>
private void QueryRoom_Click(object sender, EventArgs e)
{
TaskUtility.StartAndAwaitTask(async() => await JoinRoom(false, RoomText.Text));
TaskUtility.StartAndAwaitTask(async () => await JoinRoom(false, RoomText.Text));
}
/// <summary>
@ -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
/// <param name="e"></param>
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 });
}
/// <summary>
@ -1199,6 +1200,22 @@ namespace Milimoe.FunGame.Desktop.UI
}
}
/// <summary>
/// 刷新房间列表
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RefreshRoomList_Click(object sender, EventArgs e)
{
TaskUtility.StartAndAwaitTask(async () =>
{
if (MainController != null)
{
await MainController.UpdateRoomAsync();
}
});
}
/// <summary>
/// 关闭主界面
/// </summary>
@ -1341,7 +1358,7 @@ namespace Milimoe.FunGame.Desktop.UI
{
// 先退出登录再断开连接
bool SuccessLogOut = false;
TaskUtility.StartAndAwaitTask(async() =>
TaskUtility.StartAndAwaitTask(async () =>
{
if (await LogOut()) SuccessLogOut = true;
}).OnCompleted(() =>

View File

@ -1,4 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">