Ejemplo n.º 1
0
		public void Initialize(CoherentUIMenu owner)
		{
			if (Handler != null)
			{
				return;
			}
			if (IsMessage)
			{
				var TargetObject = (Target != null)? Target : owner.gameObject;
				var TargetBehaviour = TargetObject as GameObject;
				if (TargetBehaviour == null)
				{
					var error = string.Format("Target {0} is not a GameObject",
							Target.GetType().Name);
					Debug.LogError(error);
				}
				Handler = () =>
				{
					TargetBehaviour.SendMessage(Method);
				};
			}
			else
			{
				var TargetType = Target.GetType();
				var MethodInfo = TargetType.GetMethod(Method,
					System.Type.EmptyTypes);
				if (MethodInfo == null)
				{
					var error = string.Format(
						"Could not find method {0} in type {1}", Method,
						TargetType.Name);
					Debug.LogError(error);
				}
				Handler = () =>
				{
					MethodInfo.Invoke(Target, new object[0]);
				};
			}
		}
Ejemplo n.º 2
0
		public void Initialize(CoherentUIMenu owner)
		{
			Click.Initialize(owner);
		}