Skip to content

Commit a094acd

Browse files
authored
2.17.0 (#145)
* feat: updated to the new ui update * Using new overload for basic popup * space * Partially implemented new custom tribe previews, added debug tile coordinates in tribe preview * finished preview and got stuck on popups shit * added temporary popup fix * finished tribe preview
1 parent acf1164 commit a094acd

6 files changed

Lines changed: 392 additions & 222 deletions

File tree

PolyMod.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
</RestoreAdditionalProjectSources>
1212
<Configurations>IL2CPP</Configurations>
1313
<RootNamespace>PolyMod</RootNamespace>
14-
<Version>1.2.13</Version>
15-
<PolytopiaVersion>2.16.8.15757</PolytopiaVersion>
14+
<Version>1.2.14</Version>
15+
<PolytopiaVersion>2.17.0.16256</PolytopiaVersion>
1616
<Authors>PolyModdingTeam</Authors>
1717
<Description>The Battle of Polytopia's mod loader.</Description>
1818
<NoWarn>IDE0130</NoWarn>

src/Managers/AutoUpdate.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ internal static class AutoUpdate
1515
/// Checks for updates when the start screen is shown.
1616
/// </summary>
1717
[HarmonyPostfix]
18-
[HarmonyPatch(typeof(StartScreen), nameof(StartScreen.Start))]
19-
private static void StartScreen_Start()
18+
[HarmonyPatch(typeof(StartScreen_UI2), nameof(StartScreen_UI2.OnShow))]
19+
private static void StartScreen_UI2_OnShow()
2020
{
2121
if (!Plugin.config.autoUpdate) return;
2222
if (Environment.GetEnvironmentVariable("WINEPREFIX") != null)
@@ -154,7 +154,7 @@ exit 0
154154
}
155155

156156
// Show a popup to the user asking if they want to update
157-
PopupManager.GetBasicPopup(new(
157+
PopupManager.GetBasicPopupWithData(new(
158158
Localization.Get("polymod.autoupdate"),
159159
Localization.Get("polymod.autoupdate.description"),
160160
new(new PopupBase.PopupButtonData[] {

src/Managers/Compatibility.cs

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static void HashSignatures(StringBuilder checksumString)
3434
/// Checks the signature of a saved game to ensure it is compatible with the current mods.
3535
/// </summary>
3636
/// <returns>True if the signatures match or if the check is ignored, false otherwise.</returns>
37-
private static bool CheckSignatures(Action<int, BaseEventData> action, int id, BaseEventData eventData, Il2CppSystem.Guid gameId)
37+
private static bool CheckSignatures(Action action, Il2CppSystem.Guid gameId)
3838
{
3939
if (sawSignatureWarning)
4040
{
@@ -67,13 +67,14 @@ private static bool CheckSignatures(Action<int, BaseEventData> action, int id, B
6767
}
6868
if (!doChecksumsMatch)
6969
{
70-
PopupManager.GetBasicPopup(new(
70+
PopupManager.GetBasicPopupWithData(new(
7171
Localization.Get("polymod.signature.mismatch"),
7272
Localization.Get("polymod.signature.incompatible"),
7373
new(new PopupBase.PopupButtonData[] {
7474
new("OK")
7575
})
7676
)).Show();
77+
7778
return false;
7879
}
7980
return true;
@@ -83,8 +84,8 @@ private static bool CheckSignatures(Action<int, BaseEventData> action, int id, B
8384
/// Performs compatibility checks when the start screen is shown.
8485
/// </summary>
8586
[HarmonyPostfix]
86-
[HarmonyPatch(typeof(StartScreen), nameof(StartScreen.Start))]
87-
private static void StartScreen_Start()
87+
[HarmonyPatch(typeof(StartScreen_UI2), nameof(StartScreen_UI2.OnShow))]
88+
private static void StartScreen_UI2_OnShow()
8889
{
8990
string lastChecksum = checksum;
9091
try
@@ -113,18 +114,20 @@ private static void StartScreen_Start()
113114
VersionManager.SemanticVersion.Cast().CutRevision().ToString()
114115
);
115116
PlayerPrefs.Save();
116-
PopupManager.GetBasicPopup(new(
117-
Localization.Get("polymod.version.mismatch"),
118-
Localization.Get("polymod.version.mismatch.description"),
119-
new(new PopupBase.PopupButtonData[] {
120-
new("buttons.stay", customColorStates: ColorConstants.redButtonColorStates),
121-
new(
122-
"buttons.exitgame",
123-
PopupBase.PopupButtonData.States.None,
124-
(Il2CppSystem.Action)Application.Quit,
125-
closesPopup: false
126-
)
127-
}))
117+
PopupManager.GetBasicPopupWithData(
118+
new(
119+
Localization.Get("polymod.version.mismatch"),
120+
Localization.Get("polymod.version.mismatch.description"),
121+
new PopupBase.PopupButtonData[] {
122+
new("buttons.stay", customColorStates: ColorConstants.redButtonColorStates),
123+
new(
124+
"buttons.exitgame",
125+
PopupBase.PopupButtonData.States.None,
126+
(Il2CppSystem.Action)Application.Quit,
127+
closesPopup: false
128+
)
129+
}
130+
)
128131
).Show();
129132
}
130133
}
@@ -134,19 +137,19 @@ private static void StartScreen_Start()
134137
/// </summary>
135138
[HarmonyPrefix]
136139
[HarmonyPatch(typeof(GameInfoPopup), nameof(GameInfoPopup.OnMainButtonClicked))]
137-
private static bool GameInfoPopup_OnMainButtonClicked(GameInfoPopup __instance, int id, BaseEventData eventData)
140+
private static bool GameInfoPopup_OnMainButtonClicked(GameInfoPopup __instance)
138141
{
139-
return CheckSignatures(__instance.OnMainButtonClicked, id, eventData, __instance.gameId);
142+
return CheckSignatures(__instance.OnMainButtonClicked, __instance.gameId);
140143
}
141144

142145
/// <summary>
143146
/// Checks the signature of a single-player game before resuming it.
144147
/// </summary>
145148
[HarmonyPrefix]
146-
[HarmonyPatch(typeof(StartScreen), nameof(StartScreen.OnResumeButtonClick))]
147-
private static bool StartScreen_OnResumeButtonClick(StartScreen __instance, int id, BaseEventData eventData)
149+
[HarmonyPatch(typeof(StartScreen_UI2), nameof(StartScreen_UI2.OnResumeButtonLongPress))]
150+
private static bool StartScreen_OnResumeButtonClick(StartScreen_UI2 __instance)
148151
{
149-
return CheckSignatures(__instance.OnResumeButtonClick, id, eventData, LocalSaveFileUtils.GetSaveFiles(PolytopiaBackendBase.Game.GameType.SinglePlayer)[0]);
152+
return CheckSignatures(__instance.OnResumeButtonLongPress, LocalSaveFileUtils.GetSaveFiles(PolytopiaBackendBase.Game.GameType.SinglePlayer)[0]);
150153
}
151154

152155
/// <summary>

0 commit comments

Comments
 (0)