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.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Core.Interface
|
||||
namespace FunGame.Core.Api.Interface
|
||||
{
|
||||
/**
|
||||
* 接口需要在FunGame.Core.Implement中创建新的类实现
|
||||
* 接口需要在FunGame.Core项目中Implement文件夹创建新的类实现
|
||||
* 参考:
|
||||
* using FunGame.Core.Interface;
|
||||
|
||||
@ -28,7 +28,6 @@ namespace FunGame.Core.Interface
|
||||
|
||||
public interface ServerInterface
|
||||
{
|
||||
// 实现类:ServerInterfaceImpl
|
||||
public string RemoteServerIP();
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public class ActiveItem : Item
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public class ActiveSkill : Skill
|
||||
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public class Character
|
||||
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public class CharacterStatistics
|
||||
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public class GameStatistics
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public abstract class Item
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public class PassiveItem : Item
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public class PassiveSkill : Skill
|
||||
{
|
@ -6,7 +6,7 @@ using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public class Room
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public abstract class Skill
|
||||
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public class Stock
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
public class User
|
||||
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Entity
|
||||
namespace FunGame.Core.Api.Model.Entity
|
||||
{
|
||||
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.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Enum
|
||||
namespace FunGame.Core.Api.Model.Enum
|
||||
{
|
||||
public static class SocketEnums
|
||||
{
|
@ -4,16 +4,15 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Reflection;
|
||||
using FunGame.Models.Config;
|
||||
using FunGame.Models.Enum;
|
||||
using System.Diagnostics;
|
||||
using FunGame.Core.Api.Model.Enum;
|
||||
|
||||
namespace FunGame.Utils.DataHelper
|
||||
namespace FunGame.Core.Api.Util
|
||||
{
|
||||
/// <summary>
|
||||
/// 在FunGame.Core中添加新接口和新实现时,需要:
|
||||
/// 在FunGame.Core.Api中添加新接口和新实现时,需要:
|
||||
/// 1、在这里定义类名和方法名
|
||||
/// 2、在FunGame.Models.Enum.CommonEnums里同步添加InterfaceType和InterfaceMethod
|
||||
/// 2、在FunGame.Core.Api.Model.Enum.CommonEnums里同步添加InterfaceType和InterfaceMethod
|
||||
/// </summary>
|
||||
public class AssemblyHelper
|
||||
{
|
||||
@ -22,13 +21,26 @@ namespace FunGame.Utils.DataHelper
|
||||
*/
|
||||
public const string ServerInterface = "ServerInterface";
|
||||
|
||||
public const string Implement = "Impl"; // 实现类的后缀(无需修改)
|
||||
|
||||
/**
|
||||
* 定义方法名
|
||||
*/
|
||||
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 "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取FUNGAME.CORE.DLL中指定方法的返回值
|
||||
/// </summary>
|
||||
/// <param name="Interface">接口代号</param>
|
||||
/// <param name="Method">方法代号</param>
|
||||
/// <returns></returns>
|
||||
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); // 通过类名获取获取命名空间+类名称
|
||||
string MethodName = GetMethodName(Method); // 获取方法名
|
||||
if (Assembly != null && Type != null) this.Method = Type.GetMethod(MethodName); // 从Type中查找方法名
|
@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Utils.DataHelper
|
||||
namespace FunGame.Core.Api.Util
|
||||
{
|
||||
public class INIHelper
|
||||
{
|
@ -6,10 +6,15 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<Company>Milimoe</Company>
|
||||
<BaseOutputPath>..\bin</BaseOutputPath>
|
||||
<Authors>Milimoe</Authors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Implement\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FunGame.Core.Api\FunGame.Core.Api.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -41,6 +41,11 @@
|
||||
<Folder Include="UI\Store\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FunGame.Core.Api\FunGame.Core.Api.csproj" />
|
||||
<ProjectReference Include="..\FunGame.Core\FunGame.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Images\logo.ico">
|
||||
<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
|
||||
{
|
@ -6,7 +6,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Component
|
||||
namespace FunGame.Desktop.Models.Component
|
||||
{
|
||||
public partial class ExitButton : Button
|
||||
{
|
||||
@ -15,7 +15,7 @@ namespace FunGame.Models.Component
|
||||
InitializeComponent();
|
||||
Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
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.BorderSize = 0;
|
||||
FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
|
||||
@ -35,7 +35,7 @@ namespace FunGame.Models.Component
|
||||
InitializeComponent();
|
||||
Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
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.BorderSize = 0;
|
||||
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
|
||||
{
|
||||
@ -32,11 +32,11 @@
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShowMessage));
|
||||
this.MsgText = new System.Windows.Forms.Label();
|
||||
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.MidButton = new System.Windows.Forms.Button();
|
||||
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.SuspendLayout();
|
||||
//
|
||||
@ -129,7 +129,7 @@
|
||||
this.TransparentRect.Name = "TransparentRect";
|
||||
this.TransparentRect.Opacity = 125;
|
||||
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.TabIndex = 103;
|
||||
this.TransparentRect.TabStop = false;
|
@ -7,9 +7,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace FunGame.Models
|
||||
namespace FunGame.Desktop.Models.Component
|
||||
{
|
||||
partial class TextArea
|
||||
{
|
@ -8,7 +8,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FunGame.Models
|
||||
namespace FunGame.Desktop.Models.Component
|
||||
{
|
||||
[ToolboxBitmap(typeof(TextBox))]
|
||||
partial class TextArea : RichTextBox
|
@ -1,4 +1,4 @@
|
||||
namespace FunGame.Models
|
||||
namespace FunGame.Desktop.Models.Component
|
||||
{
|
||||
partial class TransparentRect
|
||||
{
|
@ -7,7 +7,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FunGame.Models
|
||||
namespace FunGame.Desktop.Models.Component
|
||||
{
|
||||
partial class TransparentRect : GroupBox
|
||||
{
|
@ -4,10 +4,9 @@ using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FunGame.Models.Config;
|
||||
using FunGame.Utils.DataHelper;
|
||||
using FunGame.Core.Api.Util;
|
||||
|
||||
namespace FunGame.Models.Config
|
||||
namespace FunGame.Desktop.Models.Config
|
||||
{
|
||||
public static class Config
|
||||
{
|
||||
@ -26,6 +25,7 @@ namespace FunGame.Models.Config
|
||||
* WebHelper Configs
|
||||
*/
|
||||
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_Disconnected = "-WebHelper .disconnected";
|
||||
public const string WebHelper_GetUser = "-WebHelper .get user";
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Config
|
||||
namespace FunGame.Desktop.Models.Config
|
||||
{
|
||||
public static class Usercfg
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FunGame.Models.Enum
|
||||
namespace FunGame.Desktop.Models.Enum
|
||||
{
|
||||
/// <summary>
|
||||
/// 这里存放框架实现相关的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>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FunGame.Properties {
|
||||
namespace FunGame.Desktop.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ namespace FunGame.Properties {
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
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;
|
||||
}
|
||||
return resourceMan;
|
@ -1,7 +1,7 @@
|
||||
using FunGame.Models.Component;
|
||||
using FunGame.Models.Config;
|
||||
using FunGame.Desktop.Models.Component;
|
||||
using FunGame.Desktop.Models.Config;
|
||||
|
||||
namespace FunGame
|
||||
namespace FunGame.Desktop.UI
|
||||
{
|
||||
partial class Main
|
||||
{
|
||||
@ -33,7 +33,7 @@ namespace FunGame
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
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.MinForm = new System.Windows.Forms.Button();
|
||||
this.Connection = new System.Windows.Forms.Label();
|
||||
@ -55,10 +55,10 @@ namespace FunGame
|
||||
this.QueryRoom = new System.Windows.Forms.Button();
|
||||
this.RoomList = new System.Windows.Forms.ListBox();
|
||||
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.TransparentRectControl = new FunGame.Models.TransparentRect();
|
||||
this.GameInfo = new FunGame.Models.TextArea();
|
||||
this.TransparentRectControl = new FunGame.Desktop.Models.Component.TransparentRect();
|
||||
this.GameInfo = new FunGame.Desktop.Models.Component.TextArea();
|
||||
this.QuitRoom = new System.Windows.Forms.Button();
|
||||
this.CreateRoom = 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.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.BorderSize = 0;
|
||||
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.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.FlatAppearance.BorderColor = System.Drawing.Color.LightGray;
|
||||
this.MinForm.FlatAppearance.BorderSize = 0;
|
||||
@ -131,10 +131,10 @@ namespace FunGame
|
||||
//
|
||||
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.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.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.Text = "服务器连接失败";
|
||||
this.Connection.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
@ -142,7 +142,7 @@ namespace FunGame
|
||||
// Light
|
||||
//
|
||||
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.Name = "Light";
|
||||
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.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.FlatAppearance.BorderSize = 0;
|
||||
this.SendTalkText.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Teal;
|
||||
@ -433,7 +433,7 @@ namespace FunGame
|
||||
this.TransparentRectControl.Name = "TransparentRectControl";
|
||||
this.TransparentRectControl.Opacity = 125;
|
||||
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.TabIndex = 2;
|
||||
this.TransparentRectControl.TabStop = false;
|
||||
@ -559,7 +559,7 @@ namespace FunGame
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
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.Controls.Add(this.StopMatch);
|
||||
this.Controls.Add(this.Copyright);
|
||||
@ -637,8 +637,8 @@ namespace FunGame
|
||||
private Button Store;
|
||||
private LinkLabel Copyright;
|
||||
private Button StopMatch;
|
||||
private Models.TextArea GameInfo;
|
||||
private Models.TextArea NoticeText;
|
||||
private Models.TransparentRect TransparentRectControl;
|
||||
private Models.Component.TextArea GameInfo;
|
||||
private Models.Component.TextArea NoticeText;
|
||||
private Models.Component.TransparentRect TransparentRectControl;
|
||||
}
|
||||
}
|
@ -1,16 +1,17 @@
|
||||
using FunGame.Models.Component;
|
||||
using FunGame.Models.Config;
|
||||
using FunGame.Models.Entity;
|
||||
using FunGame.Desktop.Models.Component;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Sockets;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
using static FunGame.Models.Enum.CommonEnums;
|
||||
using FunGame.Utils.WebHelper;
|
||||
using FunGame.Models.Enum;
|
||||
using FunGame.Utils.DataHelper;
|
||||
using static FunGame.Desktop.Models.Enum.CommonEnums;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
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
|
||||
{
|
||||
@ -79,36 +80,49 @@ namespace FunGame
|
||||
{
|
||||
case Config.WebHelper_SetGreen:
|
||||
Usercfg.FunGame_isRetrying = false;
|
||||
WebHelper_Action = (Main? main) =>
|
||||
WebHelper_Action = (main) =>
|
||||
{
|
||||
SetServerStatusLight(true);
|
||||
};
|
||||
if (this.InvokeRequired)
|
||||
this.BeginInvoke(WebHelper_Action, this);
|
||||
if (InvokeRequired)
|
||||
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
|
||||
WebHelper_Action(this);
|
||||
Usercfg.FunGame_isConnected = true;
|
||||
NOW_CONNECTEDRETRY = 0;
|
||||
break;
|
||||
case Config.WebHelper_SetRed:
|
||||
WebHelper_Action = (Main? main) =>
|
||||
WebHelper_Action = (main) =>
|
||||
{
|
||||
SetServerStatusLight(false);
|
||||
};
|
||||
if (this.InvokeRequired)
|
||||
this.BeginInvoke(WebHelper_Action, this);
|
||||
if (InvokeRequired)
|
||||
BeginInvoke(WebHelper_Action, this);
|
||||
else
|
||||
WebHelper_Action(this);
|
||||
Usercfg.FunGame_isConnected = false;
|
||||
break;
|
||||
case Config.WebHelper_Disconnected:
|
||||
Usercfg.FunGame_isRetrying = false;
|
||||
WebHelper_Action = (Main? main) =>
|
||||
WebHelper_Action = (main) =>
|
||||
{
|
||||
SetServerStatusLight(false);
|
||||
};
|
||||
if (this.InvokeRequired)
|
||||
this.BeginInvoke(WebHelper_Action, this);
|
||||
if (InvokeRequired)
|
||||
BeginInvoke(WebHelper_Action, this);
|
||||
else
|
||||
WebHelper_Action(this);
|
||||
Usercfg.FunGame_isConnected = false;
|
||||
@ -142,7 +156,7 @@ namespace FunGame
|
||||
}
|
||||
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);
|
||||
}
|
||||
return null;
|
||||
@ -189,13 +203,13 @@ namespace FunGame
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (this.IsHandleCreated)
|
||||
if (IsHandleCreated)
|
||||
{
|
||||
// 检查是否创建了窗口句柄,再Invoke委托。
|
||||
break;
|
||||
}
|
||||
}
|
||||
Main_Action = (Main? main) =>
|
||||
Main_Action = (main) =>
|
||||
{
|
||||
if (!Usercfg.FunGame_isConnected)
|
||||
{
|
||||
@ -209,7 +223,7 @@ namespace FunGame
|
||||
WritelnGameInfo("ERROR:无法连接至服务器,请检查网络并重启游戏再试。");
|
||||
return;
|
||||
}
|
||||
WebHelper_Action = (Main? main) =>
|
||||
WebHelper_Action = (main) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -217,13 +231,13 @@ namespace FunGame
|
||||
{
|
||||
if (WebHelper != null)
|
||||
{
|
||||
WebHelper.WebHelpMethod((int)CommonEnums.WebHelperMethod.CloseSocket);
|
||||
WebHelper.WebHelpMethod((int)WebHelperMethod.CloseSocket);
|
||||
WebHelper = null;
|
||||
}
|
||||
Usercfg.FunGame_isRetrying = true;
|
||||
Application.DoEvents();
|
||||
WebHelper = new WebHelper(main);
|
||||
WebHelper.WebHelpMethod((int)CommonEnums.WebHelperMethod.CreateSocket); // Invoke -> CreateSocket
|
||||
WebHelper.WebHelpMethod((int)WebHelperMethod.CreateSocket); // Invoke -> CreateSocket
|
||||
}
|
||||
}
|
||||
catch
|
||||
@ -233,7 +247,7 @@ namespace FunGame
|
||||
};
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
if (InvokeRequired)
|
||||
{
|
||||
BeginInvoke(WebHelper_Action, main);
|
||||
}
|
||||
@ -244,7 +258,7 @@ namespace FunGame
|
||||
});
|
||||
}
|
||||
};
|
||||
if (this.InvokeRequired)
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(Main_Action, this);
|
||||
}
|
||||
@ -385,7 +399,7 @@ namespace FunGame
|
||||
{
|
||||
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);
|
||||
InRoom();
|
||||
@ -413,7 +427,7 @@ namespace FunGame
|
||||
{
|
||||
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);
|
||||
InRoom();
|
||||
@ -440,7 +454,7 @@ namespace FunGame
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case (int)CommonEnums.StartMatch_State.Matching:
|
||||
case (int)StartMatch_State.Matching:
|
||||
// 开始匹配
|
||||
Usercfg.FunGame_isMatching = true;
|
||||
int loop = 0;
|
||||
@ -460,20 +474,20 @@ namespace FunGame
|
||||
{
|
||||
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
|
||||
{
|
||||
StartMatch_Action((int)CommonEnums.StartMatch_State.Success, new object[] { roomid });
|
||||
StartMatch_Action((int)StartMatch_State.Success, new object[] { roomid });
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
case (int)CommonEnums.StartMatch_State.Success:
|
||||
case (int)StartMatch_State.Success:
|
||||
Usercfg.FunGame_isMatching = false;
|
||||
// 匹配成功返回房间号
|
||||
roomid = "-1";
|
||||
@ -492,21 +506,21 @@ namespace FunGame
|
||||
// 设置按钮可见性
|
||||
InRoom();
|
||||
// 创建委托,操作主界面
|
||||
StartMatch_Action = (int i, object[]? objs) =>
|
||||
StartMatch_Action = (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
|
||||
{
|
||||
StartMatch_Action((int)CommonEnums.StartMatch_State.Enable, new object[] { true });
|
||||
StartMatch_Action((int)StartMatch_State.Enable, new object[] { true });
|
||||
}
|
||||
MatchFunGame = null;
|
||||
break;
|
||||
case (int)CommonEnums.StartMatch_State.Enable:
|
||||
case (int)StartMatch_State.Enable:
|
||||
// 设置匹配过程中的各种按钮是否可用
|
||||
bool isPause = false;
|
||||
if (objs != null) isPause = (bool)objs[0];
|
||||
@ -517,21 +531,21 @@ namespace FunGame
|
||||
RoomBox.Enabled = isPause;
|
||||
Login.Enabled = isPause;
|
||||
break;
|
||||
case (int)CommonEnums.StartMatch_State.Cancel:
|
||||
case (int)StartMatch_State.Cancel:
|
||||
WritelnGameInfo(GetNowShortTime() + " 终止匹配");
|
||||
WritelnGameInfo("[ " + Usercfg.LoginUserName + " ] 已终止匹配。");
|
||||
Usercfg.FunGame_isMatching = false;
|
||||
StartMatch_Action = (int i, object[]? objs) =>
|
||||
StartMatch_Action = (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
|
||||
{
|
||||
StartMatch_Action((int)CommonEnums.StartMatch_State.Enable, new object[] { true });
|
||||
StartMatch_Action((int)StartMatch_State.Enable, new object[] { true });
|
||||
}
|
||||
MatchFunGame = null;
|
||||
StopMatch.Visible = false;
|
||||
@ -565,17 +579,17 @@ namespace FunGame
|
||||
/// </summary>
|
||||
private void StopMatch_Click()
|
||||
{
|
||||
StartMatch_Action = (int i, object[]? objs) =>
|
||||
StartMatch_Action = (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
|
||||
{
|
||||
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)
|
||||
{
|
||||
case (int)CommonEnums.CreateRoom_State.Creating:
|
||||
CreateRoom_Action = (int i, object[]? objs) =>
|
||||
case (int)CreateRoom_State.Creating:
|
||||
CreateRoom_Action = (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
|
||||
{
|
||||
CreateRoom_Action((int)CommonEnums.CreateRoom_State.Success, new object[] { roomtype });
|
||||
CreateRoom_Action((int)CreateRoom_State.Success, new object[] { roomtype });
|
||||
}
|
||||
break;
|
||||
case (int)CommonEnums.CreateRoom_State.Success:
|
||||
case (int)CreateRoom_State.Success:
|
||||
roomid = Convert.ToString(new Random().Next(1, 10000));
|
||||
SetRoomid(roomid);
|
||||
InRoom();
|
||||
@ -671,17 +685,25 @@ namespace FunGame
|
||||
/// 设置服务器连接状态指示灯
|
||||
/// </summary>
|
||||
/// <param name="green"></param>
|
||||
private void SetServerStatusLight(bool green)
|
||||
private void SetServerStatusLight(bool green, int ping = 0)
|
||||
{
|
||||
if (green)
|
||||
{
|
||||
if (ping > 0)
|
||||
{
|
||||
Connection.Text = "心跳延迟 " + ping + "ms";
|
||||
this.Light.Image = Properties.Resources.green;
|
||||
}
|
||||
else
|
||||
{
|
||||
Connection.Text = "服务器连接成功";
|
||||
this.Light.Image = global::FunGame.Properties.Resources.green;
|
||||
this.Light.Image = Properties.Resources.green;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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>
|
||||
private void Exit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ShowMessage.OKCancelMessage("你确定关闭游戏?", "退出") == (int)CommonEnums.MessageResult.OK)
|
||||
if (ShowMessage.OKCancelMessage("你确定关闭游戏?", "退出") == (int)MessageResult.OK)
|
||||
{
|
||||
if (WebHelper != null)
|
||||
{
|
||||
WebHelper.WebHelpMethod((int)CommonEnums.WebHelperMethod.CloseSocket);
|
||||
WebHelper.WebHelpMethod((int)WebHelperMethod.CloseSocket);
|
||||
WebHelper = null;
|
||||
}
|
||||
System.Environment.Exit(0);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -718,8 +740,8 @@ namespace FunGame
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
//获取鼠标左键按下时的位置
|
||||
this.LOCATION_X = e.Location.X;
|
||||
this.LOCATION_Y = e.Location.Y;
|
||||
LOCATION_X = e.Location.X;
|
||||
LOCATION_Y = e.Location.Y;
|
||||
}
|
||||
}
|
||||
|
||||
@ -733,8 +755,8 @@ namespace FunGame
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
//计算鼠标移动距离
|
||||
this.Left += e.Location.X - this.LOCATION_X;
|
||||
this.Top += e.Location.Y - this.LOCATION_Y;
|
||||
Left += e.Location.X - LOCATION_X;
|
||||
Top += e.Location.Y - LOCATION_Y;
|
||||
}
|
||||
}
|
||||
|
||||
@ -760,9 +782,9 @@ namespace FunGame
|
||||
StartMatch.Visible = false;
|
||||
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);
|
||||
};
|
||||
@ -770,13 +792,13 @@ namespace FunGame
|
||||
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
|
||||
{
|
||||
StartMatch_Action((int)CommonEnums.StartMatch_State.Matching, null);
|
||||
StartMatch_Action((int)StartMatch_State.Matching, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -815,17 +837,17 @@ namespace FunGame
|
||||
ShowMessage.WarningMessage("请勾选你要创建的房间类型!");
|
||||
return;
|
||||
}
|
||||
CreateRoom_Action = (int i, object[]? objs) =>
|
||||
CreateRoom_Action = (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
|
||||
{
|
||||
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>
|
||||
private void MinForm_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
WindowState = FormWindowState.Minimized;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -1102,31 +1124,31 @@ namespace FunGame
|
||||
case Config.FunGame_ShowStore:
|
||||
break;
|
||||
case Config.FunGame_CreateMix:
|
||||
CreateRoom_Action = (int i, object[]? objs) =>
|
||||
CreateRoom_Action = (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
|
||||
{
|
||||
CreateRoom_Action((int)CommonEnums.CreateRoom_State.Creating, new object[] { Config.GameMode_Mix });
|
||||
CreateRoom_Action((int)CreateRoom_State.Creating, new object[] { Config.GameMode_Mix });
|
||||
}
|
||||
break;
|
||||
case Config.FunGame_CreateTeam:
|
||||
CreateRoom_Action = (int i, object[]? objs) =>
|
||||
CreateRoom_Action = (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
|
||||
{
|
||||
CreateRoom_Action((int)CommonEnums.CreateRoom_State.Creating, new object[] { Config.GameMode_Team });
|
||||
CreateRoom_Action((int)CreateRoom_State.Creating, new object[] { Config.GameMode_Team });
|
||||
}
|
||||
break;
|
||||
case Config.FunGame_StartGame:
|
||||
@ -1157,7 +1179,7 @@ namespace FunGame
|
||||
/// <returns></returns>
|
||||
private string GetNowTime()
|
||||
{
|
||||
DateTime now = System.DateTime.Now;
|
||||
DateTime now = DateTime.Now;
|
||||
return now.AddMilliseconds(-now.Millisecond).ToString();
|
||||
}
|
||||
|
||||
@ -1167,10 +1189,33 @@ namespace FunGame
|
||||
/// <returns></returns>
|
||||
private string GetNowShortTime()
|
||||
{
|
||||
DateTime now = System.DateTime.Now;
|
||||
DateTime now = DateTime.Now;
|
||||
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
|
||||
}
|
||||
}
|
@ -57,6 +57,111 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</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" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
@ -1,4 +1,4 @@
|
||||
namespace FunGame.UI
|
||||
namespace FunGame.Desktop.UI
|
||||
{
|
||||
internal static class Start
|
||||
{
|
@ -5,13 +5,15 @@ using System.Net.Sockets;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FunGame.Models.Config;
|
||||
using FunGame.Models.Component;
|
||||
using FunGame.Models.Entity;
|
||||
using FunGame.Desktop.Models.Component;
|
||||
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
|
||||
{
|
||||
@ -156,6 +158,7 @@ namespace FunGame.Utils.WebHelper
|
||||
case (int)SocketEnums.Type.HeartBeat:
|
||||
if (WaitHeartBeat != null && !WaitHeartBeat.IsCompleted) WaitHeartBeat.Wait(1);
|
||||
Config.WebHelper_HeartBeatFaileds = 0;
|
||||
main.GetMessage(this, Config.WebHelper_SetGreenAndPing);
|
||||
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
|
||||
VisualStudioVersion = 17.3.32804.467
|
||||
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
|
||||
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
|
||||
Global
|
||||
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}.Release|Any CPU.ActiveCfg = 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
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|