From 7be283ca30629e648725e4e1861616d86eda7238 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Fri, 24 Jan 2025 16:46:10 +0100 Subject: [PATCH] Apply API renames. --- Glamourer.Api | 2 +- Glamourer/Api/IpcProviders.cs | 2 +- Glamourer/Api/StateApi.cs | 8 ++++---- Glamourer/Events/StateUpdated.cs | 2 +- Glamourer/State/StateEditor.cs | 4 ++-- Glamourer/State/StateListener.cs | 2 +- Glamourer/State/StateManager.cs | 12 ++++++------ 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Glamourer.Api b/Glamourer.Api index b1b90e6..4ac38fb 160000 --- a/Glamourer.Api +++ b/Glamourer.Api @@ -1 +1 @@ -Subproject commit b1b90e6ecfeee76a12cb27793753fa87af21083f +Subproject commit 4ac38fbed6fb0f31c0b75de26950ab82d3bee258 diff --git a/Glamourer/Api/IpcProviders.cs b/Glamourer/Api/IpcProviders.cs index 166245f..515cd34 100644 --- a/Glamourer/Api/IpcProviders.cs +++ b/Glamourer/Api/IpcProviders.cs @@ -52,7 +52,7 @@ public sealed class IpcProviders : IDisposable, IApiService IpcSubscribers.RevertToAutomationName.Provider(pi, api.State), IpcSubscribers.StateChanged.Provider(pi, api.State), IpcSubscribers.StateChangedWithType.Provider(pi, api.State), - IpcSubscribers.StateUpdated.Provider(pi, api.State), + IpcSubscribers.StateFinalized.Provider(pi, api.State), IpcSubscribers.GPoseChanged.Provider(pi, api.State), ]; _initializedProvider.Invoke(); diff --git a/Glamourer/Api/StateApi.cs b/Glamourer/Api/StateApi.cs index 41f7650..347d2b6 100644 --- a/Glamourer/Api/StateApi.cs +++ b/Glamourer/Api/StateApi.cs @@ -255,7 +255,7 @@ public sealed class StateApi : IGlamourerApiState, IApiService, IDisposable public event Action? StateChanged; public event Action? StateChangedWithType; - public event Action? StateUpdated; + public event Action? StateFinalized; public event Action? GPoseChanged; private void ApplyDesign(ActorState state, DesignBase design, uint key, ApplyFlag flags) @@ -349,11 +349,11 @@ public sealed class StateApi : IGlamourerApiState, IApiService, IDisposable StateChangedWithType.Invoke(actor.Address, type); } - private void OnStateUpdated(StateUpdateType type, ActorData actors) + private void OnStateUpdated(StateFinalizationType type, ActorData actors) { Glamourer.Log.Verbose($"[OnStateUpdated] State Updated with Type {type}. [Affecting {actors.ToLazyString("nothing")}.]"); - if (StateUpdated != null) + if (StateFinalized != null) foreach (var actor in actors.Objects) - StateUpdated.Invoke(actor.Address, type); + StateFinalized.Invoke(actor.Address, type); } } diff --git a/Glamourer/Events/StateUpdated.cs b/Glamourer/Events/StateUpdated.cs index f18a69a..faaf33a 100644 --- a/Glamourer/Events/StateUpdated.cs +++ b/Glamourer/Events/StateUpdated.cs @@ -14,7 +14,7 @@ namespace Glamourer.Events; /// /// public sealed class StateUpdated() - : EventWrapper(nameof(StateUpdated)) + : EventWrapper(nameof(StateUpdated)) { public enum Priority { diff --git a/Glamourer/State/StateEditor.cs b/Glamourer/State/StateEditor.cs index 13b0706..ebf347f 100644 --- a/Glamourer/State/StateEditor.cs +++ b/Glamourer/State/StateEditor.cs @@ -43,7 +43,7 @@ public class StateEditor( Glamourer.Log.Verbose( $"Set model id in state {state.Identifier.Incognito(null)} from {old} to {modelId}. [Affecting {actors.ToLazyString("nothing")}.]"); StateChanged.Invoke(StateChangeType.Model, source, state, actors, null); - StateUpdated.Invoke(StateUpdateType.ModelChange, actors); + StateUpdated.Invoke(StateFinalizationType.ModelChange, actors); } /// @@ -421,7 +421,7 @@ public class StateEditor( $"Applied design to {state.Identifier.Incognito(null)}. [Affecting {actors.ToLazyString("nothing")}.]"); StateChanged.Invoke(StateChangeType.Design, state.Sources[MetaIndex.Wetness], state, actors, null); // FIXME: maybe later if(settings.SendStateUpdate) - StateUpdated.Invoke(StateUpdateType.DesignApplied, actors); + StateUpdated.Invoke(StateFinalizationType.DesignApplied, actors); return; diff --git a/Glamourer/State/StateListener.cs b/Glamourer/State/StateListener.cs index c4c16b5..d8648bb 100644 --- a/Glamourer/State/StateListener.cs +++ b/Glamourer/State/StateListener.cs @@ -281,7 +281,7 @@ public class StateListener : IDisposable _objects.Update(); if (_objects.TryGetValue(identifier, out var actors) && actors.Valid) - _stateUpdated.Invoke(StateUpdateType.Gearset, actors); + _stateUpdated.Invoke(StateFinalizationType.Gearset, actors); } diff --git a/Glamourer/State/StateManager.cs b/Glamourer/State/StateManager.cs index 0348148..948e225 100644 --- a/Glamourer/State/StateManager.cs +++ b/Glamourer/State/StateManager.cs @@ -279,7 +279,7 @@ public sealed class StateManager( StateChanged.Invoke(StateChangeType.Reset, source, state, actors, null); // only invoke if we define this reset call as the final call in our state update. if(stateUpdate) - StateUpdated.Invoke(StateUpdateType.Revert, actors); + StateUpdated.Invoke(StateFinalizationType.Revert, actors); } public void ResetAdvancedState(ActorState state, StateSource source, uint key = 0) @@ -306,7 +306,7 @@ public sealed class StateManager( $"Reset advanced customization and dye state of {state.Identifier.Incognito(null)} to game base. [Affecting {actors.ToLazyString("nothing")}.]"); StateChanged.Invoke(StateChangeType.Reset, source, state, actors, null); // Update that we have completed a full operation. (We can do this directly as nothing else is linked) - StateUpdated.Invoke(StateUpdateType.RevertAdvanced, actors); + StateUpdated.Invoke(StateFinalizationType.RevertAdvanced, actors); } public void ResetCustomize(ActorState state, StateSource source, uint key = 0) @@ -325,7 +325,7 @@ public sealed class StateManager( Glamourer.Log.Verbose( $"Reset customization state of {state.Identifier.Incognito(null)} to game base. [Affecting {actors.ToLazyString("nothing")}.]"); // Update that we have completed a full operation. (We can do this directly as nothing else is linked) - StateUpdated.Invoke(StateUpdateType.RevertCustomize, actors); + StateUpdated.Invoke(StateFinalizationType.RevertCustomize, actors); } public void ResetEquip(ActorState state, StateSource source, uint key = 0) @@ -376,7 +376,7 @@ public sealed class StateManager( Glamourer.Log.Verbose( $"Reset equipment state of {state.Identifier.Incognito(null)} to game base. [Affecting {actors.ToLazyString("nothing")}.]"); // Update that we have completed a full operation. (We can do this directly as nothing else is linked) - StateUpdated.Invoke(StateUpdateType.RevertEquipment, actors); + StateUpdated.Invoke(StateFinalizationType.RevertEquipment, actors); } public void ResetStateFixed(ActorState state, bool respectManualPalettes, uint key = 0) @@ -469,7 +469,7 @@ public sealed class StateManager( || CustomizeArray.Compare(actor.Model.GetCustomize(), state.ModelData.Customize).RequiresRedraw(), false); StateChanged.Invoke(StateChangeType.Reapply, source, state, data, null); if(stateUpdate) - StateUpdated.Invoke(StateUpdateType.Reapply, data); + StateUpdated.Invoke(StateFinalizationType.Reapply, data); } /// Automation variant for reapply, to fire the correct StateUpdateType once reapplied. @@ -490,7 +490,7 @@ public sealed class StateManager( || CustomizeArray.Compare(actor.Model.GetCustomize(), state.ModelData.Customize).RequiresRedraw(), false); StateChanged.Invoke(StateChangeType.Reapply, source, state, data, null); // invoke the automation update based on what reset is. - StateUpdated.Invoke(wasReset ? StateUpdateType.RevertAutomation : StateUpdateType.ReapplyAutomation, data); + StateUpdated.Invoke(wasReset ? StateFinalizationType.RevertAutomation : StateFinalizationType.ReapplyAutomation, data); } public void DeleteState(ActorIdentifier identifier)