Пример #1
0
        public void Run(RemoteInterface remoteInterface)
        {
            // Draw 2D text overlay on screen.
            // The X and Y values are coordinates on the screen space, mapped to a 1000x1000 area.
            TextOverlay hello  = new TextOverlay("Hello World", 10, 5, 5).Show();
            TextOverlay colors = new TextOverlay("This text is red and transparent".Red(), 10, 5, 30, 180).Show();

            // Use RemoteInterface.Log() to display text in the mod loader console.
            remoteInterface.Log("Hello World");
        }
        unsafe void IMod.Run(RemoteInterface remoteInterface)
        {
            ri = remoteInterface;

            ri.Log("Rayman 2 Tank Controls");

            w = new World();

            hm = new HookManager();
            hm.CreateHook(EngineFunctions.fn_p_stReadAnalogJoystickMario, MarioFunction);
            hm.CreateHook(InputFunctions.VReadInput, ReadInputFunction);
            object p = hm.CreateHook(EngineFunctions.PLA_fn_bSetNewState, PLA_fn_bSetNewState);
        }
Пример #3
0
        unsafe void IMod.Run(RemoteInterface remoteInterface)
        {
            ri = remoteInterface;

            ri.Log("New Project, Hello World!");
        }
Пример #4
0
        public void Run(RemoteInterface remoteInterface)
        {
            Interface             = remoteInterface;
            GlobalActions.Engine += CountFrames;
            random = new Random();

            World world             = new World(remoteInterface);
            List <TextOverlay> vars = new List <TextOverlay>();

            GlobalInput.Actions['g'] = () =>
            {
                foreach (TextOverlay overlay in vars)
                {
                    overlay.Hide();
                }
                vars = new List <TextOverlay>();

                vars.Add(new TextOverlay("Rayman Dsgvars=".Red(), 6, 5, 0).Show());

                world.ReadObjectNames();
                Dictionary <string, Pointer <SuperObject> > superObjects = world.GetActiveSuperObjects();

                Interface.Log("SUPEROBJECT NAMES:", LogType.Debug);
                foreach (KeyValuePair <string, Pointer <SuperObject> > o in superObjects)
                {
                    Interface.Log($"{o.Key} {o.Value}", LogType.Debug);
                }

                SuperObject *rayman = superObjects["Rayman"];
                Perso *      perso  = (Perso *)rayman->engineObjectPtr;

                DsgVar *dsgVars = *perso->brain->mind->dsgMem->dsgVar;

                Interface.Log("DSGVARS:", LogType.Debug);
                for (int i = 0; i < dsgVars->dsgVarInfosLength; i++)
                {
                    DsgVarInfo info = dsgVars->dsgVarInfos[i];
                    DsgVarType type = info.type;

                    Pointer <byte> buffer = perso->brain->mind->dsgMem->memoryBufferCurrent;
                    int            offset = info.offsetInBuffer;

                    string        name  = $"{Enum.GetName(typeof(DsgVarType), type)}!{i}";
                    Func <object> value = buffer.GetDisplayReference(type, offset);

                    if (value != null)
                    {
                        vars.Add(new TextOverlay(_ => $"{name.Yellow()}\\{value()}", 5, ((vars.Count + 1) * 5 * 2.6f + 5) < 1000 ? 5 : 505, (vars.Count * 5 * 2.6f + 5) % 980).Show());
                    }
                }
            };

            GlobalInput.Actions['r'] = () =>
            {
                RandomizeAllObjects(world);
            };

            RandomizeMode mode = new RandomizeModeInterval(randomizeInterval);

            GlobalActions.Engine += () =>
            {
                if (mode.ShouldRandomize())
                {
                    RandomizeAllObjects(world);
                }
            };
        }