mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-23 04:29:36 +08:00
修改架构
This commit is contained in:
parent
d8489d654a
commit
b1e572bfc7
@ -3,21 +3,22 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Api.Factory
|
namespace Milimoe.FunGame.Core.Api.Factory
|
||||||
{
|
{
|
||||||
internal class ItemFactory
|
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)
|
switch (type)
|
||||||
{
|
{
|
||||||
case Entity.Enum.ItemType.Active:
|
case ItemType.Active:
|
||||||
item = new Milimoe.FunGame.Core.Entity.General.ActiveItem(Name);
|
item = new Milimoe.FunGame.Core.Entity.ActiveItem(Name);
|
||||||
break;
|
break;
|
||||||
case Entity.Enum.ItemType.Passive:
|
case ItemType.Passive:
|
||||||
item = new Milimoe.FunGame.Core.Entity.General.PassiveItem(Name);
|
item = new Milimoe.FunGame.Core.Entity.PassiveItem(Name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
using Milimoe.FunGame.Core.Entity.General;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Policy;
|
using System.Security.Policy;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Api.Factory
|
namespace Milimoe.FunGame.Core.Api.Factory
|
||||||
{
|
{
|
||||||
internal class RoomFactory
|
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,
|
RoomType = type,
|
||||||
RoomState = Entity.Enum.RoomState.Created
|
RoomState = RoomState.Created
|
||||||
};
|
};
|
||||||
return room;
|
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,
|
RoomType = type,
|
||||||
RoomState = Entity.Enum.RoomState.Created
|
RoomState = RoomState.Created
|
||||||
};
|
};
|
||||||
return room;
|
return room;
|
||||||
}
|
}
|
||||||
|
@ -3,21 +3,23 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Api.Factory
|
namespace Milimoe.FunGame.Core.Api.Factory
|
||||||
{
|
{
|
||||||
internal class SkillFactory
|
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)
|
switch (type)
|
||||||
{
|
{
|
||||||
case Entity.Enum.SkillType.Active:
|
case SkillType.Active:
|
||||||
skill = new Milimoe.FunGame.Core.Entity.General.ActiveSkill(Name);
|
skill = new Milimoe.FunGame.Core.Entity.ActiveSkill(Name);
|
||||||
break;
|
break;
|
||||||
case Entity.Enum.SkillType.Passive:
|
case SkillType.Passive:
|
||||||
skill = new Milimoe.FunGame.Core.Entity.General.PassiveSkill(Name);
|
skill = new Milimoe.FunGame.Core.Entity.PassiveSkill(Name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return skill;
|
return skill;
|
||||||
|
@ -8,19 +8,19 @@ namespace Milimoe.FunGame.Core.Api.Factory
|
|||||||
{
|
{
|
||||||
internal class UserFactory
|
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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Milimoe.FunGame.Core.Entity.Enum;
|
|
||||||
using Milimoe.FunGame.Core.Library.Constant;
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Api.Utility
|
namespace Milimoe.FunGame.Core.Api.Utility
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Milimoe.FunGame.Core.Entity;
|
||||||
using Milimoe.FunGame.Core.Library.Constant;
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Api.Utility
|
namespace Milimoe.FunGame.Core.Api.Utility
|
||||||
@ -20,11 +21,11 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
|||||||
if (!IsEntity<T>()) return null;
|
if (!IsEntity<T>()) return null;
|
||||||
object? instance = null;
|
object? instance = null;
|
||||||
if (objs is null || objs.Length == 0) 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");
|
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;
|
object instance = General.EntityInstance;
|
||||||
if (!IsEntity<T>()) return instance;
|
if (!IsEntity<T>()) return instance;
|
||||||
if (objs is null || objs.Length == 0) 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");
|
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;
|
object instance = General.EntityInstance;
|
||||||
if (!IsEntity<T>()) return instance;
|
if (!IsEntity<T>()) return instance;
|
||||||
if (objs is null || objs.Length == 0) 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");
|
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>()
|
private static bool IsEntity<T>()
|
||||||
{
|
{
|
||||||
if (typeof(T) == typeof(Entity.General.ActiveItem) || typeof(T) == typeof(Entity.General.ActiveSkill)
|
if (typeof(T) == typeof(Entity.ActiveItem) || typeof(T) == typeof(ActiveSkill)
|
||||||
|| typeof(T) == typeof(Entity.General.Character) || typeof(T) == typeof(Entity.General.CharacterStatistics)
|
|| typeof(T) == typeof(Entity.Character) || typeof(T) == typeof(Entity.CharacterStatistics)
|
||||||
|| typeof(T) == typeof(Entity.General.GameStatistics) || typeof(T) == typeof(Entity.General.Inventory)
|
|| typeof(T) == typeof(Entity.GameStatistics) || typeof(T) == typeof(Inventory)
|
||||||
|| typeof(T) == typeof(Entity.General.Item) || typeof(T) == typeof(Entity.General.PassiveItem)
|
|| typeof(T) == typeof(Entity.Item) || typeof(T) == typeof(Entity.PassiveItem)
|
||||||
|| typeof(T) == typeof(Entity.General.PassiveSkill) || typeof(T) == typeof(Entity.General.Room)
|
|| typeof(T) == typeof(PassiveSkill) || typeof(T) == typeof(Entity.Room)
|
||||||
|| typeof(T) == typeof(Entity.General.Skill) || typeof(T) == typeof(Entity.General.User)
|
|| typeof(T) == typeof(Skill) || typeof(T) == typeof(Entity.User)
|
||||||
|| typeof(T) == typeof(Entity.General.UserStatistics))
|
|| typeof(T) == typeof(Entity.UserStatistics))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Milimoe.FunGame.Core.Entity.Enum;
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
// 通用工具类,客户端和服务器端都可以直接调用的工具方法都可以写在这里
|
// 通用工具类,客户端和服务器端都可以直接调用的工具方法都可以写在这里
|
||||||
namespace Milimoe.FunGame.Core.Api.Utility
|
namespace Milimoe.FunGame.Core.Api.Utility
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Milimoe.FunGame.Core.Entity.Enum;
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Api.Utility
|
namespace Milimoe.FunGame.Core.Api.Utility
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface的定义已经搬至:
|
/// Interface的定义已经搬至:
|
||||||
/// Milimoe.FunGame.Core.Others中的 &InterfaceType 和 &InterfaceSet
|
/// Milimoe.FunGame.Core.Library.Constant 中的 &InterfaceType 和 &InterfaceSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ReflectionHelper
|
public class ReflectionHelper
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class Character
|
public class Character
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class Empty
|
public class Empty
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class ActiveItem : Item
|
public class ActiveItem : Item
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public abstract class Item
|
public abstract class Item
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class PassiveItem : Item
|
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.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class ActiveSkill : Skill
|
public class ActiveSkill : Skill
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class PassiveSkill : Skill
|
public class PassiveSkill : Skill
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public abstract class Skill
|
public abstract class Skill
|
||||||
{
|
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class CharacterStatistics
|
public class CharacterStatistics
|
||||||
{
|
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class GameStatistics
|
public class GameStatistics
|
||||||
{
|
{
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class UserStatistics
|
public class UserStatistics
|
||||||
{
|
{
|
@ -4,8 +4,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class Inventory
|
public class Inventory
|
||||||
{
|
{
|
@ -5,8 +5,9 @@ using System.Linq;
|
|||||||
using System.Security.Policy;
|
using System.Security.Policy;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class Room
|
public class Room
|
||||||
{
|
{
|
||||||
@ -15,8 +16,8 @@ namespace Milimoe.FunGame.Core.Entity.General
|
|||||||
public DateTime Time { get; set; } = DateTime.Now;
|
public DateTime Time { get; set; } = DateTime.Now;
|
||||||
public Hashtable PlayerList { get; set; } = new Hashtable();
|
public Hashtable PlayerList { get; set; } = new Hashtable();
|
||||||
public User? RoomMaster { get; set; }
|
public User? RoomMaster { get; set; }
|
||||||
public Milimoe.FunGame.Core.Entity.Enum.RoomType RoomType { get; set; }
|
public RoomType RoomType { get; set; }
|
||||||
public Milimoe.FunGame.Core.Entity.Enum.RoomState RoomState { get; set; }
|
public RoomState RoomState { get; set; }
|
||||||
public GameStatistics? Statistics { get; set; } = null;
|
public GameStatistics? Statistics { get; set; } = null;
|
||||||
|
|
||||||
internal Room(User? master = null)
|
internal Room(User? master = null)
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.General
|
namespace Milimoe.FunGame.Core.Entity
|
||||||
{
|
{
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
@ -22,8 +22,4 @@
|
|||||||
<DebugType>embedded</DebugType>
|
<DebugType>embedded</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Library\Common\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -3,24 +3,25 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Interface.Base
|
namespace Milimoe.FunGame.Core.Interface.Base
|
||||||
{
|
{
|
||||||
public interface ISQLProxy
|
public interface ISQLProxy
|
||||||
{
|
{
|
||||||
public Entity.Enum.ProxyResult Execute();
|
public ProxyResult Execute();
|
||||||
public Entity.Enum.ProxyResult Execute(object[]? objs = null);
|
public ProxyResult Execute(object[]? objs = null);
|
||||||
public Entity.Enum.ProxyResult Execute(StringBuilder script);
|
public ProxyResult Execute(StringBuilder script);
|
||||||
public int ExecuteRow();
|
public int ExecuteRow();
|
||||||
public int ExecuteRow(object[]? objs = null);
|
public int ExecuteRow(object[]? objs = null);
|
||||||
public int ExecuteRow(StringBuilder script);
|
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(object[]? objs = null);
|
||||||
public System.Data.DataSet GetData(StringBuilder script);
|
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(object[]? objs = null);
|
||||||
public System.Data.DataTable GetDataTable(StringBuilder script);
|
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.DataSet set, object[]? objs = null);
|
||||||
public System.Data.DataRow GetDataRow(System.Data.DataTable table, object[]? objs = null);
|
public System.Data.DataRow GetDataRow(System.Data.DataTable table, object[]? objs = null);
|
||||||
public System.Data.DataRow GetDataRow(StringBuilder script);
|
public System.Data.DataRow GetDataRow(StringBuilder script);
|
||||||
|
@ -3,27 +3,28 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Interface.Base
|
namespace Milimoe.FunGame.Core.Interface.Base
|
||||||
{
|
{
|
||||||
internal interface ISQLService
|
internal interface ISQLService
|
||||||
{
|
{
|
||||||
internal Entity.Enum.ProxyResult Execute();
|
internal ProxyResult Execute();
|
||||||
internal Entity.Enum.ProxyResult Execute(object[]? objs = null);
|
internal ProxyResult Execute(object[]? objs = null);
|
||||||
internal Entity.Enum.ProxyResult Execute(StringBuilder script);
|
internal ProxyResult Execute(StringBuilder script);
|
||||||
internal int UpdateRow(object[]? objs = null);
|
internal int UpdateRow(object[]? objs = null);
|
||||||
internal int UpdateRow(StringBuilder script);
|
internal int UpdateRow(StringBuilder script);
|
||||||
internal int DeleteRow(object[]? objs = null);
|
internal int DeleteRow(object[]? objs = null);
|
||||||
internal int DeleteRow(StringBuilder script);
|
internal int DeleteRow(StringBuilder script);
|
||||||
internal int AddRow(object[]? objs = null);
|
internal int AddRow(object[]? objs = null);
|
||||||
internal int AddRow(StringBuilder script);
|
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(object[]? objs = null);
|
||||||
internal System.Data.DataSet GetData(StringBuilder script);
|
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(object[]? objs);
|
||||||
internal System.Data.DataTable GetDataTable(StringBuilder script);
|
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.DataSet set, object[]? objs = null);
|
||||||
internal System.Data.DataRow GetDataRow(System.Data.DataTable table, object[]? objs = null);
|
internal System.Data.DataRow GetDataRow(System.Data.DataTable table, object[]? objs = null);
|
||||||
internal System.Data.DataRow GetDataRow(StringBuilder script);
|
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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -9,10 +10,10 @@ namespace Milimoe.FunGame.Core.Interface
|
|||||||
{
|
{
|
||||||
public interface IEvent
|
public interface IEvent
|
||||||
{
|
{
|
||||||
public delegate Milimoe.FunGame.Core.Entity.Enum.EventResult BeforeEvent(object sender, GeneralEventArgs e);
|
public delegate EventResult BeforeEvent(object sender, GeneralEventArgs e);
|
||||||
public delegate Milimoe.FunGame.Core.Entity.Enum.EventResult AfterEvent(object sender, GeneralEventArgs e);
|
public delegate EventResult AfterEvent(object sender, GeneralEventArgs e);
|
||||||
public delegate Milimoe.FunGame.Core.Entity.Enum.EventResult SucceedEvent(object sender, GeneralEventArgs e);
|
public delegate EventResult SucceedEvent(object sender, GeneralEventArgs e);
|
||||||
public delegate Milimoe.FunGame.Core.Entity.Enum.EventResult FailedEvent(object sender, GeneralEventArgs e);
|
public delegate EventResult FailedEvent(object sender, GeneralEventArgs e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IConnectEvent : IEvent
|
public interface IConnectEvent : IEvent
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace Milimoe.FunGame.Core.Interface
|
namespace Milimoe.FunGame.Core.Interface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 接口需要在FunGame.Core项目中创建新的类实现
|
* 接口需要在FunGame.Implement项目中创建新的类实现
|
||||||
* namespace必须是Milimoe.FunGame.Core.Implement,文件夹位置随意
|
* namespace必须是Milimoe.FunGame.Core.Implement,文件夹位置随意
|
||||||
* 参考:
|
* 参考:
|
||||||
* using Milimoe.FunGame.Core.Interface;
|
* using Milimoe.FunGame.Core.Interface;
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class BuyItemEvent : IBuyItemEvent
|
public class BuyItemEvent : IBuyItemEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedBuyItemEvent;
|
public event IEvent.SucceedEvent? SucceedBuyItemEvent;
|
||||||
public event IEvent.FailedEvent? FailedBuyItemEvent;
|
public event IEvent.FailedEvent? FailedBuyItemEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeBuyItemEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeBuyItemEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeBuyItemEvent != null)
|
if (BeforeBuyItemEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeBuyItemEvent(this, e);
|
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)
|
if (AfterBuyItemEvent != null)
|
||||||
{
|
{
|
||||||
return AfterBuyItemEvent(this, e);
|
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)
|
if (SucceedBuyItemEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedBuyItemEvent(this, e);
|
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)
|
if (FailedBuyItemEvent != null)
|
||||||
{
|
{
|
||||||
return FailedBuyItemEvent(this, e);
|
return FailedBuyItemEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class ChangeAccountSettingEvent : IChangeAccountSettingEvent
|
public class ChangeAccountSettingEvent : IChangeAccountSettingEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedChangeAccountSettingEvent;
|
public event IEvent.SucceedEvent? SucceedChangeAccountSettingEvent;
|
||||||
public event IEvent.FailedEvent? FailedChangeAccountSettingEvent;
|
public event IEvent.FailedEvent? FailedChangeAccountSettingEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeChangeAccountSettingEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeChangeAccountSettingEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeChangeAccountSettingEvent != null)
|
if (BeforeChangeAccountSettingEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeChangeAccountSettingEvent(this, e);
|
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)
|
if (AfterChangeAccountSettingEvent != null)
|
||||||
{
|
{
|
||||||
return AfterChangeAccountSettingEvent(this, e);
|
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)
|
if (SucceedChangeAccountSettingEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedChangeAccountSettingEvent(this, e);
|
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)
|
if (FailedChangeAccountSettingEvent != null)
|
||||||
{
|
{
|
||||||
return FailedChangeAccountSettingEvent(this, e);
|
return FailedChangeAccountSettingEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class ChangeProfileEvent : IChangeProfileEvent
|
public class ChangeProfileEvent : IChangeProfileEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedChangeProfileEvent;
|
public event IEvent.SucceedEvent? SucceedChangeProfileEvent;
|
||||||
public event IEvent.FailedEvent? FailedChangeProfileEvent;
|
public event IEvent.FailedEvent? FailedChangeProfileEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeChangeProfileEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeChangeProfileEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeChangeProfileEvent != null)
|
if (BeforeChangeProfileEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeChangeProfileEvent(this, e);
|
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)
|
if (AfterChangeProfileEvent != null)
|
||||||
{
|
{
|
||||||
return AfterChangeProfileEvent(this, e);
|
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)
|
if (SucceedChangeProfileEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedChangeProfileEvent(this, e);
|
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)
|
if (FailedChangeProfileEvent != null)
|
||||||
{
|
{
|
||||||
return FailedChangeProfileEvent(this, e);
|
return FailedChangeProfileEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class ChangeRoomSettingEvent : IChangeRoomSettingEvent
|
public class ChangeRoomSettingEvent : IChangeRoomSettingEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedChangeRoomSettingEvent;
|
public event IEvent.SucceedEvent? SucceedChangeRoomSettingEvent;
|
||||||
public event IEvent.FailedEvent? FailedChangeRoomSettingEvent;
|
public event IEvent.FailedEvent? FailedChangeRoomSettingEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeChangeRoomSettingEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeChangeRoomSettingEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeChangeRoomSettingEvent != null)
|
if (BeforeChangeRoomSettingEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeChangeRoomSettingEvent(this, e);
|
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)
|
if (AfterChangeRoomSettingEvent != null)
|
||||||
{
|
{
|
||||||
return AfterChangeRoomSettingEvent(this, e);
|
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)
|
if (SucceedChangeRoomSettingEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedChangeRoomSettingEvent(this, e);
|
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)
|
if (FailedChangeRoomSettingEvent != null)
|
||||||
{
|
{
|
||||||
return FailedChangeRoomSettingEvent(this, e);
|
return FailedChangeRoomSettingEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class ConnectEvent : IConnectEvent
|
public class ConnectEvent : IConnectEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedConnectEvent;
|
public event IEvent.SucceedEvent? SucceedConnectEvent;
|
||||||
public event IEvent.FailedEvent? FailedConnectEvent;
|
public event IEvent.FailedEvent? FailedConnectEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeConnectEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeConnectEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeConnectEvent != null)
|
if (BeforeConnectEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeConnectEvent(this, e);
|
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)
|
if (AfterConnectEvent != null)
|
||||||
{
|
{
|
||||||
return AfterConnectEvent(this, e);
|
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)
|
if (SucceedConnectEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedConnectEvent(this, e);
|
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)
|
if (FailedConnectEvent != null)
|
||||||
{
|
{
|
||||||
return FailedConnectEvent(this, e);
|
return FailedConnectEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class CreateRoomEvent : ICreateRoomEvent
|
public class CreateRoomEvent : ICreateRoomEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedCreateRoomEvent;
|
public event IEvent.SucceedEvent? SucceedCreateRoomEvent;
|
||||||
public event IEvent.FailedEvent? FailedCreateRoomEvent;
|
public event IEvent.FailedEvent? FailedCreateRoomEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeCreateRoomEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeCreateRoomEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeCreateRoomEvent != null)
|
if (BeforeCreateRoomEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeCreateRoomEvent(this, e);
|
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)
|
if (AfterCreateRoomEvent != null)
|
||||||
{
|
{
|
||||||
return AfterCreateRoomEvent(this, e);
|
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)
|
if (SucceedCreateRoomEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedCreateRoomEvent(this, e);
|
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)
|
if (FailedCreateRoomEvent != null)
|
||||||
{
|
{
|
||||||
return FailedCreateRoomEvent(this, e);
|
return FailedCreateRoomEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class DisconnectEvent : IDisconnectEvent
|
public class DisconnectEvent : IDisconnectEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedDisconnectEvent;
|
public event IEvent.SucceedEvent? SucceedDisconnectEvent;
|
||||||
public event IEvent.FailedEvent? FailedDisconnectEvent;
|
public event IEvent.FailedEvent? FailedDisconnectEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeDisconnectEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeDisconnectEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeDisconnectEvent != null)
|
if (BeforeDisconnectEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeDisconnectEvent(this, e);
|
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)
|
if (AfterDisconnectEvent != null)
|
||||||
{
|
{
|
||||||
return AfterDisconnectEvent(this, e);
|
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)
|
if (SucceedDisconnectEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedDisconnectEvent(this, e);
|
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)
|
if (FailedDisconnectEvent != null)
|
||||||
{
|
{
|
||||||
return FailedDisconnectEvent(this, e);
|
return FailedDisconnectEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class EndGameEvent : IEndGameEvent
|
public class EndGameEvent : IEndGameEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedEndGameEvent;
|
public event IEvent.SucceedEvent? SucceedEndGameEvent;
|
||||||
public event IEvent.FailedEvent? FailedEndGameEvent;
|
public event IEvent.FailedEvent? FailedEndGameEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeEndGameEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeEndGameEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeEndGameEvent != null)
|
if (BeforeEndGameEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeEndGameEvent(this, e);
|
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)
|
if (AfterEndGameEvent != null)
|
||||||
{
|
{
|
||||||
return AfterEndGameEvent(this, e);
|
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)
|
if (SucceedEndGameEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedEndGameEvent(this, e);
|
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)
|
if (FailedEndGameEvent != null)
|
||||||
{
|
{
|
||||||
return FailedEndGameEvent(this, e);
|
return FailedEndGameEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class GeneralEventArgs : EventArgs
|
public class GeneralEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public T Instance { get; set; }
|
public T Instance { get; set; }
|
||||||
public GeneralEvent()
|
public GeneralEvent()
|
||||||
{
|
{
|
||||||
Instance = System.Activator.CreateInstance<T>();
|
Instance = Activator.CreateInstance<T>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class IntoRoomEvent : IIntoRoomEvent
|
public class IntoRoomEvent : IIntoRoomEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedIntoRoomEvent;
|
public event IEvent.SucceedEvent? SucceedIntoRoomEvent;
|
||||||
public event IEvent.FailedEvent? FailedIntoRoomEvent;
|
public event IEvent.FailedEvent? FailedIntoRoomEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeIntoRoomEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeIntoRoomEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeIntoRoomEvent != null)
|
if (BeforeIntoRoomEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeIntoRoomEvent(this, e);
|
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)
|
if (AfterIntoRoomEvent != null)
|
||||||
{
|
{
|
||||||
return AfterIntoRoomEvent(this, e);
|
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)
|
if (SucceedIntoRoomEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedIntoRoomEvent(this, e);
|
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)
|
if (FailedIntoRoomEvent != null)
|
||||||
{
|
{
|
||||||
return FailedIntoRoomEvent(this, e);
|
return FailedIntoRoomEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class LoginEvent : ILoginEvent
|
public class LoginEvent : ILoginEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedLoginEvent;
|
public event IEvent.SucceedEvent? SucceedLoginEvent;
|
||||||
public event IEvent.FailedEvent? FailedLoginEvent;
|
public event IEvent.FailedEvent? FailedLoginEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeLoginEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeLoginEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeLoginEvent != null)
|
if (BeforeLoginEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeLoginEvent(this, e);
|
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)
|
if (AfterLoginEvent != null)
|
||||||
{
|
{
|
||||||
return AfterLoginEvent(this, e);
|
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)
|
if (SucceedLoginEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedLoginEvent(this, e);
|
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)
|
if (FailedLoginEvent != null)
|
||||||
{
|
{
|
||||||
return FailedLoginEvent(this, e);
|
return FailedLoginEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class LogoutEvent : ILogoutEvent
|
public class LogoutEvent : ILogoutEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedLogoutEvent;
|
public event IEvent.SucceedEvent? SucceedLogoutEvent;
|
||||||
public event IEvent.FailedEvent? FailedLogoutEvent;
|
public event IEvent.FailedEvent? FailedLogoutEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeLogoutEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeLogoutEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeLogoutEvent != null)
|
if (BeforeLogoutEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeLogoutEvent(this, e);
|
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)
|
if (AfterLogoutEvent != null)
|
||||||
{
|
{
|
||||||
return AfterLogoutEvent(this, e);
|
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)
|
if (SucceedLogoutEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedLogoutEvent(this, e);
|
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)
|
if (FailedLogoutEvent != null)
|
||||||
{
|
{
|
||||||
return FailedLogoutEvent(this, e);
|
return FailedLogoutEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class OpenInventoryEvent : IOpenInventoryEvent
|
public class OpenInventoryEvent : IOpenInventoryEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedOpenInventoryEvent;
|
public event IEvent.SucceedEvent? SucceedOpenInventoryEvent;
|
||||||
public event IEvent.FailedEvent? FailedOpenInventoryEvent;
|
public event IEvent.FailedEvent? FailedOpenInventoryEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeOpenInventoryEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeOpenInventoryEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeOpenInventoryEvent != null)
|
if (BeforeOpenInventoryEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeOpenInventoryEvent(this, e);
|
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)
|
if (AfterOpenInventoryEvent != null)
|
||||||
{
|
{
|
||||||
return AfterOpenInventoryEvent(this, e);
|
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)
|
if (SucceedOpenInventoryEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedOpenInventoryEvent(this, e);
|
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)
|
if (FailedOpenInventoryEvent != null)
|
||||||
{
|
{
|
||||||
return FailedOpenInventoryEvent(this, e);
|
return FailedOpenInventoryEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class OpenStoreEvent : IOpenStoreEvent
|
public class OpenStoreEvent : IOpenStoreEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedOpenStoreEvent;
|
public event IEvent.SucceedEvent? SucceedOpenStoreEvent;
|
||||||
public event IEvent.FailedEvent? FailedOpenStoreEvent;
|
public event IEvent.FailedEvent? FailedOpenStoreEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeOpenStoreEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeOpenStoreEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeOpenStoreEvent != null)
|
if (BeforeOpenStoreEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeOpenStoreEvent(this, e);
|
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)
|
if (AfterOpenStoreEvent != null)
|
||||||
{
|
{
|
||||||
return AfterOpenStoreEvent(this, e);
|
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)
|
if (SucceedOpenStoreEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedOpenStoreEvent(this, e);
|
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)
|
if (FailedOpenStoreEvent != null)
|
||||||
{
|
{
|
||||||
return FailedOpenStoreEvent(this, e);
|
return FailedOpenStoreEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class QuitRoomEvent : IQuitRoomEvent
|
public class QuitRoomEvent : IQuitRoomEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedQuitRoomEvent;
|
public event IEvent.SucceedEvent? SucceedQuitRoomEvent;
|
||||||
public event IEvent.FailedEvent? FailedQuitRoomEvent;
|
public event IEvent.FailedEvent? FailedQuitRoomEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeQuitRoomEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeQuitRoomEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeQuitRoomEvent != null)
|
if (BeforeQuitRoomEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeQuitRoomEvent(this, e);
|
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)
|
if (AfterQuitRoomEvent != null)
|
||||||
{
|
{
|
||||||
return AfterQuitRoomEvent(this, e);
|
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)
|
if (SucceedQuitRoomEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedQuitRoomEvent(this, e);
|
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)
|
if (FailedQuitRoomEvent != null)
|
||||||
{
|
{
|
||||||
return FailedQuitRoomEvent(this, e);
|
return FailedQuitRoomEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class RegEvent : IRegEvent
|
public class RegEvent : IRegEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedRegEvent;
|
public event IEvent.SucceedEvent? SucceedRegEvent;
|
||||||
public event IEvent.FailedEvent? FailedRegEvent;
|
public event IEvent.FailedEvent? FailedRegEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeRegEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeRegEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeRegEvent != null)
|
if (BeforeRegEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeRegEvent(this, e);
|
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)
|
if (AfterRegEvent != null)
|
||||||
{
|
{
|
||||||
return AfterRegEvent(this, e);
|
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)
|
if (SucceedRegEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedRegEvent(this, e);
|
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)
|
if (FailedRegEvent != null)
|
||||||
{
|
{
|
||||||
return FailedRegEvent(this, e);
|
return FailedRegEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class SendTalkEvent : ISendTalkEvent
|
public class SendTalkEvent : ISendTalkEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedSendTalkEvent;
|
public event IEvent.SucceedEvent? SucceedSendTalkEvent;
|
||||||
public event IEvent.FailedEvent? FailedSendTalkEvent;
|
public event IEvent.FailedEvent? FailedSendTalkEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeSendTalkEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeSendTalkEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeSendTalkEvent != null)
|
if (BeforeSendTalkEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeSendTalkEvent(this, e);
|
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)
|
if (AfterSendTalkEvent != null)
|
||||||
{
|
{
|
||||||
return AfterSendTalkEvent(this, e);
|
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)
|
if (SucceedSendTalkEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedSendTalkEvent(this, e);
|
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)
|
if (FailedSendTalkEvent != null)
|
||||||
{
|
{
|
||||||
return FailedSendTalkEvent(this, e);
|
return FailedSendTalkEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class ShowRankingEvent : IShowRankingEvent
|
public class ShowRankingEvent : IShowRankingEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedShowRankingEvent;
|
public event IEvent.SucceedEvent? SucceedShowRankingEvent;
|
||||||
public event IEvent.FailedEvent? FailedShowRankingEvent;
|
public event IEvent.FailedEvent? FailedShowRankingEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeShowRankingEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeShowRankingEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeShowRankingEvent != null)
|
if (BeforeShowRankingEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeShowRankingEvent(this, e);
|
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)
|
if (AfterShowRankingEvent != null)
|
||||||
{
|
{
|
||||||
return AfterShowRankingEvent(this, e);
|
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)
|
if (SucceedShowRankingEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedShowRankingEvent(this, e);
|
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)
|
if (FailedShowRankingEvent != null)
|
||||||
{
|
{
|
||||||
return FailedShowRankingEvent(this, e);
|
return FailedShowRankingEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class SignInEvent : ISignInEvent
|
public class SignInEvent : ISignInEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedSignInEvent;
|
public event IEvent.SucceedEvent? SucceedSignInEvent;
|
||||||
public event IEvent.FailedEvent? FailedSignInEvent;
|
public event IEvent.FailedEvent? FailedSignInEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeSignInEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeSignInEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeSignInEvent != null)
|
if (BeforeSignInEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeSignInEvent(this, e);
|
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)
|
if (AfterSignInEvent != null)
|
||||||
{
|
{
|
||||||
return AfterSignInEvent(this, e);
|
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)
|
if (SucceedSignInEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedSignInEvent(this, e);
|
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)
|
if (FailedSignInEvent != null)
|
||||||
{
|
{
|
||||||
return FailedSignInEvent(this, e);
|
return FailedSignInEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class StartGameEvent : IStartGameEvent
|
public class StartGameEvent : IStartGameEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedStartGameEvent;
|
public event IEvent.SucceedEvent? SucceedStartGameEvent;
|
||||||
public event IEvent.FailedEvent? FailedStartGameEvent;
|
public event IEvent.FailedEvent? FailedStartGameEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeStartGameEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeStartGameEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeStartGameEvent != null)
|
if (BeforeStartGameEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeStartGameEvent(this, e);
|
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)
|
if (AfterStartGameEvent != null)
|
||||||
{
|
{
|
||||||
return AfterStartGameEvent(this, e);
|
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)
|
if (SucceedStartGameEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedStartGameEvent(this, e);
|
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)
|
if (FailedStartGameEvent != null)
|
||||||
{
|
{
|
||||||
return FailedStartGameEvent(this, e);
|
return FailedStartGameEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class StartMatchEvent : IStartMatchEvent
|
public class StartMatchEvent : IStartMatchEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedStartMatchEvent;
|
public event IEvent.SucceedEvent? SucceedStartMatchEvent;
|
||||||
public event IEvent.FailedEvent? FailedStartMatchEvent;
|
public event IEvent.FailedEvent? FailedStartMatchEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeStartMatchEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeStartMatchEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeStartMatchEvent != null)
|
if (BeforeStartMatchEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeStartMatchEvent(this, e);
|
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)
|
if (AfterStartMatchEvent != null)
|
||||||
{
|
{
|
||||||
return AfterStartMatchEvent(this, e);
|
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)
|
if (SucceedStartMatchEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedStartMatchEvent(this, e);
|
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)
|
if (FailedStartMatchEvent != null)
|
||||||
{
|
{
|
||||||
return FailedStartMatchEvent(this, e);
|
return FailedStartMatchEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Interface;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Event
|
namespace Milimoe.FunGame.Core.Library.Common.Event
|
||||||
{
|
{
|
||||||
public class UseItemEvent : IUseItemEvent
|
public class UseItemEvent : IUseItemEvent
|
||||||
{
|
{
|
||||||
@ -14,44 +15,44 @@ namespace Milimoe.FunGame.Core.Entity.Event
|
|||||||
public event IEvent.SucceedEvent? SucceedUseItemEvent;
|
public event IEvent.SucceedEvent? SucceedUseItemEvent;
|
||||||
public event IEvent.FailedEvent? FailedUseItemEvent;
|
public event IEvent.FailedEvent? FailedUseItemEvent;
|
||||||
|
|
||||||
public virtual Enum.EventResult OnBeforeUseItemEvent(GeneralEventArgs e)
|
public virtual EventResult OnBeforeUseItemEvent(GeneralEventArgs e)
|
||||||
{
|
{
|
||||||
if (BeforeUseItemEvent != null)
|
if (BeforeUseItemEvent != null)
|
||||||
{
|
{
|
||||||
return BeforeUseItemEvent(this, e);
|
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)
|
if (AfterUseItemEvent != null)
|
||||||
{
|
{
|
||||||
return AfterUseItemEvent(this, e);
|
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)
|
if (SucceedUseItemEvent != null)
|
||||||
{
|
{
|
||||||
return SucceedUseItemEvent(this, e);
|
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)
|
if (FailedUseItemEvent != null)
|
||||||
{
|
{
|
||||||
return FailedUseItemEvent(this, e);
|
return FailedUseItemEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enum.EventResult.Fail;
|
return EventResult.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Network
|
namespace Milimoe.FunGame.Core.Library.Common.Network
|
||||||
{
|
{
|
||||||
public class SQLConnection
|
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.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Enum
|
namespace Milimoe.FunGame.Core.Library.Constant
|
||||||
{
|
{
|
||||||
public static class FunGameEnum
|
public static class FunGameEnum
|
||||||
{
|
{
|
@ -3,11 +3,13 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Library.Constant
|
namespace Milimoe.FunGame.Core.Library.Constant
|
||||||
{
|
{
|
||||||
public class General
|
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.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Enum
|
namespace Milimoe.FunGame.Core.Library.Constant
|
||||||
{
|
{
|
||||||
public enum SocketHelperMethod
|
public enum SocketHelperMethod
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Enum
|
namespace Milimoe.FunGame.Core.Library.Constant
|
||||||
{
|
{
|
||||||
public enum MessageResult
|
public enum MessageResult
|
||||||
{
|
{
|
||||||
@ -21,6 +21,14 @@ namespace Milimoe.FunGame.Core.Entity.Enum
|
|||||||
Fail
|
Fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum SocketResult
|
||||||
|
{
|
||||||
|
Success,
|
||||||
|
Fail,
|
||||||
|
NotSent,
|
||||||
|
NotReceived
|
||||||
|
}
|
||||||
|
|
||||||
public enum ProxyResult
|
public enum ProxyResult
|
||||||
{
|
{
|
||||||
Success,
|
Success,
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Enum
|
namespace Milimoe.FunGame.Core.Library.Constant
|
||||||
{
|
{
|
||||||
public enum StartMatchState
|
public enum StartMatchState
|
||||||
{
|
{
|
@ -4,8 +4,14 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Entity.Enum
|
namespace Milimoe.FunGame.Core.Library.Constant
|
||||||
{
|
{
|
||||||
|
public enum InterfaceType
|
||||||
|
{
|
||||||
|
IClient,
|
||||||
|
IServer
|
||||||
|
}
|
||||||
|
|
||||||
public enum RoomType
|
public enum RoomType
|
||||||
{
|
{
|
||||||
Mix,
|
Mix,
|
@ -1,9 +1,9 @@
|
|||||||
using Milimoe.FunGame.Core.Entity.Enum;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Library.Exception
|
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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
@ -7,19 +7,14 @@ using Milimoe.FunGame.Core.Interface.Base;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
using Milimoe.FunGame.Core.Api.Utility;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Service
|
namespace Milimoe.FunGame.Core.Service
|
||||||
{
|
{
|
||||||
internal class SocketManager
|
internal class SocketManager
|
||||||
{
|
{
|
||||||
internal static SocketManager? Instance { get; private set; }
|
internal static Socket? Socket { get; private set; } = null;
|
||||||
|
|
||||||
internal Socket? Socket { get; } = null;
|
|
||||||
|
|
||||||
private SocketManager(Socket socket)
|
|
||||||
{
|
|
||||||
Socket = socket;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Socket? Connect(string IP, int Port = 22222)
|
internal static Socket? Connect(string IP, int Port = 22222)
|
||||||
{
|
{
|
||||||
@ -38,7 +33,7 @@ namespace Milimoe.FunGame.Core.Service
|
|||||||
socket.Connect(ServerEndPoint);
|
socket.Connect(ServerEndPoint);
|
||||||
if (socket.Connected)
|
if (socket.Connected)
|
||||||
{
|
{
|
||||||
Instance = new SocketManager(socket);
|
SocketManager.Socket = socket;
|
||||||
return socket;
|
return socket;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -51,5 +46,76 @@ namespace Milimoe.FunGame.Core.Service
|
|||||||
}
|
}
|
||||||
return null;
|
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.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Milimoe.FunGame.Core.Entity.Enum;
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Desktop.Entity.Component
|
namespace Milimoe.FunGame.Desktop.Entity.Component
|
||||||
{
|
{
|
||||||
|
@ -4,8 +4,8 @@ using System.Linq;
|
|||||||
using System.Security.AccessControl;
|
using System.Security.AccessControl;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Milimoe.FunGame.Core.Entity.Enum;
|
|
||||||
using Milimoe.FunGame.Core.Api.Utility;
|
using Milimoe.FunGame.Core.Api.Utility;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Desktop.Others
|
namespace Milimoe.FunGame.Desktop.Others
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Milimoe.FunGame.Core.Entity.General;
|
using Milimoe.FunGame.Core.Entity;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Desktop.Others
|
namespace Milimoe.FunGame.Desktop.Others
|
||||||
{
|
{
|
||||||
|
@ -5,8 +5,7 @@ using System.Windows.Forms;
|
|||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Milimoe.FunGame.Core.Api.Utility;
|
using Milimoe.FunGame.Core.Api.Utility;
|
||||||
using Milimoe.FunGame.Core.Entity.General;
|
using Milimoe.FunGame.Core.Entity;
|
||||||
using Milimoe.FunGame.Core.Entity.Enum;
|
|
||||||
using Milimoe.FunGame.Desktop.Entity.Component;
|
using Milimoe.FunGame.Desktop.Entity.Component;
|
||||||
using Milimoe.FunGame.Desktop.Others;
|
using Milimoe.FunGame.Desktop.Others;
|
||||||
using Milimoe.FunGame.Desktop.Utils;
|
using Milimoe.FunGame.Desktop.Utils;
|
||||||
@ -1436,15 +1435,15 @@ namespace Milimoe.FunGame.Desktop.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ErrorType ErrorType = NetworkUtility.IsServerAddress(ip, port);
|
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_IPADRESS = ip;
|
||||||
Others.Constant.SERVER_PORT = port;
|
Others.Constant.SERVER_PORT = port;
|
||||||
NOW_CONNECTEDRETRY = -1;
|
NOW_CONNECTEDRETRY = -1;
|
||||||
Connect();
|
Connect();
|
||||||
}
|
}
|
||||||
else if (ErrorType == Core.Entity.Enum.ErrorType.IsNotIP) ShowMessage.ErrorMessage("这不是一个IP地址!");
|
else if (ErrorType == Core.Library.Constant.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.IsNotPort) ShowMessage.ErrorMessage("这不是一个端口号!\n正确范围:1~65535");
|
||||||
else ShowMessage.ErrorMessage("格式错误!\n这不是一个服务器地址。");
|
else ShowMessage.ErrorMessage("格式错误!\n这不是一个服务器地址。");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -8,12 +8,12 @@ using System.Threading.Tasks;
|
|||||||
using FunGame.Desktop.Models.Component;
|
using FunGame.Desktop.Models.Component;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using Milimoe.FunGame.Core.Entity.General;
|
using Milimoe.FunGame.Core.Entity;
|
||||||
using Milimoe.FunGame.Core.Entity.Enum;
|
|
||||||
using Milimoe.FunGame.Desktop.Others;
|
using Milimoe.FunGame.Desktop.Others;
|
||||||
using Milimoe.FunGame.Desktop.UI;
|
using Milimoe.FunGame.Desktop.UI;
|
||||||
using Milimoe.FunGame.Core.Api.Utility;
|
using Milimoe.FunGame.Core.Api.Utility;
|
||||||
using Milimoe.FunGame.Core.Api.Factory;
|
using Milimoe.FunGame.Core.Api.Factory;
|
||||||
|
using Milimoe.FunGame.Core.Library.Constant;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Desktop.Utils
|
namespace Milimoe.FunGame.Desktop.Utils
|
||||||
{
|
{
|
||||||
@ -40,30 +40,30 @@ namespace Milimoe.FunGame.Desktop.Utils
|
|||||||
{
|
{
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case (int)Core.Entity.Enum.SocketHelperMethod.CreateSocket:
|
case (int)SocketHelperMethod.CreateSocket:
|
||||||
CreateSocket();
|
CreateSocket();
|
||||||
break;
|
break;
|
||||||
case (int)Core.Entity.Enum.SocketHelperMethod.CloseSocket:
|
case (int)SocketHelperMethod.CloseSocket:
|
||||||
Close();
|
Close();
|
||||||
break;
|
break;
|
||||||
case (int)Core.Entity.Enum.SocketHelperMethod.StartSocketHelper:
|
case (int)SocketHelperMethod.StartSocketHelper:
|
||||||
StartSocketHelper();
|
StartSocketHelper();
|
||||||
break;
|
break;
|
||||||
case (int)Core.Entity.Enum.SocketHelperMethod.Login:
|
case (int)SocketHelperMethod.Login:
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Send((int)SocketMessageType.CheckLogin, new object[] { Main, client, FactoryHelper.New<User>("Mili") });
|
Send((int)SocketMessageType.CheckLogin, new object[] { Main, client, FactoryHelper.New<User>("Mili") });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case (int)Core.Entity.Enum.SocketHelperMethod.Logout:
|
case (int)SocketHelperMethod.Logout:
|
||||||
if (client != null && Usercfg.LoginUser != null)
|
if (client != null && Usercfg.LoginUser != null)
|
||||||
{
|
{
|
||||||
Send((int)SocketMessageType.Logout, new object[] { Main, client, Usercfg.LoginUser });
|
Send((int)SocketMessageType.Logout, new object[] { Main, client, Usercfg.LoginUser });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case (int)Core.Entity.Enum.SocketHelperMethod.Disconnect:
|
case (int)SocketHelperMethod.Disconnect:
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Send((int)SocketMessageType.Disconnect, new object[] { Main, client });
|
Send((int)SocketMessageType.Disconnect, new object[] { Main, client });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user