public extern static bool With( UIntPtr handle, [MarshalAs(UnmanagedType.FunctionPtr)] OnPerform onPerform, IntPtr performContext, [MarshalAs(UnmanagedType.FunctionPtr)] OnError onError, IntPtr errorContext );
public static bool PerformAnimation(Sim actor, OnPerform onPerform) { IGameObject obj2 = actor.Inventory.SetInUse(typeof(MagicWand), TestFunction, typeof(MagicWand)); actor.CarryStateMachine = StateMachineClient.Acquire(actor.Proxy.ObjectId, "wand"); actor.CarryStateMachine.SetActor("x", actor); actor.CarryStateMachine.EnterState("x", "Cast Spell - Practice"); Simulator.Sleep(0x23); bool result = onPerform(); Simulator.Sleep(0x41); actor.Inventory.SetNotInUse(obj2); return(result); }
public static bool With(UIntPtr handle, OnPerform onPerform, OnError onError = null) { var result = false; try { result = NAPI.With( handle, (context) => onPerform?.Invoke(), IntPtr.Zero, (context, error) => onError?.Invoke(error), IntPtr.Zero ); } catch (Exception error) { onError?.Invoke(error.Message); } return(result); }