2023-02-15 22:17:19 +00:00
|
|
|
|
using System;
|
2023-03-26 13:47:18 +00:00
|
|
|
|
using System.Numerics;
|
2023-02-15 22:17:19 +00:00
|
|
|
|
using Dalamud.Interface.Colors;
|
2022-10-23 02:38:58 +00:00
|
|
|
|
using Dalamud.Interface.Windowing;
|
|
|
|
|
using ECommons;
|
|
|
|
|
using ImGuiNET;
|
2023-02-15 22:17:19 +00:00
|
|
|
|
using Pal.Client.Configuration;
|
2023-02-21 13:58:30 +00:00
|
|
|
|
using Pal.Client.Extensions;
|
2023-02-10 19:48:14 +00:00
|
|
|
|
using Pal.Client.Properties;
|
2022-10-23 02:38:58 +00:00
|
|
|
|
|
2022-10-26 18:43:24 +00:00
|
|
|
|
namespace Pal.Client.Windows
|
2022-10-23 02:38:58 +00:00
|
|
|
|
{
|
2023-02-15 22:17:19 +00:00
|
|
|
|
internal sealed class AgreementWindow : Window, IDisposable, ILanguageChanged
|
2022-10-23 02:38:58 +00:00
|
|
|
|
{
|
2023-02-11 13:31:43 +00:00
|
|
|
|
private const string WindowId = "###PalPalaceAgreement";
|
2023-02-15 22:17:19 +00:00
|
|
|
|
private readonly WindowSystem _windowSystem;
|
|
|
|
|
private readonly ConfigurationManager _configurationManager;
|
|
|
|
|
private readonly IPalacePalConfiguration _configuration;
|
2022-10-23 02:38:58 +00:00
|
|
|
|
private int _choice;
|
|
|
|
|
|
2023-02-15 22:17:19 +00:00
|
|
|
|
public AgreementWindow(
|
|
|
|
|
WindowSystem windowSystem,
|
|
|
|
|
ConfigurationManager configurationManager,
|
|
|
|
|
IPalacePalConfiguration configuration)
|
|
|
|
|
: base(WindowId)
|
2022-10-23 02:38:58 +00:00
|
|
|
|
{
|
2023-02-15 22:17:19 +00:00
|
|
|
|
_windowSystem = windowSystem;
|
|
|
|
|
_configurationManager = configurationManager;
|
|
|
|
|
_configuration = configuration;
|
|
|
|
|
|
2023-02-11 23:41:48 +00:00
|
|
|
|
LanguageChanged();
|
|
|
|
|
|
2023-02-11 13:07:38 +00:00
|
|
|
|
Flags = ImGuiWindowFlags.NoCollapse;
|
2022-10-23 02:38:58 +00:00
|
|
|
|
Size = new Vector2(500, 500);
|
2023-02-11 13:07:38 +00:00
|
|
|
|
SizeCondition = ImGuiCond.FirstUseEver;
|
|
|
|
|
PositionCondition = ImGuiCond.FirstUseEver;
|
2022-10-23 02:38:58 +00:00
|
|
|
|
Position = new Vector2(310, 310);
|
2023-02-11 13:07:38 +00:00
|
|
|
|
|
|
|
|
|
SizeConstraints = new WindowSizeConstraints
|
|
|
|
|
{
|
|
|
|
|
MinimumSize = new Vector2(500, 500),
|
|
|
|
|
MaximumSize = new Vector2(2000, 2000),
|
|
|
|
|
};
|
2023-02-15 22:17:19 +00:00
|
|
|
|
|
|
|
|
|
IsOpen = configuration.FirstUse;
|
|
|
|
|
_windowSystem.AddWindow(this);
|
2022-10-23 02:38:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-02-15 22:17:19 +00:00
|
|
|
|
public void Dispose()
|
|
|
|
|
=> _windowSystem.RemoveWindow(this);
|
|
|
|
|
|
2023-02-11 13:31:43 +00:00
|
|
|
|
public void LanguageChanged()
|
|
|
|
|
=> WindowName = $"{Localization.Palace_Pal}{WindowId}";
|
|
|
|
|
|
2022-10-23 02:38:58 +00:00
|
|
|
|
public override void OnOpen()
|
|
|
|
|
{
|
|
|
|
|
_choice = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Draw()
|
|
|
|
|
{
|
2023-02-10 19:48:14 +00:00
|
|
|
|
ImGui.TextWrapped(Localization.Explanation_1);
|
|
|
|
|
ImGui.TextWrapped(Localization.Explanation_2);
|
2022-10-23 02:38:58 +00:00
|
|
|
|
|
|
|
|
|
ImGui.Spacing();
|
|
|
|
|
|
2023-02-10 19:48:14 +00:00
|
|
|
|
ImGui.TextWrapped(Localization.Explanation_3);
|
|
|
|
|
ImGui.TextWrapped(Localization.Explanation_4);
|
2022-10-26 18:43:24 +00:00
|
|
|
|
|
2023-02-21 15:30:16 +00:00
|
|
|
|
PalImGui.RadioButtonWrapped(Localization.Config_UploadMyDiscoveries_ShowOtherTraps, ref _choice,
|
|
|
|
|
(int)EMode.Online);
|
|
|
|
|
PalImGui.RadioButtonWrapped(Localization.Config_NeverUploadDiscoveries_ShowMyTraps, ref _choice,
|
|
|
|
|
(int)EMode.Offline);
|
2022-10-26 18:43:24 +00:00
|
|
|
|
|
2022-10-23 02:38:58 +00:00
|
|
|
|
ImGui.Separator();
|
|
|
|
|
|
2023-02-11 13:07:38 +00:00
|
|
|
|
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
|
|
|
|
ImGui.TextWrapped(Localization.Agreement_Warning1);
|
|
|
|
|
ImGui.TextWrapped(Localization.Agreement_Warning2);
|
|
|
|
|
ImGui.TextWrapped(Localization.Agreement_Warning3);
|
|
|
|
|
ImGui.PopStyleColor();
|
2022-10-23 02:38:58 +00:00
|
|
|
|
|
|
|
|
|
ImGui.Separator();
|
|
|
|
|
|
|
|
|
|
if (_choice == -1)
|
2023-02-10 19:48:14 +00:00
|
|
|
|
ImGui.TextDisabled(Localization.Agreement_PickOneOption);
|
2022-10-23 02:38:58 +00:00
|
|
|
|
ImGui.BeginDisabled(_choice == -1);
|
2023-02-10 19:48:14 +00:00
|
|
|
|
if (ImGui.Button(Localization.Agreement_UsingThisOnMyOwnRisk))
|
2022-10-23 02:38:58 +00:00
|
|
|
|
{
|
2023-02-15 22:17:19 +00:00
|
|
|
|
_configuration.Mode = (EMode)_choice;
|
|
|
|
|
_configuration.FirstUse = false;
|
|
|
|
|
_configurationManager.Save(_configuration);
|
2022-10-23 02:38:58 +00:00
|
|
|
|
|
|
|
|
|
IsOpen = false;
|
|
|
|
|
}
|
2023-02-15 22:17:19 +00:00
|
|
|
|
|
2022-10-23 02:38:58 +00:00
|
|
|
|
ImGui.EndDisabled();
|
|
|
|
|
|
|
|
|
|
ImGui.Separator();
|
|
|
|
|
|
2023-02-10 19:48:14 +00:00
|
|
|
|
if (ImGui.Button(Localization.Agreement_ViewPluginAndServerSourceCode))
|
2023-02-11 13:07:38 +00:00
|
|
|
|
GenericHelpers.ShellStart("https://github.com/carvelli/PalPalace");
|
2022-10-23 02:38:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|