示例#1
0
文件: Bomb.cs 项目: imgr8/FishingMine
    public override ICatchable WhenCatched(IHook hook)
    {
        this.MoveBehaviour.StopMove ();
        Explode();

        return null;
    }
        public async void HookedDbContext_MustCallHooks_WhenRunningSaveChangesAsync()
        {
            var hooks = new IHook[]
                            {
                                new TimestampPreInsertHook()
                            };

            var context = new LocalContext(hooks);
            var entity = new TimestampedSoftDeletedEntity();
            context.Entities.Add(entity);
            await context.SaveChangesAsync();

            Assert.AreEqual(entity.CreatedAt.Date, DateTime.Today);
        }
示例#3
0
 public virtual bool CanConnect(IHook one, IHook two)
 {
     return(HookType.IsInstanceOfType(one) && HookType.IsInstanceOfType(two));
 }
示例#4
0
 // Constructor
 public CutsceneTracker()
 {
     _moviePlayHook = MoviePlay.Fun_Play.Hook(MoviePlayImpl).Activate();
     _movieEndHook  = MoviePlay.Fun_End.Hook(MovieEndImpl).Activate();
 }
示例#5
0
 public virtual ICatchable WhenCatched(IHook hook)
 {
     return this;
 }
示例#6
0
        private void AttachHooks(IHook[] hooks)
        {
            if (hooks == null) {
                InitializeHooks();
                return;
            };

            PreHooks = hooks.OfType<IPreActionHook>().ToList();
            PostHooks = hooks.OfType<IPostActionHook>().ToList();
            PostLoadHooks = hooks.OfType<IPostLoadHook>().ToList();
        }
示例#7
0
 public TestEventPublisher(IEventPublisher eventPublisher, IHook <object> hook)
 {
     _eventPublisher = eventPublisher;
     _hook           = hook;
 }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class, using the specified <paramref name="nameOrConnectionString"/>, , filling <see cref="_hooks"/> and <see cref="_hooks"/>.
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 /// <param name="nameOrConnectionString">The name or connection string.</param>
 public HookedDbContext(IHook[] hooks, string nameOrConnectionString)
     : base(nameOrConnectionString)
 {
     _hooks = hooks.Select(h => new HookDecorator { Hook = h }).ToList();
 }
示例#9
0
 public DefaultSettingsHook(DefaultSettings defaultSettings, IReloadedHooks hooks)
 {
     DefaultSettings       = defaultSettings;
     ReadConfigFromIniHook = hooks.CreateHook <ReadConfigfromINI>(ReadConfigFromIni, 0x00629CE0).Activate();
 }
示例#10
0
		public static void AddHook(IHook hook)
		{
			DeductionHooks[hook.HookedSymbol] = hook;
		}
示例#11
0
 public Detour(IHook hook, Delegate targetDelegate)
 {
     _hook = hook;
     _targetDelegate = targetDelegate;
 }
 public LocalContext(IHook[] hooks)
     : base(hooks)
 {
 }
示例#13
0
 void before_each()
 {
     _subject = new SubjectToHook();
     _notToBeGCed = Hook;
     _hook = CreateHook(new InProcessMemory(), _subject.ManagedPointer, Marshal.GetFunctionPointerForDelegate(_notToBeGCed));
 }
示例#14
0
    // Use this for initialization
    void Start()
    {
        // Устанавливаем крючок, в соответствии с заданной позицией

        if (Mathf.Approximately (this.length, 0.0f)) {	// Если длина крючка равна 0, то используем расположение, заданное в редакторе
            this.length = Vector3.Distance(this.fishingHookPivotPoint.transform.position, this.fishingHookCenterOfRotation.transform.position);
        } else {
            if (this.length < 0) {
                this.length = SimpleSpinning.lengthByDefault;
            }

            this.fishingHookPivotPoint.transform.position = new Vector3 (
                this.fishingHookCenterOfRotation.transform.position.x,
                this.fishingHookCenterOfRotation.transform.position.y - this.length,	// минус, потому что крючок направлен вниз
                this.fishingHookCenterOfRotation.transform.position.z
            );
        }

        if (this.maxLength <= this.length) {
            this.maxLength = SimpleSpinning.maxLengthByDefault;
        }

        if (this.angleSpeed <= 0) {
            this.angleSpeed = SimpleSpinning.angleSpeedByDefault;
        }

        if (this.maxAngleDeviation < 0.0f || this.maxAngleDeviation > 90.0f) {
            this.maxAngleDeviation = SimpleSpinning.maxAngleDeviationByDefault;
        }

        if (this.catchSpeed < 0) {
            this.catchSpeed = SimpleSpinning.catchSpeedByDefault;
        }

        this.directionHookMove = DirectionHookMove.nowhere;

        this.fishingHook = this.fishingHookGameObject.GetComponent<IHook> ();

        this.fishingHook.SetOwner (this);

        this.fishingHook.OnCatchStaff += (ICatchable obj) => {
            this.catchedStuff = obj;
            this.ChangeState(SpinningState.PullStuff);
        };
    }
