From 5f916efb13b7170e6da0c04ec664120b8478b63a Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Sun, 18 Jun 2023 13:24:13 +0200 Subject: [PATCH] Rename ChatService and move some support buttons to OtterGui. --- OtterGui | 2 +- .../Manager/ActiveCollectionMigration.cs | 2 +- .../Collections/Manager/ActiveCollections.cs | 8 +-- .../Collections/Manager/CollectionStorage.cs | 18 +++---- .../Manager/IndividualCollections.Files.cs | 14 ++--- .../Collections/Manager/InheritanceManager.cs | 4 +- Penumbra/Mods/Editor/ModMerger.cs | 2 +- Penumbra/Mods/Editor/ModNormalizer.cs | 12 ++--- Penumbra/Mods/Manager/ModImportManager.cs | 2 +- Penumbra/Mods/Manager/ModOptionEditor.cs | 2 +- Penumbra/Mods/ModCreator.cs | 2 +- Penumbra/Mods/Subclasses/MultiModGroup.cs | 2 +- Penumbra/Penumbra.cs | 6 +-- Penumbra/Services/ValidityChecker.cs | 2 +- Penumbra/UI/AdvancedWindow/FileEditor.cs | 2 +- Penumbra/UI/AdvancedWindow/ItemSwapTab.cs | 2 +- .../ModEditWindow.Materials.MtrlTab.cs | 2 +- .../ModEditWindow.ShaderPackages.cs | 8 +-- Penumbra/UI/Classes/Colors.cs | 9 ++-- Penumbra/UI/ConfigWindow.cs | 3 +- Penumbra/UI/Tabs/SettingsTab.cs | 5 +- Penumbra/UI/UiHelpers.cs | 51 ------------------- 22 files changed, 56 insertions(+), 104 deletions(-) diff --git a/OtterGui b/OtterGui index ced7068b..a79abe20 160000 --- a/OtterGui +++ b/OtterGui @@ -1 +1 @@ -Subproject commit ced7068b8bf9729018c9f03f9a8e9354b9e7ca3e +Subproject commit a79abe203da2673f71a4e31422c6058375fb8dec diff --git a/Penumbra/Collections/Manager/ActiveCollectionMigration.cs b/Penumbra/Collections/Manager/ActiveCollectionMigration.cs index 7126d0e2..7ea52eb6 100644 --- a/Penumbra/Collections/Manager/ActiveCollectionMigration.cs +++ b/Penumbra/Collections/Manager/ActiveCollectionMigration.cs @@ -50,7 +50,7 @@ public static class ActiveCollectionMigration { if (!storage.ByName(collectionName, out var collection)) { - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Last choice of <{player}>'s Collection {collectionName} is not available, reset to {ModCollection.Empty.Name}.", "Load Failure", NotificationType.Warning); dict.Add(player, ModCollection.Empty); diff --git a/Penumbra/Collections/Manager/ActiveCollections.cs b/Penumbra/Collections/Manager/ActiveCollections.cs index be46f02b..69cd1239 100644 --- a/Penumbra/Collections/Manager/ActiveCollections.cs +++ b/Penumbra/Collections/Manager/ActiveCollections.cs @@ -335,7 +335,7 @@ public class ActiveCollections : ISavable, IDisposable ?? (configChanged ? ModCollection.DefaultCollectionName : ModCollection.Empty.Name); if (!_storage.ByName(defaultName, out var defaultCollection)) { - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Last choice of {TutorialService.DefaultCollection} {defaultName} is not available, reset to {ModCollection.Empty.Name}.", "Load Failure", NotificationType.Warning); @@ -351,7 +351,7 @@ public class ActiveCollections : ISavable, IDisposable var interfaceName = jObject[nameof(Interface)]?.ToObject() ?? Default.Name; if (!_storage.ByName(interfaceName, out var interfaceCollection)) { - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Last choice of {TutorialService.InterfaceCollection} {interfaceName} is not available, reset to {ModCollection.Empty.Name}.", "Load Failure", NotificationType.Warning); Interface = ModCollection.Empty; @@ -366,7 +366,7 @@ public class ActiveCollections : ISavable, IDisposable var currentName = jObject[nameof(Current)]?.ToObject() ?? Default.Name; if (!_storage.ByName(currentName, out var currentCollection)) { - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Last choice of {TutorialService.SelectedCollection} {currentName} is not available, reset to {ModCollection.DefaultCollectionName}.", "Load Failure", NotificationType.Warning); Current = _storage.DefaultNamed; @@ -385,7 +385,7 @@ public class ActiveCollections : ISavable, IDisposable { if (!_storage.ByName(typeName, out var typeCollection)) { - Penumbra.ChatService.NotificationMessage($"Last choice of {name} Collection {typeName} is not available, removed.", + Penumbra.Chat.NotificationMessage($"Last choice of {name} Collection {typeName} is not available, removed.", "Load Failure", NotificationType.Warning); configChanged = true; diff --git a/Penumbra/Collections/Manager/CollectionStorage.cs b/Penumbra/Collections/Manager/CollectionStorage.cs index 0a6b95a8..0bee38cf 100644 --- a/Penumbra/Collections/Manager/CollectionStorage.cs +++ b/Penumbra/Collections/Manager/CollectionStorage.cs @@ -107,7 +107,7 @@ public class CollectionStorage : IReadOnlyList, IDisposable { if (!CanAddCollection(name, out var fixedName)) { - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"The new collection {name} would lead to the same path {fixedName} as one that already exists.", "Warning", NotificationType.Warning); return false; @@ -118,7 +118,7 @@ public class CollectionStorage : IReadOnlyList, IDisposable _collections.Add(newCollection); _saveService.ImmediateSave(new ModCollectionSave(_modStorage, newCollection)); - Penumbra.ChatService.NotificationMessage($"Created new collection {newCollection.AnonymizedName}.", "Success", + Penumbra.Chat.NotificationMessage($"Created new collection {newCollection.AnonymizedName}.", "Success", NotificationType.Success); _communicator.CollectionChange.Invoke(CollectionType.Inactive, null, newCollection, string.Empty); return true; @@ -131,13 +131,13 @@ public class CollectionStorage : IReadOnlyList, IDisposable { if (collection.Index <= ModCollection.Empty.Index || collection.Index >= _collections.Count) { - Penumbra.ChatService.NotificationMessage("Can not remove the empty collection.", "Error", NotificationType.Error); + Penumbra.Chat.NotificationMessage("Can not remove the empty collection.", "Error", NotificationType.Error); return false; } if (collection.Index == DefaultNamed.Index) { - Penumbra.ChatService.NotificationMessage("Can not remove the default collection.", "Error", NotificationType.Error); + Penumbra.Chat.NotificationMessage("Can not remove the default collection.", "Error", NotificationType.Error); return false; } @@ -147,7 +147,7 @@ public class CollectionStorage : IReadOnlyList, IDisposable for (var i = collection.Index; i < Count; ++i) _collections[i].Index = i; - Penumbra.ChatService.NotificationMessage($"Deleted collection {collection.AnonymizedName}.", "Success", NotificationType.Success); + Penumbra.Chat.NotificationMessage($"Deleted collection {collection.AnonymizedName}.", "Success", NotificationType.Success); _communicator.CollectionChange.Invoke(CollectionType.Inactive, collection, null, string.Empty); return true; } @@ -190,14 +190,14 @@ public class CollectionStorage : IReadOnlyList, IDisposable if (!IsValidName(name)) { // TODO: handle better. - Penumbra.ChatService.NotificationMessage($"Collection of unsupported name found: {name} is not a valid collection name.", + Penumbra.Chat.NotificationMessage($"Collection of unsupported name found: {name} is not a valid collection name.", "Warning", NotificationType.Warning); continue; } if (ByName(name, out _)) { - Penumbra.ChatService.NotificationMessage($"Duplicate collection found: {name} already exists. Import skipped.", + Penumbra.Chat.NotificationMessage($"Duplicate collection found: {name} already exists. Import skipped.", "Warning", NotificationType.Warning); continue; } @@ -205,7 +205,7 @@ public class CollectionStorage : IReadOnlyList, IDisposable var collection = ModCollection.CreateFromData(_saveService, _modStorage, name, version, Count, settings, inheritance); var correctName = _saveService.FileNames.CollectionFile(collection); if (file.FullName != correctName) - Penumbra.ChatService.NotificationMessage($"Collection {file.Name} does not correspond to {collection.Name}.", "Warning", + Penumbra.Chat.NotificationMessage($"Collection {file.Name} does not correspond to {collection.Name}.", "Warning", NotificationType.Warning); _collections.Add(collection); } @@ -226,7 +226,7 @@ public class CollectionStorage : IReadOnlyList, IDisposable if (AddCollection(ModCollection.DefaultCollectionName, null)) return _collections[^1]; - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Unknown problem creating a collection with the name {ModCollection.DefaultCollectionName}, which is required to exist.", "Error", NotificationType.Error); return Count > 1 ? _collections[1] : _collections[0]; diff --git a/Penumbra/Collections/Manager/IndividualCollections.Files.cs b/Penumbra/Collections/Manager/IndividualCollections.Files.cs index 0225927e..d670fc42 100644 --- a/Penumbra/Collections/Manager/IndividualCollections.Files.cs +++ b/Penumbra/Collections/Manager/IndividualCollections.Files.cs @@ -57,7 +57,7 @@ public partial class IndividualCollections if (group.Length == 0 || group.Any(i => !i.IsValid)) { changes = true; - Penumbra.ChatService.NotificationMessage("Could not load an unknown individual collection, removed.", "Load Failure", + Penumbra.Chat.NotificationMessage("Could not load an unknown individual collection, removed.", "Load Failure", NotificationType.Warning); continue; } @@ -66,7 +66,7 @@ public partial class IndividualCollections if (collectionName.Length == 0 || !storage.ByName(collectionName, out var collection)) { changes = true; - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Could not load the collection \"{collectionName}\" as individual collection for {identifier}, set to None.", "Load Failure", NotificationType.Warning); @@ -76,7 +76,7 @@ public partial class IndividualCollections if (!Add(group, collection)) { changes = true; - Penumbra.ChatService.NotificationMessage($"Could not add an individual collection for {identifier}, removed.", + Penumbra.Chat.NotificationMessage($"Could not add an individual collection for {identifier}, removed.", "Load Failure", NotificationType.Warning); } @@ -84,7 +84,7 @@ public partial class IndividualCollections catch (Exception e) { changes = true; - Penumbra.ChatService.NotificationMessage($"Could not load an unknown individual collection, removed:\n{e}", "Load Failure", + Penumbra.Chat.NotificationMessage($"Could not load an unknown individual collection, removed:\n{e}", "Load Failure", NotificationType.Error); } } @@ -124,7 +124,7 @@ public partial class IndividualCollections if (Add($"{_actorService.AwaitedService.Data.ToName(kind, dataId)} ({kind.ToName()})", group, collection)) Penumbra.Log.Information($"Migrated {name} ({kind.ToName()}) to NPC Identifiers [{ids}]."); else - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Could not migrate {name} ({collection.AnonymizedName}) which was assumed to be a {kind.ToName()} with IDs [{ids}], please look through your individual collections.", "Migration Failure", NotificationType.Error); } @@ -140,13 +140,13 @@ public partial class IndividualCollections }, collection)) Penumbra.Log.Information($"Migrated {shortName} ({collection.AnonymizedName}) to Player Identifier."); else - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Could not migrate {shortName} ({collection.AnonymizedName}), please look through your individual collections.", "Migration Failure", NotificationType.Error); } else { - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Could not migrate {name} ({collection.AnonymizedName}), which can not be a player name nor is it a known NPC name, please look through your individual collections.", "Migration Failure", NotificationType.Error); } diff --git a/Penumbra/Collections/Manager/InheritanceManager.cs b/Penumbra/Collections/Manager/InheritanceManager.cs index ca17a87d..fef7bdbc 100644 --- a/Penumbra/Collections/Manager/InheritanceManager.cs +++ b/Penumbra/Collections/Manager/InheritanceManager.cs @@ -146,12 +146,12 @@ public class InheritanceManager : IDisposable continue; changes = true; - Penumbra.ChatService.NotificationMessage($"{collection.Name} can not inherit from {subCollection.Name}, removed.", "Warning", + Penumbra.Chat.NotificationMessage($"{collection.Name} can not inherit from {subCollection.Name}, removed.", "Warning", NotificationType.Warning); } else { - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Inherited collection {subCollectionName} for {collection.AnonymizedName} does not exist, it was removed.", "Warning", NotificationType.Warning); changes = true; diff --git a/Penumbra/Mods/Editor/ModMerger.cs b/Penumbra/Mods/Editor/ModMerger.cs index 1ed590cf..3b5babcc 100644 --- a/Penumbra/Mods/Editor/ModMerger.cs +++ b/Penumbra/Mods/Editor/ModMerger.cs @@ -84,7 +84,7 @@ public class ModMerger : IDisposable catch (Exception ex) { Error = ex; - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Could not merge {MergeFromMod!.Name} into {MergeToMod!.Name}, cleaning up changes.:\n{ex}", "Failure", NotificationType.Error); FailureCleanup(); diff --git a/Penumbra/Mods/Editor/ModNormalizer.cs b/Penumbra/Mods/Editor/ModNormalizer.cs index 0019b5f6..1726eab2 100644 --- a/Penumbra/Mods/Editor/ModNormalizer.cs +++ b/Penumbra/Mods/Editor/ModNormalizer.cs @@ -77,7 +77,7 @@ public class ModNormalizer } catch (Exception e) { - Penumbra.ChatService.NotificationMessage($"Could not normalize mod:\n{e}", "Failure", NotificationType.Error); + Penumbra.Chat.NotificationMessage($"Could not normalize mod:\n{e}", "Failure", NotificationType.Error); } finally { @@ -90,7 +90,7 @@ public class ModNormalizer { if (Directory.Exists(_normalizationDirName)) { - Penumbra.ChatService.NotificationMessage("Could not normalize mod:\n" + Penumbra.Chat.NotificationMessage("Could not normalize mod:\n" + "The directory TmpNormalization may not already exist when normalizing a mod.", "Failure", NotificationType.Error); return false; @@ -98,7 +98,7 @@ public class ModNormalizer if (Directory.Exists(_oldDirName)) { - Penumbra.ChatService.NotificationMessage("Could not normalize mod:\n" + Penumbra.Chat.NotificationMessage("Could not normalize mod:\n" + "The directory TmpNormalizationOld may not already exist when normalizing a mod.", "Failure", NotificationType.Error); return false; @@ -204,7 +204,7 @@ public class ModNormalizer } catch (Exception e) { - Penumbra.ChatService.NotificationMessage($"Could not normalize mod:\n{e}", "Failure", NotificationType.Error); + Penumbra.Chat.NotificationMessage($"Could not normalize mod:\n{e}", "Failure", NotificationType.Error); } return false; @@ -232,7 +232,7 @@ public class ModNormalizer } catch (Exception e) { - Penumbra.ChatService.NotificationMessage($"Could not move old files out of the way while normalizing mod mod:\n{e}", "Failure", + Penumbra.Chat.NotificationMessage($"Could not move old files out of the way while normalizing mod mod:\n{e}", "Failure", NotificationType.Error); } @@ -256,7 +256,7 @@ public class ModNormalizer } catch (Exception e) { - Penumbra.ChatService.NotificationMessage($"Could not move new files into the mod while normalizing mod mod:\n{e}", "Failure", + Penumbra.Chat.NotificationMessage($"Could not move new files into the mod while normalizing mod mod:\n{e}", "Failure", NotificationType.Error); foreach (var dir in Mod.ModPath.EnumerateDirectories()) { diff --git a/Penumbra/Mods/Manager/ModImportManager.cs b/Penumbra/Mods/Manager/ModImportManager.cs index 5a9fa319..bbe881b0 100644 --- a/Penumbra/Mods/Manager/ModImportManager.cs +++ b/Penumbra/Mods/Manager/ModImportManager.cs @@ -48,7 +48,7 @@ public class ModImportManager : IDisposable if (File.Exists(s)) return true; - Penumbra.ChatService.NotificationMessage($"Failed to import queued mod at {s}, the file does not exist.", "Warning", + Penumbra.Chat.NotificationMessage($"Failed to import queued mod at {s}, the file does not exist.", "Warning", NotificationType.Warning); return false; }).Select(s => new FileInfo(s)).ToArray(); diff --git a/Penumbra/Mods/Manager/ModOptionEditor.cs b/Penumbra/Mods/Manager/ModOptionEditor.cs index b4306877..ab6e839a 100644 --- a/Penumbra/Mods/Manager/ModOptionEditor.cs +++ b/Penumbra/Mods/Manager/ModOptionEditor.cs @@ -398,7 +398,7 @@ public class ModOptionEditor return true; if (message) - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Could not name option {newName} because option with same filename {path} already exists.", "Warning", NotificationType.Warning); diff --git a/Penumbra/Mods/ModCreator.cs b/Penumbra/Mods/ModCreator.cs index 5d37e99e..527c658d 100644 --- a/Penumbra/Mods/ModCreator.cs +++ b/Penumbra/Mods/ModCreator.cs @@ -51,7 +51,7 @@ public partial class ModCreator } catch (Exception e) { - Penumbra.ChatService.NotificationMessage($"Could not create directory for new Mod {newName}:\n{e}", "Failure", + Penumbra.Chat.NotificationMessage($"Could not create directory for new Mod {newName}:\n{e}", "Failure", NotificationType.Error); return null; } diff --git a/Penumbra/Mods/Subclasses/MultiModGroup.cs b/Penumbra/Mods/Subclasses/MultiModGroup.cs index 0383f763..40f3d37e 100644 --- a/Penumbra/Mods/Subclasses/MultiModGroup.cs +++ b/Penumbra/Mods/Subclasses/MultiModGroup.cs @@ -59,7 +59,7 @@ public sealed class MultiModGroup : IModGroup { if (ret.PrioritizedOptions.Count == IModGroup.MaxMultiOptions) { - Penumbra.ChatService.NotificationMessage( + Penumbra.Chat.NotificationMessage( $"Multi Group {ret.Name} has more than {IModGroup.MaxMultiOptions} options, ignoring excessive options.", "Warning", NotificationType.Warning); break; diff --git a/Penumbra/Penumbra.cs b/Penumbra/Penumbra.cs index ba64ef79..fbbaab51 100644 --- a/Penumbra/Penumbra.cs +++ b/Penumbra/Penumbra.cs @@ -31,7 +31,7 @@ public class Penumbra : IDalamudPlugin => "Penumbra"; public static readonly Logger Log = new(); - public static ChatService ChatService { get; private set; } = null!; + public static ChatService Chat { get; private set; } = null!; private readonly ValidityChecker _validityChecker; private readonly ResidentResourceManager _residentResources; @@ -55,7 +55,7 @@ public class Penumbra : IDalamudPlugin var startTimer = new StartTracker(); using var timer = startTimer.Measure(StartTimeType.Total); _services = ServiceManager.CreateProvider(this, pluginInterface, Log, startTimer); - ChatService = _services.GetRequiredService(); + Chat = _services.GetRequiredService(); _validityChecker = _services.GetRequiredService(); var startup = _services.GetRequiredService().GetDalamudConfig(DalamudServices.WaitingForPluginsOption, out bool s) ? s.ToString() @@ -115,7 +115,7 @@ public class Penumbra : IDalamudPlugin _communicatorService.ChangedItemClick.Subscribe((button, it) => { if (button == MouseButton.Left && it is Item item) - ChatService.LinkItem(item); + Chat.LinkItem(item); }, ChangedItemClick.Priority.Link); } diff --git a/Penumbra/Services/ValidityChecker.cs b/Penumbra/Services/ValidityChecker.cs index 44df07e3..3d09f097 100644 --- a/Penumbra/Services/ValidityChecker.cs +++ b/Penumbra/Services/ValidityChecker.cs @@ -38,7 +38,7 @@ public class ValidityChecker public void LogExceptions() { if( ImcExceptions.Count > 0 ) - Penumbra.ChatService.NotificationMessage( $"{ImcExceptions} IMC Exceptions thrown during Penumbra load. Please repair your game files.", "Warning", NotificationType.Warning ); + Penumbra.Chat.NotificationMessage( $"{ImcExceptions} IMC Exceptions thrown during Penumbra load. Please repair your game files.", "Warning", NotificationType.Warning ); } // Because remnants of penumbra in devPlugins cause issues, we check for them to warn users to remove them. diff --git a/Penumbra/UI/AdvancedWindow/FileEditor.cs b/Penumbra/UI/AdvancedWindow/FileEditor.cs index e42f9724..0f163994 100644 --- a/Penumbra/UI/AdvancedWindow/FileEditor.cs +++ b/Penumbra/UI/AdvancedWindow/FileEditor.cs @@ -129,7 +129,7 @@ public class FileEditor where T : class, IWritable } catch (Exception e) { - Penumbra.ChatService.NotificationMessage($"Could not export {_defaultPath}:\n{e}", "Error", NotificationType.Error); + Penumbra.Chat.NotificationMessage($"Could not export {_defaultPath}:\n{e}", "Error", NotificationType.Error); } }, _getInitialPath(), false); diff --git a/Penumbra/UI/AdvancedWindow/ItemSwapTab.cs b/Penumbra/UI/AdvancedWindow/ItemSwapTab.cs index 7ca83ec8..9331fb32 100644 --- a/Penumbra/UI/AdvancedWindow/ItemSwapTab.cs +++ b/Penumbra/UI/AdvancedWindow/ItemSwapTab.cs @@ -327,7 +327,7 @@ public class ItemSwapTab : IDisposable, ITab } catch (Exception e) { - Penumbra.ChatService.NotificationMessage($"Could not create new Swap Option:\n{e}", "Error", NotificationType.Error); + Penumbra.Chat.NotificationMessage($"Could not create new Swap Option:\n{e}", "Error", NotificationType.Error); try { if (optionCreated && _selectedGroup != null) diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.Materials.MtrlTab.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.Materials.MtrlTab.cs index 2b607280..753ad8e9 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.Materials.MtrlTab.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.Materials.MtrlTab.cs @@ -90,7 +90,7 @@ public partial class ModEditWindow LoadedShpkPath = FullPath.Empty; LoadedShpkPathName = string.Empty; AssociatedShpk = null; - Penumbra.ChatService.NotificationMessage( $"Could not load {LoadedShpkPath.ToPath()}:\n{e}", "Penumbra Advanced Editing", NotificationType.Error ); + Penumbra.Chat.NotificationMessage( $"Could not load {LoadedShpkPath.ToPath()}:\n{e}", "Penumbra Advanced Editing", NotificationType.Error ); } Update(); diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.ShaderPackages.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.ShaderPackages.cs index b6af9dd9..4e8a4f45 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.ShaderPackages.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.ShaderPackages.cs @@ -80,12 +80,12 @@ public partial class ModEditWindow } catch( Exception e ) { - Penumbra.ChatService.NotificationMessage( $"Could not export {defaultName}{tab.Extension} to {name}:\n{e.Message}", "Penumbra Advanced Editing", + Penumbra.Chat.NotificationMessage( $"Could not export {defaultName}{tab.Extension} to {name}:\n{e.Message}", "Penumbra Advanced Editing", NotificationType.Error ); return; } - Penumbra.ChatService.NotificationMessage( $"Shader Program Blob {defaultName}{tab.Extension} exported successfully to {Path.GetFileName( name )}", + Penumbra.Chat.NotificationMessage( $"Shader Program Blob {defaultName}{tab.Extension} exported successfully to {Path.GetFileName( name )}", "Penumbra Advanced Editing", NotificationType.Success ); }, null, false ); } @@ -110,7 +110,7 @@ public partial class ModEditWindow } catch( Exception e ) { - Penumbra.ChatService.NotificationMessage( $"Could not import {name}:\n{e.Message}", "Penumbra Advanced Editing", NotificationType.Error ); + Penumbra.Chat.NotificationMessage( $"Could not import {name}:\n{e.Message}", "Penumbra Advanced Editing", NotificationType.Error ); return; } @@ -122,7 +122,7 @@ public partial class ModEditWindow catch( Exception e ) { tab.Shpk.SetInvalid(); - Penumbra.ChatService.NotificationMessage( $"Failed to update resources after importing {name}:\n{e.Message}", "Penumbra Advanced Editing", + Penumbra.Chat.NotificationMessage( $"Failed to update resources after importing {name}:\n{e.Message}", "Penumbra Advanced Editing", NotificationType.Error ); return; } diff --git a/Penumbra/UI/Classes/Colors.cs b/Penumbra/UI/Classes/Colors.cs index 67dc17e2..42577034 100644 --- a/Penumbra/UI/Classes/Colors.cs +++ b/Penumbra/UI/Classes/Colors.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using OtterGui.Custom; namespace Penumbra.UI.Classes; @@ -31,13 +32,13 @@ public static class Colors public const uint RegexWarningBorder = 0xFF0000B0; public const uint MetaInfoText = 0xAAFFFFFF; public const uint RedTableBgTint = 0x40000080; - public const uint DiscordColor = 0xFFDA8972; + public const uint DiscordColor = CustomGui.DiscordColor; public const uint FilterActive = 0x807070FF; public const uint TutorialMarker = 0xFF20FFFF; public const uint TutorialBorder = 0xD00000FF; - public const uint ReniColorButton = 0xFFCC648D; - public const uint ReniColorHovered = 0xFFB070B0; - public const uint ReniColorActive = 0xFF9070E0; + public const uint ReniColorButton = CustomGui.ReniColorButton; + public const uint ReniColorHovered = CustomGui.ReniColorHovered; + public const uint ReniColorActive = CustomGui.ReniColorActive ; public static (uint DefaultColor, string Name, string Description) Data(this ColorId color) => color switch diff --git a/Penumbra/UI/ConfigWindow.cs b/Penumbra/UI/ConfigWindow.cs index 2ce27052..05c70ff8 100644 --- a/Penumbra/UI/ConfigWindow.cs +++ b/Penumbra/UI/ConfigWindow.cs @@ -4,6 +4,7 @@ using Dalamud.Interface.Windowing; using Dalamud.Plugin; using ImGuiNET; using OtterGui; +using OtterGui.Custom; using OtterGui.Raii; using Penumbra.Services; using Penumbra.UI.Classes; @@ -143,7 +144,7 @@ public sealed class ConfigWindow : Window ImGui.NewLine(); ImGui.NewLine(); - UiHelpers.DrawDiscordButton(0); + CustomGui.DrawDiscordButton(Penumbra.ChatService, 0); ImGui.SameLine(); UiHelpers.DrawSupportButton(_penumbra!); ImGui.NewLine(); diff --git a/Penumbra/UI/Tabs/SettingsTab.cs b/Penumbra/UI/Tabs/SettingsTab.cs index 16443239..4f243026 100644 --- a/Penumbra/UI/Tabs/SettingsTab.cs +++ b/Penumbra/UI/Tabs/SettingsTab.cs @@ -7,6 +7,7 @@ using Dalamud.Interface.Components; using Dalamud.Utility; using ImGuiNET; using OtterGui; +using OtterGui.Custom; using OtterGui.Raii; using OtterGui.Widgets; using Penumbra.Api; @@ -790,10 +791,10 @@ public class SettingsTab : ITab UiHelpers.DrawSupportButton(_penumbra); ImGui.SetCursorPos(new Vector2(xPos, 0)); - UiHelpers.DrawDiscordButton(width); + CustomGui.DrawDiscordButton(Penumbra.Chat, width); ImGui.SetCursorPos(new Vector2(xPos, 2 * ImGui.GetFrameHeightWithSpacing())); - UiHelpers.DrawGuideButton(width); + CustomGui.DrawGuideButton(Penumbra.Chat, width); ImGui.SetCursorPos(new Vector2(xPos, 3 * ImGui.GetFrameHeightWithSpacing())); if (ImGui.Button("Restart Tutorial", new Vector2(width, 0))) diff --git a/Penumbra/UI/UiHelpers.cs b/Penumbra/UI/UiHelpers.cs index f46eac35..7d517afc 100644 --- a/Penumbra/UI/UiHelpers.cs +++ b/Penumbra/UI/UiHelpers.cs @@ -8,7 +8,6 @@ using OtterGui; using OtterGui.Raii; using Penumbra.Interop.Structs; using Penumbra.String; -using Penumbra.UI.Classes; namespace Penumbra.UI; @@ -46,29 +45,6 @@ public static class UiHelpers ImGui.SetTooltip("Click to copy to clipboard."); } - /// Draw a button to open the official discord server. - /// The desired width of the button. - public static void DrawDiscordButton(float width) - { - const string address = @"https://discord.gg/kVva7DHV4r"; - using var color = ImRaii.PushColor(ImGuiCol.Button, Colors.DiscordColor); - if (ImGui.Button("Join Discord for Support", new Vector2(width, 0))) - try - { - var process = new ProcessStartInfo(address) - { - UseShellExecute = true, - }; - Process.Start(process); - } - catch - { - Penumbra.ChatService.NotificationMessage($"Unable to open Discord at {address}.", "Error", NotificationType.Error); - } - - ImGuiUtil.HoverTooltip($"Open {address}"); - } - /// The longest support button text. public const string SupportInfoButtonText = "Copy Support Info to Clipboard"; @@ -101,33 +77,6 @@ public static class UiHelpers }); } - /// Draw the button that opens the ReniGuide. - public static void DrawGuideButton(float width) - { - const string address = @"https://reniguide.info/"; - using var color = ImRaii.PushColor(ImGuiCol.Button, Colors.ReniColorButton) - .Push(ImGuiCol.ButtonHovered, Colors.ReniColorHovered) - .Push(ImGuiCol.ButtonActive, Colors.ReniColorActive); - if (ImGui.Button("Beginner's Guides", new Vector2(width, 0))) - try - { - var process = new ProcessStartInfo(address) - { - UseShellExecute = true, - }; - Process.Start(process); - } - catch - { - Penumbra.ChatService.NotificationMessage($"Could not open guide at {address} in external browser.", "Error", - NotificationType.Error); - } - - ImGuiUtil.HoverTooltip( - $"Open {address}\nImage and text based guides for most functionality of Penumbra made by Serenity.\n" - + "Not directly affiliated and potentially, but not usually out of date."); - } - /// Draw default vertical space. public static void DefaultLineSpace() => ImGui.Dummy(DefaultSpace);