コード例 #1
0
        public static void Update()
        {
            try {
                RVAFinder.Update();
                if (!Memory.IsHooked)
                {
                    Memory.HookProcess();
                }

                if (Memory.GameState == GameState.TitleScreen)
                {
                    if (TitleScreenCallback != null)
                    {
                        OnTitleScreen();
                    }
                    UberStateController.SkipListenersNextUpdate = true;
                }
                else if (Memory.GameState == GameState.Game)
                {
                    UberStateController.Update();
                    if (InputUnlockCallback != null && InterOp.player_can_move())
                    {
                        OnInputUnlock();
                    }
                    SeedController.UpdateGoal();
                    TrackFileController.Update();
                }
                AHK.Tick();
            } catch (Exception e) {
                Log($"Update error: {e.Message}\n{e.StackTrace}");
            }
        }
コード例 #2
0
        public static bool Initialize()
        {
            try {
                if (!Directory.Exists(SaveFolder))
                {
                    Directory.CreateDirectory(SaveFolder);
                }

                if (!File.Exists(SeedPathFile))
                {
                    File.WriteAllText(SeedPathFile, @"C:\moon\.currentseed");
                }

                foreach (var fileName in new string[] { LogFile, MessageLog })
                {
                    if (!File.Exists(fileName))
                    {
                        File.WriteAllText(fileName, "");
                        Log($"Wrote blank {fileName} (normal for first-time init)");
                    }
                }

                AHK.Init();
                SeedController.ReadSeed(true);
                RVAFinder.Init();
                Memory = new MemoryManager();
                if (!Memory.HookProcess())
                {
                    return(false);
                }

                Memory.PatchNoPause(true);
                Log("init complete", false);
                return(true);
            } catch (Exception e) {
                Log($"init error: {e.Message}\n{e.StackTrace}");
                return(true);
            }
        }