// GESTION DE LA CONFIGURATION public void Save() { ConfigNode _temp = ConfigNode.CreateConfigFromObject(this, new ConfigNode()); _temp.Save(FileConfig); QuickScroll.Log("Settings Saved", "QSettings"); }
private void OnDestroy() { GameEvents.onGUIApplicationLauncherReady.Remove(AppLauncherReady); GameEvents.onGUIApplicationLauncherDestroyed.Remove(AppLauncherDestroyed); GameEvents.onLevelWasLoadedGUIReady.Remove(AppLauncherDestroyed); QuickScroll.Log("OnDestroy", "QStockToolbar"); }
internal static void HideSettings() { WindowSettings = false; Switch(false); Save(); QuickScroll.Log("HideSettings", "QGUI"); }
internal void Set(bool SetTrue, bool force = false) { if (!isAvailable) { return; } if (appLauncherButton != null) { if (SetTrue) { if (isFalse) { appLauncherButton.SetTrue(force); } } else { if (isTrue) { appLauncherButton.SetFalse(force); } } } QuickScroll.Log("Set", "QStockToolbar"); }
private void OnHover() { if (QGUI.WindowSettings || !QSettings.Instance.StockToolBarHovering) { return; } QGUI.ShowSettings(); QuickScroll.Log("OnHover", "QStockToolbar"); }
internal static void VerifyKey(Key key) { try { Input.GetKey(CurrentKey(key)); } catch { QuickScroll.Warning("Wrong key: " + CurrentKey(key), "QKey"); SetCurrentKey(key, DefaultKey(key)); } }
private void OnFalse() { if (!QGUI.WindowSettings) { return; } QGUI.HideSettings(); QuickScroll.Log("OnFalse", "QStockToolbar"); }
private void Destroy() { if (appLauncherButton != null) { ApplicationLauncher.Instance.RemoveModApplication(appLauncherButton); appLauncherButton = null; } QuickScroll.Log("Destroy", "QStockToolbar"); }
private void OnTrue() { if (QGUI.WindowSettings) { return; } QGUI.ShowSettings(); QuickScroll.Log("OnTrue", "QStockToolbar"); }
private void AppLauncherDestroyed(GameScenes gameScene) { if (CanUseIt) { return; } Destroy(); QuickScroll.Log("onLevelWasLoadedGUIReady", "QStockToolbar"); }
public static void Settings() { WindowSettings = !WindowSettings; Switch(WindowSettings); if (!WindowSettings) { Save(); } QuickScroll.Log("Settings", "QGUI"); }
internal void OnDestroy() { if (!isAvailable || Button == null) { return; } Button.Destroy(); Button = null; QuickScroll.Log("OnDestroy", "QBlizzyToolbar"); }
private void AppLauncherReady() { QSettings.Instance.Load(); if (!Enabled) { return; } Init(); QuickScroll.Log("AppLauncherReady", "QStockToolbar"); }
internal void Reset() { if (Enabled) { Start(); } else { OnDestroy(); } QuickScroll.Log("Reset", "QBlizzyToolbar"); }
private void Init() { if (!isAvailable || !CanUseIt) { return; } if (appLauncherButton == null) { appLauncherButton = ApplicationLauncher.Instance.AddModApplication(OnTrue, OnFalse, OnHover, OnHoverOut, null, null, AppScenes, GetTexture); } QuickScroll.Log("Init", "QStockToolbar"); }
private void OnHoverOut() { if (!QGUI.WindowSettings || !QSettings.Instance.StockToolBarHovering) { return; } if (!isTrue && !isHovering) { QGUI.HideSettings(); } QuickScroll.Log("OnHoverOut", "QStockToolbar"); }
// Initialisation des modules private void Awake() { if (Instance != null) { Destroy (this); Warning ("There's already an Instance of " + MOD); return; } Instance = this; if (BlizzyToolbar == null) BlizzyToolbar = new QBlizzyToolbar (); QGUI.Awake (); QShortCuts.Awake (); Log ("Awake"); }
internal void Start() { if (!HighLogic.LoadedSceneIsGame || !isAvailable || !Enabled || Button != null) { return; } Button = ToolbarManager.Instance.add(QuickScroll.MOD, QuickScroll.MOD); Button.TexturePath = TexturePath; Button.ToolTip = QuickScroll.MOD + ": Settings"; Button.OnClick += (e) => OnClick(); Button.Visibility = new GameScenesVisibility(AppScenes); QuickScroll.Log("Start", "QBlizzyToolbar"); }
private void Awake() { if (Instance != null) { Destroy(this); return; } Instance = this; DontDestroyOnLoad(Instance); GameEvents.onGUIApplicationLauncherReady.Add(AppLauncherReady); GameEvents.onGUIApplicationLauncherDestroyed.Add(AppLauncherDestroyed); GameEvents.onLevelWasLoadedGUIReady.Add(AppLauncherDestroyed); QuickScroll.Log("Awake", "QStockToolbar"); }
internal void Reset() { if (appLauncherButton != null) { Set(false); if (!Enabled) { Destroy(); } } if (Enabled) { Init(); } QuickScroll.Log("Reset", "QStockToolbar"); }
public void Load() { if (File.Exists(FileConfig)) { try { ConfigNode _temp = ConfigNode.Load(FileConfig); ConfigNode.LoadObjectFromConfig(this, _temp); } catch { Save(); } QuickScroll.Log("Settings Loaded", "QSettings"); } else { Save(); } }
// Initialisation des modules private void Awake() { if (Instance != null) { Destroy(this); Warning("There's already an Instance of " + MOD); return; } Instance = this; if (BlizzyToolbar == null) { BlizzyToolbar = new QBlizzyToolbar(); } QGUI.Awake(); QShortCuts.Awake(); Log("Awake"); }
// Changer de filtre/catégorie internal static void SelectPartCategory(bool dirScrolling, List <PartCategorizer.Category> categories, int index, UIList list) { if (QSettings.Instance.EnableWheelBlockTopEnd) { if (dirScrolling && index == 0) { return; } if (!dirScrolling && index == categories.Count - 1) { return; } } PartCategorizer.Category _category = (dirScrolling ? PrevCategory(categories, index) : NextCategory(categories, index)); UIRadioButton _btn = _category.button.activeButton; _btn.SetState(UIRadioButton.State.True, UIRadioButton.CallType.APPLICATION, null, true); //PartListTooltipsTWEAK (false); QuickScroll.Log("SelectPartCategory " + (dirScrolling ? "Prev" : "Next"), "QCategory"); }
internal static void Update() { if (EditorLogic.fetch.editorScreen != EditorScreen.Parts || !QSettings.Instance.EnableWheelScroll || !EditorPanels.Instance.IsMouseOver()) { return; } if (EditorPartList.Instance != null) { if (EditorPartList.Instance.partListScrollRect.vertical && EditorPartList.Instance.partListScrollRect.verticalScrollbar.IsInteractable()) { if (string.IsNullOrEmpty(PartCategorizer.Instance.searchField.text) && !PartCategorizer.Instance.searchField.isFocused) { if (indexParts > 0) { int _partsPages = partsPages; if (EditorPartList.Instance.partListScrollRect.verticalScrollbar.numberOfSteps != _partsPages) { EditorPartList.Instance.partListScrollRect.verticalScrollbar.numberOfSteps = _partsPages; EditorPartList.Instance.partListScrollRect.scrollSensitivity = _partsPages * 150f; QuickScroll.Log("Set pages: " + _partsPages, "QScroll"); QuickScroll.Log("\tscrollSensitivity " + _partsPages * 150f, "QScroll"); } } } if (PartCategorizer.Instance.searchField.isFocused) { if (EditorPartList.Instance.partListScrollRect.scrollSensitivity != 27f || EditorPartList.Instance.partListScrollRect.verticalScrollbar.numberOfSteps != 0) { EditorPartList.Instance.partListScrollRect.verticalScrollbar.numberOfSteps = 0; EditorPartList.Instance.partListScrollRect.scrollSensitivity = 27f; QuickScroll.Log("Reset scrollSensitivity and numberOfSteps", "QScroll"); } } } } float _scroll = Input.GetAxis("Mouse ScrollWheel"); if (_scroll == 0) { return; } if (isOverArrow) { if (isSimple) { PartCategorizer.Instance.SetAdvancedMode(); } else { PartCategorizer.Instance.SetSimpleMode(); } return; } bool _ModKeyFilterWheel = false; bool _ModKeyCategoryWheel = false; if (QSettings.Instance.EnableWheelShortCut) { _ModKeyFilterWheel = Input.GetKey(QSettings.Instance.ModKeyFilterWheel); _ModKeyCategoryWheel = Input.GetKey(QSettings.Instance.ModKeyCategoryWheel); } bool _ModKeyWheel = _ModKeyFilterWheel || _ModKeyCategoryWheel; if (isOverFilters || (_ModKeyWheel && isOverCategories) || (_ModKeyFilterWheel && isOverParts)) { if (isSimple) { PartCategorizer.Instance.SetAdvancedMode(); } QCategory.SelectPartFilter(_scroll > 0); } else if (isOverCategories || (_ModKeyCategoryWheel && isOverParts)) { QCategory.SelectPartCategory(_scroll > 0); } /*else if (isOverParts && indexParts > 0) { * QCategory.PartListTooltipsTWEAK (false); * }*/ }
internal static void ShowSettings() { WindowSettings = true; Lock(true); QuickScroll.Log("ShowSettings", "QGUI"); }
private void AppLauncherDestroyed() { Destroy(); QuickScroll.Log("onGUIApplicationLauncherDestroyed", "QStockToolbar"); }