lessen punishment for not reading

This commit is contained in:
Stanley Dimant
2022-07-19 01:11:20 +02:00
parent 136fc32e1e
commit ccfb314337
3 changed files with 66 additions and 18 deletions

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Authors></Authors> <Authors></Authors>
<Company></Company> <Company></Company>
<Version>0.1.15.0</Version> <Version>0.1.16.0</Version>
<Description></Description> <Description></Description>
<Copyright></Copyright> <Copyright></Copyright>
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl> <PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>

View File

@@ -2,6 +2,7 @@
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
using System.Threading.Tasks;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using ImGuiNET; using ImGuiNET;
@@ -46,6 +47,10 @@ namespace MareSynchronos.UI
private string _enteredDarkSoulsCaptcha2 = string.Empty; private string _enteredDarkSoulsCaptcha2 = string.Empty;
private string _enteredDarkSoulsCaptcha3 = string.Empty; private string _enteredDarkSoulsCaptcha3 = string.Empty;
private bool _failedOnce = false;
private Task _timeoutTask;
private string _timeoutTime;
private bool DarkSoulsCaptchaValid => _darkSoulsCaptcha1.Item2 == _enteredDarkSoulsCaptcha1 private bool DarkSoulsCaptchaValid => _darkSoulsCaptcha1.Item2 == _enteredDarkSoulsCaptcha1
&& _darkSoulsCaptcha2.Item2 == _enteredDarkSoulsCaptcha2 && _darkSoulsCaptcha2.Item2 == _enteredDarkSoulsCaptcha2
&& _darkSoulsCaptcha3.Item2 == _enteredDarkSoulsCaptcha3; && _darkSoulsCaptcha3.Item2 == _enteredDarkSoulsCaptcha3;
@@ -120,13 +125,13 @@ namespace MareSynchronos.UI
UiShared.TextWrapped(TosParagraphs[0]); UiShared.TextWrapped(TosParagraphs[0]);
UiShared.TextWrapped(TosParagraphs[1]); UiShared.TextWrapped(TosParagraphs[1]);
UiShared.ColorTextWrapped(TosParagraphs[2], ImGuiColors.DalamudRed); UiShared.TextWrapped(TosParagraphs[2]);
UiShared.ColorTextWrapped(TosParagraphs[3], ImGuiColors.DalamudYellow); UiShared.TextWrapped(TosParagraphs[3]);
UiShared.TextWrapped(TosParagraphs[4]); UiShared.TextWrapped(TosParagraphs[4]);
UiShared.ColorTextWrapped(TosParagraphs[5], ImGuiColors.DalamudRed); UiShared.TextWrapped(TosParagraphs[5]);
ImGui.Separator(); ImGui.Separator();
if (!_pluginConfiguration.DarkSoulsAgreement || DarkSoulsCaptchaValid) if ((!_pluginConfiguration.DarkSoulsAgreement || DarkSoulsCaptchaValid) && (_timeoutTask?.IsCompleted ?? true))
{ {
if (ImGui.Button("I agree##toSetup")) if (ImGui.Button("I agree##toSetup"))
{ {
@@ -141,22 +146,48 @@ namespace MareSynchronos.UI
} }
else else
{ {
_pluginConfiguration.DarkSoulsAgreement = true; if (!_failedOnce)
_pluginConfiguration.Save(); {
GenerateDarkSoulsAgreementCaptcha(); _failedOnce = true;
_timeoutTask = Task.Run(async () =>
{
for (int i = 60; i > 0; i--)
{
_timeoutTime = $"{i}s remaining";
Logger.Debug(_timeoutTime);
await Task.Delay(TimeSpan.FromSeconds(1));
}
});
}
else
{
_pluginConfiguration.DarkSoulsAgreement = true;
_pluginConfiguration.Save();
GenerateDarkSoulsAgreementCaptcha();
}
} }
} }
} }
else else
{ {
UiShared.ColorTextWrapped("Congratulations. You have failed to read the agreements.", ImGuiColors.DalamudYellow); if (_failedOnce && (!_timeoutTask?.IsCompleted ?? true))
UiShared.TextWrapped("Enter the following 3 words from the agreement exactly as described without punctuation to make the \"I agree\" button visible again."); {
ImGui.SetNextItemWidth(100); UiShared.ColorTextWrapped("Congratulations. You have failed to read the agreements.", ImGuiColors.DalamudYellow);
ImGui.InputText(_darkSoulsCaptcha1.Item1, ref _enteredDarkSoulsCaptcha1, 255); UiShared.TextWrapped("I'm going to give you 1 minute to read the agreements carefully again. If you fail once more you will have to solve an annoying puzzle.");
ImGui.SetNextItemWidth(100); UiShared.TextWrapped(_timeoutTime);
ImGui.InputText(_darkSoulsCaptcha2.Item1, ref _enteredDarkSoulsCaptcha2, 255); }
ImGui.SetNextItemWidth(100); else
ImGui.InputText(_darkSoulsCaptcha3.Item1, ref _enteredDarkSoulsCaptcha3, 255); {
UiShared.ColorTextWrapped("Congratulations. You have failed to read the agreements. Again.", ImGuiColors.DalamudYellow);
UiShared.TextWrapped("I did warn you. Here's your annoying puzzle:");
UiShared.TextWrapped("Enter the following 3 words from the agreement exactly as described without punctuation to make the \"I agree\" button visible again.");
ImGui.SetNextItemWidth(100);
ImGui.InputText(_darkSoulsCaptcha1.Item1, ref _enteredDarkSoulsCaptcha1, 255);
ImGui.SetNextItemWidth(100);
ImGui.InputText(_darkSoulsCaptcha2.Item1, ref _enteredDarkSoulsCaptcha2, 255);
ImGui.SetNextItemWidth(100);
ImGui.InputText(_darkSoulsCaptcha3.Item1, ref _enteredDarkSoulsCaptcha3, 255);
}
} }
} }
else if (_pluginConfiguration.AcceptedAgreement else if (_pluginConfiguration.AcceptedAgreement
@@ -231,8 +262,8 @@ namespace MareSynchronos.UI
"There is no support for custom services from the plugin creator. Use at your own risk."); "There is no support for custom services from the plugin creator. Use at your own risk.");
UiShared.ColorTextWrapped("On registration on a service the plugin will create and save a secret key to your plugin configuration. " + UiShared.ColorTextWrapped("On registration on a service the plugin will create and save a secret key to your plugin configuration. " +
"Make a backup of your secret key. In case of loss, it cannot be restored. The secret key is your identification to the service " + "Make a backup of your secret key. In case of loss, it cannot be restored. The secret key is your identification to the service " +
"to verify who you are. It is directly tied to the UID you will be receiving. In case of loss, you will have to re-register an account.", ImGuiColors.DalamudRed); "to verify who you are. It is directly tied to the UID you will be receiving. In case of loss, you will have to re-register an account.", ImGuiColors.DalamudYellow);
UiShared.ColorTextWrapped("Do not ever, under any circumstances, share your secret key to anyone! Likewise do not share your Mare Synchronos plugin configuration to anyone!", ImGuiColors.DalamudRed); UiShared.ColorTextWrapped("Do not ever, under any circumstances, share your secret key to anyone! Likewise do not share your Mare Synchronos plugin configuration to anyone!", ImGuiColors.DalamudYellow);
_uiShared.DrawServiceSelection(new Action(() => { }), true); _uiShared.DrawServiceSelection(new Action(() => { }), true);
} }
} }

