public static void Notify_DownloadCompleted(ModMetaData mod) { var downloading = AllButtons.OfType <ModButton_Downloading>() .FirstOrDefault(b => b.Identifier == mod.Identifier); var missing = AllButtons.OfType <ModButton_Missing>() .FirstOrDefault(b => b.Identifier == mod.Identifier); // add installed item to MBM var installed = ModButton_Installed.For(mod); if (missing != null && missing.Active) { Insert(installed, ActiveButtons.IndexOf(missing)); } else { TryAdd(installed); } Page_BetterModConfig.Instance.Selected = installed; TryRemove(downloading); TryRemove(missing); Page_BetterModConfig.Instance.Notify_ModsListChanged(); }
public static void Notify_Unsubscribed(string publishedFileId) { var button = AllButtons.OfType <ModButton_Installed>() .FirstOrDefault(b => b.Versions.Any(m => m.Source == ContentSource.SteamWorkshop && m.Identifier == publishedFileId)); var mod = button?.Versions.First(m => m.Source == ContentSource.SteamWorkshop && m.Identifier == publishedFileId); button?.Notify_VersionRemoved(mod); }
static void Prefix() { try { AllButtons.RemoveAll(item => item.buttonManager == null); foreach (var button in AllButtons) { button.OnUpdate(); } } catch { } }
public static void Insert(ModButton button, int to) { AllButtons.TryAdd(button); AvailableButtons.TryRemove(button); if (ActiveButtons.Contains(button)) { if (ActiveButtons.IndexOf(button) < to) { to--; } ActiveButtons.Remove(button); } ActiveButtons.Insert(Mathf.Clamp(to, 0, ActiveButtons.Count), button); Notify_ModOrderChanged(); }
async void FadeEverything(bool disable, bool overridePaused = false) { if (isPaused && !overridePaused && CAN_FADE_WHEN_PAUSED) // CANT FADE WHEN PAUSED { return; } await Task.Delay(100); print("FADETO: " + disable); VideoSliderAndSettings.AbortAnimation("TranslateTo"); VideoSliderAndSettings.TranslateTo(VideoSliderAndSettings.TranslationX, disable ? 80 : 0, fadeTime, Easing.Linear); EpisodeLabel.AbortAnimation("TranslateTo"); EpisodeLabel.TranslateTo(EpisodeLabel.TranslationX, disable ? -60 : 20, fadeTime, Easing.Linear); AllButtons.AbortAnimation("FadeTo"); AllButtons.IsEnabled = !disable; await AllButtons.FadeTo(disable? 0 : 1, fadeTime, Easing.Linear); }
/// <summary> /// Updates the list of all <see cref="ExtendedToolBarButton"/> objects in the toolbar. /// </summary> /// <param name="e">This parameter is not used.</param> protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e) { base.OnItemsChanged(e); AllButtons.Clear(); foreach (object?Item in Items) { if (Item is ExtendedToolBarButton AsExtendedToolBarButton) { bool IsCommandGroupEnabled = ExtendedToolBar.IsCommandGroupEnabled(AsExtendedToolBarButton.Command); if (IsCommandGroupEnabled) { ExtendedToolBarItem NewMenuItem = new ExtendedToolBarItem(AsExtendedToolBarButton); AllButtons.Add(NewMenuItem); } } } }
protected override void ChildButtonsLogicActivate() { AllButtons.ForEach(x => x.enabled = true); }
public void OnAllStart() { AllButtons.ForEach(b => b.interactable = false); allStop.interactable = true; }
public void OnStopButton() { AllButtons.ForEach(b => b.interactable = false); AllStartButtons.ForEach(b => b.interactable = true); }