forked from liza/Questionable
master #4
31
Questionable/External/QuestionableIpc.cs
vendored
Normal file
31
Questionable/External/QuestionableIpc.cs
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Questionable.Controller;
|
||||
|
||||
namespace Questionable.External;
|
||||
|
||||
internal sealed class QuestionableIpc : IDisposable
|
||||
{
|
||||
private const string IpcIsRunning = "Questionable.IsRunning";
|
||||
private const string IpcGetCurrentQuestId = "Questionable.GetCurrentQuestId";
|
||||
|
||||
private readonly ICallGateProvider<bool> _isRunning;
|
||||
private readonly ICallGateProvider<string?> _getCurrentQuestId;
|
||||
|
||||
public QuestionableIpc(QuestController questController, IDalamudPluginInterface pluginInterface)
|
||||
{
|
||||
_isRunning = pluginInterface.GetIpcProvider<bool>(IpcIsRunning);
|
||||
_isRunning.RegisterFunc(() => questController.IsRunning);
|
||||
|
||||
_getCurrentQuestId = pluginInterface.GetIpcProvider<string?>(IpcGetCurrentQuestId);
|
||||
_getCurrentQuestId.RegisterFunc(() => questController.CurrentQuest?.Quest.Id.ToString());
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_getCurrentQuestId.UnregisterFunc();
|
||||
_isRunning.UnregisterFunc();
|
||||
}
|
||||
}
|
@ -120,6 +120,7 @@ public sealed class QuestionablePlugin : IDalamudPlugin
|
||||
serviceCollection.AddSingleton<LifestreamIpc>();
|
||||
serviceCollection.AddSingleton<YesAlreadyIpc>();
|
||||
serviceCollection.AddSingleton<ArtisanIpc>();
|
||||
serviceCollection.AddSingleton<QuestionableIpc>();
|
||||
}
|
||||
|
||||
private static void AddTaskFactories(ServiceCollection serviceCollection)
|
||||
@ -235,6 +236,7 @@ public sealed class QuestionablePlugin : IDalamudPlugin
|
||||
serviceProvider.GetRequiredService<CreditsController>();
|
||||
serviceProvider.GetRequiredService<HelpUiController>();
|
||||
serviceProvider.GetRequiredService<LeveUiController>();
|
||||
serviceProvider.GetRequiredService<QuestionableIpc>();
|
||||
serviceProvider.GetRequiredService<DalamudInitializer>();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user