// // /*=============================================================================== // // Copyright (C) 2025 PhantomsXR Ltd. All Rights Reserved. // // // // This file is part of the Phantom.XRMOD.GoapModue.UnityFusion. // // // // The XR-MOD cannot be copied, distributed, or made available to // // third-parties for commercial purposes without written permission of PhantomsXR Ltd. // // // // Contact nswell@phantomsxr.com for licensing requests. // // ===============================================================================*/ using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using Goap.Agent.Core; using UnityEngine; using UnityFusion.CLR.TypeSystem; using UnityFusion.CLR.Method; using UnityFusion.Runtime.Enviorment; using UnityFusion.Runtime.Intepreter; using UnityFusion.Runtime.Stack; using UnityFusion.Reflection; using UnityFusion.CLR.Utils; using UnityFusion.CLRBinding.Adapter; #if DEBUG && !DISABLE_UNITYFUSION_DEBUG using AutoList = System.Collections.Generic.List; #else using AutoList = UnityFusion.Other.UncheckedList; #endif namespace UnityFusion.Runtime.Generated { public unsafe class ActionBuilder_GoapActionBase_Binding { public static void Register(UnityFusion.Runtime.Enviorment.AppDomain app) { BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; MethodBase method; Type[] args; Type type = typeof(Goap.Runtime.ActionBuilder); Dictionary> genericMethods = new Dictionary>(); List lst = null; foreach (var m in type.GetMethods()) { if (m.IsGenericMethodDefinition) { if (!genericMethods.TryGetValue(m.Name, out lst)) { lst = new List(); genericMethods[m.Name] = lst; } lst.Add(m); } } args = new[] {typeof(TargetKeyBaseAdapter.Adapter)}; if (genericMethods.TryGetValue("SetTarget", out lst)) { foreach (var m in lst) { if (m.MatchGenericParameters(args, typeof(Goap.Runtime.ActionBuilder))) { method = m.MakeGenericMethod(args); app.RegisterCLRMethodRedirection(method, SetTarget_0); break; } } } args = new Type[] {typeof(UnityFusion.CLRBinding.Adapter.WorldKeyBaseAdapter.Adapter)}; if (genericMethods.TryGetValue("AddEffect", out lst)) { foreach (var m in lst) { if (m.MatchGenericParameters(args, typeof(Goap.Runtime.ActionBuilder), typeof(Goap.Core.EffectType))) { method = m.MakeGenericMethod(args); app.RegisterCLRMethodRedirection(method, AddEffect_1); break; } } } args = new Type[] {typeof(System.Single)}; method = type.GetMethod("SetBaseCost", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetBaseCost_2); args = new Type[] {typeof(UnityFusion.CLRBinding.Adapter.WorldKeyBaseAdapter.Adapter)}; if (genericMethods.TryGetValue("AddCondition", out lst)) { foreach (var m in lst) { if (m.MatchGenericParameters(args, typeof(Goap.Runtime.ActionBuilder), typeof(Goap.Core.Comparison), typeof(System.Int32))) { method = m.MakeGenericMethod(args); app.RegisterCLRMethodRedirection(method, AddCondition_3); break; } } } args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("SetValidateTarget", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetValidateTarget_6); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("SetRequiresTarget", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetRequiresTarget_7); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("SetValidateConditions", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetValidateConditions_8); args = new Type[]{typeof(System.Single)}; method = type.GetMethod("SetStoppingDistance", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetStoppingDistance_9); args = new Type[]{typeof(Goap.Agent.Core.ActionMoveMode)}; method = type.GetMethod("SetMoveMode", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetMoveMode_10); args = new Type[]{typeof(Goap.Agent.Core.IActionProperties)}; method = type.GetMethod("SetProperties", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetProperties_11); args = new Type[]{typeof(System.Action)}; method = type.GetMethod("SetCallback", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetCallback_12); } static StackObject* SetTarget_0(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); Goap.Runtime.ActionBuilder instance_of_this_method = (Goap.Runtime.ActionBuilder) typeof(Goap.Runtime.ActionBuilder).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method .SetTarget(__method.GenericArguments.First().ReflectionType); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* AddEffect_1(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); Goap.Core.EffectType @type = (Goap.Core.EffectType) typeof(Goap.Core.EffectType).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 20); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Goap.Runtime.ActionBuilder instance_of_this_method = (Goap.Runtime.ActionBuilder) typeof(Goap.Runtime.ActionBuilder).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.AddEffect(__method.GenericArguments.First().ReflectionType, @type); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* SetBaseCost_2(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @baseCost = *(float*) &ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Goap.Runtime.ActionBuilder instance_of_this_method = (Goap.Runtime.ActionBuilder) typeof(Goap.Runtime.ActionBuilder).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.SetBaseCost(@baseCost); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* AddCondition_3(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 @amount = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Goap.Core.Comparison @comparison = (Goap.Core.Comparison) typeof(Goap.Core.Comparison).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 20); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); Goap.Runtime.ActionBuilder instance_of_this_method = (Goap.Runtime.ActionBuilder) typeof(Goap.Runtime.ActionBuilder).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.AddCondition(__method.GenericArguments.First().ReflectionType, @comparison, @amount); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* SetValidateTarget_6(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @validate = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Goap.Runtime.ActionBuilder instance_of_this_method = (Goap.Runtime.ActionBuilder) typeof(Goap.Runtime.ActionBuilder).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.SetValidateTarget(@validate); object obj_result_of_this_method = result_of_this_method; if (obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType) obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* SetRequiresTarget_7(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @requiresTarget = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Goap.Runtime.ActionBuilder instance_of_this_method = (Goap.Runtime.ActionBuilder) typeof(Goap.Runtime.ActionBuilder).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.SetRequiresTarget(@requiresTarget); object obj_result_of_this_method = result_of_this_method; if (obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType) obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* SetValidateConditions_8(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @validate = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Goap.Runtime.ActionBuilder instance_of_this_method = (Goap.Runtime.ActionBuilder) typeof(Goap.Runtime.ActionBuilder).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.SetValidateConditions(@validate); object obj_result_of_this_method = result_of_this_method; if (obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType) obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* SetStoppingDistance_9(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @inRange = *(float*) &ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Goap.Runtime.ActionBuilder instance_of_this_method = (Goap.Runtime.ActionBuilder) typeof(Goap.Runtime.ActionBuilder).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.SetStoppingDistance(@inRange); object obj_result_of_this_method = result_of_this_method; if (obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType) obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* SetMoveMode_10(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); Goap.Agent.Core.ActionMoveMode @moveMode = (Goap.Agent.Core.ActionMoveMode) typeof(Goap.Agent.Core.ActionMoveMode).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 20); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Goap.Runtime.ActionBuilder instance_of_this_method = (Goap.Runtime.ActionBuilder) typeof(Goap.Runtime.ActionBuilder).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.SetMoveMode(@moveMode); object obj_result_of_this_method = result_of_this_method; if (obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType) obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* SetProperties_11(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); Goap.Agent.Core.IActionProperties @properties = (Goap.Agent.Core.IActionProperties) typeof(Goap.Agent.Core.IActionProperties).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Goap.Runtime.ActionBuilder instance_of_this_method = (Goap.Runtime.ActionBuilder) typeof(Goap.Runtime.ActionBuilder).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.SetProperties(@properties); object obj_result_of_this_method = result_of_this_method; if (obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType) obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* SetCallback_12(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Action @callback = (System.Action) typeof(System.Action).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 8); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); Goap.Runtime.ActionBuilder instance_of_this_method = (Goap.Runtime.ActionBuilder) typeof(Goap.Runtime.ActionBuilder).CheckCLRTypes( StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.SetCallback(@callback); object obj_result_of_this_method = result_of_this_method; if (obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType) obj_result_of_this_method).ILInstance); } return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } } }