void PopulateAppLauncherButtons(bool force = false) { if (!QStockToolbar.isAvailable || (!First && !force)) { return; } Log("Begin PopulateAppLauncherButtons", "QHide"); bool _cansave = false; ApplicationLauncherButton[] _appLauncherButtons = (ApplicationLauncherButton[])Resources.FindObjectsOfTypeAll(typeof(ApplicationLauncherButton)); for (int _i = _appLauncherButtons.Length - 1; _i >= 0; --_i) { ApplicationLauncherButton _appLauncherButton = _appLauncherButtons[_i]; if (!QStockToolbar.isModApp(_appLauncherButton) || QStockToolbar.Instance.isThisApp(_appLauncherButton)) { continue; } string toolTip; Log("Mods: " + QMods.GetModName(_appLauncherButton, out toolTip) + " " + _appLauncherButton.GetInstanceID(), "QHide"); QMods _QData = ModsToolbar.Find(q => q.AppRef == QMods.GetAppRef(_appLauncherButton)); if (_QData != null) { if (_QData.ModName != "None" && _QData.isActive) { if (!_QData.isThisApp(_appLauncherButton)) { _QData.Refresh(_appLauncherButton); } if (_QData.isHidden != QSettings.Instance.isHidden) { _QData.isHidden = QSettings.Instance.isHidden; } continue; } ModsToolbar.Remove(_QData); //Log ("Deleted an lost AppLauncherButton", "QHide"); } _QData = new QMods(_appLauncherButton); ModsToolbar.Add(_QData); _cansave = true; Log("Added the AppLauncherButton of: " + _QData.ToolTip, "QHide"); } if (_cansave) { QSettings.Instance.Save(); } Log("End PopulateAppLauncherButtons", "QHide"); Log("AppLauncherButtons count: " + _appLauncherButtons.Length, "QHide"); Log("ModsToolbar count: " + ModsToolbar.Count, "QHide"); Log("ModHasFirstConfig count: " + QSettings.Instance.ModHasFirstConfig.Count, "QHide"); }
protected override void Awake() { if (Instance != null) { Destroy(this); return; } Instance = this; DontDestroyOnLoad(Instance); GameEvents.onGUIApplicationLauncherReady.Add(AppLauncherReady); GameEvents.onGUIApplicationLauncherDestroyed.Add(AppLauncherDestroyed); GameEvents.onLevelWasLoadedGUIReady.Add(AppLauncherDestroyed); Log("Awake", "QStockToolbar"); }