mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-22 20:19:34 +08:00
修改架构
This commit is contained in:
parent
d8489d654a
commit
b1e572bfc7
@ -3,21 +3,22 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Factory
|
||||
{
|
||||
internal class ItemFactory
|
||||
{
|
||||
internal static Milimoe.FunGame.Core.Entity.General.Item? GetInstance(Milimoe.FunGame.Core.Entity.Enum.ItemType type, string Name)
|
||||
internal static Milimoe.FunGame.Core.Entity.Item? GetInstance(ItemType type, string Name)
|
||||
{
|
||||
Milimoe.FunGame.Core.Entity.General.Item? item = null;
|
||||
Milimoe.FunGame.Core.Entity.Item? item = null;
|
||||
switch (type)
|
||||
{
|
||||
case Entity.Enum.ItemType.Active:
|
||||
item = new Milimoe.FunGame.Core.Entity.General.ActiveItem(Name);
|
||||
case ItemType.Active:
|
||||
item = new Milimoe.FunGame.Core.Entity.ActiveItem(Name);
|
||||
break;
|
||||
case Entity.Enum.ItemType.Passive:
|
||||
item = new Milimoe.FunGame.Core.Entity.General.PassiveItem(Name);
|
||||
case ItemType.Passive:
|
||||
item = new Milimoe.FunGame.Core.Entity.PassiveItem(Name);
|
||||
break;
|
||||
}
|
||||
return item;
|
||||
|
@ -1,32 +1,32 @@
|
||||
using Milimoe.FunGame.Core.Entity.General;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Factory
|
||||
{
|
||||
internal class RoomFactory
|
||||
{
|
||||
internal static Milimoe.FunGame.Core.Entity.General.Room GetInstanceByRandomID(Milimoe.FunGame.Core.Entity.Enum.RoomType type, Milimoe.FunGame.Core.Entity.General.User? user)
|
||||
internal static Milimoe.FunGame.Core.Entity.Room GetInstanceByRandomID(RoomType type, Milimoe.FunGame.Core.Entity.User? user)
|
||||
{
|
||||
Milimoe.FunGame.Core.Entity.General.Room room = new(user)
|
||||
Milimoe.FunGame.Core.Entity.Room room = new(user)
|
||||
{
|
||||
RoomType = type,
|
||||
RoomState = Entity.Enum.RoomState.Created
|
||||
RoomState = RoomState.Created
|
||||
};
|
||||
return room;
|
||||
}
|
||||
|
||||
internal static Milimoe.FunGame.Core.Entity.General.Room GetInstanceByRoomID(Milimoe.FunGame.Core.Entity.Enum.RoomType type, string roomid, Milimoe.FunGame.Core.Entity.General.User? user)
|
||||
internal static Milimoe.FunGame.Core.Entity.Room GetInstanceByRoomID(RoomType type, string roomid, Milimoe.FunGame.Core.Entity.User? user)
|
||||
{
|
||||
Milimoe.FunGame.Core.Entity.General.Room room = new(roomid, user)
|
||||
Milimoe.FunGame.Core.Entity.Room room = new(roomid, user)
|
||||
{
|
||||
RoomType = type,
|
||||
RoomState = Entity.Enum.RoomState.Created
|
||||
RoomState = RoomState.Created
|
||||
};
|
||||
return room;
|
||||
}
|
||||
|
@ -3,21 +3,23 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Factory
|
||||
{
|
||||
internal class SkillFactory
|
||||
{
|
||||
internal static Milimoe.FunGame.Core.Entity.General.Skill? GetInstance(Milimoe.FunGame.Core.Entity.Enum.SkillType type, string Name)
|
||||
internal static Skill? GetInstance(SkillType type, string Name)
|
||||
{
|
||||
Milimoe.FunGame.Core.Entity.General.Skill? skill = null;
|
||||
Skill? skill = null;
|
||||
switch (type)
|
||||
{
|
||||
case Entity.Enum.SkillType.Active:
|
||||
skill = new Milimoe.FunGame.Core.Entity.General.ActiveSkill(Name);
|
||||
case SkillType.Active:
|
||||
skill = new Milimoe.FunGame.Core.Entity.ActiveSkill(Name);
|
||||
break;
|
||||
case Entity.Enum.SkillType.Passive:
|
||||
skill = new Milimoe.FunGame.Core.Entity.General.PassiveSkill(Name);
|
||||
case SkillType.Passive:
|
||||
skill = new Milimoe.FunGame.Core.Entity.PassiveSkill(Name);
|
||||
break;
|
||||
}
|
||||
return skill;
|
||||
|
@ -8,19 +8,19 @@ namespace Milimoe.FunGame.Core.Api.Factory
|
||||
{
|
||||
internal class UserFactory
|
||||
{
|
||||
internal static Milimoe.FunGame.Core.Entity.General.User GetInstance()
|
||||
internal static Milimoe.FunGame.Core.Entity.User GetInstance()
|
||||
{
|
||||
return new Milimoe.FunGame.Core.Entity.General.User();
|
||||
return new Milimoe.FunGame.Core.Entity.User();
|
||||
}
|
||||
|
||||
internal static Milimoe.FunGame.Core.Entity.General.User GetInstance(string username)
|
||||
internal static Milimoe.FunGame.Core.Entity.User GetInstance(string username)
|
||||
{
|
||||
return new Milimoe.FunGame.Core.Entity.General.User(username);
|
||||
return new Milimoe.FunGame.Core.Entity.User(username);
|
||||
}
|
||||
|
||||
internal static Milimoe.FunGame.Core.Entity.General.User GetInstance(string username, string password)
|
||||
internal static Milimoe.FunGame.Core.Entity.User GetInstance(string username, string password)
|
||||
{
|
||||
return new Milimoe.FunGame.Core.Entity.General.User(username, password);
|
||||
return new Milimoe.FunGame.Core.Entity.User(username, password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using Milimoe.FunGame.Core.Entity.Enum;
|
||||
using Milimoe.FunGame.Core.Interface.Base;
|
||||
using Milimoe.FunGame.Core.Interface.Base;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Entity.Enum;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Utility
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Utility
|
||||
@ -20,11 +21,11 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
if (!IsEntity<T>()) return null;
|
||||
object? instance = null;
|
||||
if (objs is null || objs.Length == 0) return instance;
|
||||
if (typeof(T) == typeof(Entity.General.User))
|
||||
if (typeof(T) == typeof(Entity.User))
|
||||
{
|
||||
instance = Factory.UserFactory.GetInstance("Mili");
|
||||
}
|
||||
else if (typeof(T) == typeof(Entity.General.Skill))
|
||||
else if (typeof(T) == typeof(Skill))
|
||||
{
|
||||
|
||||
}
|
||||
@ -45,11 +46,11 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
object instance = General.EntityInstance;
|
||||
if (!IsEntity<T>()) return instance;
|
||||
if (objs is null || objs.Length == 0) return instance;
|
||||
if (typeof(T) == typeof(Entity.General.User))
|
||||
if (typeof(T) == typeof(Entity.User))
|
||||
{
|
||||
instance = Factory.UserFactory.GetInstance("Mili");
|
||||
}
|
||||
else if (typeof(T) == typeof(Entity.General.Skill))
|
||||
else if (typeof(T) == typeof(Skill))
|
||||
{
|
||||
|
||||
}
|
||||
@ -70,11 +71,11 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
object instance = General.EntityInstance;
|
||||
if (!IsEntity<T>()) return instance;
|
||||
if (objs is null || objs.Length == 0) return instance;
|
||||
if (typeof(T) == typeof(Entity.General.User))
|
||||
if (typeof(T) == typeof(Entity.User))
|
||||
{
|
||||
instance = Factory.UserFactory.GetInstance("Mili");
|
||||
}
|
||||
else if (typeof(T) == typeof(Entity.General.Skill))
|
||||
else if (typeof(T) == typeof(Skill))
|
||||
{
|
||||
|
||||
}
|
||||
@ -84,13 +85,13 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
|
||||
private static bool IsEntity<T>()
|
||||
{
|
||||
if (typeof(T) == typeof(Entity.General.ActiveItem) || typeof(T) == typeof(Entity.General.ActiveSkill)
|
||||
|| typeof(T) == typeof(Entity.General.Character) || typeof(T) == typeof(Entity.General.CharacterStatistics)
|
||||
|| typeof(T) == typeof(Entity.General.GameStatistics) || typeof(T) == typeof(Entity.General.Inventory)
|
||||
|| typeof(T) == typeof(Entity.General.Item) || typeof(T) == typeof(Entity.General.PassiveItem)
|
||||
|| typeof(T) == typeof(Entity.General.PassiveSkill) || typeof(T) == typeof(Entity.General.Room)
|
||||
|| typeof(T) == typeof(Entity.General.Skill) || typeof(T) == typeof(Entity.General.User)
|
||||
|| typeof(T) == typeof(Entity.General.UserStatistics))
|
||||
if (typeof(T) == typeof(Entity.ActiveItem) || typeof(T) == typeof(ActiveSkill)
|
||||
|| typeof(T) == typeof(Entity.Character) || typeof(T) == typeof(Entity.CharacterStatistics)
|
||||
|| typeof(T) == typeof(Entity.GameStatistics) || typeof(T) == typeof(Inventory)
|
||||
|| typeof(T) == typeof(Entity.Item) || typeof(T) == typeof(Entity.PassiveItem)
|
||||
|| typeof(T) == typeof(PassiveSkill) || typeof(T) == typeof(Entity.Room)
|
||||
|| typeof(T) == typeof(Skill) || typeof(T) == typeof(Entity.User)
|
||||
|| typeof(T) == typeof(Entity.UserStatistics))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Entity.Enum;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
// 通用工具类,客户端和服务器端都可以直接调用的工具方法都可以写在这里
|
||||
namespace Milimoe.FunGame.Core.Api.Utility
|
||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Entity.Enum;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Utility
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface的定义已经搬至:
|
||||
/// Milimoe.FunGame.Core.Others中的 &InterfaceType 和 &InterfaceSet
|
||||
/// Milimoe.FunGame.Core.Library.Constant 中的 &InterfaceType 和 &InterfaceSet
|
||||
/// </summary>
|
||||
public class ReflectionHelper
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class Character
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class Empty
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class ActiveItem : Item
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public abstract class Item
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class PassiveItem : Item
|
||||
{
|
@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Sockets;
|
||||
using System.Net;
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Service;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Network
|
||||
{
|
||||
public class Socket
|
||||
{
|
||||
public System.Net.Sockets.Socket Instance { get; }
|
||||
|
||||
private Socket(System.Net.Sockets.Socket Instance)
|
||||
{
|
||||
this.Instance = Instance;
|
||||
}
|
||||
|
||||
public static Socket Connect(string IP, int Port = 22222)
|
||||
{
|
||||
System.Net.Sockets.Socket? socket = SocketManager.Connect(IP, Port);
|
||||
if (socket != null) return new Socket(socket);
|
||||
else throw new Milimoe.FunGame.Core.Entity.Exception.SystemError("创建Socket失败。");
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class ActiveSkill : Skill
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class PassiveSkill : Skill
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public abstract class Skill
|
||||
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class CharacterStatistics
|
||||
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class GameStatistics
|
||||
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class UserStatistics
|
||||
{
|
@ -4,8 +4,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class Inventory
|
||||
{
|
@ -5,8 +5,9 @@ using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class Room
|
||||
{
|
||||
@ -15,8 +16,8 @@ namespace Milimoe.FunGame.Core.Entity.General
|
||||
public DateTime Time { get; set; } = DateTime.Now;
|
||||
public Hashtable PlayerList { get; set; } = new Hashtable();
|
||||
public User? RoomMaster { get; set; }
|
||||
public Milimoe.FunGame.Core.Entity.Enum.RoomType RoomType { get; set; }
|
||||
public Milimoe.FunGame.Core.Entity.Enum.RoomState RoomState { get; set; }
|
||||
public RoomType RoomType { get; set; }
|
||||
public RoomState RoomState { get; set; }
|
||||
public GameStatistics? Statistics { get; set; } = null;
|
||||
|
||||
internal Room(User? master = null)
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.General
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
public class User
|
||||
{
|
@ -22,8 +22,4 @@
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Library\Common\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -3,24 +3,25 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Interface.Base
|
||||
{
|
||||
public interface ISQLProxy
|
||||
{
|
||||
public Entity.Enum.ProxyResult Execute();
|
||||
public Entity.Enum.ProxyResult Execute(object[]? objs = null);
|
||||
public Entity.Enum.ProxyResult Execute(StringBuilder script);
|
||||
public ProxyResult Execute();
|
||||
public ProxyResult Execute(object[]? objs = null);
|
||||
public ProxyResult Execute(StringBuilder script);
|
||||
public int ExecuteRow();
|
||||
public int ExecuteRow(object[]? objs = null);
|
||||
public int ExecuteRow(StringBuilder script);
|
||||
public System.Data.DataSet GetData(Entity.Enum.EntityType type, object[]? objs = null);
|
||||
public System.Data.DataSet GetData(EntityType type, object[]? objs = null);
|
||||
public System.Data.DataSet GetData(object[]? objs = null);
|
||||
public System.Data.DataSet GetData(StringBuilder script);
|
||||
public System.Data.DataTable GetDataTable(Entity.Enum.EntityType type, object[]? objs = null);
|
||||
public System.Data.DataTable GetDataTable(EntityType type, object[]? objs = null);
|
||||
public System.Data.DataTable GetDataTable(object[]? objs = null);
|
||||
public System.Data.DataTable GetDataTable(StringBuilder script);
|
||||
public System.Data.DataRow GetDataRow(Entity.Enum.EntityType type, object[]? objs = null);
|
||||
public System.Data.DataRow GetDataRow(EntityType type, object[]? objs = null);
|
||||
public System.Data.DataRow GetDataRow(System.Data.DataSet set, object[]? objs = null);
|
||||
public System.Data.DataRow GetDataRow(System.Data.DataTable table, object[]? objs = null);
|
||||
public System.Data.DataRow GetDataRow(StringBuilder script);
|
||||
|
@ -3,27 +3,28 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Interface.Base
|
||||
{
|
||||
internal interface ISQLService
|
||||
{
|
||||
internal Entity.Enum.ProxyResult Execute();
|
||||
internal Entity.Enum.ProxyResult Execute(object[]? objs = null);
|
||||
internal Entity.Enum.ProxyResult Execute(StringBuilder script);
|
||||
internal ProxyResult Execute();
|
||||
internal ProxyResult Execute(object[]? objs = null);
|
||||
internal ProxyResult Execute(StringBuilder script);
|
||||
internal int UpdateRow(object[]? objs = null);
|
||||
internal int UpdateRow(StringBuilder script);
|
||||
internal int DeleteRow(object[]? objs = null);
|
||||
internal int DeleteRow(StringBuilder script);
|
||||
internal int AddRow(object[]? objs = null);
|
||||
internal int AddRow(StringBuilder script);
|
||||
internal System.Data.DataSet GetData(Entity.Enum.EntityType type, object[]? objs = null);
|
||||
internal System.Data.DataSet GetData(EntityType type, object[]? objs = null);
|
||||
internal System.Data.DataSet GetData(object[]? objs = null);
|
||||
internal System.Data.DataSet GetData(StringBuilder script);
|
||||
internal System.Data.DataTable GetDataTable(Entity.Enum.EntityType type, object[]? objs = null);
|
||||
internal System.Data.DataTable GetDataTable(EntityType type, object[]? objs = null);
|
||||
internal System.Data.DataTable GetDataTable(object[]? objs);
|
||||
internal System.Data.DataTable GetDataTable(StringBuilder script);
|
||||
internal System.Data.DataRow GetDataRow(Entity.Enum.EntityType type, object[]? objs = null);
|
||||
internal System.Data.DataRow GetDataRow(EntityType type, object[]? objs = null);
|
||||
internal System.Data.DataRow GetDataRow(System.Data.DataSet set, object[]? objs = null);
|
||||
internal System.Data.DataRow GetDataRow(System.Data.DataTable table, object[]? objs = null);
|
||||
internal System.Data.DataRow GetDataRow(StringBuilder script);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Milimoe.FunGame.Core.Entity.Event;
|
||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -9,10 +10,10 @@ namespace Milimoe.FunGame.Core.Interface
|
||||
{
|
||||
public interface IEvent
|
||||
{
|
||||
public delegate Milimoe.FunGame.Core.Entity.Enum.EventResult BeforeEvent(object sender, GeneralEventArgs e);
|
||||
public delegate Milimoe.FunGame.Core.Entity.Enum.EventResult AfterEvent(object sender, GeneralEventArgs e);
|
||||
public delegate Milimoe.FunGame.Core.Entity.Enum.EventResult SucceedEvent(object sender, GeneralEventArgs e);
|
||||
public delegate Milimoe.FunGame.Core.Entity.Enum.EventResult FailedEvent(object sender, GeneralEventArgs e);
|
||||
public delegate EventResult BeforeEvent(object sender, GeneralEventArgs e);
|
||||
public delegate EventResult AfterEvent(object sender, GeneralEventArgs e);
|
||||
public delegate EventResult SucceedEvent(object sender, GeneralEventArgs e);
|
||||
public delegate EventResult FailedEvent(object sender, GeneralEventArgs e);
|
||||
}
|
||||
|
||||
public interface IConnectEvent : IEvent
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace Milimoe.FunGame.Core.Interface
|
||||
{
|
||||
/**
|
||||
* 接口需要在FunGame.Core项目中创建新的类实现
|
||||
* 接口需要在FunGame.Implement项目中创建新的类实现
|
||||
* namespace必须是Milimoe.FunGame.Core.Implement,文件夹位置随意
|
||||
* 参考:
|
||||
* using Milimoe.FunGame.Core.Interface;
|
||||
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class BuyItemEvent : IBuyItemEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedBuyItemEvent;
|
||||
public event IEvent.FailedEvent? FailedBuyItemEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeBuyItemEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeBuyItemEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeBuyItemEvent != null)
|
||||
{
|
||||
return BeforeBuyItemEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterBuyItemEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterBuyItemEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterBuyItemEvent != null)
|
||||
{
|
||||
return AfterBuyItemEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedBuyItemEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedBuyItemEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedBuyItemEvent != null)
|
||||
{
|
||||
return SucceedBuyItemEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedBuyItemEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedBuyItemEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedBuyItemEvent != null)
|
||||
{
|
||||
return FailedBuyItemEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class ChangeAccountSettingEvent : IChangeAccountSettingEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedChangeAccountSettingEvent;
|
||||
public event IEvent.FailedEvent? FailedChangeAccountSettingEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeChangeAccountSettingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeChangeAccountSettingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeChangeAccountSettingEvent != null)
|
||||
{
|
||||
return BeforeChangeAccountSettingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterChangeAccountSettingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterChangeAccountSettingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterChangeAccountSettingEvent != null)
|
||||
{
|
||||
return AfterChangeAccountSettingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedChangeAccountSettingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedChangeAccountSettingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedChangeAccountSettingEvent != null)
|
||||
{
|
||||
return SucceedChangeAccountSettingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedChangeAccountSettingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedChangeAccountSettingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedChangeAccountSettingEvent != null)
|
||||
{
|
||||
return FailedChangeAccountSettingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class ChangeProfileEvent : IChangeProfileEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedChangeProfileEvent;
|
||||
public event IEvent.FailedEvent? FailedChangeProfileEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeChangeProfileEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeChangeProfileEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeChangeProfileEvent != null)
|
||||
{
|
||||
return BeforeChangeProfileEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterChangeProfileEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterChangeProfileEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterChangeProfileEvent != null)
|
||||
{
|
||||
return AfterChangeProfileEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedChangeProfileEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedChangeProfileEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedChangeProfileEvent != null)
|
||||
{
|
||||
return SucceedChangeProfileEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedChangeProfileEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedChangeProfileEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedChangeProfileEvent != null)
|
||||
{
|
||||
return FailedChangeProfileEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class ChangeRoomSettingEvent : IChangeRoomSettingEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedChangeRoomSettingEvent;
|
||||
public event IEvent.FailedEvent? FailedChangeRoomSettingEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeChangeRoomSettingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeChangeRoomSettingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeChangeRoomSettingEvent != null)
|
||||
{
|
||||
return BeforeChangeRoomSettingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterChangeRoomSettingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterChangeRoomSettingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterChangeRoomSettingEvent != null)
|
||||
{
|
||||
return AfterChangeRoomSettingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedChangeRoomSettingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedChangeRoomSettingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedChangeRoomSettingEvent != null)
|
||||
{
|
||||
return SucceedChangeRoomSettingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedChangeRoomSettingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedChangeRoomSettingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedChangeRoomSettingEvent != null)
|
||||
{
|
||||
return FailedChangeRoomSettingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class ConnectEvent : IConnectEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedConnectEvent;
|
||||
public event IEvent.FailedEvent? FailedConnectEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeConnectEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeConnectEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeConnectEvent != null)
|
||||
{
|
||||
return BeforeConnectEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterConnectEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterConnectEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterConnectEvent != null)
|
||||
{
|
||||
return AfterConnectEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedConnectEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedConnectEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedConnectEvent != null)
|
||||
{
|
||||
return SucceedConnectEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedConnectEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedConnectEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedConnectEvent != null)
|
||||
{
|
||||
return FailedConnectEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class CreateRoomEvent : ICreateRoomEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedCreateRoomEvent;
|
||||
public event IEvent.FailedEvent? FailedCreateRoomEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeCreateRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeCreateRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeCreateRoomEvent != null)
|
||||
{
|
||||
return BeforeCreateRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterCreateRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterCreateRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterCreateRoomEvent != null)
|
||||
{
|
||||
return AfterCreateRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedCreateRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedCreateRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedCreateRoomEvent != null)
|
||||
{
|
||||
return SucceedCreateRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedCreateRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedCreateRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedCreateRoomEvent != null)
|
||||
{
|
||||
return FailedCreateRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class DisconnectEvent : IDisconnectEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedDisconnectEvent;
|
||||
public event IEvent.FailedEvent? FailedDisconnectEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeDisconnectEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeDisconnectEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeDisconnectEvent != null)
|
||||
{
|
||||
return BeforeDisconnectEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterDisconnectEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterDisconnectEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterDisconnectEvent != null)
|
||||
{
|
||||
return AfterDisconnectEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedDisconnectEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedDisconnectEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedDisconnectEvent != null)
|
||||
{
|
||||
return SucceedDisconnectEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedDisconnectEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedDisconnectEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedDisconnectEvent != null)
|
||||
{
|
||||
return FailedDisconnectEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class EndGameEvent : IEndGameEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedEndGameEvent;
|
||||
public event IEvent.FailedEvent? FailedEndGameEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeEndGameEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeEndGameEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeEndGameEvent != null)
|
||||
{
|
||||
return BeforeEndGameEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterEndGameEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterEndGameEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterEndGameEvent != null)
|
||||
{
|
||||
return AfterEndGameEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedEndGameEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedEndGameEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedEndGameEvent != null)
|
||||
{
|
||||
return SucceedEndGameEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedEndGameEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedEndGameEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedEndGameEvent != null)
|
||||
{
|
||||
return FailedEndGameEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class GeneralEventArgs : EventArgs
|
||||
{
|
||||
@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public T Instance { get; set; }
|
||||
public GeneralEvent()
|
||||
{
|
||||
Instance = System.Activator.CreateInstance<T>();
|
||||
Instance = Activator.CreateInstance<T>();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class IntoRoomEvent : IIntoRoomEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedIntoRoomEvent;
|
||||
public event IEvent.FailedEvent? FailedIntoRoomEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeIntoRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeIntoRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeIntoRoomEvent != null)
|
||||
{
|
||||
return BeforeIntoRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterIntoRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterIntoRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterIntoRoomEvent != null)
|
||||
{
|
||||
return AfterIntoRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedIntoRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedIntoRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedIntoRoomEvent != null)
|
||||
{
|
||||
return SucceedIntoRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedIntoRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedIntoRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedIntoRoomEvent != null)
|
||||
{
|
||||
return FailedIntoRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class LoginEvent : ILoginEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedLoginEvent;
|
||||
public event IEvent.FailedEvent? FailedLoginEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeLoginEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeLoginEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeLoginEvent != null)
|
||||
{
|
||||
return BeforeLoginEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterLoginEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterLoginEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterLoginEvent != null)
|
||||
{
|
||||
return AfterLoginEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedLoginEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedLoginEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedLoginEvent != null)
|
||||
{
|
||||
return SucceedLoginEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedLoginEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedLoginEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedLoginEvent != null)
|
||||
{
|
||||
return FailedLoginEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class LogoutEvent : ILogoutEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedLogoutEvent;
|
||||
public event IEvent.FailedEvent? FailedLogoutEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeLogoutEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeLogoutEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeLogoutEvent != null)
|
||||
{
|
||||
return BeforeLogoutEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterLogoutEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterLogoutEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterLogoutEvent != null)
|
||||
{
|
||||
return AfterLogoutEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedLogoutEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedLogoutEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedLogoutEvent != null)
|
||||
{
|
||||
return SucceedLogoutEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedLogoutEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedLogoutEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedLogoutEvent != null)
|
||||
{
|
||||
return FailedLogoutEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class OpenInventoryEvent : IOpenInventoryEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedOpenInventoryEvent;
|
||||
public event IEvent.FailedEvent? FailedOpenInventoryEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeOpenInventoryEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeOpenInventoryEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeOpenInventoryEvent != null)
|
||||
{
|
||||
return BeforeOpenInventoryEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterOpenInventoryEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterOpenInventoryEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterOpenInventoryEvent != null)
|
||||
{
|
||||
return AfterOpenInventoryEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedOpenInventoryEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedOpenInventoryEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedOpenInventoryEvent != null)
|
||||
{
|
||||
return SucceedOpenInventoryEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedOpenInventoryEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedOpenInventoryEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedOpenInventoryEvent != null)
|
||||
{
|
||||
return FailedOpenInventoryEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class OpenStoreEvent : IOpenStoreEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedOpenStoreEvent;
|
||||
public event IEvent.FailedEvent? FailedOpenStoreEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeOpenStoreEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeOpenStoreEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeOpenStoreEvent != null)
|
||||
{
|
||||
return BeforeOpenStoreEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterOpenStoreEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterOpenStoreEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterOpenStoreEvent != null)
|
||||
{
|
||||
return AfterOpenStoreEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedOpenStoreEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedOpenStoreEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedOpenStoreEvent != null)
|
||||
{
|
||||
return SucceedOpenStoreEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedOpenStoreEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedOpenStoreEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedOpenStoreEvent != null)
|
||||
{
|
||||
return FailedOpenStoreEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class QuitRoomEvent : IQuitRoomEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedQuitRoomEvent;
|
||||
public event IEvent.FailedEvent? FailedQuitRoomEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeQuitRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeQuitRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeQuitRoomEvent != null)
|
||||
{
|
||||
return BeforeQuitRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterQuitRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterQuitRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterQuitRoomEvent != null)
|
||||
{
|
||||
return AfterQuitRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedQuitRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedQuitRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedQuitRoomEvent != null)
|
||||
{
|
||||
return SucceedQuitRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedQuitRoomEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedQuitRoomEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedQuitRoomEvent != null)
|
||||
{
|
||||
return FailedQuitRoomEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class RegEvent : IRegEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedRegEvent;
|
||||
public event IEvent.FailedEvent? FailedRegEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeRegEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeRegEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeRegEvent != null)
|
||||
{
|
||||
return BeforeRegEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterRegEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterRegEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterRegEvent != null)
|
||||
{
|
||||
return AfterRegEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedRegEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedRegEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedRegEvent != null)
|
||||
{
|
||||
return SucceedRegEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedRegEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedRegEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedRegEvent != null)
|
||||
{
|
||||
return FailedRegEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class SendTalkEvent : ISendTalkEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedSendTalkEvent;
|
||||
public event IEvent.FailedEvent? FailedSendTalkEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeSendTalkEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeSendTalkEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeSendTalkEvent != null)
|
||||
{
|
||||
return BeforeSendTalkEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterSendTalkEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterSendTalkEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterSendTalkEvent != null)
|
||||
{
|
||||
return AfterSendTalkEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedSendTalkEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedSendTalkEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedSendTalkEvent != null)
|
||||
{
|
||||
return SucceedSendTalkEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedSendTalkEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedSendTalkEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedSendTalkEvent != null)
|
||||
{
|
||||
return FailedSendTalkEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class ShowRankingEvent : IShowRankingEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedShowRankingEvent;
|
||||
public event IEvent.FailedEvent? FailedShowRankingEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeShowRankingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeShowRankingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeShowRankingEvent != null)
|
||||
{
|
||||
return BeforeShowRankingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterShowRankingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterShowRankingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterShowRankingEvent != null)
|
||||
{
|
||||
return AfterShowRankingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedShowRankingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedShowRankingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedShowRankingEvent != null)
|
||||
{
|
||||
return SucceedShowRankingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedShowRankingEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedShowRankingEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedShowRankingEvent != null)
|
||||
{
|
||||
return FailedShowRankingEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class SignInEvent : ISignInEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedSignInEvent;
|
||||
public event IEvent.FailedEvent? FailedSignInEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeSignInEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeSignInEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeSignInEvent != null)
|
||||
{
|
||||
return BeforeSignInEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterSignInEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterSignInEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterSignInEvent != null)
|
||||
{
|
||||
return AfterSignInEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedSignInEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedSignInEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedSignInEvent != null)
|
||||
{
|
||||
return SucceedSignInEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedSignInEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedSignInEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedSignInEvent != null)
|
||||
{
|
||||
return FailedSignInEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class StartGameEvent : IStartGameEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedStartGameEvent;
|
||||
public event IEvent.FailedEvent? FailedStartGameEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeStartGameEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeStartGameEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeStartGameEvent != null)
|
||||
{
|
||||
return BeforeStartGameEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterStartGameEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterStartGameEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterStartGameEvent != null)
|
||||
{
|
||||
return AfterStartGameEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedStartGameEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedStartGameEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedStartGameEvent != null)
|
||||
{
|
||||
return SucceedStartGameEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedStartGameEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedStartGameEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedStartGameEvent != null)
|
||||
{
|
||||
return FailedStartGameEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class StartMatchEvent : IStartMatchEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedStartMatchEvent;
|
||||
public event IEvent.FailedEvent? FailedStartMatchEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeStartMatchEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeStartMatchEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeStartMatchEvent != null)
|
||||
{
|
||||
return BeforeStartMatchEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterStartMatchEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterStartMatchEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterStartMatchEvent != null)
|
||||
{
|
||||
return AfterStartMatchEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedStartMatchEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedStartMatchEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedStartMatchEvent != null)
|
||||
{
|
||||
return SucceedStartMatchEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedStartMatchEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedStartMatchEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedStartMatchEvent != null)
|
||||
{
|
||||
return FailedStartMatchEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Event
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||
{
|
||||
public class UseItemEvent : IUseItemEvent
|
||||
{
|
||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
||||
public event IEvent.SucceedEvent? SucceedUseItemEvent;
|
||||
public event IEvent.FailedEvent? FailedUseItemEvent;
|
||||
|
||||
public virtual Enum.EventResult OnBeforeUseItemEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnBeforeUseItemEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (BeforeUseItemEvent != null)
|
||||
{
|
||||
return BeforeUseItemEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnAfterUseItemEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnAfterUseItemEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (AfterUseItemEvent != null)
|
||||
{
|
||||
return AfterUseItemEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnSucceedUseItemEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnSucceedUseItemEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (SucceedUseItemEvent != null)
|
||||
{
|
||||
return SucceedUseItemEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
|
||||
public virtual Enum.EventResult OnFailedUseItemEvent(GeneralEventArgs e)
|
||||
public virtual EventResult OnFailedUseItemEvent(GeneralEventArgs e)
|
||||
{
|
||||
if (FailedUseItemEvent != null)
|
||||
{
|
||||
return FailedUseItemEvent(this, e);
|
||||
}
|
||||
|
||||
return Enum.EventResult.Fail;
|
||||
return EventResult.Fail;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Network
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Network
|
||||
{
|
||||
public class SQLConnection
|
||||
{
|
88
FunGame.Core/Library/Common/Network/Socket.cs
Normal file
88
FunGame.Core/Library/Common/Network/Socket.cs
Normal file
@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Sockets;
|
||||
using System.Net;
|
||||
using Milimoe.FunGame.Core.Interface;
|
||||
using Milimoe.FunGame.Core.Service;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Interface.Base;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Common.Network
|
||||
{
|
||||
public class Socket
|
||||
{
|
||||
public System.Net.Sockets.Socket Instance { get; }
|
||||
public string ServerIP { get; } = "";
|
||||
public int ServerPort { get; } = 0;
|
||||
public string ServerName { get; } = "";
|
||||
public string ServerNotice { get; } = "";
|
||||
public int HeartBeatFaileds { get; } = 0;
|
||||
public bool Connected
|
||||
{
|
||||
get
|
||||
{
|
||||
return Instance != null && Instance.Connected;
|
||||
}
|
||||
}
|
||||
|
||||
private Socket(System.Net.Sockets.Socket Instance, string ServerIP, int ServerPort)
|
||||
{
|
||||
this.Instance = Instance;
|
||||
this.ServerIP= ServerIP;
|
||||
this.ServerPort = ServerPort;
|
||||
}
|
||||
|
||||
public static Socket Connect(string IP, int Port = 22222)
|
||||
{
|
||||
System.Net.Sockets.Socket? socket = SocketManager.Connect(IP, Port);
|
||||
if (socket != null) return new Socket(socket, IP, Port);
|
||||
else throw new Milimoe.FunGame.Core.Library.Exception.SystemError("创建Socket失败。");
|
||||
}
|
||||
|
||||
public SocketResult Send(SocketMessageType type, string msg = "")
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
if (SocketManager.Send(type, msg) == SocketResult.Success)
|
||||
{
|
||||
return SocketResult.Success;
|
||||
}
|
||||
else return SocketResult.Fail;
|
||||
}
|
||||
return SocketResult.NotSent;
|
||||
}
|
||||
|
||||
private string[] Receive()
|
||||
{
|
||||
return SocketManager.Receive();
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
Task HeartBeatStream = Task.Factory.StartNew(StartSendHeartBeatStream);
|
||||
Task StreamReader = Task.Factory.StartNew(StartReceive);
|
||||
}
|
||||
|
||||
private void StartReceive()
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
while (Connected)
|
||||
{
|
||||
Receive();
|
||||
}
|
||||
}
|
||||
|
||||
private void StartSendHeartBeatStream()
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
while (Connected)
|
||||
{
|
||||
Send(SocketMessageType.HeartBeat); // 发送心跳包
|
||||
Thread.Sleep(20000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
FunGame.Core/Library/Constant/ConstantSet.cs
Normal file
25
FunGame.Core/Library/Constant/ConstantSet.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
public class InterfaceSet
|
||||
{
|
||||
public const string IClient = "IClientImpl";
|
||||
public const string IServer = "IServerImpl";
|
||||
}
|
||||
|
||||
public class SocketSet
|
||||
{
|
||||
public const string Unknown = "Unknown";
|
||||
public const string GetNotice = "GetNotice";
|
||||
public const string Login = "Login";
|
||||
public const string CheckLogin = "CheckLogin";
|
||||
public const string Logout = "Logout";
|
||||
public const string Disconnect = "Disconnect";
|
||||
public const string HeartBeat = "HeartBeat";
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Enum
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
public static class FunGameEnum
|
||||
{
|
@ -3,11 +3,13 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
public class General
|
||||
{
|
||||
public static Entity.General.Empty EntityInstance { get; } = new();
|
||||
public static Empty EntityInstance { get; } = new();
|
||||
public static Encoding DEFAULT_ENCODING { get; } = Encoding.UTF8;
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
public enum InterfaceType
|
||||
{
|
||||
IClient,
|
||||
IServer
|
||||
}
|
||||
|
||||
public class InterfaceSet
|
||||
{
|
||||
public const string IClient = "IClientImpl";
|
||||
public const string IServer = "IServerImpl";
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Enum
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
public enum SocketHelperMethod
|
||||
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Enum
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
public enum MessageResult
|
||||
{
|
||||
@ -21,6 +21,14 @@ namespace Milimoe.FunGame.Core.Entity.Enum
|
||||
Fail
|
||||
}
|
||||
|
||||
public enum SocketResult
|
||||
{
|
||||
Success,
|
||||
Fail,
|
||||
NotSent,
|
||||
NotReceived
|
||||
}
|
||||
|
||||
public enum ProxyResult
|
||||
{
|
||||
Success,
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Enum
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
public enum StartMatchState
|
||||
{
|
@ -4,8 +4,14 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity.Enum
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
public enum InterfaceType
|
||||
{
|
||||
IClient,
|
||||
IServer
|
||||
}
|
||||
|
||||
public enum RoomType
|
||||
{
|
||||
Mix,
|
@ -1,9 +1,9 @@
|
||||
using Milimoe.FunGame.Core.Entity.Enum;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Library.Exception
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using Milimoe.FunGame.Core.Entity.Enum;
|
||||
using Milimoe.FunGame.Core.Interface.Base;
|
||||
using Milimoe.FunGame.Core.Interface.Base;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
@ -7,19 +7,14 @@ using Milimoe.FunGame.Core.Interface.Base;
|
||||
using System.Collections;
|
||||
using System.Net.Sockets;
|
||||
using System.Net;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Service
|
||||
{
|
||||
internal class SocketManager
|
||||
{
|
||||
internal static SocketManager? Instance { get; private set; }
|
||||
|
||||
internal Socket? Socket { get; } = null;
|
||||
|
||||
private SocketManager(Socket socket)
|
||||
{
|
||||
Socket = socket;
|
||||
}
|
||||
internal static Socket? Socket { get; private set; } = null;
|
||||
|
||||
internal static Socket? Connect(string IP, int Port = 22222)
|
||||
{
|
||||
@ -38,7 +33,7 @@ namespace Milimoe.FunGame.Core.Service
|
||||
socket.Connect(ServerEndPoint);
|
||||
if (socket.Connected)
|
||||
{
|
||||
Instance = new SocketManager(socket);
|
||||
SocketManager.Socket = socket;
|
||||
return socket;
|
||||
}
|
||||
}
|
||||
@ -51,5 +46,76 @@ namespace Milimoe.FunGame.Core.Service
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static SocketResult Send(SocketMessageType type, string msg)
|
||||
{
|
||||
if (Socket != null)
|
||||
{
|
||||
if (Socket.Send(Core.Library.Constant.General.DEFAULT_ENCODING.GetBytes(MakeMessage(type, msg))) > 0)
|
||||
{
|
||||
return SocketResult.Success;
|
||||
}
|
||||
else return SocketResult.Fail;
|
||||
}
|
||||
return SocketResult.NotSent;
|
||||
}
|
||||
|
||||
internal static string[] Receive()
|
||||
{
|
||||
string[] result = new string[2];
|
||||
if (Socket != null)
|
||||
{
|
||||
// 从服务器接收消息
|
||||
byte[] buffer = new byte[2048];
|
||||
int length = Socket.Receive(buffer);
|
||||
if (length > 0)
|
||||
{
|
||||
string msg = Core.Library.Constant.General.DEFAULT_ENCODING.GetString(buffer, 0, length);
|
||||
result[0] = GetTypeString(GetType(msg));
|
||||
result[1] = GetMessage(msg);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int GetType(string msg)
|
||||
{
|
||||
int index = msg.IndexOf(';') - 1;
|
||||
if (index > 0)
|
||||
return Convert.ToInt32(msg[..index]);
|
||||
else
|
||||
return Convert.ToInt32(msg[..1]);
|
||||
}
|
||||
|
||||
private static string GetMessage(string msg)
|
||||
{
|
||||
int index = msg.IndexOf(';') + 1;
|
||||
return msg[index..];
|
||||
}
|
||||
|
||||
private static string MakeMessage(SocketMessageType type, string msg)
|
||||
{
|
||||
return (int)type + ";" + msg;
|
||||
}
|
||||
|
||||
private static string GetTypeString(SocketMessageType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
SocketMessageType.GetNotice => SocketSet.GetNotice,
|
||||
SocketMessageType.Login => SocketSet.Login,
|
||||
SocketMessageType.CheckLogin => SocketSet.CheckLogin,
|
||||
SocketMessageType.Logout => SocketSet.Logout,
|
||||
SocketMessageType.Disconnect => SocketSet.Disconnect,
|
||||
SocketMessageType.HeartBeat => SocketSet.HeartBeat,
|
||||
_ => SocketSet.Unknown,
|
||||
};
|
||||
}
|
||||
|
||||
private static string GetTypeString(int type)
|
||||
{
|
||||
return GetTypeString((SocketMessageType)type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Milimoe.FunGame.Core.Entity.Enum;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Desktop.Entity.Component
|
||||
{
|
||||
|
@ -4,8 +4,8 @@ using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Entity.Enum;
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Desktop.Others
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Milimoe.FunGame.Core.Entity.General;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
|
||||
namespace Milimoe.FunGame.Desktop.Others
|
||||
{
|
||||
|
@ -5,8 +5,7 @@ using System.Windows.Forms;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
using Milimoe.FunGame.Core.Entity.General;
|
||||
using Milimoe.FunGame.Core.Entity.Enum;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
using Milimoe.FunGame.Desktop.Entity.Component;
|
||||
using Milimoe.FunGame.Desktop.Others;
|
||||
using Milimoe.FunGame.Desktop.Utils;
|
||||
@ -1436,15 +1435,15 @@ namespace Milimoe.FunGame.Desktop.UI
|
||||
return;
|
||||
}
|
||||
ErrorType ErrorType = NetworkUtility.IsServerAddress(ip, port);
|
||||
if (ErrorType == Core.Entity.Enum.ErrorType.None)
|
||||
if (ErrorType == Core.Library.Constant.ErrorType.None)
|
||||
{
|
||||
Others.Constant.SERVER_IPADRESS = ip;
|
||||
Others.Constant.SERVER_PORT = port;
|
||||
NOW_CONNECTEDRETRY = -1;
|
||||
Connect();
|
||||
}
|
||||
else if (ErrorType == Core.Entity.Enum.ErrorType.IsNotIP) ShowMessage.ErrorMessage("这不是一个IP地址!");
|
||||
else if (ErrorType == Core.Entity.Enum.ErrorType.IsNotPort) ShowMessage.ErrorMessage("这不是一个端口号!\n正确范围:1~65535");
|
||||
else if (ErrorType == Core.Library.Constant.ErrorType.IsNotIP) ShowMessage.ErrorMessage("这不是一个IP地址!");
|
||||
else if (ErrorType == Core.Library.Constant.ErrorType.IsNotPort) ShowMessage.ErrorMessage("这不是一个端口号!\n正确范围:1~65535");
|
||||
else ShowMessage.ErrorMessage("格式错误!\n这不是一个服务器地址。");
|
||||
break;
|
||||
default:
|
||||
|
@ -8,12 +8,12 @@ using System.Threading.Tasks;
|
||||
using FunGame.Desktop.Models.Component;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Net.NetworkInformation;
|
||||
using Milimoe.FunGame.Core.Entity.General;
|
||||
using Milimoe.FunGame.Core.Entity.Enum;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
using Milimoe.FunGame.Desktop.Others;
|
||||
using Milimoe.FunGame.Desktop.UI;
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
using Milimoe.FunGame.Core.Api.Factory;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Desktop.Utils
|
||||
{
|
||||
@ -40,30 +40,30 @@ namespace Milimoe.FunGame.Desktop.Utils
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case (int)Core.Entity.Enum.SocketHelperMethod.CreateSocket:
|
||||
case (int)SocketHelperMethod.CreateSocket:
|
||||
CreateSocket();
|
||||
break;
|
||||
case (int)Core.Entity.Enum.SocketHelperMethod.CloseSocket:
|
||||
case (int)SocketHelperMethod.CloseSocket:
|
||||
Close();
|
||||
break;
|
||||
case (int)Core.Entity.Enum.SocketHelperMethod.StartSocketHelper:
|
||||
case (int)SocketHelperMethod.StartSocketHelper:
|
||||
StartSocketHelper();
|
||||
break;
|
||||
case (int)Core.Entity.Enum.SocketHelperMethod.Login:
|
||||
case (int)SocketHelperMethod.Login:
|
||||
if (client != null)
|
||||
{
|
||||
Send((int)SocketMessageType.CheckLogin, new object[] { Main, client, FactoryHelper.New<User>("Mili") });
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case (int)Core.Entity.Enum.SocketHelperMethod.Logout:
|
||||
case (int)SocketHelperMethod.Logout:
|
||||
if (client != null && Usercfg.LoginUser != null)
|
||||
{
|
||||
Send((int)SocketMessageType.Logout, new object[] { Main, client, Usercfg.LoginUser });
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case (int)Core.Entity.Enum.SocketHelperMethod.Disconnect:
|
||||
case (int)SocketHelperMethod.Disconnect:
|
||||
if (client != null)
|
||||
{
|
||||
Send((int)SocketMessageType.Disconnect, new object[] { Main, client });
|
||||
|
Loading…
x
Reference in New Issue
Block a user