Пример #1
0
        private static void RenderInstanceBendIfExtracted(ref NetNode instance, CameraInfo cameraInfo, ushort nodeID, NetInfo info, int iter, NetNode.Flags flags, ref uint instanceIndex, ref Instance data)
        {
            IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
            {
                var newInstructions = new List <CodeInstruction>();

                var mainIfBlock = instructions.GetIfBlock(MainIfBlockFind);
                //Logger.Debug(nameof(NetNodePatch), nameof(mainIfBlock), mainIfBlock);

                var bendIfBlock = mainIfBlock.GetIfBlock(BendIfBlockFind);

                //Logger.Debug(nameof(NetNodePatch), nameof(junctionIfBlock), junctionIfBlock);

                newInstructions.AddRange(bendIfBlock);
#if Debug
                Patcher.AddStopWatch(newInstructions);
#endif
                newInstructions.Add(new CodeInstruction(OpCodes.Ret));
#if Debug && Trace
                Logger.AddDebugInstructions(newInstructions, nameof(NetNodePatch), nameof(NetNodePatch.RenderInstanceBendIfExtracted));
#endif
#if Debug && IL
                Logger.Debug(nameof(NetNodePatch), nameof(NetNodePatch.RenderInstanceBendIfExtracted), newInstructions);
#endif
                return(newInstructions);
            }

            _ = Transpiler(null);
        }
Пример #2
0
        private static void RenderInstanceExtracted(ref NetSegment instance, CameraInfo cameraInfo, ushort segmentID, int layerMask, NetInfo info, Instance data, NetManager netManager)
        {
            IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
            {
                var newInstructions = new List <CodeInstruction>();

                newInstructions.Add(new CodeInstruction(OpCodes.Ldarg_S, 6));
                newInstructions.Add(new CodeInstruction(OpCodes.Stloc_S, NetManagerVarIndex));

                newInstructions.AddRange(instructions.GetFor(Patcher.GetIVarInstruction(39)));
#if Debug
                Patcher.AddStopWatch(newInstructions);
#endif
                newInstructions.Add(new CodeInstruction(OpCodes.Ret));
#if Debug && Trace
                Logger.AddDebugInstructions(newInstructions, nameof(NetSegmentPatch), nameof(RenderInstanceExtracted));
#endif
#if Debug && IL
                Logger.Debug(nameof(NetSegmentPatch), nameof(RenderInstanceExtracted), newInstructions);
#endif
                return(newInstructions);
            }

            _ = Transpiler(null);
        }