|
|
@@ -1,8 +1,10 @@
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Reflection;
|
|
|
+using Base;
|
|
|
+using Object = Base.Object;
|
|
|
|
|
|
-namespace Base
|
|
|
+namespace Model
|
|
|
{
|
|
|
[ObjectEvent]
|
|
|
public class EventComponentEvent : ObjectEvent<EventComponent>, ILoader, IAwake
|
|
|
@@ -23,11 +25,11 @@ namespace Base
|
|
|
/// </summary>
|
|
|
public class EventComponent: Component
|
|
|
{
|
|
|
- private Dictionary<EventIdType, List<object>> allEvents;
|
|
|
+ private Dictionary<int, List<object>> allEvents;
|
|
|
|
|
|
public void Load()
|
|
|
{
|
|
|
- this.allEvents = new Dictionary<EventIdType, List<object>>();
|
|
|
+ this.allEvents = new Dictionary<int, List<object>>();
|
|
|
Assembly[] assemblies = Object.ObjectManager.GetAssemblies();
|
|
|
foreach (Assembly assembly in assemblies)
|
|
|
{
|
|
|
@@ -51,7 +53,7 @@ namespace Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void Run(EventIdType type)
|
|
|
+ public void Run(int type)
|
|
|
{
|
|
|
List<object> iEvents = null;
|
|
|
if (!this.allEvents.TryGetValue(type, out iEvents))
|
|
|
@@ -66,7 +68,7 @@ namespace Base
|
|
|
IEvent iEvent = obj as IEvent;
|
|
|
if (iEvent == null)
|
|
|
{
|
|
|
- throw new GameException($"event type: {type} is not IEvent");
|
|
|
+ throw new Exception($"event type: {type} is not IEvent");
|
|
|
}
|
|
|
iEvent.Run();
|
|
|
}
|
|
|
@@ -77,7 +79,7 @@ namespace Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void Run<A>(EventIdType type, A a)
|
|
|
+ public void Run<A>(int type, A a)
|
|
|
{
|
|
|
List<object> iEvents = null;
|
|
|
if (!this.allEvents.TryGetValue(type, out iEvents))
|
|
|
@@ -92,7 +94,7 @@ namespace Base
|
|
|
var iEvent = obj as IEvent<A>;
|
|
|
if (iEvent == null)
|
|
|
{
|
|
|
- throw new GameException($"event type: {type} is not IEvent<{typeof (A).Name}>");
|
|
|
+ throw new Exception($"event type: {type} is not IEvent<{typeof (A).Name}>");
|
|
|
}
|
|
|
iEvent.Run(a);
|
|
|
}
|
|
|
@@ -103,7 +105,7 @@ namespace Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void Run<A, B>(EventIdType type, A a, B b)
|
|
|
+ public void Run<A, B>(int type, A a, B b)
|
|
|
{
|
|
|
List<object> iEvents = null;
|
|
|
if (!this.allEvents.TryGetValue(type, out iEvents))
|
|
|
@@ -118,7 +120,7 @@ namespace Base
|
|
|
var iEvent = obj as IEvent<A, B>;
|
|
|
if (iEvent == null)
|
|
|
{
|
|
|
- throw new GameException($"event type: {type} is not IEvent<{typeof (A).Name}, {typeof (B).Name}>");
|
|
|
+ throw new Exception($"event type: {type} is not IEvent<{typeof (A).Name}, {typeof (B).Name}>");
|
|
|
}
|
|
|
iEvent.Run(a, b);
|
|
|
}
|
|
|
@@ -129,7 +131,7 @@ namespace Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void Run<A, B, C>(EventIdType type, A a, B b, C c)
|
|
|
+ public void Run<A, B, C>(int type, A a, B b, C c)
|
|
|
{
|
|
|
List<object> iEvents = null;
|
|
|
if (!this.allEvents.TryGetValue(type, out iEvents))
|
|
|
@@ -144,7 +146,7 @@ namespace Base
|
|
|
var iEvent = obj as IEvent<A, B, C>;
|
|
|
if (iEvent == null)
|
|
|
{
|
|
|
- throw new GameException($"event type: {type} is not IEvent<{typeof (A).Name}, {typeof (B).Name}, {typeof (C).Name}>");
|
|
|
+ throw new Exception($"event type: {type} is not IEvent<{typeof (A).Name}, {typeof (B).Name}, {typeof (C).Name}>");
|
|
|
}
|
|
|
iEvent.Run(a, b, c);
|
|
|
}
|
|
|
@@ -155,7 +157,7 @@ namespace Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void Run<A, B, C, D>(EventIdType type, A a, B b, C c, D d)
|
|
|
+ public void Run<A, B, C, D>(int type, A a, B b, C c, D d)
|
|
|
{
|
|
|
List<object> iEvents = null;
|
|
|
if (!this.allEvents.TryGetValue(type, out iEvents))
|
|
|
@@ -170,7 +172,7 @@ namespace Base
|
|
|
var iEvent = obj as IEvent<A, B, C, D>;
|
|
|
if (iEvent == null)
|
|
|
{
|
|
|
- throw new GameException($"event type: {type} is not IEvent<{typeof (A).Name}, {typeof (B).Name}, {typeof (C).Name}, {typeof (D).Name}>");
|
|
|
+ throw new Exception($"event type: {type} is not IEvent<{typeof (A).Name}, {typeof (B).Name}, {typeof (C).Name}, {typeof (D).Name}>");
|
|
|
}
|
|
|
iEvent.Run(a, b, c, d);
|
|
|
}
|
|
|
@@ -181,7 +183,7 @@ namespace Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void Run<A, B, C, D, E>(EventIdType type, A a, B b, C c, D d, E e)
|
|
|
+ public void Run<A, B, C, D, E>(int type, A a, B b, C c, D d, E e)
|
|
|
{
|
|
|
List<object> iEvents = null;
|
|
|
if (!this.allEvents.TryGetValue(type, out iEvents))
|
|
|
@@ -196,7 +198,7 @@ namespace Base
|
|
|
var iEvent = obj as IEvent<A, B, C, D, E>;
|
|
|
if (iEvent == null)
|
|
|
{
|
|
|
- throw new GameException(
|
|
|
+ throw new Exception(
|
|
|
$"event type: {type} is not IEvent<{typeof (A).Name}, {typeof (B).Name}, {typeof (C).Name}, {typeof (D).Name}, {typeof (E).Name}>");
|
|
|
}
|
|
|
iEvent.Run(a, b, c, d, e);
|
|
|
@@ -207,7 +209,7 @@ namespace Base
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- public void Run<A, B, C, D, E,F>(EventIdType type, A a, B b, C c, D d, E e,F f)
|
|
|
+ public void Run<A, B, C, D, E,F>(int type, A a, B b, C c, D d, E e,F f)
|
|
|
{
|
|
|
List<object> iEvents = null;
|
|
|
if (!this.allEvents.TryGetValue(type, out iEvents))
|
|
|
@@ -222,7 +224,7 @@ namespace Base
|
|
|
var iEvent = obj as IEvent<A, B, C, D, E,F>;
|
|
|
if (iEvent == null)
|
|
|
{
|
|
|
- throw new GameException(
|
|
|
+ throw new Exception(
|
|
|
$"event type: {type} is not IEvent<{typeof(A).Name}, {typeof(B).Name}, {typeof(C).Name}, {typeof(D).Name}, {typeof(E).Name}>");
|
|
|
}
|
|
|
iEvent.Run(a, b, c, d, e,f);
|