View File

@@ -374,6 +374,23 @@ namespace MareSynchronos.UI
private string _secretKey = ""; private string _secretKey = "";
public static void OutlineTextWrapped(string text, Vector4 textcolor, Vector4 outlineColor, float dist = 3)
{
var cursorPos = ImGui.GetCursorPos();
UiShared.ColorTextWrapped(text, outlineColor);
ImGui.SetCursorPos(new(cursorPos.X, cursorPos.Y + dist));
UiShared.ColorTextWrapped(text, outlineColor);
ImGui.SetCursorPos(new(cursorPos.X + dist, cursorPos.Y));
UiShared.ColorTextWrapped(text, outlineColor);
ImGui.SetCursorPos(new(cursorPos.X + dist, cursorPos.Y + dist));
UiShared.ColorTextWrapped(text, outlineColor);
ImGui.SetCursorPos(new(cursorPos.X + dist / 2, cursorPos.Y + dist / 2));
UiShared.ColorTextWrapped(text, textcolor);
ImGui.SetCursorPos(new(cursorPos.X + dist / 2, cursorPos.Y + dist / 2));
UiShared.ColorTextWrapped(text, textcolor);
}
public static void DrawHelpText(string helpText) public static void DrawHelpText(string helpText)
{ {
ImGui.SameLine(); ImGui.SameLine();