From 813f7eab3df2d95c6c7af8e184be9634b0f433b4 Mon Sep 17 00:00:00 2001 From: Adrienne Walker Date: Sat, 12 Sep 2020 13:59:11 -0700 Subject: [PATCH] Add additional supported fields to IOverlayPreset --- OverlayPlugin.Common/IOverlayPreset.cs | 2 ++ OverlayPlugin.Core/Controls/NewOverlayDialog.cs | 4 ++++ OverlayPlugin.Core/Controls/WSConfigPanel.cs | 2 ++ OverlayPlugin.Core/EventSources/CactbotEventSource.cs | 4 +++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/OverlayPlugin.Common/IOverlayPreset.cs b/OverlayPlugin.Common/IOverlayPreset.cs index 3ee4399a2..a18719a75 100644 --- a/OverlayPlugin.Common/IOverlayPreset.cs +++ b/OverlayPlugin.Common/IOverlayPreset.cs @@ -13,6 +13,8 @@ public interface IOverlayPreset string Url { get; } int[] Size { get; } bool Locked { get; } + bool IsOverlayPreset { get; } + bool IsSharedPreset { get; } List Supports { get; } } } diff --git a/OverlayPlugin.Core/Controls/NewOverlayDialog.cs b/OverlayPlugin.Core/Controls/NewOverlayDialog.cs index 0de9f826c..e7db83f01 100644 --- a/OverlayPlugin.Core/Controls/NewOverlayDialog.cs +++ b/OverlayPlugin.Core/Controls/NewOverlayDialog.cs @@ -80,6 +80,8 @@ private Dictionary PreparePresetCombo(ComboBox cbPreset) foreach (var item in registry.OverlayPresets) { + if (!item.IsOverlayPreset) + continue; cbPreset.Items.Add(item); } @@ -265,6 +267,8 @@ class OverlayPreset : IOverlayPreset [JsonIgnore] public int[] Size { get; set; } public bool Locked { get; set; } + public bool IsOverlayPreset { get; set; } = true; + public bool IsSharedPreset { get; set; } = true; public List Supports { get; set; } [JsonExtensionData] diff --git a/OverlayPlugin.Core/Controls/WSConfigPanel.cs b/OverlayPlugin.Core/Controls/WSConfigPanel.cs index 46aa4e3d6..76762e238 100644 --- a/OverlayPlugin.Core/Controls/WSConfigPanel.cs +++ b/OverlayPlugin.Core/Controls/WSConfigPanel.cs @@ -320,6 +320,8 @@ private void RebuildOverlayOptions() foreach (var preset in _registry.OverlayPresets) { + if (!preset.IsSharedPreset) + continue; cbOverlay.Items.Add(new { label = preset.Name, diff --git a/OverlayPlugin.Core/EventSources/CactbotEventSource.cs b/OverlayPlugin.Core/EventSources/CactbotEventSource.cs index 4a78f3ede..4b002f951 100644 --- a/OverlayPlugin.Core/EventSources/CactbotEventSource.cs +++ b/OverlayPlugin.Core/EventSources/CactbotEventSource.cs @@ -739,13 +739,15 @@ private void StopFileWatcher() watchers = null; } - struct OverlayPreset : IOverlayPreset + class OverlayPreset : IOverlayPreset { public string Name { get; set; } public string Type { get { return "MiniParse"; } } public string Url { get; set; } public int[] Size { get; set; } public bool Locked { get; set; } + public bool IsOverlayPreset { get; set; } = true; + public bool IsSharedPreset { get; set; } = true; public List Supports { get { return new List { "modern" }; } } }