summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XUtliPoolLib/XSetParentCommand.cs
blob: 8a446751015cfc994f3134b550550ae9a87de23e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;

namespace XUtliPoolLib
{
	public class XSetParentCommand
	{
		public static ExecuteCommandHandler handler = new ExecuteCommandHandler(XSetParentCommand.Execute);

		public static CanExecuteHandler canExecute = new CanExecuteHandler(XSetParentCommand.CanExecute);

		public static DebugHandler debugHandler = new DebugHandler(XSetParentCommand.DebugString);

		public static void DebugString(XGameObject gameObject, XEngineCommand command, string str, int id)
		{
			bool flag = command.data != null;
			if (flag)
			{
				XGameObject xgameObject = command.data.data as XGameObject;
				bool flag2 = xgameObject != null;
				if (flag2)
				{
					XSingleton<XDebug>.singleton.AddWarningLog2("[EngineCommand] SetParentCmd {0} ID:{1} parent:{2} current:{3}", new object[]
					{
						str,
						id,
						xgameObject.Name,
						gameObject.Name
					});
				}
			}
		}

		public static bool CanExecute(XGameObject gameObject, XEngineCommand command)
		{
			bool flag = command.data != null;
			if (flag)
			{
				XGameObject xgameObject = command.data.data as XGameObject;
				bool flag2 = xgameObject != null;
				if (flag2)
				{
					return xgameObject.IsLoaded;
				}
			}
			return true;
		}

		public static void Execute(XGameObject gameObject, XEngineCommand command)
		{
			XGameObject parent = (command.data == null) ? null : (command.data.data as XGameObject);
			gameObject.SyncSetParent(parent);
		}
	}
}