Skip to content

Commit a56cad6

Browse files
committed
Using new overload for basic popup
1 parent 3599e22 commit a56cad6

3 files changed

Lines changed: 41 additions & 41 deletions

File tree

src/Managers/AutoUpdate.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Text.Json;
44
using HarmonyLib;
55
using UnityEngine;
6-
using static PopupManager;
76

87
namespace PolyMod.Managers;
98

@@ -155,19 +154,17 @@ exit 0
155154
}
156155

157156
// Show a popup to the user asking if they want to update
158-
BasicPopup popup = PopupManager.GetBasicPopup();
159-
popup.Header = Localization.Get("polymod.autoupdate");
160-
popup.Description = Localization.Get("polymod.autoupdate.description");
161-
popup.buttonData = new PopupBase.PopupButtonData[] {
157+
PopupManager.GetBasicPopupWithData(new(
158+
Localization.Get("polymod.autoupdate"),
159+
Localization.Get("polymod.autoupdate.description"),
160+
new(new PopupBase.PopupButtonData[] {
162161
new(
163162
"polymod.autoupdate.update",
164163
PopupBase.PopupButtonData.States.None,
165164
(Il2CppSystem.Action)Update
166165
)
167-
};
168-
169-
popup.Show();
170-
166+
}))
167+
).Show();
171168
}
172169
catch (Exception e)
173170
{

src/Managers/Compatibility.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,13 @@ private static bool CheckSignatures(Action action, Il2CppSystem.Guid gameId)
6767
}
6868
if (!doChecksumsMatch)
6969
{
70-
BasicPopup popup = PopupManager.GetBasicPopup();
71-
popup.Header = Localization.Get("polymod.signature.mismatch");
72-
popup.Description = Localization.Get("polymod.signature.incompatible");
73-
popup.buttonData = new PopupBase.PopupButtonData[] {
74-
new("OK")
75-
};
76-
77-
popup.Show();
70+
PopupManager.GetBasicPopupWithData(new(
71+
Localization.Get("polymod.signature.mismatch"),
72+
Localization.Get("polymod.signature.incompatible"),
73+
new(new PopupBase.PopupButtonData[] {
74+
new("OK")
75+
})
76+
)).Show();
7877

7978
return false;
8079
}
@@ -116,20 +115,21 @@ private static void StartScreen_UI2_OnShow()
116115
);
117116
PlayerPrefs.Save();
118117

119-
BasicPopup popup = PopupManager.GetBasicPopup();
120-
popup.Header = Localization.Get("polymod.version.mismatch");
121-
popup.Description = Localization.Get("polymod.version.mismatch.description");
122-
popup.buttonData = new PopupBase.PopupButtonData[] {
123-
new("buttons.stay", customColorStates: ColorConstants.redButtonColorStates),
124-
new(
125-
"buttons.exitgame",
126-
PopupBase.PopupButtonData.States.None,
127-
(Il2CppSystem.Action)Application.Quit,
128-
closesPopup: false
129-
)
130-
};
131-
132-
popup.Show();
118+
PopupManager.GetBasicPopupWithData(
119+
new(
120+
Localization.Get("polymod.version.mismatch"),
121+
Localization.Get("polymod.version.mismatch.description"),
122+
new PopupBase.PopupButtonData[] {
123+
new("buttons.stay", customColorStates: ColorConstants.redButtonColorStates),
124+
new(
125+
"buttons.exitgame",
126+
PopupBase.PopupButtonData.States.None,
127+
(Il2CppSystem.Action)Application.Quit,
128+
closesPopup: false
129+
)
130+
}
131+
)
132+
).Show();
133133
}
134134
}
135135

src/Managers/Hub.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,21 @@ void OpenDiscord()
196196

197197
if (Main.dependencyCycle)
198198
{
199-
BasicPopup popup = PopupManager.GetBasicPopup();
200-
popup.Header = Localization.Get("polymod.cycle");
201-
popup.Description = Localization.Get("polymod.cycle.description");
202-
popup.buttonData = new PopupBase.PopupButtonData[] {
199+
BasicPopup popup = PopupManager.GetBasicPopupWithData(
203200
new(
204-
"buttons.exitgame",
205-
PopupBase.PopupButtonData.States.None,
206-
(Il2CppSystem.Action)Application.Quit,
207-
closesPopup: false,
208-
customColorStates: ColorConstants.redButtonColorStates
201+
Localization.Get("polymod.cycle"),
202+
Localization.Get("polymod.cycle.description"),
203+
new PopupBase.PopupButtonData[] {
204+
new(
205+
"buttons.exitgame",
206+
PopupBase.PopupButtonData.States.None,
207+
(Il2CppSystem.Action)Application.Quit,
208+
closesPopup: false,
209+
customColorStates: ColorConstants.redButtonColorStates
210+
)
211+
}
209212
)
210-
};
213+
);
211214

212215
popup.IsUnskippable = true;
213216
popup.Show();

0 commit comments

Comments
 (0)