示例#1
0
        private static void Prefix(scnEditor __instance)
        {
            if (!Main.IsEnabled ||
                !scrController.instance.paused ||
                GCS.standaloneLevelMode)
            {
                if (_gameObject == null)
                {
                    return;
                }
                Object.DestroyImmediate(_gameObject);
                Object.DestroyImmediate(_mainBehavior);
                _gameObject   = null;
                _mainBehavior = null;

                return;
            }

            if (_gameObject != null ||
                !Input.GetKeyDown(KeyCode.F9) ||
                Input.GetKey(KeyCode.LeftAlt) ||
                Input.GetKey(KeyCode.RightAlt) ||
                Input.GetKey(KeyCode.LeftControl) ||
                Input.GetKey(KeyCode.RightControl) ||
                Input.GetKey(KeyCode.LeftCommand) ||
                Input.GetKey(KeyCode.RightCommand))
            {
                return;
            }

            _gameObject   = new GameObject();
            _mainBehavior = _gameObject.AddComponent <MainBehavior>();
        }
示例#2
0
            private static bool Prefix(scnEditor __instance)
            {
                bool flag1 = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) ||
                             Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand);
                bool flag2 = Input.GetKeyDown(KeyCode.Q);
                bool flag3 = flag1 && flag2 & Main.settings.KeyBindSettings.EditorKeyBindSettings.Quit;

                void Invoke(MethodBase methodBase, params object[] parameters)
                {
                    methodBase.Invoke(__instance, parameters);
                }

                if (flag3)
                {
                    if (Main.R68)
                    {
                        if (GCS.customLevelPaths != null)
                        {
                            GCS.sceneToLoad = "scnCLS";
                            scrUIController.instance.WipeToBlack(WipeDirection.StartsFromRight);
                        }
                        else
                        {
                            scrController.instance.QuitToMainMenu();
                        }
                    }
                    else
                    {
                        Invoke(_tryQuitToMenu);
                    }
                    return(false);
                }

                return(true);
            }
        private void ShowOrHideElements()
        {
            if (scrUIController.instance == null)
            {
                return;
            }
            scrUIController uiController = scrUIController.instance;

            bool hideEverything = Settings.HideEverything;
            bool hideOtto       = hideEverything || Settings.HideOtto;
            bool hideBeta       = hideEverything || Settings.HideBeta;
            bool hideTitle      = hideEverything || Settings.HideTitle;

            hideEverything &= AdofaiTweaks.IsEnabled && Settings.IsEnabled;
            hideOtto       &= AdofaiTweaks.IsEnabled && Settings.IsEnabled;
            hideBeta       &= AdofaiTweaks.IsEnabled && Settings.IsEnabled;
            hideTitle      &= AdofaiTweaks.IsEnabled && Settings.IsEnabled;

            RDC.noHud = hideEverything;

            scnEditor editor = Object.FindObjectOfType <scnEditor>();

            if (scrController.instance.isEditingLevel)
            {
                if (editor?.ottoCanvas.gameObject.activeSelf == hideOtto)
                {
                    editor.ottoCanvas.gameObject.SetActive(!hideOtto);
                }
            }
            else
            {
                uiController.difficultyImage.enabled = !hideOtto;
                if (uiController.difficultyContainer.gameObject.activeSelf == hideOtto)
                {
                    uiController.difficultyContainer.gameObject.SetActive(!hideOtto);
                }
                if (uiController.difficultyFadeContainer.gameObject.activeSelf == hideOtto)
                {
                    uiController.difficultyFadeContainer.gameObject.SetActive(!hideOtto);
                }
            }

            if (SteamAPI.Init())
            {
                bool            isBeta       = SteamApps.GetCurrentBetaName(out _, 20);
                scrEnableIfBeta enableIfBeta =
                    Resources.FindObjectsOfTypeAll <scrEnableIfBeta>().FirstOrDefault();
                if (isBeta && enableIfBeta && enableIfBeta.gameObject.activeSelf == hideBeta)
                {
                    enableIfBeta.gameObject.SetActive(!hideBeta);
                }
            }

            if (uiController.txtLevelName.gameObject.activeSelf == hideTitle)
            {
                uiController.txtLevelName.gameObject.SetActive(!hideTitle);
            }
        }
示例#4
0
 public static void OnUpdate(scnEditor instance)
 {
     foreach (BEKeybind keybind in keybinds)
     {
         if (keybind.CheckPressed())
         {
             BECommand.Execute(instance, keybind.BoundCommand);
         }
     }
 }
 public static void Postfix(scnEditor __instance)
 {
     if (isUpdating > 0)
     {
         UpdateFont();
         isUpdating -= 1;
     }
     //if (scrController.instance.paused) {
     //UpdateFont();
     //}
 }
 public static void Prefix(scnEditor __instance)
 {
     scrollEventInside = ScrollEvent.inside;
     if (!Settings.DisableEditorZoom)
     {
         return;
     }
     if (!__instance.isLevelEditor || __instance.controller.paused)
     {
         return;
     }
     ScrollEvent.inside = true;
 }
