Skip to content

Commit

Permalink
AutoHook 2.5.0.0 [PUSH]
Browse files Browse the repository at this point in the history
Hope nothing broke.
  • Loading branch information
InitialDet committed Oct 4, 2023
1 parent ff6ce5b commit 2ea28a1
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 91 deletions.
29 changes: 19 additions & 10 deletions AutoHook/PluginUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static void ShowPaypal()

if (ImGui.Button(buttonText))
{
OpenBrowser("https://www.paypal.com/donate/?business=PDZJVTF5484UA&no_recurring=0&currency_code=USD");
OpenBrowser(@"https://www.paypal.com/donate/?business=PDZJVTF5484UA&no_recurring=0&currency_code=USD");
}

ImGui.PopStyleColor(3);
Expand All @@ -140,16 +140,25 @@ public static void ShowPaypal()
private void DrawLanguageSelector()
{
ImGui.SetNextItemWidth(55);
var languages = new List<string> { "en", "cz", "es", "fr", "ko"};
var currentLanguage = languages.IndexOf(Service.Configuration.CurrentLanguage);
if (ImGui.Combo(UIStrings.PluginUi_Language, ref currentLanguage, languages.ToArray(), languages.Count))
var languages = new List<string>
{
Service.Configuration.CurrentLanguage = languages[currentLanguage];
UIStrings.Culture = new CultureInfo(Service.Configuration.CurrentLanguage);
Service.Configuration.Save();
Service.Chat.Print("Saved");
// get current ImGui tab name
}
@"en",
@"cz",
@"es",
@"fr",
@"ge",
@"jp",
@"ko"
};
var currentLanguage = languages.IndexOf(Service.Configuration.CurrentLanguage);

if (!ImGui.Combo(UIStrings.PluginUi_Language, ref currentLanguage, languages.ToArray(), languages.Count))
return;

Service.Configuration.CurrentLanguage = languages[currentLanguage];
UIStrings.Culture = new CultureInfo(Service.Configuration.CurrentLanguage);
Service.Configuration.Save();
//Service.Chat.Print("Saved");
}

private static void OpenBrowser(string url)
Expand Down
9 changes: 9 additions & 0 deletions AutoHook/Resources/Localization/UIStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions AutoHook/Resources/Localization/UIStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -655,4 +655,7 @@ If you want to Auto Mooch only a specific fish and ignore others, disable this o
<data name="PluginUi_Language" xml:space="preserve">
<value>Language</value>
</data>
<data name="TabGeneral_DrawHeader_Localization_Help" xml:space="preserve">
<value>Help with the plugin localization (Crowdin)</value>
</data>
</root>
151 changes: 70 additions & 81 deletions AutoHook/Ui/TabGeneral.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Numerics;
using AutoHook.Resources.Localization;
using Dalamud.Interface.Colors;
Expand All @@ -23,38 +21,39 @@ public override void DrawHeader()
ImGui.Separator();

ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow);
ImGui.TextWrapped(UIStrings.DrawHeader_CheckChangelog);
ImGui.TextWrapped("Localization options were added, but currently only English is available. If you want to help with the translation, please visit the link below");
ImGui.PopStyleColor();

ImGui.Spacing();


DrawChangelog();

ImGui.Spacing();

if (ImGui.Button(UIStrings.DrawHeader_ClickToReportAnIssue))
if (ImGui.Button(UIStrings.TabGeneral_DrawHeader_Localization_Help))
{
Process.Start(new ProcessStartInfo { FileName = "https://github.com/InitialDet/AutoHook/issues", UseShellExecute = true });
Process.Start(new ProcessStartInfo
{ FileName = "https://crowdin.com/project/autohook-plugin-localization", UseShellExecute = true });
}

ImGui.Spacing();

DrawChangelog();

ImGui.Spacing();

#if DEBUG

ImGui.SameLine();
ImGui.Separator();
ImGui.Spacing();
if (ImGui.Button(UIStrings.DrawHeader_Testing))
{
ImGui.TabItemButton(UIStrings.TabNameGPConfig);
//Service.Chat.Print(Service.Configuration.CurrentLanguage);

}

ImGui.Spacing();

#endif
}