示例#15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class using the an existing connection to connect 
 /// to a database. The connection will not be disposed when the context is disposed. (see <see cref="DbContext"/> overloaded constructor)
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 /// <param name="existingConnection">An existing connection to use for the new context.</param>
 /// <param name="contextOwnsConnection">If set to true the connection is disposed when the context is disposed, otherwise the caller must dispose the connection.</param>
 /// <remarks>Main reason for allowing this, is to enable reusing another database connection. (For instance one that is profiled by Miniprofiler (http://miniprofiler.com/)).</remarks>
 public HookedDbContext(IHook[] hooks, DbConnection existingConnection, bool contextOwnsConnection)
     : base(existingConnection, contextOwnsConnection)
 {
     PreHooks = hooks.OfType<IPreActionHook>().ToList();
     PostHooks = hooks.OfType<IPostActionHook>().ToList();
 }
示例#16
0
        public override void Execute(DrawTheory theory, IEnumerable <IFunctionInstance> arguments, IEnumerable <IAtom> body)
        {
            IHook hook = this.ExecuteResult(theory, arguments, body) as IHook;

            theory.AddHook(hook);
        }
示例#17
0
 public int GetHookIndex(IHook hook) => allHooks.IndexOf(hook);
示例#18
0
 public HookedDbContext(IHook[] hooks)
 {
     PreHooks = hooks.OfType<IPreActionHook>().ToList();
     PostHooks = hooks.OfType<IPostActionHook>().ToList();
 }
示例#19
0
 /// <summary>
 /// Registers a hook
 /// </summary>
 /// <param name="hook">The hook to register.</param>
 /// <param name="order">Optional ordering to run the hook in</param>
 public void RegisterHook(IHook hook, Int32? order = null)
 {
     _hooks.Add(new HookDecorator { Hook = hook, Order = order });
 }
示例#20
0
 public HookedDbContext(IHook[] hooks, string nameOrConnectionString)
     : base(nameOrConnectionString)
 {
     PreHooks = hooks.OfType<IPreActionHook>().ToList();
     PostHooks = hooks.OfType<IPostActionHook>().ToList();
 }
示例#21
0
 /// <summary>
 /// Hooks the game Draw HUD function
 /// </summary>
 static Queue()
 {
     DrawHudHook = new Hook <DrawHUD>(DrawHudHookImpl, DrawHudAddress);
     DrawHudHook.Activate();
 }
示例#22
0
 public StageLoadCrashFixHook()
 {
     _cameraInitHook = new Hook <TObjCamera_Init>(TObjCameraInit, 0x0061D3B0).Activate();
 }
示例#23
0
 public void RemoveController(IHook controller)
 {
     ControllerList.Remove(controller);
 }
示例#24
0
 public static void AddHook(IHook hook)
 {
     DeductionHooks[hook.HookedSymbol] = hook;
 }
示例#25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class, using the specified <paramref name="nameOrConnectionString"/>, , filling <see cref="PreHooks"/> and <see cref="PostHooks"/>.
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 /// <param name="nameOrConnectionString">The name or connection string.</param>
 public HookedDbContext(IHook[] hooks, string nameOrConnectionString)
     : base(nameOrConnectionString)
 {
     AttachHooks(hooks);
     ListenToObjectMaterialized();
 }
示例#26
0
 /// <inheritdoc cref="IHook.Install(long, bool)"/>
 /// <param name="hook">Hook to be installed.</param>
 /// <param name="process">Target process.</param>
 public static void Install(this IHook hook, Process process, bool ignoreProcessHasNoWindow = false) => hook.Install(process.Id, ignoreProcessHasNoWindow);
 public TestScheduledCommandPublisher(IScheduledCommandPublisher messageSession, IHook <object> hook)
 {
     _messageSession = messageSession;
     _hook           = hook;
 }
示例#28
0
 /// <inheritdoc cref="IHook.Combine(IEnumerable{IHook})"/>
 public static IHook Combine(this IEnumerable <IHook> hooks) => IHook.Combine(hooks);
示例#29
0
 public void AddHook(IHook hook)
 {
     this.hooks.Add(hook);
 }
示例#30
0
 // Constructor
 public VictoryCounter()
 {
     _tObjTeamExecHook = TObjTeam.Fun_Exec.Hook(CheckScoreIncrementHookFunction).Activate();
 }
示例#31
0
 public virtual void Init(IHook hook)
 {
     _hook = hook;
 }
示例#32
0
 public void SetHook(IHook hook)
 {
     _hook = hook;
 }
示例#33
0
 public DefaultSettingsHook(DefaultSettings defaultSettings)
 {
     DefaultSettings       = defaultSettings;
     ReadConfigFromIniHook = Fun_ReadConfigfromINI.Hook(ReadConfigFromIni).Activate();
 }
示例#34
0
 void RegisterHook(IHook hook)
 {
     hook.OnRegister(this);
     Harmony.CreateAndPatchAll(hook.GetType());
     hooks.Add(hook);
 }
