summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XUtliPoolLib/XEngineCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Scripts/XUtliPoolLib/XEngineCommand.cs')
-rw-r--r--Client/Assets/Scripts/XUtliPoolLib/XEngineCommand.cs84
1 files changed, 84 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XUtliPoolLib/XEngineCommand.cs b/Client/Assets/Scripts/XUtliPoolLib/XEngineCommand.cs
new file mode 100644
index 00000000..42208a5d
--- /dev/null
+++ b/Client/Assets/Scripts/XUtliPoolLib/XEngineCommand.cs
@@ -0,0 +1,84 @@
+using System;
+
+namespace XUtliPoolLib
+{
+ public class XEngineCommand : IQueueObject
+ {
+ public IQueueObject next { get; set; }
+
+ public XGameObject gameObject = null;
+
+ public ExecuteCommandHandler handler = null;
+
+ public CanExecuteHandler canExecute = null;
+
+ public XObjAsyncData data = null;
+
+ public int objID = -1;
+
+ public int commandID = -1;
+
+ public static int globalCommandID = 0;
+
+ public DebugHandler debugHandler = null;
+
+ public int id = -1;
+
+ public static int debugid = 0;
+
+ public static bool debug = false;
+
+ public bool IsValid()
+ {
+ return this.gameObject != null && this.gameObject.objID == this.objID;
+ }
+
+ public void Execute()
+ {
+ bool flag = this.handler != null;
+ if (flag)
+ {
+ this.handler(this.gameObject, this);
+ }
+ }
+
+ public void Reset()
+ {
+ this.objID = -1;
+ this.commandID = -1;
+ this.gameObject = null;
+ this.handler = null;
+ this.canExecute = null;
+ this.data = null;
+ this.id = -1;
+ this.debugHandler = null;
+ }
+
+ public bool CanExecute()
+ {
+ bool flag = this.gameObject != null && this.gameObject.IsLoaded;
+ bool result;
+ if (flag)
+ {
+ bool flag2 = this.canExecute != null;
+ result = (!flag2 || this.canExecute(this.gameObject, this));
+ }
+ else
+ {
+ result = false;
+ }
+ return result;
+ }
+
+ public static int GetCommandID()
+ {
+ int result = XEngineCommand.globalCommandID++;
+ bool flag = XEngineCommand.globalCommandID > 1000000;
+ if (flag)
+ {
+ XEngineCommand.globalCommandID = 0;
+ }
+ return result;
+ }
+ }
+}