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

@ -129,7 +129,7 @@ public class FileEditor<T> where T : class, IWritable
}
catch (Exception e)
{
Penumbra.ChatService.NotificationMessage($"Could not export {_defaultPath}:\n{e}", "Error", NotificationType.Error);
Penumbra.Chat.NotificationMessage($"Could not export {_defaultPath}:\n{e}", "Error", NotificationType.Error);
}
}, _getInitialPath(), false);

View file

@ -327,7 +327,7 @@ public class ItemSwapTab : IDisposable, ITab
}
catch (Exception e)
{
Penumbra.ChatService.NotificationMessage($"Could not create new Swap Option:\n{e}", "Error", NotificationType.Error);
Penumbra.Chat.NotificationMessage($"Could not create new Swap Option:\n{e}", "Error", NotificationType.Error);
try
{
if (optionCreated && _selectedGroup != null)

View file

@ -90,7 +90,7 @@ public partial class ModEditWindow
LoadedShpkPath = FullPath.Empty;
LoadedShpkPathName = string.Empty;
AssociatedShpk = null;
Penumbra.ChatService.NotificationMessage( $"Could not load {LoadedShpkPath.ToPath()}:\n{e}", "Penumbra Advanced Editing", NotificationType.Error );
Penumbra.Chat.NotificationMessage( $"Could not load {LoadedShpkPath.ToPath()}:\n{e}", "Penumbra Advanced Editing", NotificationType.Error );
}
Update();

View file

@ -80,12 +80,12 @@ public partial class ModEditWindow
}
catch( Exception e )
{
Penumbra.ChatService.NotificationMessage( $"Could not export {defaultName}{tab.Extension} to {name}:\n{e.Message}", "Penumbra Advanced Editing",
Penumbra.Chat.NotificationMessage( $"Could not export {defaultName}{tab.Extension} to {name}:\n{e.Message}", "Penumbra Advanced Editing",
NotificationType.Error );
return;
}
Penumbra.ChatService.NotificationMessage( $"Shader Program Blob {defaultName}{tab.Extension} exported successfully to {Path.GetFileName( name )}",
Penumbra.Chat.NotificationMessage( $"Shader Program Blob {defaultName}{tab.Extension} exported successfully to {Path.GetFileName( name )}",
"Penumbra Advanced Editing", NotificationType.Success );
}, null, false );
}
@ -110,7 +110,7 @@ public partial class ModEditWindow
}
catch( Exception e )
{
Penumbra.ChatService.NotificationMessage( $"Could not import {name}:\n{e.Message}", "Penumbra Advanced Editing", NotificationType.Error );
Penumbra.Chat.NotificationMessage( $"Could not import {name}:\n{e.Message}", "Penumbra Advanced Editing", NotificationType.Error );
return;
}
@ -122,7 +122,7 @@ public partial class ModEditWindow
catch( Exception e )
{
tab.Shpk.SetInvalid();
Penumbra.ChatService.NotificationMessage( $"Failed to update resources after importing {name}:\n{e.Message}", "Penumbra Advanced Editing",
Penumbra.Chat.NotificationMessage( $"Failed to update resources after importing {name}:\n{e.Message}", "Penumbra Advanced Editing",
NotificationType.Error );
return;
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using OtterGui.Custom;
namespace Penumbra.UI.Classes;
@ -31,13 +32,13 @@ public static class Colors
public const uint RegexWarningBorder = 0xFF0000B0;
public const uint MetaInfoText = 0xAAFFFFFF;
public const uint RedTableBgTint = 0x40000080;
public const uint DiscordColor = 0xFFDA8972;
public const uint DiscordColor = CustomGui.DiscordColor;
public const uint FilterActive = 0x807070FF;
public const uint TutorialMarker = 0xFF20FFFF;
public const uint TutorialBorder = 0xD00000FF;
public const uint ReniColorButton = 0xFFCC648D;
public const uint ReniColorHovered = 0xFFB070B0;
public const uint ReniColorActive = 0xFF9070E0;
public const uint ReniColorButton = CustomGui.ReniColorButton;
public const uint ReniColorHovered = CustomGui.ReniColorHovered;
public const uint ReniColorActive = CustomGui.ReniColorActive ;
public static (uint DefaultColor, string Name, string Description) Data(this ColorId color)
=> color switch

View file

@ -4,6 +4,7 @@ using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using ImGuiNET;
using OtterGui;
using OtterGui.Custom;
using OtterGui.Raii;
using Penumbra.Services;
using Penumbra.UI.Classes;
@ -143,7 +144,7 @@ public sealed class ConfigWindow : Window
ImGui.NewLine();
ImGui.NewLine();
UiHelpers.DrawDiscordButton(0);
CustomGui.DrawDiscordButton(Penumbra.ChatService, 0);
ImGui.SameLine();
UiHelpers.DrawSupportButton(_penumbra!);
ImGui.NewLine();

View file

@ -7,6 +7,7 @@ using Dalamud.Interface.Components;
using Dalamud.Utility;
using ImGuiNET;
using OtterGui;
using OtterGui.Custom;
using OtterGui.Raii;
using OtterGui.Widgets;
using Penumbra.Api;
@ -790,10 +791,10 @@ public class SettingsTab : ITab
UiHelpers.DrawSupportButton(_penumbra);
ImGui.SetCursorPos(new Vector2(xPos, 0));
UiHelpers.DrawDiscordButton(width);
CustomGui.DrawDiscordButton(Penumbra.Chat, width);
ImGui.SetCursorPos(new Vector2(xPos, 2 * ImGui.GetFrameHeightWithSpacing()));
UiHelpers.DrawGuideButton(width);
CustomGui.DrawGuideButton(Penumbra.Chat, width);
ImGui.SetCursorPos(new Vector2(xPos, 3 * ImGui.GetFrameHeightWithSpacing()));
if (ImGui.Button("Restart Tutorial", new Vector2(width, 0)))

View file

@ -8,7 +8,6 @@ using OtterGui;
using OtterGui.Raii;
using Penumbra.Interop.Structs;
using Penumbra.String;
using Penumbra.UI.Classes;
namespace Penumbra.UI;
@ -46,29 +45,6 @@ public static class UiHelpers
ImGui.SetTooltip("Click to copy to clipboard.");
}
/// <summary> Draw a button to open the official discord server. </summary>
/// <param name="width">The desired width of the button.</param>
public static void DrawDiscordButton(float width)
{
const string address = @"https://discord.gg/kVva7DHV4r";
using var color = ImRaii.PushColor(ImGuiCol.Button, Colors.DiscordColor);
if (ImGui.Button("Join Discord for Support", new Vector2(width, 0)))
try
{
var process = new ProcessStartInfo(address)
{
UseShellExecute = true,
};
Process.Start(process);
}
catch
{
Penumbra.ChatService.NotificationMessage($"Unable to open Discord at {address}.", "Error", NotificationType.Error);
}
ImGuiUtil.HoverTooltip($"Open {address}");
}
/// <summary> The longest support button text. </summary>
public const string SupportInfoButtonText = "Copy Support Info to Clipboard";
@ -101,33 +77,6 @@ public static class UiHelpers
});
}
/// <summary> Draw the button that opens the ReniGuide. </summary>
public static void DrawGuideButton(float width)
{
const string address = @"https://reniguide.info/";
using var color = ImRaii.PushColor(ImGuiCol.Button, Colors.ReniColorButton)
.Push(ImGuiCol.ButtonHovered, Colors.ReniColorHovered)
.Push(ImGuiCol.ButtonActive, Colors.ReniColorActive);
if (ImGui.Button("Beginner's Guides", new Vector2(width, 0)))
try
{
var process = new ProcessStartInfo(address)
{
UseShellExecute = true,
};
Process.Start(process);
}
catch
{
Penumbra.ChatService.NotificationMessage($"Could not open guide at {address} in external browser.", "Error",
NotificationType.Error);
}
ImGuiUtil.HoverTooltip(
$"Open {address}\nImage and text based guides for most functionality of Penumbra made by Serenity.\n"
+ "Not directly affiliated and potentially, but not usually out of date.");
}
/// <summary> Draw default vertical space. </summary>
public static void DefaultLineSpace()
=> ImGui.Dummy(DefaultSpace);