Exemplo n.º 1
0
        public static void Patch(PatchContext ctx)
        {
            var UpdateOnceBeforeFrameMethod = Type.GetStaticMethod(nameof(MyGameLogic.UpdateOnceBeforeFrame));

            MyEntity_Transpile.Patch(ctx, UpdateOnceBeforeFrameMethod);

            if (MyDistributedUpdater_Iterate.ApiExists())
            {
                var UpdateBeforeSimulationMethod = Type.GetStaticMethod(nameof(MyGameLogic.UpdateBeforeSimulation));
                foreach (var updateMethod in MyDistributedUpdater_Iterate.FindUpdateMethods(UpdateBeforeSimulationMethod))
                {
                    MyEntity_Transpile.Patch(ctx, updateMethod);
                }

                var UpdateAfterSimulationMethod = Type.GetStaticMethod(nameof(MyGameLogic.UpdateAfterSimulation));
                foreach (var updateMethod in MyDistributedUpdater_Iterate.FindUpdateMethods(UpdateAfterSimulationMethod))
                {
                    MyEntity_Transpile.Patch(ctx, updateMethod);
                }
            }
            else
            {
                Log.Error("Unable to find MyDistributedUpdater.Iterate(Delegate) method.  Some profiling data will be missing.");
            }
        }
Exemplo n.º 2
0
        public static void Patch(PatchContext ctx)
        {
            foreach (var parallelUpdateMethod in Methods)
            {
                var method = Type.GetMethod(parallelUpdateMethod, ReflectionUtils.StaticFlags | ReflectionUtils.InstanceFlags);
                if (method == null)
                {
                    Log.Error($"Unable to find {Type}#{parallelUpdateMethod}.  Some profiling data will be missing");
                    continue;
                }

                MyEntity_Transpile.Patch(ctx, method);
            }
        }