示例#7
0
        public override void Execute(scnEditor instance, string[] args)
        {
            int pageMargin = 0;

            if (args.Length == 0)
            {
                return;
            }

            if (args.Length > 1)
            {
                object p = castStringToType(args[1]);

                if (isType(p, out int page))
                {
                    pageMargin = page;
                }
            }

            int currentPage, maxPage;

            currentPage = scnEditorPrivates.GetField <int>("currentPage");
            maxPage     = scnEditorPrivates.GetField <int>("maxPage");

            switch (args[0].ToLower())
            {
            case "set":
                currentPage = Mathf.Clamp(pageMargin, 0, maxPage);
                break;

            case "add":
            case "next":
                currentPage = Mathf.Clamp(currentPage + pageMargin, 0, maxPage);
                break;

            case "substract":
            case "previous":
            case "prev":
                currentPage = Mathf.Clamp(currentPage - pageMargin, 0, maxPage);
                break;

            default:
                return;
            }

            scnEditorPrivates.SetField("currentPage", currentPage);
            instance.ShowEventsPage(currentPage);
        }
示例#8
0
            private static bool Prefix(scnEditor __instance)
            {
                var settings = MiscModule.Settings;

                if (settings.KeyBinding.Editor.quitKeyActive && settings.KeyBinding.Editor.quitKey.Down())
                {
                    if (GCS.standaloneLevelMode)
                    {
                        return(true);
                    }

                    __instance.Run(TryQuitToMenu);
                }

                return(true);
            }
示例#9
0
            private static void Prefix(scnEditor __instance)
            {
                if (GCS.standaloneLevelMode)
                {
                    IsPlaying = true;
                }
                if (!Startup.IsEnabled || !RandomTweaks.settings.EnableOverloadGauge || !IsPlaying)
                {
                    DestroyUI();
                    return;
                }

                if (!UI)
                {
                    StartUI();
                }
            }
示例#10
0
        public override void Execute(scnEditor instance, string[] args) //자동완성이 안대요 살려주세요 저런
        {
            object myObj = castStringToType(args[0]);

            if (isType(myObj, out bool sdsaf))
            {
            }

            string cc = BEString.Get("command.test_command.name");

            Dictionary <string, object> paramDictionary = new Dictionary <string, object>();

            paramDictionary.Add("parameter_name", 1213);
            paramDictionary.Add("parameter_name2", 456f);
            paramDictionary.Add("parameter_name3", false);
            paramDictionary.Add("parameter_name4", null);

            cc = BEString.GetAndParse("command.test_command.description", paramDictionary);
        }
示例#11
0
        public static void Execute(scnEditor instance, string input)
        {
            string cmd = input.Substring(0, Math.Max(input.IndexOf(' '), input.Length)).ToLower();

            string[] args = input.Substring(Math.Max(input.IndexOf(' '), Math.Max(input.Length - 1, 0))).Split(' ');

            if (StoredCommands.ContainsKey(cmd))
            {
                StoredCommands[cmd].Execute(instance, args);
            }
            else
            {
                BetterEditor.Logger.Log(
                    BEString.GetAndParse("command_global.unknown_command",
                                         new Dictionary <string, object> {
                    { "command_name", cmd }
                }
                                         ));
            }
        }
示例#12
0
            public static bool Prefix(scnEditor __instance, ref bool ___showingPopup)
            {
                bool flag = (!(__instance.eventSystem.currentSelectedGameObject != null) || !(__instance.eventSystem.currentSelectedGameObject.GetComponent <InputField>() != null)) && !___showingPopup && RandomTweaks.settings.PlayCLSInEditor;

                if (flag)
                {
                    if (Input.GetKeyDown(KeyCode.P) && ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))) && ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))) && !GCS.standaloneLevelMode)
                    {
                        if (__instance.levelPath == null)
                        {
                            __instance.ShowPopup(true, scnEditor.PopupType.SaveBeforeLevelExport);
                            return(true);
                        }
                        GCS.standaloneLevelMode = true;
                        PlayEditorLevelPatch.IsNotPlayingAlone = false;
                        GCS.customLevelPaths = CustomLevel.GetWorldPaths(__instance.levelPath, false, true);
                        SceneManager.LoadScene("scnEditor");
                        return(false);
                    }
                    else
                    {
                        if (Input.GetKeyDown(KeyCode.Escape))
                        {
                            if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
                            {
                                GCS.standaloneLevelMode = false;
                                GCS.customLevelPaths    = null;
                                __instance.SwitchToEditMode(false);
                                return(false);
                            }
                            else
                            {
                            }
                        }
                    }
                }
                return(true);
            }
