mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-16 21:54:16 +01:00
feat: add toast options to event, too
This commit is contained in:
parent
e81356d476
commit
72a981057f
1 changed files with 8 additions and 3 deletions
|
|
@ -12,7 +12,7 @@ namespace Dalamud.Game.Internal.Gui
|
||||||
{
|
{
|
||||||
#region Events
|
#region Events
|
||||||
|
|
||||||
public delegate void OnToastDelegate(ref SeString message, ref bool isHandled);
|
public delegate void OnToastDelegate(ref SeString message, ref ToastOptions options, ref bool isHandled);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Event that will be fired when a toast is sent by the game or a plugin.
|
/// Event that will be fired when a toast is sent by the game or a plugin.
|
||||||
|
|
@ -133,8 +133,13 @@ namespace Dalamud.Game.Internal.Gui
|
||||||
// call events
|
// call events
|
||||||
var isHandled = false;
|
var isHandled = false;
|
||||||
var str = this.Dalamud.SeStringManager.Parse(bytes.ToArray());
|
var str = this.Dalamud.SeStringManager.Parse(bytes.ToArray());
|
||||||
|
var options = new ToastOptions
|
||||||
|
{
|
||||||
|
Position = (ToastPosition) isTop,
|
||||||
|
Speed = (ToastSpeed)isFast,
|
||||||
|
};
|
||||||
|
|
||||||
this.OnToast?.Invoke(ref str, ref isHandled);
|
this.OnToast?.Invoke(ref str, ref options, ref isHandled);
|
||||||
|
|
||||||
// do nothing if handled
|
// do nothing if handled
|
||||||
if (isHandled)
|
if (isHandled)
|
||||||
|
|
@ -151,7 +156,7 @@ namespace Dalamud.Game.Internal.Gui
|
||||||
{
|
{
|
||||||
fixed (byte* message = terminated)
|
fixed (byte* message = terminated)
|
||||||
{
|
{
|
||||||
return this.showToastHook.Original(manager, (IntPtr)message, layer, isTop, isFast, logMessageId);
|
return this.showToastHook.Original(manager, (IntPtr)message, layer, (byte)options.Position, (byte)options.Speed, logMessageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue