Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonBlade committed Sep 10, 2022
2 parents 664a861 + d010ebc commit e31dec0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions HeelsPlugin/IpcManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace HeelsPlugin
{
public class IpcManager : IDisposable
{
private static readonly string API_VERSION = "1.0.0";
private static readonly string API_VERSION = "1.0.1";

public static readonly string ApiVersionIdentifier = "HeelsPlugin.ApiVersion";
public static readonly string GetOffsetIdentifier = "HeelsPlugin.GetOffset";
Expand All @@ -18,23 +18,23 @@ public class IpcManager : IDisposable
private ICallGateProvider<string>? ApiVersion;
private ICallGateProvider<float>? GetOffset;
private ICallGateProvider<float, object?>? OffsetUpdate;
private ICallGateSubscriber<GameObject, float, object?>? RegisterPlayer;
private ICallGateSubscriber<GameObject, object?>? UnregisterPlayer;
private ICallGateProvider<GameObject, float, object?>? RegisterPlayer;
private ICallGateProvider<GameObject, object?>? UnregisterPlayer;

public IpcManager(DalamudPluginInterface pluginInterface, PluginMemory memory)
{
ApiVersion = pluginInterface.GetIpcProvider<string>(ApiVersionIdentifier);
GetOffset = pluginInterface.GetIpcProvider<float>(IpcManager.GetOffsetIdentifier);
OffsetUpdate = pluginInterface.GetIpcProvider<float, object?>(IpcManager.OffsetChangedIdentifier);
RegisterPlayer = pluginInterface.GetIpcSubscriber<GameObject, float, object?>(IpcManager.RegisterPlayerIdentifier);
UnregisterPlayer = pluginInterface.GetIpcSubscriber<GameObject, object?>(IpcManager.UnregisterPlayerIdentifier);
RegisterPlayer = pluginInterface.GetIpcProvider<GameObject, float, object?>(IpcManager.RegisterPlayerIdentifier);
UnregisterPlayer = pluginInterface.GetIpcProvider<GameObject, object?>(IpcManager.UnregisterPlayerIdentifier);

RegisterPlayer.Subscribe((gameObject, offset) =>
RegisterPlayer.RegisterAction((gameObject, offset) =>
{
memory.PlayerOffsets[gameObject] = offset;
});

UnregisterPlayer.Subscribe((gameObject) =>
UnregisterPlayer.RegisterAction((gameObject) =>
{
memory.PlayerOffsets.Remove(gameObject);
});
Expand All @@ -52,6 +52,8 @@ public void Dispose()
{
ApiVersion?.UnregisterFunc();
GetOffset?.UnregisterFunc();
RegisterPlayer?.UnregisterAction();
UnregisterPlayer?.UnregisterAction();
}
}
}

0 comments on commit e31dec0

Please sign in to comment.