Rename ChatService and move some support buttons to OtterGui.

This commit is contained in:
Ottermandias 2023-06-18 13:24:13 +02:00
parent 3f1d84343a
commit 5f916efb13
22 changed files with 56 additions and 104 deletions

View file

@ -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);

View file

@ -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<string>() ?? 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<string>() ?? 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;

View file

@ -107,7 +107,7 @@ public class CollectionStorage : IReadOnlyList<ModCollection>, 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<ModCollection>, 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<ModCollection>, 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<ModCollection>, 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<ModCollection>, 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<ModCollection>, 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<ModCollection>, 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];

View file

@ -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);
}

View file

@ -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;