Exemplo n.º 1
0
        public static void CreateMenu(EverestModule everestModule, TextMenu menu, bool inGame)
        {
            TextMenu.Item enabledItem = new TextMenu.OnOff("Enabled".ToDialogText(), Settings.Enabled).Change((value) => {
                Settings.Enabled = value;
                foreach (TextMenu.Item item in options)
                {
                    item.Visible = value;
                }
            });
            menu.Add(enabledItem);
            CreateOptions(everestModule, menu, inGame);
            foreach (TextMenu.Item item in options)
            {
                menu.Add(item);
                item.Visible = Settings.Enabled;
            }

            foreach (string text in Split(InputController.TasFilePath, 60).Reverse())
            {
                enabledItem.AddDescription(menu, text);
            }

            enabledItem.AddDescription(menu, "Working TAS File Path:");

            HitboxTweak.AddSubMenuDescription(menu, inGame);
            InfoHud.AddSubMenuDescription(menu);
            keyConfigButton.AddDescription(menu, "Key Config Description".ToDialogText());
        }
        public override void Unload()
        {
            Hotkeys.Unload();
            Core.Instance.Unload();
            FastForwardBoost.Unload();
            DisableAchievements.Instance.Unload();
            GraphicsCore.Instance.Unload();
            SimplifiedGraphicsFeature.Instance.Unload();
            CenterCamera.Instance.Unload();
            AutoMute.Unload();
            HideGameplay.Instance.Unload();
            HitboxTweak.Unload();
            InfoHud.Unload();
            PlayerInfo.Unload();
            On.Celeste.LevelLoader.LoadingThread -= LevelLoader_LoadingThread;
            StudioCommunicationClient.Destroy();

            UnixRtc?.Dispose();

            Manager.DisableExternal();

#if DEBUG
            Benchmark.Unload();
#endif
        }
        public override void Load()
        {
            Hotkeys.Load();
            Core.Load();
            FastForwardBoost.Load();
            DisableAchievements.Load();
            GraphicsCore.Load();
            SimplifiedGraphicsFeature.Load();
            CenterCamera.Load();
            AutoMute.Load();
            HideGameplay.Load();
            HitboxTweak.Load();
            InfoHud.Load();
            ConsoleEnhancements.Load();

            AttributeUtils.Invoke <LoadAttribute>();

            // Open unix IO pipe for interfacing with Linux / Mac Celeste Studio
            if (UnixRtcEnabled)
            {
                File.Delete("/tmp/celestetas");
                UnixRtc = new NamedPipeServerStream("/tmp/celestetas", PipeDirection.InOut);
                UnixRtc.WaitForConnection();
                UnixRtcStreamOut = new StreamWriter(UnixRtc);
                UnixRtcStreamIn  = new StreamReader(UnixRtc);
                Logger.Log("CelesteTAS", "Unix socket is active on /tmp/celestetas");
            }

            // Open memory mapped file for interfacing with Windows Celeste Studio
            StudioCommunicationClient.Run();

#if DEBUG
            Benchmark.Load();
#endif
        }
        public override void Load()
        {
            Hotkeys.Load();

            Core.Instance = new Core();
            Core.Instance.Load();

            FastForwardBoost.Load();

            DisableAchievements.Instance = new DisableAchievements();
            DisableAchievements.Instance.Load();

            GraphicsCore.Instance = new GraphicsCore();
            GraphicsCore.Instance.Load();

            SimplifiedGraphicsFeature.Instance = new SimplifiedGraphicsFeature();
            SimplifiedGraphicsFeature.Instance.Load();

            CenterCamera.Instance = new CenterCamera();
            CenterCamera.Instance.Load();

            AutoMute.Load();

            HideGameplay.Instance = new HideGameplay();
            HideGameplay.Instance.Load();

            HitboxTweak.Load();

            InfoHud.Load();

            PlayerInfo.Load();

            // Optional: Allow spawning at specified location
            On.Celeste.LevelLoader.LoadingThread += LevelLoader_LoadingThread;

            // Open unix IO pipe for interfacing with Linux / Mac Celeste Studio
            if (UnixRtcEnabled)
            {
                File.Delete("/tmp/celestetas");
                UnixRtc = new NamedPipeServerStream("/tmp/celestetas", PipeDirection.InOut);
                UnixRtc.WaitForConnection();
                UnixRtcStreamOut = new StreamWriter(UnixRtc);
                UnixRtcStreamIn  = new StreamReader(UnixRtc);
                Logger.Log("CelesteTAS", "Unix socket is active on /tmp/celestetas");
            }

            // Open memory mapped file for interfacing with Windows Celeste Studio
            if (StudioCommunicationClient.Instance == null)
            {
                StudioCommunicationClient.Run();
            }

#if DEBUG
            Benchmark.Load();
#endif
        }
        public override void Unload()
        {
            Hotkeys.Unload();
            Core.Unload();
            FastForwardBoost.Unload();
            DisableAchievements.Unload();
            GraphicsCore.Unload();
            SimplifiedGraphicsFeature.Unload();
            CenterCamera.Unload();
            AutoMute.Unload();
            HideGameplay.Unload();
            HitboxTweak.Unload();
            InfoHud.Unload();
            ConsoleEnhancements.Unload();
            StudioCommunicationClient.Destroy();

            AttributeUtils.Invoke <UnloadAttribute>();

            UnixRtc?.Dispose();

#if DEBUG
            Benchmark.Unload();
#endif
        }