public override void Draw()
{

if (ImGui.BeginTabBar(@"TabBarsGeneral", ImGuiTabBarFlags.NoTooltip))
{
if (ImGui.BeginTabItem($"{UIStrings.DefaultCast}###DC1"))
Expand Down Expand Up @@ -114,86 +113,73 @@ public void DrawDefaultMooch()
}

private bool _openChangelog = false;

[Localizable(false)]
private void DrawChangelog()
{
if (ImGui.Button(UIStrings.Changelog))
{
//ImGui.OpenPopup("changelog");
_openChangelog = !_openChangelog;

/*if (_openChangelog)
{
ImGui.SetNextWindowSize(new Vector2(400, 250));
}*/
}

if (_openChangelog)

if (!_openChangelog)
return;

ImGui.SetNextWindowSize(new Vector2(400, 0));
if (ImGui.Begin($"{UIStrings.Changelog}", ref _openChangelog, ImGuiWindowFlags.AlwaysAutoResize))
{
ImGui.SetNextWindowSize(new Vector2(400, 0));
if (ImGui.Begin($"{UIStrings.Changelog}", ref _openChangelog, ImGuiWindowFlags.AlwaysAutoResize))
var changes = PluginChangeLog.Versions;

if (changes.Count > 0)
{
var changes = PluginChangeLog.Versions;
// check if the list is empty and store the first value
if (changes.Count > 0)
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow);
ImGui.TextWrapped($"{changes[0].VersionNumber}");
ImGui.PopStyleColor();
ImGui.Separator();

//First value is the current Version
foreach (var mainChange in changes[0].MainChanges)
{
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow);
ImGui.TextWrapped($"{changes[0].VersionNumber}");
ImGui.PopStyleColor();
ImGui.Separator();

//Current Version
foreach (var mainChange in changes[0].MainChanges)
{
ImGui.TextWrapped($"- {mainChange}");
}

ImGui.Spacing();

if (changes[0].MinorChanges.Count > 0)
ImGui.TextWrapped($"- {mainChange}");
}

ImGui.Spacing();

if (changes[0].MinorChanges.Count > 0)
{
ImGui.TextWrapped("Bug Fixes");
foreach (var minorChange in changes[0].MinorChanges)
{
ImGui.TextWrapped("Bug Fixes");
foreach (var minorChange in changes[0].MinorChanges)
{
ImGui.TextWrapped($"- {minorChange}");
}
ImGui.TextWrapped($"- {minorChange}");
}

ImGui.Separator();

}

if (ImGui.BeginChild("old_versions", new Vector2(0, 150), true))
ImGui.Separator();

if (ImGui.BeginChild("old_versions", new Vector2(0, 150), true))
{
for (var i = 1; i < changes.Count; i++)
{
// old versions
for (var i = 1; i < changes.Count; i++)
if (!ImGui.TreeNode($"{changes[i].VersionNumber}"))
continue;

foreach (var mainChange in changes[i].MainChanges)
ImGui.TextWrapped($"- {mainChange}");

if (changes[i].MinorChanges.Count > 0)
{
if (ImGui.TreeNode($"{changes[i].VersionNumber}"))
{
foreach (var mainChange in changes[i].MainChanges)
{
ImGui.TextWrapped($"- {mainChange}");
}
ImGui.Spacing();
ImGui.TextWrapped("Bug Fixes");

if (changes[i].MinorChanges.Count > 0)
{
ImGui.Spacing();
ImGui.TextWrapped("Bug Fixes");
foreach (var minorChange in changes[i].MinorChanges)
{
ImGui.TextWrapped($"- {minorChange}");
}
}

ImGui.TreePop();
}
foreach (var minorChange in changes[i].MinorChanges)
ImGui.TextWrapped($"- {minorChange}");
}
ImGui.TreePop();
}
ImGui.EndChild();

}
ImGui.EndChild();
}
ImGui.End();
}

ImGui.End();
}

[Localizable(false)]
Expand All @@ -215,7 +201,7 @@ public static class PluginChangeLog
{
"It's now possible to enable both Double and Triple hook (hold shift when selecting the options)",
},
MinorChanges =
MinorChanges =
{
"Removed captalization for bait names",
}
Expand All @@ -233,13 +219,15 @@ public static class PluginChangeLog
},
new Version("2.4.2.0")
{
MainChanges = {
MainChanges =
{
"Added customizable hitbox for autogig",
"Added an option to see the fish hitbox when spearfishing",
"(experimental) Nature's Bounty will be used when the target fish appears on screen",
"Added changelog button"
},
MinorChanges = {
MinorChanges =
{
"Gig hitbox is now enabled by default",
"Fixed the order of the Chum Timer Min/Max fields",
"Fixed some options not saving correctly"
Expand All @@ -251,7 +239,8 @@ public static class PluginChangeLog
},
new Version("2.4.0.0")
{
MainChanges = {
MainChanges =
{
"Presets for custom baits added, you can now swap configs without needing to recreate it every time",
"Added options to cast Chum only when under the effect of Fisher's Intuition",
"Added an option to only cast Prize Catch when Mooch II is not available, saving you 100gp if all you want is to mooch",
Expand All @@ -261,8 +250,8 @@ public static class PluginChangeLog
}
}
};


public class Version
{
public string VersionNumber { get; set; }
Expand Down

0 comments on commit 2ea28a1

Please sign in to comment.