示例#35
0
 public void Register(IHook hook)
 {
     hooks.Add(hook);
 }
 /// <summary>
 /// Initializes the hook class.
 /// </summary>
 private void SetupHook(WndProc proc, IntPtr address)
 {
     HookFunction = proc;
     Hook         = SDK.Hooks.CreateHook <WndProc>(HookFunction, (long)address).Activate();
 }
示例#37
0
 /// <summary>
 /// Registers a hook.
 /// </summary>
 /// <param name="hook">The hook to register.</param>
 public void Add(IHook hook)
 {
     RegisterHook(hook as IPreActionHook);
     RegisterHook(hook as IPostActionHook);
 }
示例#38
0
 public void AddController(IHook controller)
 {
     if (!ControllerList.Contains(controller))
         ControllerList.Add(controller);
 }
示例#39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class, filling <see cref="_hooks"/> and <see cref="_hooks"/>.
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 public HookedDbContext(IHook[] hooks)
 {
     _hooks = hooks.Select(h => new HookDecorator { Hook = h }).ToList();
 }
示例#40
0
 public void RemoveController(IHook controller)
 {
     ControllerList.Remove(controller);
 }
示例#41
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class using the an existing connection to connect 
 /// to a database. The connection will not be disposed when the context is disposed. (see <see cref="DbContext"/> overloaded constructor)
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 /// <param name="existingConnection">An existing connection to use for the new context.</param>
 /// <param name="contextOwnsConnection">If set to true the connection is disposed when the context is disposed, otherwise the caller must dispose the connection.</param>
 /// <remarks>Main reason for allowing this, is to enable reusing another database connection. (For instance one that is profiled by Miniprofiler (http://miniprofiler.com/)).</remarks>
 public HookedDbContext(IHook[] hooks, DbConnection existingConnection, bool contextOwnsConnection)
     : base(existingConnection, contextOwnsConnection)
 {
     _hooks = hooks.Select(h => new HookDecorator { Hook = h }).ToList();
 }
示例#42
0
 public ClippingPlanesHook(float aspectLimit)
 {
     AspectRatioLimit    = aspectLimit;
     BuildClipPlanesHook = Fun_CameraBuildPerspClipPlanes.Hook(BuildClipPlanesImpl).Activate();
 }
示例#43
0
 public AspectRatioHook(float aspectRatioLimit)
 {
     AspectRatioLimit  = aspectRatioLimit;
     SetViewWindowHook = Fun_RwCameraSetViewWindow.Hook(SetViewWindowImpl).Activate();
 }
示例#44
0
 public DefaultSettingsHook(DefaultSettings defaultSettings)
 {
     DefaultSettings       = defaultSettings;
     ReadConfigFromIniHook = new Hook <ReadConfigfromINI>(ReadConfigFromIni, 0x00629CE0).Activate();
 }
 public TestCommandDispatcher(ICommandDispatcher commandDispatcher, IHook <ICommand> hook)
 {
     _commandDispatcher = commandDispatcher;
     _hook = hook;
 }
示例#46
0
 /// <inheritdoc/>
 public abstract bool TryCreate(T instance, out IHook <T> hook);
示例#47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class using the an existing connection to connect 
 /// to a database. The connection will not be disposed when the context is disposed. (see <see cref="DbContext"/> overloaded constructor)
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 /// <param name="existingConnection">An existing connection to use for the new context.</param>
 /// <param name="contextOwnsConnection">If set to true the connection is disposed when the context is disposed, otherwise the caller must dispose the connection.</param>
 /// <remarks>Main reason for allowing this, is to enable reusing another database connection. (For instance one that is profiled by Miniprofiler (http://miniprofiler.com/)).</remarks>
 public HookedDbContext(IHook[] hooks, DbConnection existingConnection, bool contextOwnsConnection)
     : base(existingConnection, contextOwnsConnection)
 {
     AttachHooks(hooks);
     ListenToObjectMaterialized();
 }
 public unsafe DrawDistanceHook(Config config, IReloadedHooks hooks, IReloadedHooksUtilities utilities)
 {
     _config       = config;
     _optimizeHook = hooks.CreateHook <SetParamOptimize>(ModifyObjectDistance, 0x0043DF40).Activate();
 }
示例#49
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class, filling <see cref="PreHooks"/> and <see cref="PostHooks"/>.
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 public HookedDbContext(IHook[] hooks)
     : base()
 {
     AttachHooks(hooks);
     ListenToObjectMaterialized();
 }
示例#50
0
 public virtual void OnCreate(object Hook)
 {
     this.m_Hook = Hook as IHook;
 }
示例#51
0
 public static bool IsConnectedTo(this IHook hook, IHook other)
 {
     return(hook.Connections.Exists(x => x.From == other || x.To == other));
 }
示例#52
0
 public virtual void OnCreate(object Hook)
 {
     this.m_Hook = Hook as IHook;
 }