Exemplo n.º 6
0
        private static void CreateOptions(EverestModule everestModule, TextMenu menu, bool inGame)
        {
            options = new List <TextMenu.Item> {
                HitboxTweak.CreateSubMenu(menu, inGame),
                SimplifiedGraphicsFeature.CreateSubMenu(),
                InfoHud.CreateSubMenu(),

                new TextMenuExt.SubMenu("Round Values".ToDialogText(), false).Apply(subMenu => {
                    subMenu.Add(new TextMenu.OnOff("Round Position".ToDialogText(), Settings.RoundPosition).Change(value =>
                                                                                                                   Settings.RoundPosition = value));
                    subMenu.Add(new TextMenu.OnOff("Round Speed".ToDialogText(), Settings.RoundSpeed).Change(value =>
                                                                                                             Settings.RoundSpeed = value));
                    subMenu.Add(new TextMenu.OnOff("Round Velocity".ToDialogText(), Settings.RoundVelocity).Change(value =>
                                                                                                                   Settings.RoundVelocity = value));
                    subMenu.Add(new TextMenu.OnOff("Round Custom Info".ToDialogText(), Settings.RoundCustomInfo).Change(value =>
                                                                                                                        Settings.RoundCustomInfo = value));
                }),

                new TextMenuExt.SubMenu("Relaunch Required".ToDialogText(), false).Apply(subMenu => {
                    subMenu.Add(new TextMenu.OnOff("Launch Studio At Boot".ToDialogText(), Settings.LaunchStudioAtBoot).Change(value =>
                                                                                                                               Settings.LaunchStudioAtBoot = value));
                    subMenu.Add(new TextMenu.OnOff("Auto Extract New Studio".ToDialogText(), Settings.AutoExtractNewStudio).Change(value =>
                                                                                                                                   Settings.AutoExtractNewStudio = value));

                    // TODO need some guys who know Linux to make it actually work
                    // subMenu.Add(new TextMenu.OnOff("Unix RTC".ToDialogText(), Settings.UnixRtc).Change(value => Settings.UnixRtc = value));
                }),

                new TextMenuExt.SubMenu("More Options".ToDialogText(), false).Apply(subMenu => {
                    subMenu.Add(new TextMenu.OnOff("Center Camera".ToDialogText(), Settings.CenterCamera).Change(value =>
                                                                                                                 Settings.CenterCamera = value));
                    subMenu.Add(new TextMenu.OnOff("Pause After Load State".ToDialogText(), Settings.PauseAfterLoadState).Change(value =>
                                                                                                                                 Settings.PauseAfterLoadState = value));
                    subMenu.Add(new TextMenu.OnOff("Restore Settings".ToDialogText(), Settings.RestoreSettings).Change(value =>
                                                                                                                       Settings.RestoreSettings = value));
                    subMenu.Add(
                        new TextMenu.OnOff("Disable Achievements".ToDialogText(), Settings.DisableAchievements).Change(value =>
                                                                                                                       Settings.DisableAchievements = value));
                    subMenu.Add(new TextMenu.OnOff("Mod 9D Lighting".ToDialogText(), Settings.Mod9DLighting).Change(value =>
                                                                                                                    Settings.Mod9DLighting = value));
                }),
                new TextMenu.Button(Dialog.Clean("options_keyconfig")).Pressed(() => {
                    menu.Focused = false;
                    Entity keyboardConfig;
                    if (CreateKeyboardConfigUi != null)
                    {
                        keyboardConfig = CreateKeyboardConfigUi.Invoke(everestModule, new object[] { menu }) as Entity;
                    }
                    else
                    {
                        keyboardConfig = new ModuleSettingsKeyboardConfigUI(everestModule)
                        {
                            OnClose = () => menu.Focused = true
                        };
                    }

                    Engine.Scene.Add(keyboardConfig);
                    Engine.Scene.OnEndOfFrame += () => Engine.Scene.Entities.UpdateLists();
                }).Apply(item => keyConfigButton = item)
            };
        }