mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-22 03:59:35 +08:00
添加接口
This commit is contained in:
parent
52a33c0ddb
commit
295943e172
223
FunGame.Core.Api/Interface/Events.cs
Normal file
223
FunGame.Core.Api/Interface/Events.cs
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FunGame.Core.Api.Interface
|
||||||
|
{
|
||||||
|
public interface FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeConnectEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterConnectEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeDisconnectEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterDisconnectEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeLoginEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterLoginEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeLogoutEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterLogoutEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeRegEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterRegEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeIntoRoomEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterIntoRoomEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeSendTalkEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterSendTalkEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeCreateRoomEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterCreateRoomEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeQuitRoomEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterQuitRoomEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeChangeRoomSettingEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterChangeRoomSettingEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeStartMatchEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterStartMatchEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeStartGameEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterStartGameEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeChangeProfileEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterChangeProfileEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeChangeAccountSettingEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterChangeAccountSettingEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeOpenStockEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterOpenStockEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeSignInEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterSignInEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeOpenStoreEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterOpenStoreEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeBuyItemEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterBuyItemEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeShowRankingEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterShowRankingEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeUseItemEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterUseItemEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BeforeEndGameEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AfterEndGameEvent : FunGameEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -142,59 +142,4 @@ namespace FunGame.Core.Api.Model.Enum
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
public class EnumHelper
|
|
||||||
{
|
|
||||||
#region 工具方法
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取实现类类名
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Interface">接口代号</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string GetImplementClassName(int Interface)
|
|
||||||
{
|
|
||||||
foreach (string str in System.Enum.GetNames(typeof(InterfaceType)))
|
|
||||||
{
|
|
||||||
InterfaceType temp = (InterfaceType)System.Enum.Parse(typeof(InterfaceType), Interface.ToString(), true);
|
|
||||||
if (temp.ToString() == str)
|
|
||||||
return temp + "Impl";
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取实现类的方法名
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Method">方法代号</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string GetImplementMethodName(int Method)
|
|
||||||
{
|
|
||||||
foreach (string str in System.Enum.GetNames(typeof(InterfaceMethod)))
|
|
||||||
{
|
|
||||||
InterfaceMethod temp = (InterfaceMethod)System.Enum.Parse(typeof(InterfaceMethod), Method.ToString(), true);
|
|
||||||
if (temp.ToString() == str)
|
|
||||||
return temp.ToString();
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取Socket枚举名
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="SocketType">Socket枚举</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string GetSocketTypeName(int SocketType)
|
|
||||||
{
|
|
||||||
foreach (string str in System.Enum.GetNames(typeof(SocketMessageType)))
|
|
||||||
{
|
|
||||||
SocketMessageType temp = (SocketMessageType)System.Enum.Parse(typeof(SocketMessageType), SocketType.ToString(), true);
|
|
||||||
if (temp.ToString() == str)
|
|
||||||
return temp.ToString();
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,10 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace FunGame.Core.Api.Util
|
namespace FunGame.Core.Api.Util
|
||||||
{
|
{
|
||||||
|
#region 通用工具类
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 工具类,客户端和服务器端都可以直接调用的工具方法都可以写在这里
|
/// 通用工具类,客户端和服务器端都可以直接调用的工具方法都可以写在这里
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Utility
|
public class Utility
|
||||||
{
|
{
|
||||||
@ -79,6 +81,10 @@ namespace FunGame.Core.Api.Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 读写INI文件工具类
|
||||||
|
|
||||||
public class INIHelper
|
public class INIHelper
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -177,6 +183,10 @@ namespace FunGame.Core.Api.Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 接口反射工具类
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 在FunGame.Core.Api中添加新接口和新实现时,需要:
|
/// 在FunGame.Core.Api中添加新接口和新实现时,需要:
|
||||||
/// 在FunGame.Core.Api.Model.Enum.CommonEnums里同步添加InterfaceType、InterfaceMethod
|
/// 在FunGame.Core.Api.Model.Enum.CommonEnums里同步添加InterfaceType、InterfaceMethod
|
||||||
@ -253,4 +263,61 @@ namespace FunGame.Core.Api.Util
|
|||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 枚举反射工具类
|
||||||
|
|
||||||
|
public class EnumHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取实现类类名
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Interface">接口代号</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetImplementClassName(int Interface)
|
||||||
|
{
|
||||||
|
foreach (string str in System.Enum.GetNames(typeof(InterfaceType)))
|
||||||
|
{
|
||||||
|
InterfaceType temp = (InterfaceType)System.Enum.Parse(typeof(InterfaceType), Interface.ToString(), true);
|
||||||
|
if (temp.ToString() == str)
|
||||||
|
return temp + "Impl";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取实现类的方法名
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Method">方法代号</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetImplementMethodName(int Method)
|
||||||
|
{
|
||||||
|
foreach (string str in System.Enum.GetNames(typeof(InterfaceMethod)))
|
||||||
|
{
|
||||||
|
InterfaceMethod temp = (InterfaceMethod)System.Enum.Parse(typeof(InterfaceMethod), Method.ToString(), true);
|
||||||
|
if (temp.ToString() == str)
|
||||||
|
return temp.ToString();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取Socket枚举名
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="SocketType">Socket枚举</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetSocketTypeName(int SocketType)
|
||||||
|
{
|
||||||
|
foreach (string str in System.Enum.GetNames(typeof(SocketMessageType)))
|
||||||
|
{
|
||||||
|
SocketMessageType temp = (SocketMessageType)System.Enum.Parse(typeof(SocketMessageType), SocketType.ToString(), true);
|
||||||
|
if (temp.ToString() == str)
|
||||||
|
return temp.ToString();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using FunGame.Core.Api.Model.Enum;
|
using FunGame.Core.Api.Model.Enum;
|
||||||
using static FunGame.Core.Api.Model.Enum.EnumHelper;
|
|
||||||
|
|
||||||
namespace FunGame.Desktop.Models.Component
|
namespace FunGame.Desktop.Models.Component
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using FunGame.Core.Api.Model.Entity;
|
using FunGame.Core.Api.Model.Entity;
|
||||||
using FunGame.Core.Api.Model.Enum;
|
using FunGame.Core.Api.Model.Enum;
|
||||||
|
using FunGame.Core.Api.Util;
|
||||||
using FunGame.Desktop.Models.Config;
|
using FunGame.Desktop.Models.Config;
|
||||||
using FunGame.Desktop.UI;
|
using FunGame.Desktop.UI;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user