Update Project
12
FunGame.Core.Api/FunGame.Core.Api.csproj
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<BaseOutputPath>..\bin</BaseOutputPath>
|
||||||
|
<Company>Milimoe</Company>
|
||||||
|
<Authors>Milimoe</Authors>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -4,10 +4,10 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Core.Interface
|
namespace FunGame.Core.Api.Interface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 接口需要在FunGame.Core.Implement中创建新的类实现
|
* 接口需要在FunGame.Core项目中Implement文件夹创建新的类实现
|
||||||
* 参考:
|
* 参考:
|
||||||
* using FunGame.Core.Interface;
|
* using FunGame.Core.Interface;
|
||||||
|
|
||||||
@ -28,7 +28,6 @@ namespace FunGame.Core.Interface
|
|||||||
|
|
||||||
public interface ServerInterface
|
public interface ServerInterface
|
||||||
{
|
{
|
||||||
// 实现类:ServerInterfaceImpl
|
|
||||||
public string RemoteServerIP();
|
public string RemoteServerIP();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public class ActiveItem : Item
|
public class ActiveItem : Item
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public class ActiveSkill : Skill
|
public class ActiveSkill : Skill
|
||||||
{
|
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public class Character
|
public class Character
|
||||||
{
|
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public class CharacterStatistics
|
public class CharacterStatistics
|
||||||
{
|
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public class GameStatistics
|
public class GameStatistics
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public abstract class Item
|
public abstract class Item
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public class PassiveItem : Item
|
public class PassiveItem : Item
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public class PassiveSkill : Skill
|
public class PassiveSkill : Skill
|
||||||
{
|
{
|
@ -6,7 +6,7 @@ using System.Security.Policy;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public class Room
|
public class Room
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public abstract class Skill
|
public abstract class Skill
|
||||||
{
|
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public class Stock
|
public class Stock
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Entity
|
namespace FunGame.Core.Api.Model.Entity
|
||||||
{
|
{
|
||||||
public class UserStatistics
|
public class UserStatistics
|
||||||
{
|
{
|
97
FunGame.Core.Api/Model/Enum/CommonEnums.cs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FunGame.Core.Api.Model.Enum
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 这里存放框架实现相关的State Type Result Method
|
||||||
|
/// 添加FunGame.Core.Api接口和实现时,需要在这里同步添加:InterfaceType和InterfaceMethod
|
||||||
|
/// </summary>
|
||||||
|
public static class CommonEnums
|
||||||
|
{
|
||||||
|
#region State
|
||||||
|
|
||||||
|
public enum StartMatch_State
|
||||||
|
{
|
||||||
|
Matching = 1,
|
||||||
|
Success = 2,
|
||||||
|
Enable = 3,
|
||||||
|
Cancel = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CreateRoom_State
|
||||||
|
{
|
||||||
|
Creating = 1,
|
||||||
|
Success = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum RoomState
|
||||||
|
{
|
||||||
|
Created = 1,
|
||||||
|
Gaming = 2,
|
||||||
|
Close = 3,
|
||||||
|
Complete = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum OnlineState
|
||||||
|
{
|
||||||
|
Offline = 1,
|
||||||
|
Online = 2,
|
||||||
|
Matching = 3,
|
||||||
|
InRoom = 4,
|
||||||
|
Gaming = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Type
|
||||||
|
|
||||||
|
public enum RoomType
|
||||||
|
{
|
||||||
|
Mix = 1,
|
||||||
|
Team = 2,
|
||||||
|
MixHasPass = 3,
|
||||||
|
TeamHasPass = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum InterfaceType
|
||||||
|
{
|
||||||
|
ServerInterface = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Result
|
||||||
|
|
||||||
|
public enum MessageResult
|
||||||
|
{
|
||||||
|
OK = 1,
|
||||||
|
Cancel = 2,
|
||||||
|
Yes = 3,
|
||||||
|
No = 4,
|
||||||
|
Retry = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Method
|
||||||
|
|
||||||
|
public enum WebHelperMethod
|
||||||
|
{
|
||||||
|
CreateSocket = 1,
|
||||||
|
CloseSocket = 2,
|
||||||
|
StartWebHelper = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum InterfaceMethod
|
||||||
|
{
|
||||||
|
GetServerIP = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Enum
|
namespace FunGame.Core.Api.Model.Enum
|
||||||
{
|
{
|
||||||
public static class SocketEnums
|
public static class SocketEnums
|
||||||
{
|
{
|
@ -4,16 +4,15 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using FunGame.Models.Config;
|
|
||||||
using FunGame.Models.Enum;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using FunGame.Core.Api.Model.Enum;
|
||||||
|
|
||||||
namespace FunGame.Utils.DataHelper
|
namespace FunGame.Core.Api.Util
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 在FunGame.Core中添加新接口和新实现时,需要:
|
/// 在FunGame.Core.Api中添加新接口和新实现时,需要:
|
||||||
/// 1、在这里定义类名和方法名
|
/// 1、在这里定义类名和方法名
|
||||||
/// 2、在FunGame.Models.Enum.CommonEnums里同步添加InterfaceType和InterfaceMethod
|
/// 2、在FunGame.Core.Api.Model.Enum.CommonEnums里同步添加InterfaceType和InterfaceMethod
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AssemblyHelper
|
public class AssemblyHelper
|
||||||
{
|
{
|
||||||
@ -22,13 +21,26 @@ namespace FunGame.Utils.DataHelper
|
|||||||
*/
|
*/
|
||||||
public const string ServerInterface = "ServerInterface";
|
public const string ServerInterface = "ServerInterface";
|
||||||
|
|
||||||
public const string Implement = "Impl"; // 实现类的后缀(无需修改)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定义方法名
|
* 定义方法名
|
||||||
*/
|
*/
|
||||||
public const string GetRemoteServerIP = "RemoteServerIP";
|
public const string GetRemoteServerIP = "RemoteServerIP";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义需要反射的DLL
|
||||||
|
*/
|
||||||
|
public const string FUNGAME_CORE = "FunGame.Core";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无需二次修改的
|
||||||
|
*/
|
||||||
|
public const string Implement = "Impl"; // 实现类的后缀
|
||||||
|
public static string PluginDocPath = System.Diagnostics.Process.GetCurrentProcess() + "/plugins/"; // 插件目录,反射插件DLL需要用LoadFile()方法
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
/////////////// * 下 面 是 工 具 类 实 现 * ////////////////
|
||||||
|
///////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定义反射变量
|
* 定义反射变量
|
||||||
*/
|
*/
|
||||||
@ -78,9 +90,15 @@ namespace FunGame.Utils.DataHelper
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取FUNGAME.CORE.DLL中指定方法的返回值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Interface">接口代号</param>
|
||||||
|
/// <param name="Method">方法代号</param>
|
||||||
|
/// <returns></returns>
|
||||||
public object? GetFunGameCoreValue(int Interface, int Method)
|
public object? GetFunGameCoreValue(int Interface, int Method)
|
||||||
{
|
{
|
||||||
Assembly = Assembly.LoadFile(System.Windows.Forms.Application.StartupPath + @"FunGame.Core.dll"); // 要绝对路径
|
Assembly = Assembly.Load(@FUNGAME_CORE);
|
||||||
Type = GetFunGameCoreImplement(Interface); // 通过类名获取获取命名空间+类名称
|
Type = GetFunGameCoreImplement(Interface); // 通过类名获取获取命名空间+类名称
|
||||||
string MethodName = GetMethodName(Method); // 获取方法名
|
string MethodName = GetMethodName(Method); // 获取方法名
|
||||||
if (Assembly != null && Type != null) this.Method = Type.GetMethod(MethodName); // 从Type中查找方法名
|
if (Assembly != null && Type != null) this.Method = Type.GetMethod(MethodName); // 从Type中查找方法名
|
@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Utils.DataHelper
|
namespace FunGame.Core.Api.Util
|
||||||
{
|
{
|
||||||
public class INIHelper
|
public class INIHelper
|
||||||
{
|
{
|
@ -6,10 +6,15 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Company>Milimoe</Company>
|
<Company>Milimoe</Company>
|
||||||
<BaseOutputPath>..\bin</BaseOutputPath>
|
<BaseOutputPath>..\bin</BaseOutputPath>
|
||||||
|
<Authors>Milimoe</Authors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Implement\" />
|
<Folder Include="Implement\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\FunGame.Core.Api\FunGame.Core.Api.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -41,6 +41,11 @@
|
|||||||
<Folder Include="UI\Store\" />
|
<Folder Include="UI\Store\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\FunGame.Core.Api\FunGame.Core.Api.csproj" />
|
||||||
|
<ProjectReference Include="..\FunGame.Core\FunGame.Core.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="Images\logo.ico">
|
<None Update="Images\logo.ico">
|
||||||
<Pack>True</Pack>
|
<Pack>True</Pack>
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
@ -1,4 +1,4 @@
|
|||||||
namespace FunGame.Models.Component
|
namespace FunGame.Desktop.Models.Component
|
||||||
{
|
{
|
||||||
partial class ExitButton
|
partial class ExitButton
|
||||||
{
|
{
|
@ -6,7 +6,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Component
|
namespace FunGame.Desktop.Models.Component
|
||||||
{
|
{
|
||||||
public partial class ExitButton : Button
|
public partial class ExitButton : Button
|
||||||
{
|
{
|
||||||
@ -15,7 +15,7 @@ namespace FunGame.Models.Component
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Anchor = System.Windows.Forms.AnchorStyles.None;
|
Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
BackColor = System.Drawing.Color.White;
|
BackColor = System.Drawing.Color.White;
|
||||||
BackgroundImage = global::FunGame.Properties.Resources.exit;
|
BackgroundImage = global::FunGame.Desktop.Properties.Resources.exit;
|
||||||
FlatAppearance.BorderColor = System.Drawing.Color.White;
|
FlatAppearance.BorderColor = System.Drawing.Color.White;
|
||||||
FlatAppearance.BorderSize = 0;
|
FlatAppearance.BorderSize = 0;
|
||||||
FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
|
FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
|
||||||
@ -35,7 +35,7 @@ namespace FunGame.Models.Component
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Anchor = System.Windows.Forms.AnchorStyles.None;
|
Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
BackColor = System.Drawing.Color.White;
|
BackColor = System.Drawing.Color.White;
|
||||||
BackgroundImage = global::FunGame.Properties.Resources.exit;
|
BackgroundImage = global::FunGame.Desktop.Properties.Resources.exit;
|
||||||
FlatAppearance.BorderColor = System.Drawing.Color.White;
|
FlatAppearance.BorderColor = System.Drawing.Color.White;
|
||||||
FlatAppearance.BorderSize = 0;
|
FlatAppearance.BorderSize = 0;
|
||||||
FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
|
FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
|
@ -1,4 +1,4 @@
|
|||||||
namespace FunGame.Models.Component
|
namespace FunGame.Desktop.Models.Component
|
||||||
{
|
{
|
||||||
partial class ShowMessage
|
partial class ShowMessage
|
||||||
{
|
{
|
||||||
@ -32,11 +32,11 @@
|
|||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShowMessage));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShowMessage));
|
||||||
this.MsgText = new System.Windows.Forms.Label();
|
this.MsgText = new System.Windows.Forms.Label();
|
||||||
this.LeftButton = new System.Windows.Forms.Button();
|
this.LeftButton = new System.Windows.Forms.Button();
|
||||||
this.Exit = new FunGame.Models.Component.ExitButton(this.components);
|
this.Exit = new FunGame.Desktop.Models.Component.ExitButton(this.components);
|
||||||
this.RightButton = new System.Windows.Forms.Button();
|
this.RightButton = new System.Windows.Forms.Button();
|
||||||
this.MidButton = new System.Windows.Forms.Button();
|
this.MidButton = new System.Windows.Forms.Button();
|
||||||
this.Title = new System.Windows.Forms.Label();
|
this.Title = new System.Windows.Forms.Label();
|
||||||
this.TransparentRect = new FunGame.Models.TransparentRect();
|
this.TransparentRect = new FunGame.Desktop.Models.Component.TransparentRect();
|
||||||
this.TransparentRect.SuspendLayout();
|
this.TransparentRect.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -129,7 +129,7 @@
|
|||||||
this.TransparentRect.Name = "TransparentRect";
|
this.TransparentRect.Name = "TransparentRect";
|
||||||
this.TransparentRect.Opacity = 125;
|
this.TransparentRect.Opacity = 125;
|
||||||
this.TransparentRect.Radius = 20;
|
this.TransparentRect.Radius = 20;
|
||||||
this.TransparentRect.ShapeBorderStyle = FunGame.Models.TransparentRect.ShapeBorderStyles.ShapeBSNone;
|
this.TransparentRect.ShapeBorderStyle = FunGame.Desktop.Models.Component.TransparentRect.ShapeBorderStyles.ShapeBSNone;
|
||||||
this.TransparentRect.Size = new System.Drawing.Size(235, 170);
|
this.TransparentRect.Size = new System.Drawing.Size(235, 170);
|
||||||
this.TransparentRect.TabIndex = 103;
|
this.TransparentRect.TabIndex = 103;
|
||||||
this.TransparentRect.TabStop = false;
|
this.TransparentRect.TabStop = false;
|
@ -7,9 +7,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using FunGame.Models.Enum;
|
using FunGame.Desktop.Models.Enum;
|
||||||
|
|
||||||
namespace FunGame.Models.Component
|
namespace FunGame.Desktop.Models.Component
|
||||||
{
|
{
|
||||||
public partial class ShowMessage : Form
|
public partial class ShowMessage : Form
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace FunGame.Models
|
namespace FunGame.Desktop.Models.Component
|
||||||
{
|
{
|
||||||
partial class TextArea
|
partial class TextArea
|
||||||
{
|
{
|
@ -8,7 +8,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace FunGame.Models
|
namespace FunGame.Desktop.Models.Component
|
||||||
{
|
{
|
||||||
[ToolboxBitmap(typeof(TextBox))]
|
[ToolboxBitmap(typeof(TextBox))]
|
||||||
partial class TextArea : RichTextBox
|
partial class TextArea : RichTextBox
|
@ -1,4 +1,4 @@
|
|||||||
namespace FunGame.Models
|
namespace FunGame.Desktop.Models.Component
|
||||||
{
|
{
|
||||||
partial class TransparentRect
|
partial class TransparentRect
|
||||||
{
|
{
|
@ -7,7 +7,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace FunGame.Models
|
namespace FunGame.Desktop.Models.Component
|
||||||
{
|
{
|
||||||
partial class TransparentRect : GroupBox
|
partial class TransparentRect : GroupBox
|
||||||
{
|
{
|
@ -4,10 +4,9 @@ using System.Linq;
|
|||||||
using System.Security.AccessControl;
|
using System.Security.AccessControl;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using FunGame.Models.Config;
|
using FunGame.Core.Api.Util;
|
||||||
using FunGame.Utils.DataHelper;
|
|
||||||
|
|
||||||
namespace FunGame.Models.Config
|
namespace FunGame.Desktop.Models.Config
|
||||||
{
|
{
|
||||||
public static class Config
|
public static class Config
|
||||||
{
|
{
|
||||||
@ -26,6 +25,7 @@ namespace FunGame.Models.Config
|
|||||||
* WebHelper Configs
|
* WebHelper Configs
|
||||||
*/
|
*/
|
||||||
public const string WebHelper_SetGreen = "-WebHelper .set green";
|
public const string WebHelper_SetGreen = "-WebHelper .set green";
|
||||||
|
public const string WebHelper_SetGreenAndPing = "-WebHelper .set greenandping";
|
||||||
public const string WebHelper_SetRed = "-WebHelper .set red";
|
public const string WebHelper_SetRed = "-WebHelper .set red";
|
||||||
public const string WebHelper_Disconnected = "-WebHelper .disconnected";
|
public const string WebHelper_Disconnected = "-WebHelper .disconnected";
|
||||||
public const string WebHelper_GetUser = "-WebHelper .get user";
|
public const string WebHelper_GetUser = "-WebHelper .get user";
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Config
|
namespace FunGame.Desktop.Models.Config
|
||||||
{
|
{
|
||||||
public static class Usercfg
|
public static class Usercfg
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FunGame.Models.Enum
|
namespace FunGame.Desktop.Models.Enum
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 这里存放框架实现相关的State Type Result Method
|
/// 这里存放框架实现相关的State Type Result Method
|
27
FunGame.Desktop/Models/Enum/SocketEnums.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FunGame.Desktop.Models.Enum
|
||||||
|
{
|
||||||
|
public static class SocketEnums
|
||||||
|
{
|
||||||
|
public enum Type
|
||||||
|
{
|
||||||
|
GetNotice = 1,
|
||||||
|
Login = 2,
|
||||||
|
CheckLogin = 3,
|
||||||
|
Logout = 4,
|
||||||
|
HeartBeat = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
public const string TYPE_UNKNOWN = "Unknown Type";
|
||||||
|
public const string TYPE_GetNotice = "GetNotice";
|
||||||
|
public const string TYPE_Login = "Login";
|
||||||
|
public const string TYPE_CheckLogin = "CheckLogin";
|
||||||
|
public const string TYPE_Logout = "Logout";
|
||||||
|
public const string TYPE_HeartBeat = "HeartBeat";
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,7 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace FunGame.Properties {
|
namespace FunGame.Desktop.Properties {
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ namespace FunGame.Properties {
|
|||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
get {
|
get {
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FunGame.Properties.Resources", typeof(Resources).Assembly);
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FunGame.Desktop.Properties.Resources", typeof(Resources).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
return resourceMan;
|
return resourceMan;
|
@ -1,7 +1,7 @@
|
|||||||
using FunGame.Models.Component;
|
using FunGame.Desktop.Models.Component;
|
||||||
using FunGame.Models.Config;
|
using FunGame.Desktop.Models.Config;
|
||||||
|
|
||||||
namespace FunGame
|
namespace FunGame.Desktop.UI
|
||||||
{
|
{
|
||||||
partial class Main
|
partial class Main
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@ namespace FunGame
|
|||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
|
||||||
this.Exit = new FunGame.Models.Component.ExitButton(this.components);
|
this.Exit = new FunGame.Desktop.Models.Component.ExitButton(this.components);
|
||||||
this.Title = new System.Windows.Forms.Label();
|
this.Title = new System.Windows.Forms.Label();
|
||||||
this.MinForm = new System.Windows.Forms.Button();
|
this.MinForm = new System.Windows.Forms.Button();
|
||||||
this.Connection = new System.Windows.Forms.Label();
|
this.Connection = new System.Windows.Forms.Label();
|
||||||
@ -55,10 +55,10 @@ namespace FunGame
|
|||||||
this.QueryRoom = new System.Windows.Forms.Button();
|
this.QueryRoom = new System.Windows.Forms.Button();
|
||||||
this.RoomList = new System.Windows.Forms.ListBox();
|
this.RoomList = new System.Windows.Forms.ListBox();
|
||||||
this.Notice = new System.Windows.Forms.GroupBox();
|
this.Notice = new System.Windows.Forms.GroupBox();
|
||||||
this.NoticeText = new FunGame.Models.TextArea();
|
this.NoticeText = new FunGame.Desktop.Models.Component.TextArea();
|
||||||
this.InfoBox = new System.Windows.Forms.GroupBox();
|
this.InfoBox = new System.Windows.Forms.GroupBox();
|
||||||
this.TransparentRectControl = new FunGame.Models.TransparentRect();
|
this.TransparentRectControl = new FunGame.Desktop.Models.Component.TransparentRect();
|
||||||
this.GameInfo = new FunGame.Models.TextArea();
|
this.GameInfo = new FunGame.Desktop.Models.Component.TextArea();
|
||||||
this.QuitRoom = new System.Windows.Forms.Button();
|
this.QuitRoom = new System.Windows.Forms.Button();
|
||||||
this.CreateRoom = new System.Windows.Forms.Button();
|
this.CreateRoom = new System.Windows.Forms.Button();
|
||||||
this.Logout = new System.Windows.Forms.Button();
|
this.Logout = new System.Windows.Forms.Button();
|
||||||
@ -77,7 +77,7 @@ namespace FunGame
|
|||||||
//
|
//
|
||||||
this.Exit.Anchor = System.Windows.Forms.AnchorStyles.None;
|
this.Exit.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
this.Exit.BackColor = System.Drawing.Color.White;
|
this.Exit.BackColor = System.Drawing.Color.White;
|
||||||
this.Exit.BackgroundImage = global::FunGame.Properties.Resources.exit;
|
this.Exit.BackgroundImage = global::FunGame.Desktop.Properties.Resources.exit;
|
||||||
this.Exit.FlatAppearance.BorderColor = System.Drawing.Color.White;
|
this.Exit.FlatAppearance.BorderColor = System.Drawing.Color.White;
|
||||||
this.Exit.FlatAppearance.BorderSize = 0;
|
this.Exit.FlatAppearance.BorderSize = 0;
|
||||||
this.Exit.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
|
this.Exit.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
|
||||||
@ -110,7 +110,7 @@ namespace FunGame
|
|||||||
//
|
//
|
||||||
this.MinForm.Anchor = System.Windows.Forms.AnchorStyles.None;
|
this.MinForm.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
this.MinForm.BackColor = System.Drawing.Color.White;
|
this.MinForm.BackColor = System.Drawing.Color.White;
|
||||||
this.MinForm.BackgroundImage = global::FunGame.Properties.Resources.min;
|
this.MinForm.BackgroundImage = global::FunGame.Desktop.Properties.Resources.min;
|
||||||
this.MinForm.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
this.MinForm.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||||
this.MinForm.FlatAppearance.BorderColor = System.Drawing.Color.LightGray;
|
this.MinForm.FlatAppearance.BorderColor = System.Drawing.Color.LightGray;
|
||||||
this.MinForm.FlatAppearance.BorderSize = 0;
|
this.MinForm.FlatAppearance.BorderSize = 0;
|
||||||
@ -131,10 +131,10 @@ namespace FunGame
|
|||||||
//
|
//
|
||||||
this.Connection.BackColor = System.Drawing.Color.Transparent;
|
this.Connection.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.Connection.Font = new System.Drawing.Font("LanaPixel", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.Connection.Font = new System.Drawing.Font("LanaPixel", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.Connection.Location = new System.Drawing.Point(665, 425);
|
this.Connection.Location = new System.Drawing.Point(649, 424);
|
||||||
this.Connection.Margin = new System.Windows.Forms.Padding(3);
|
this.Connection.Margin = new System.Windows.Forms.Padding(3);
|
||||||
this.Connection.Name = "Connection";
|
this.Connection.Name = "Connection";
|
||||||
this.Connection.Size = new System.Drawing.Size(114, 23);
|
this.Connection.Size = new System.Drawing.Size(130, 23);
|
||||||
this.Connection.TabIndex = 92;
|
this.Connection.TabIndex = 92;
|
||||||
this.Connection.Text = "服务器连接失败";
|
this.Connection.Text = "服务器连接失败";
|
||||||
this.Connection.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
this.Connection.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
@ -142,7 +142,7 @@ namespace FunGame
|
|||||||
// Light
|
// Light
|
||||||
//
|
//
|
||||||
this.Light.BackColor = System.Drawing.Color.Transparent;
|
this.Light.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.Light.Image = global::FunGame.Properties.Resources.red;
|
this.Light.Image = global::FunGame.Desktop.Properties.Resources.red;
|
||||||
this.Light.Location = new System.Drawing.Point(777, 426);
|
this.Light.Location = new System.Drawing.Point(777, 426);
|
||||||
this.Light.Name = "Light";
|
this.Light.Name = "Light";
|
||||||
this.Light.Size = new System.Drawing.Size(20, 20);
|
this.Light.Size = new System.Drawing.Size(20, 20);
|
||||||
@ -152,7 +152,7 @@ namespace FunGame
|
|||||||
//
|
//
|
||||||
this.SendTalkText.Anchor = System.Windows.Forms.AnchorStyles.None;
|
this.SendTalkText.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
this.SendTalkText.BackColor = System.Drawing.Color.Transparent;
|
this.SendTalkText.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.SendTalkText.BackgroundImage = global::FunGame.Properties.Resources.send;
|
this.SendTalkText.BackgroundImage = global::FunGame.Desktop.Properties.Resources.send;
|
||||||
this.SendTalkText.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
this.SendTalkText.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||||
this.SendTalkText.FlatAppearance.BorderSize = 0;
|
this.SendTalkText.FlatAppearance.BorderSize = 0;
|
||||||
this.SendTalkText.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Teal;
|
this.SendTalkText.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Teal;
|
||||||
@ -433,7 +433,7 @@ namespace FunGame
|
|||||||
this.TransparentRectControl.Name = "TransparentRectControl";
|
this.TransparentRectControl.Name = "TransparentRectControl";
|
||||||
this.TransparentRectControl.Opacity = 125;
|
this.TransparentRectControl.Opacity = 125;
|
||||||
this.TransparentRectControl.Radius = 20;
|
this.TransparentRectControl.Radius = 20;
|
||||||
this.TransparentRectControl.ShapeBorderStyle = FunGame.Models.TransparentRect.ShapeBorderStyles.ShapeBSNone;
|
this.TransparentRectControl.ShapeBorderStyle = FunGame.Desktop.Models.Component.TransparentRect.ShapeBorderStyles.ShapeBSNone;
|
||||||
this.TransparentRectControl.Size = new System.Drawing.Size(464, 343);
|
this.TransparentRectControl.Size = new System.Drawing.Size(464, 343);
|
||||||
this.TransparentRectControl.TabIndex = 2;
|
this.TransparentRectControl.TabIndex = 2;
|
||||||
this.TransparentRectControl.TabStop = false;
|
this.TransparentRectControl.TabStop = false;
|
||||||
@ -559,7 +559,7 @@ namespace FunGame
|
|||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.BackgroundImage = global::FunGame.Properties.Resources.back;
|
this.BackgroundImage = global::FunGame.Desktop.Properties.Resources.back;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
this.Controls.Add(this.StopMatch);
|
this.Controls.Add(this.StopMatch);
|
||||||
this.Controls.Add(this.Copyright);
|
this.Controls.Add(this.Copyright);
|
||||||
@ -637,8 +637,8 @@ namespace FunGame
|
|||||||
private Button Store;
|
private Button Store;
|
||||||
private LinkLabel Copyright;
|
private LinkLabel Copyright;
|
||||||
private Button StopMatch;
|
private Button StopMatch;
|
||||||
private Models.TextArea GameInfo;
|
private Models.Component.TextArea GameInfo;
|
||||||
private Models.TextArea NoticeText;
|
private Models.Component.TextArea NoticeText;
|
||||||
private Models.TransparentRect TransparentRectControl;
|
private Models.Component.TransparentRect TransparentRectControl;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,16 +1,17 @@
|
|||||||
using FunGame.Models.Component;
|
using FunGame.Desktop.Models.Component;
|
||||||
using FunGame.Models.Config;
|
|
||||||
using FunGame.Models.Entity;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using static FunGame.Models.Enum.CommonEnums;
|
using static FunGame.Desktop.Models.Enum.CommonEnums;
|
||||||
using FunGame.Utils.WebHelper;
|
using System.Net.NetworkInformation;
|
||||||
using FunGame.Models.Enum;
|
using System.Text;
|
||||||
using FunGame.Utils.DataHelper;
|
using FunGame.Core.Api.Model.Entity;
|
||||||
|
using FunGame.Desktop.Models.Enum;
|
||||||
|
using FunGame.Desktop.Models.Config;
|
||||||
|
using FunGame.Desktop.Utils;
|
||||||
|
|
||||||
namespace FunGame
|
namespace FunGame.Desktop.UI
|
||||||
{
|
{
|
||||||
public partial class Main : Form
|
public partial class Main : Form
|
||||||
{
|
{
|
||||||
@ -79,36 +80,49 @@ namespace FunGame
|
|||||||
{
|
{
|
||||||
case Config.WebHelper_SetGreen:
|
case Config.WebHelper_SetGreen:
|
||||||
Usercfg.FunGame_isRetrying = false;
|
Usercfg.FunGame_isRetrying = false;
|
||||||
WebHelper_Action = (Main? main) =>
|
WebHelper_Action = (main) =>
|
||||||
{
|
{
|
||||||
SetServerStatusLight(true);
|
SetServerStatusLight(true);
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
this.BeginInvoke(WebHelper_Action, this);
|
BeginInvoke(WebHelper_Action, this);
|
||||||
|
else
|
||||||
|
WebHelper_Action(this);
|
||||||
|
Usercfg.FunGame_isConnected = true;
|
||||||
|
NOW_CONNECTEDRETRY = 0;
|
||||||
|
break;
|
||||||
|
case Config.WebHelper_SetGreenAndPing:
|
||||||
|
Usercfg.FunGame_isRetrying = false;
|
||||||
|
WebHelper_Action = (main) =>
|
||||||
|
{
|
||||||
|
SetServerStatusLight(true, GetServerPing(Config.SERVER_IPADRESS));
|
||||||
|
};
|
||||||
|
if (InvokeRequired)
|
||||||
|
BeginInvoke(WebHelper_Action, this);
|
||||||
else
|
else
|
||||||
WebHelper_Action(this);
|
WebHelper_Action(this);
|
||||||
Usercfg.FunGame_isConnected = true;
|
Usercfg.FunGame_isConnected = true;
|
||||||
NOW_CONNECTEDRETRY = 0;
|
NOW_CONNECTEDRETRY = 0;
|
||||||
break;
|
break;
|
||||||
case Config.WebHelper_SetRed:
|
case Config.WebHelper_SetRed:
|
||||||
WebHelper_Action = (Main? main) =>
|
WebHelper_Action = (main) =>
|
||||||
{
|
{
|
||||||
SetServerStatusLight(false);
|
SetServerStatusLight(false);
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
this.BeginInvoke(WebHelper_Action, this);
|
BeginInvoke(WebHelper_Action, this);
|
||||||
else
|
else
|
||||||
WebHelper_Action(this);
|
WebHelper_Action(this);
|
||||||
Usercfg.FunGame_isConnected = false;
|
Usercfg.FunGame_isConnected = false;
|
||||||
break;
|
break;
|
||||||
case Config.WebHelper_Disconnected:
|
case Config.WebHelper_Disconnected:
|
||||||
Usercfg.FunGame_isRetrying = false;
|
Usercfg.FunGame_isRetrying = false;
|
||||||
WebHelper_Action = (Main? main) =>
|
WebHelper_Action = (main) =>
|
||||||
{
|
{
|
||||||
SetServerStatusLight(false);
|
SetServerStatusLight(false);
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
this.BeginInvoke(WebHelper_Action, this);
|
BeginInvoke(WebHelper_Action, this);
|
||||||
else
|
else
|
||||||
WebHelper_Action(this);
|
WebHelper_Action(this);
|
||||||
Usercfg.FunGame_isConnected = false;
|
Usercfg.FunGame_isConnected = false;
|
||||||
@ -142,7 +156,7 @@ namespace FunGame
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
WritelnGameInfo(webHelper, (e.Message != null) ? e.Message + "\n" + e.StackTrace : "" + e.StackTrace);
|
WritelnGameInfo(webHelper, e.Message != null ? e.Message + "\n" + e.StackTrace : "" + e.StackTrace);
|
||||||
GetMessage(webHelper, Config.WebHelper_SetRed);
|
GetMessage(webHelper, Config.WebHelper_SetRed);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -189,13 +203,13 @@ namespace FunGame
|
|||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (this.IsHandleCreated)
|
if (IsHandleCreated)
|
||||||
{
|
{
|
||||||
// 检查是否创建了窗口句柄,再Invoke委托。
|
// 检查是否创建了窗口句柄,再Invoke委托。
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Main_Action = (Main? main) =>
|
Main_Action = (main) =>
|
||||||
{
|
{
|
||||||
if (!Usercfg.FunGame_isConnected)
|
if (!Usercfg.FunGame_isConnected)
|
||||||
{
|
{
|
||||||
@ -209,7 +223,7 @@ namespace FunGame
|
|||||||
WritelnGameInfo("ERROR:无法连接至服务器,请检查网络并重启游戏再试。");
|
WritelnGameInfo("ERROR:无法连接至服务器,请检查网络并重启游戏再试。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WebHelper_Action = (Main? main) =>
|
WebHelper_Action = (main) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -217,13 +231,13 @@ namespace FunGame
|
|||||||
{
|
{
|
||||||
if (WebHelper != null)
|
if (WebHelper != null)
|
||||||
{
|
{
|
||||||
WebHelper.WebHelpMethod((int)CommonEnums.WebHelperMethod.CloseSocket);
|
WebHelper.WebHelpMethod((int)WebHelperMethod.CloseSocket);
|
||||||
WebHelper = null;
|
WebHelper = null;
|
||||||
}
|
}
|
||||||
Usercfg.FunGame_isRetrying = true;
|
Usercfg.FunGame_isRetrying = true;
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
WebHelper = new WebHelper(main);
|
WebHelper = new WebHelper(main);
|
||||||
WebHelper.WebHelpMethod((int)CommonEnums.WebHelperMethod.CreateSocket); // Invoke -> CreateSocket
|
WebHelper.WebHelpMethod((int)WebHelperMethod.CreateSocket); // Invoke -> CreateSocket
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -233,7 +247,7 @@ namespace FunGame
|
|||||||
};
|
};
|
||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
{
|
{
|
||||||
BeginInvoke(WebHelper_Action, main);
|
BeginInvoke(WebHelper_Action, main);
|
||||||
}
|
}
|
||||||
@ -244,7 +258,7 @@ namespace FunGame
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
{
|
{
|
||||||
Invoke(Main_Action, this);
|
Invoke(Main_Action, this);
|
||||||
}
|
}
|
||||||
@ -385,7 +399,7 @@ namespace FunGame
|
|||||||
{
|
{
|
||||||
if (Usercfg.FunGame_roomid.Equals("-1"))
|
if (Usercfg.FunGame_roomid.Equals("-1"))
|
||||||
{
|
{
|
||||||
if (ShowMessage.YesNoMessage("已找到房间 -> [ " + roomid + " ]\n是否加入?", "已找到房间") == (int)CommonEnums.MessageResult.Yes)
|
if (ShowMessage.YesNoMessage("已找到房间 -> [ " + roomid + " ]\n是否加入?", "已找到房间") == (int)MessageResult.Yes)
|
||||||
{
|
{
|
||||||
SetRoomid(roomid);
|
SetRoomid(roomid);
|
||||||
InRoom();
|
InRoom();
|
||||||
@ -413,7 +427,7 @@ namespace FunGame
|
|||||||
{
|
{
|
||||||
if (Usercfg.FunGame_roomid.Equals("-1"))
|
if (Usercfg.FunGame_roomid.Equals("-1"))
|
||||||
{
|
{
|
||||||
if (ShowMessage.YesNoMessage("已找到房间 -> [ " + roomid + " ]\n是否加入?", "已找到房间") == (int)CommonEnums.MessageResult.Yes)
|
if (ShowMessage.YesNoMessage("已找到房间 -> [ " + roomid + " ]\n是否加入?", "已找到房间") == (int)MessageResult.Yes)
|
||||||
{
|
{
|
||||||
SetRoomid(roomid);
|
SetRoomid(roomid);
|
||||||
InRoom();
|
InRoom();
|
||||||
@ -440,7 +454,7 @@ namespace FunGame
|
|||||||
{
|
{
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case (int)CommonEnums.StartMatch_State.Matching:
|
case (int)StartMatch_State.Matching:
|
||||||
// 开始匹配
|
// 开始匹配
|
||||||
Usercfg.FunGame_isMatching = true;
|
Usercfg.FunGame_isMatching = true;
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
@ -460,20 +474,20 @@ namespace FunGame
|
|||||||
{
|
{
|
||||||
StartMatch_Method(i, objs);
|
StartMatch_Method(i, objs);
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
{
|
{
|
||||||
Invoke(StartMatch_Action, (int)CommonEnums.StartMatch_State.Success, new object[] { roomid });
|
Invoke(StartMatch_Action, (int)StartMatch_State.Success, new object[] { roomid });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StartMatch_Action((int)CommonEnums.StartMatch_State.Success, new object[] { roomid });
|
StartMatch_Action((int)StartMatch_State.Success, new object[] { roomid });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case (int)CommonEnums.StartMatch_State.Success:
|
case (int)StartMatch_State.Success:
|
||||||
Usercfg.FunGame_isMatching = false;
|
Usercfg.FunGame_isMatching = false;
|
||||||
// 匹配成功返回房间号
|
// 匹配成功返回房间号
|
||||||
roomid = "-1";
|
roomid = "-1";
|
||||||
@ -492,21 +506,21 @@ namespace FunGame
|
|||||||
// 设置按钮可见性
|
// 设置按钮可见性
|
||||||
InRoom();
|
InRoom();
|
||||||
// 创建委托,操作主界面
|
// 创建委托,操作主界面
|
||||||
StartMatch_Action = (int i, object[]? objs) =>
|
StartMatch_Action = (i, objs) =>
|
||||||
{
|
{
|
||||||
StartMatch_Method(i, objs);
|
StartMatch_Method(i, objs);
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
{
|
{
|
||||||
Invoke(StartMatch_Action, (int)CommonEnums.StartMatch_State.Enable, new object[] { true });
|
Invoke(StartMatch_Action, (int)StartMatch_State.Enable, new object[] { true });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StartMatch_Action((int)CommonEnums.StartMatch_State.Enable, new object[] { true });
|
StartMatch_Action((int)StartMatch_State.Enable, new object[] { true });
|
||||||
}
|
}
|
||||||
MatchFunGame = null;
|
MatchFunGame = null;
|
||||||
break;
|
break;
|
||||||
case (int)CommonEnums.StartMatch_State.Enable:
|
case (int)StartMatch_State.Enable:
|
||||||
// 设置匹配过程中的各种按钮是否可用
|
// 设置匹配过程中的各种按钮是否可用
|
||||||
bool isPause = false;
|
bool isPause = false;
|
||||||
if (objs != null) isPause = (bool)objs[0];
|
if (objs != null) isPause = (bool)objs[0];
|
||||||
@ -517,21 +531,21 @@ namespace FunGame
|
|||||||
RoomBox.Enabled = isPause;
|
RoomBox.Enabled = isPause;
|
||||||
Login.Enabled = isPause;
|
Login.Enabled = isPause;
|
||||||
break;
|
break;
|
||||||
case (int)CommonEnums.StartMatch_State.Cancel:
|
case (int)StartMatch_State.Cancel:
|
||||||
WritelnGameInfo(GetNowShortTime() + " 终止匹配");
|
WritelnGameInfo(GetNowShortTime() + " 终止匹配");
|
||||||
WritelnGameInfo("[ " + Usercfg.LoginUserName + " ] 已终止匹配。");
|
WritelnGameInfo("[ " + Usercfg.LoginUserName + " ] 已终止匹配。");
|
||||||
Usercfg.FunGame_isMatching = false;
|
Usercfg.FunGame_isMatching = false;
|
||||||
StartMatch_Action = (int i, object[]? objs) =>
|
StartMatch_Action = (i, objs) =>
|
||||||
{
|
{
|
||||||
StartMatch_Method(i, objs);
|
StartMatch_Method(i, objs);
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
{
|
{
|
||||||
Invoke(StartMatch_Action, (int)CommonEnums.StartMatch_State.Enable, new object[] { true });
|
Invoke(StartMatch_Action, (int)StartMatch_State.Enable, new object[] { true });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StartMatch_Action((int)CommonEnums.StartMatch_State.Enable, new object[] { true });
|
StartMatch_Action((int)StartMatch_State.Enable, new object[] { true });
|
||||||
}
|
}
|
||||||
MatchFunGame = null;
|
MatchFunGame = null;
|
||||||
StopMatch.Visible = false;
|
StopMatch.Visible = false;
|
||||||
@ -565,17 +579,17 @@ namespace FunGame
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void StopMatch_Click()
|
private void StopMatch_Click()
|
||||||
{
|
{
|
||||||
StartMatch_Action = (int i, object[]? objs) =>
|
StartMatch_Action = (i, objs) =>
|
||||||
{
|
{
|
||||||
StartMatch_Method(i, objs);
|
StartMatch_Method(i, objs);
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
{
|
{
|
||||||
Invoke(StartMatch_Action, (int)CommonEnums.StartMatch_State.Cancel, new object[] { true });
|
Invoke(StartMatch_Action, (int)StartMatch_State.Cancel, new object[] { true });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StartMatch_Action((int)CommonEnums.StartMatch_State.Cancel, new object[] { true });
|
StartMatch_Action((int)StartMatch_State.Cancel, new object[] { true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -642,21 +656,21 @@ namespace FunGame
|
|||||||
}
|
}
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case (int)CommonEnums.CreateRoom_State.Creating:
|
case (int)CreateRoom_State.Creating:
|
||||||
CreateRoom_Action = (int i, object[]? objs) =>
|
CreateRoom_Action = (i, objs) =>
|
||||||
{
|
{
|
||||||
CreateRoom_Method(i, objs);
|
CreateRoom_Method(i, objs);
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
{
|
{
|
||||||
Invoke(CreateRoom_Action, (int)CommonEnums.CreateRoom_State.Success, new object[] { roomtype });
|
Invoke(CreateRoom_Action, (int)CreateRoom_State.Success, new object[] { roomtype });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CreateRoom_Action((int)CommonEnums.CreateRoom_State.Success, new object[] { roomtype });
|
CreateRoom_Action((int)CreateRoom_State.Success, new object[] { roomtype });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (int)CommonEnums.CreateRoom_State.Success:
|
case (int)CreateRoom_State.Success:
|
||||||
roomid = Convert.ToString(new Random().Next(1, 10000));
|
roomid = Convert.ToString(new Random().Next(1, 10000));
|
||||||
SetRoomid(roomid);
|
SetRoomid(roomid);
|
||||||
InRoom();
|
InRoom();
|
||||||
@ -671,17 +685,25 @@ namespace FunGame
|
|||||||
/// 设置服务器连接状态指示灯
|
/// 设置服务器连接状态指示灯
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="green"></param>
|
/// <param name="green"></param>
|
||||||
private void SetServerStatusLight(bool green)
|
private void SetServerStatusLight(bool green, int ping = 0)
|
||||||
{
|
{
|
||||||
if (green)
|
if (green)
|
||||||
{
|
{
|
||||||
Connection.Text = "服务器连接成功";
|
if (ping > 0)
|
||||||
this.Light.Image = global::FunGame.Properties.Resources.green;
|
{
|
||||||
|
Connection.Text = "心跳延迟 " + ping + "ms";
|
||||||
|
this.Light.Image = Properties.Resources.green;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Connection.Text = "服务器连接成功";
|
||||||
|
this.Light.Image = Properties.Resources.green;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Connection.Text = "服务器连接失败";
|
Connection.Text = "服务器连接失败";
|
||||||
this.Light.Image = global::FunGame.Properties.Resources.red;
|
this.Light.Image = Properties.Resources.red;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,14 +718,14 @@ namespace FunGame
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void Exit_Click(object sender, EventArgs e)
|
private void Exit_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (ShowMessage.OKCancelMessage("你确定关闭游戏?", "退出") == (int)CommonEnums.MessageResult.OK)
|
if (ShowMessage.OKCancelMessage("你确定关闭游戏?", "退出") == (int)MessageResult.OK)
|
||||||
{
|
{
|
||||||
if (WebHelper != null)
|
if (WebHelper != null)
|
||||||
{
|
{
|
||||||
WebHelper.WebHelpMethod((int)CommonEnums.WebHelperMethod.CloseSocket);
|
WebHelper.WebHelpMethod((int)WebHelperMethod.CloseSocket);
|
||||||
WebHelper = null;
|
WebHelper = null;
|
||||||
}
|
}
|
||||||
System.Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -718,8 +740,8 @@ namespace FunGame
|
|||||||
if (e.Button == MouseButtons.Left)
|
if (e.Button == MouseButtons.Left)
|
||||||
{
|
{
|
||||||
//获取鼠标左键按下时的位置
|
//获取鼠标左键按下时的位置
|
||||||
this.LOCATION_X = e.Location.X;
|
LOCATION_X = e.Location.X;
|
||||||
this.LOCATION_Y = e.Location.Y;
|
LOCATION_Y = e.Location.Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -733,8 +755,8 @@ namespace FunGame
|
|||||||
if (e.Button == MouseButtons.Left)
|
if (e.Button == MouseButtons.Left)
|
||||||
{
|
{
|
||||||
//计算鼠标移动距离
|
//计算鼠标移动距离
|
||||||
this.Left += e.Location.X - this.LOCATION_X;
|
Left += e.Location.X - LOCATION_X;
|
||||||
this.Top += e.Location.Y - this.LOCATION_Y;
|
Top += e.Location.Y - LOCATION_Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -760,9 +782,9 @@ namespace FunGame
|
|||||||
StartMatch.Visible = false;
|
StartMatch.Visible = false;
|
||||||
StopMatch.Visible = true;
|
StopMatch.Visible = true;
|
||||||
// 暂停其他按钮
|
// 暂停其他按钮
|
||||||
StartMatch_Method((int)CommonEnums.StartMatch_State.Enable, new object[] { false });
|
StartMatch_Method((int)StartMatch_State.Enable, new object[] { false });
|
||||||
// 创建委托,开始匹配
|
// 创建委托,开始匹配
|
||||||
StartMatch_Action = (int i, object[]? objs) =>
|
StartMatch_Action = (i, objs) =>
|
||||||
{
|
{
|
||||||
StartMatch_Method(i, objs);
|
StartMatch_Method(i, objs);
|
||||||
};
|
};
|
||||||
@ -770,13 +792,13 @@ namespace FunGame
|
|||||||
MatchFunGame = Task.Factory.StartNew(() =>
|
MatchFunGame = Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
{
|
{
|
||||||
Invoke(StartMatch_Action, (int)CommonEnums.StartMatch_State.Matching, null);
|
Invoke(StartMatch_Action, (int)StartMatch_State.Matching, null);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StartMatch_Action((int)CommonEnums.StartMatch_State.Matching, null);
|
StartMatch_Action((int)StartMatch_State.Matching, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -815,17 +837,17 @@ namespace FunGame
|
|||||||
ShowMessage.WarningMessage("请勾选你要创建的房间类型!");
|
ShowMessage.WarningMessage("请勾选你要创建的房间类型!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CreateRoom_Action = (int i, object[]? objs) =>
|
CreateRoom_Action = (i, objs) =>
|
||||||
{
|
{
|
||||||
CreateRoom_Method(i, objs);
|
CreateRoom_Method(i, objs);
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
{
|
{
|
||||||
Invoke(CreateRoom_Action, (int)CommonEnums.CreateRoom_State.Creating, new object[] { roomtype });
|
Invoke(CreateRoom_Action, (int)CreateRoom_State.Creating, new object[] { roomtype });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CreateRoom_Action((int)CommonEnums.CreateRoom_State.Creating, new object[] { roomtype });
|
CreateRoom_Action((int)CreateRoom_State.Creating, new object[] { roomtype });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1061,7 +1083,7 @@ namespace FunGame
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void MinForm_Click(object sender, EventArgs e)
|
private void MinForm_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.WindowState = FormWindowState.Minimized;
|
WindowState = FormWindowState.Minimized;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -1102,31 +1124,31 @@ namespace FunGame
|
|||||||
case Config.FunGame_ShowStore:
|
case Config.FunGame_ShowStore:
|
||||||
break;
|
break;
|
||||||
case Config.FunGame_CreateMix:
|
case Config.FunGame_CreateMix:
|
||||||
CreateRoom_Action = (int i, object[]? objs) =>
|
CreateRoom_Action = (i, objs) =>
|
||||||
{
|
{
|
||||||
CreateRoom_Method(i, objs);
|
CreateRoom_Method(i, objs);
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
{
|
{
|
||||||
Invoke(CreateRoom_Action, (int)CommonEnums.CreateRoom_State.Creating, new object[] { Config.GameMode_Mix });
|
Invoke(CreateRoom_Action, (int)CreateRoom_State.Creating, new object[] { Config.GameMode_Mix });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CreateRoom_Action((int)CommonEnums.CreateRoom_State.Creating, new object[] { Config.GameMode_Mix });
|
CreateRoom_Action((int)CreateRoom_State.Creating, new object[] { Config.GameMode_Mix });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Config.FunGame_CreateTeam:
|
case Config.FunGame_CreateTeam:
|
||||||
CreateRoom_Action = (int i, object[]? objs) =>
|
CreateRoom_Action = (i, objs) =>
|
||||||
{
|
{
|
||||||
CreateRoom_Method(i, objs);
|
CreateRoom_Method(i, objs);
|
||||||
};
|
};
|
||||||
if (this.InvokeRequired)
|
if (InvokeRequired)
|
||||||
{
|
{
|
||||||
Invoke(CreateRoom_Action, (int)CommonEnums.CreateRoom_State.Creating, new object[] { Config.GameMode_Team });
|
Invoke(CreateRoom_Action, (int)CreateRoom_State.Creating, new object[] { Config.GameMode_Team });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CreateRoom_Action((int)CommonEnums.CreateRoom_State.Creating, new object[] { Config.GameMode_Team });
|
CreateRoom_Action((int)CreateRoom_State.Creating, new object[] { Config.GameMode_Team });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Config.FunGame_StartGame:
|
case Config.FunGame_StartGame:
|
||||||
@ -1157,7 +1179,7 @@ namespace FunGame
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private string GetNowTime()
|
private string GetNowTime()
|
||||||
{
|
{
|
||||||
DateTime now = System.DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
return now.AddMilliseconds(-now.Millisecond).ToString();
|
return now.AddMilliseconds(-now.Millisecond).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1167,10 +1189,33 @@ namespace FunGame
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private string GetNowShortTime()
|
private string GetNowShortTime()
|
||||||
{
|
{
|
||||||
DateTime now = System.DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
return now.AddMilliseconds(-now.Millisecond).ToString("T");
|
return now.AddMilliseconds(-now.Millisecond).ToString("T");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取服务器的延迟
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="addr">服务器IP地址</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private int GetServerPing(string addr)
|
||||||
|
{
|
||||||
|
Ping pingSender = new();
|
||||||
|
PingOptions options = new()
|
||||||
|
{
|
||||||
|
DontFragment = true
|
||||||
|
};
|
||||||
|
string data = "getserverping";
|
||||||
|
byte[] buffer = Encoding.ASCII.GetBytes(data);
|
||||||
|
int timeout = 120;
|
||||||
|
PingReply reply = pingSender.Send(addr, timeout, buffer, options);
|
||||||
|
if (reply.Status == IPStatus.Success)
|
||||||
|
{
|
||||||
|
return Convert.ToInt32(reply.RoundtripTime);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -57,6 +57,111 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="Exit.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Title.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="MinForm.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Connection.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Light.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="SendTalkText.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="TalkText.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="StartMatch.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="CheckMix.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="CheckTeam.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="RoomSetting.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Login.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="NowAccount.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="AccountSetting.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="About.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Room.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="RoomText.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="PresetText.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="RoomBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="QueryRoom.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="RoomList.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Notice.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="NoticeText.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="InfoBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="TransparentRectControl.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="GameInfo.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="QuitRoom.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="CreateRoom.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Logout.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="CheckHasPass.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Stock.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Store.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="Copyright.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="StopMatch.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
@ -1,4 +1,4 @@
|
|||||||
namespace FunGame.UI
|
namespace FunGame.Desktop.UI
|
||||||
{
|
{
|
||||||
internal static class Start
|
internal static class Start
|
||||||
{
|
{
|
@ -5,13 +5,15 @@ using System.Net.Sockets;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using FunGame.Models.Config;
|
using FunGame.Desktop.Models.Component;
|
||||||
using FunGame.Models.Component;
|
|
||||||
using FunGame.Models.Entity;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using FunGame.Models.Enum;
|
using System.Net.NetworkInformation;
|
||||||
|
using FunGame.Core.Api.Model.Entity;
|
||||||
|
using FunGame.Desktop.Models.Enum;
|
||||||
|
using FunGame.Desktop.Models.Config;
|
||||||
|
using FunGame.Desktop.UI;
|
||||||
|
|
||||||
namespace FunGame.Utils.WebHelper
|
namespace FunGame.Desktop.Utils
|
||||||
{
|
{
|
||||||
public class WebHelper
|
public class WebHelper
|
||||||
{
|
{
|
||||||
@ -156,6 +158,7 @@ namespace FunGame.Utils.WebHelper
|
|||||||
case (int)SocketEnums.Type.HeartBeat:
|
case (int)SocketEnums.Type.HeartBeat:
|
||||||
if (WaitHeartBeat != null && !WaitHeartBeat.IsCompleted) WaitHeartBeat.Wait(1);
|
if (WaitHeartBeat != null && !WaitHeartBeat.IsCompleted) WaitHeartBeat.Wait(1);
|
||||||
Config.WebHelper_HeartBeatFaileds = 0;
|
Config.WebHelper_HeartBeatFaileds = 0;
|
||||||
|
main.GetMessage(this, Config.WebHelper_SetGreenAndPing);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
12
FunGame.Plugin/FunGame.Plugin.csproj
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<BaseOutputPath>..\bin</BaseOutputPath>
|
||||||
|
<Authors>Milimoe</Authors>
|
||||||
|
<Company>Milimoe</Company>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
24
FunGame.sln
@ -2,9 +2,23 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.3.32804.467
|
VisualStudioVersion = 17.3.32804.467
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame", "FunGame\FunGame.csproj", "{BFFCC8D2-DF96-4DD3-81BA-552FAB33495A}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Desktop", "FunGame.Desktop\FunGame.Desktop.csproj", "{BFFCC8D2-DF96-4DD3-81BA-552FAB33495A}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{842BB22E-4309-4ADD-93CD-A981CE10C30E} = {842BB22E-4309-4ADD-93CD-A981CE10C30E}
|
||||||
|
{CC6C83C6-5818-4565-8873-67587FED1D0A} = {CC6C83C6-5818-4565-8873-67587FED1D0A}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Core", "FunGame.Core\FunGame.Core.csproj", "{CC6C83C6-5818-4565-8873-67587FED1D0A}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Core", "FunGame.Core\FunGame.Core.csproj", "{CC6C83C6-5818-4565-8873-67587FED1D0A}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{842BB22E-4309-4ADD-93CD-A981CE10C30E} = {842BB22E-4309-4ADD-93CD-A981CE10C30E}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Core.Api", "FunGame.Core.Api\FunGame.Core.Api.csproj", "{842BB22E-4309-4ADD-93CD-A981CE10C30E}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FunGame.Plugin", "FunGame.Plugin\FunGame.Plugin.csproj", "{A1132284-47F3-4C2D-89DB-C34B2354D9BB}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{842BB22E-4309-4ADD-93CD-A981CE10C30E} = {842BB22E-4309-4ADD-93CD-A981CE10C30E}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -20,6 +34,14 @@ Global
|
|||||||
{CC6C83C6-5818-4565-8873-67587FED1D0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{CC6C83C6-5818-4565-8873-67587FED1D0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{CC6C83C6-5818-4565-8873-67587FED1D0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{CC6C83C6-5818-4565-8873-67587FED1D0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{CC6C83C6-5818-4565-8873-67587FED1D0A}.Release|Any CPU.Build.0 = Release|Any CPU
|
{CC6C83C6-5818-4565-8873-67587FED1D0A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{842BB22E-4309-4ADD-93CD-A981CE10C30E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{842BB22E-4309-4ADD-93CD-A981CE10C30E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{842BB22E-4309-4ADD-93CD-A981CE10C30E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{842BB22E-4309-4ADD-93CD-A981CE10C30E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A1132284-47F3-4C2D-89DB-C34B2354D9BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A1132284-47F3-4C2D-89DB-C34B2354D9BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A1132284-47F3-4C2D-89DB-C34B2354D9BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A1132284-47F3-4C2D-89DB-C34B2354D9BB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|