Skip to content

Commit 5cdd883

Browse files
committed
Added wc warning popup. Closes #120
1 parent 5c1e76d commit 5cdd883

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

resources/localization.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,5 +208,13 @@
208208
"polymod_spriteinfo_notupdated": {
209209
"English": "No sprite infos were found!",
210210
"Russian": "Данные спрайтов не найдены!"
211+
},
212+
"polymod_wc_warning": {
213+
"English": "Weekly Challenges may not work correctly due to PolyMod. Do you wish to proceed?",
214+
"Russian": "Испытания Недели могут работать неверно из-за PolyMod'а. Вы уверены что хотите продолжить?"
215+
},
216+
"polymod_wc_proceed": {
217+
"English": "PROCEED",
218+
"Russian": "ПРОДОЛЖИТЬ"
211219
}
212220
}

src/Managers/Visual.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public record VisualPartInfo(
7878
bool tintable = false
7979
);
8080
private static bool enableOutlines = false;
81+
private static bool seenWarningWCPopup = false;
8182

8283
#region General
8384

@@ -618,6 +619,34 @@ private static void PopupBase_Hide(PopupBase __instance)
618619
basicPopupWidths.Remove(__instance.GetInstanceID());
619620
}
620621

622+
[HarmonyPrefix]
623+
[HarmonyPatch(typeof(StartScreen), nameof(StartScreen.OnWeeklyChallengedButtonClick))]
624+
private static bool StartScreen_OnWeeklyChallengedButtonClick(StartScreen __instance)
625+
{
626+
if(seenWarningWCPopup)
627+
return true;
628+
BasicPopup popup = PopupManager.GetBasicPopup();
629+
popup.Header = Localization.Get("polymod.hub");
630+
popup.Description = Localization.Get("polymod.wc.warning", new Il2CppSystem.Object[] { });
631+
List<PopupBase.PopupButtonData> popupButtons = new()
632+
{
633+
new("buttons.back"),
634+
new(
635+
"polymod.wc.proceed",
636+
PopupBase.PopupButtonData.States.None,
637+
callback: (UIButtonBase.ButtonAction)((_, _) =>
638+
{
639+
seenWarningWCPopup = true;
640+
__instance.OnWeeklyChallengedButtonClick();
641+
}),
642+
customColorStates: ColorConstants.redButtonColorStates
643+
)
644+
};
645+
popup.buttonData = popupButtons.ToArray();
646+
popup.Show();
647+
return false;
648+
}
649+
621650
/// <summary>Shows a basic popup with a custom width.</summary>
622651
public static void ShowSetWidth(this BasicPopup self, int width)
623652
{

0 commit comments

Comments
 (0)