示例#13
0
 public override void Execute(scnEditor instance, string[] args)
 {
     instance.Play();
 }
示例#14
0
 public virtual void Execute(scnEditor instance, string[] args)
 {
     throw new NotImplementedException("You should override [public void BECommand.Execute()] in order to make the command work.");
 }
示例#15
0
 private static void Prefix(scnEditor __instance)
 {
     IsPlaying = false;
 }
示例#16
0
        public static void ShowPopup(this scnEditor editor, bool show, scnEditor.PopupType popupType, string text = "Example Text", float y = 450f,
                                     float alpha = 0.5f, bool skipAnim = false)
        {
            if (editor.get <bool>("popupIsAnimating"))
            {
                return;
            }
            editor.set("showingPopup", show);
            if (show)
            {
                foreach (Component component in editor.popupWindow.transform)
                {
                    component.gameObject.SetActive(false);
                }
                switch (popupType)
                {
                case scnEditor.PopupType.SaveBeforeSongImport:
                case scnEditor.PopupType.SaveBeforeImageImport:
                case scnEditor.PopupType.SaveBeforeVideoImport:
                case scnEditor.PopupType.SaveBeforeLevelExport:
                    editor.savePopupContainer.SetActive(true);
                    editor.savePopupText.text = text;
                    break;

                case scnEditor.PopupType.ExportLevel:
                    editor.publishWindow.windowContainer.SetActive(true);
                    editor.publishWindow.Init();
                    editor.invoke <object>("ShowEventPicker", new object[] { false });
                    editor.settingsPanel.ShowInspector(false);
                    editor.levelEventsPanel.ShowInspector(false);
                    break;

                case scnEditor.PopupType.MissingExportParams:
                    editor.paramsPopupContainer.SetActive(true);
                    string str2 = text;
                    //editor.paramsPopupText.text =
                    //    str2.Replace("[artist]", "<b>" + editor.levelData.artist + "</b>");
                    break;

                case scnEditor.PopupType.OpenURL:
                    editor.urlPopupContainer.SetActive(true);
                    break;

                case scnEditor.PopupType.CopyrightWarning:
                    editor.invoke <object>("ShowEventPicker", new object[] { false });
                    editor.settingsPanel.ShowInspector(false);
                    editor.levelEventsPanel.ShowInspector(false);
                    editor.copyrightPopupContainer.SetActive(true);
                    editor.copyrightText.text = text;
                    break;

                case scnEditor.PopupType.OggEncode:
                    editor.oggPopupContainer.SetActive(true);
                    editor.popupOggCancel.interactable  = true;
                    editor.popupOggConvert.interactable = true;
                    editor.oggConversionBar.gameObject.SetActive(false);
                    editor.oggConversionBarText.text = text;
                    break;

                case scnEditor.PopupType.ConversionSuccesful:
                    editor.okPopupContainer.SetActive(true);
                    editor.okPopupText.text = text;
                    break;

                case scnEditor.PopupType.ConversionError:
                    editor.okPopupContainer.SetActive(true);
                    editor.okPopupText.text = text;
                    break;

                case scnEditor.PopupType.UnsavedChanges:
                    editor.unsavedChangesPopupContainer.SetActive(true);
                    break;
                }
            }

            editor.popupPanel.SetActive(true);
            Image         component1 = editor.popupPanel.GetComponent <Image>();
            RectTransform component2 = editor.popupWindow.GetComponent <RectTransform>();
            float         duration   = skipAnim ? 0.0f : 0.5f;

            alpha = show ? alpha : 0.0f;
            float num      = 20f;
            float endValue = show ? num : y;

            component2.DOKill();
            component1.DOKill();
            if (show)
            {
                component2.SetAnchorPosY(y);
                component1.color = Color.black.WithAlpha(0.0f);
            }

            DOTweenModuleUI.DOColor(component1, Color.black.WithAlpha(alpha), duration / 2f)
            .SetUpdate(true)
            .SetEase(Ease.Linear);
            editor.set("popupIsAnimating", true);
            component2.DOAnchorPosY(endValue, duration).SetUpdate(true)
            .SetEase(show ? Ease.OutBack : Ease.InBack)
            .OnComplete(() =>
            {
                editor.set("popupIsAnimating", false);
                if (show)
                {
                    return;
                }
                editor.popupPanel.SetActive(false);
            });
            editor.ShowFileActionsPanel(false);
            editor.ShowShortcutsPanel(false);
        }