Skip to content

Commit d103aed

Browse files
committed
ui2 multiplayer part update
2 parents f556cc8 + 6c72621 commit d103aed

16 files changed

Lines changed: 629 additions & 361 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,4 +406,6 @@ dist/
406406

407407
# End of https://www.toptal.com/developers/gitignore/api/csharp
408408

409-
run.bat
409+
run.bat
410+
411+
.idea/

PolyMod.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
<Configurations>IL2CPP</Configurations>
1313
<RootNamespace>PolyMod</RootNamespace>
1414
<Version>1.3.0-pre</Version>
15-
<PolytopiaVersion>2.16.4.15698</PolytopiaVersion>
15+
<PolytopiaVersion>2.17.2.16299</PolytopiaVersion>
1616
<Authors>PolyModdingTeam</Authors>
1717
<Description>The Battle of Polytopia's mod loader.</Description>
1818
<NoWarn>IDE0130</NoWarn>
1919
<NoWarn>NU5104</NoWarn>
20+
<NoWarn>$(NoWarn);NU1902</NoWarn>
21+
<NoWarn>$(NoWarn);NU1903</NoWarn>
22+
<NoWarn>$(NoWarn);NU1904</NoWarn>
2023
</PropertyGroup>
2124

2225
<ItemGroup>

docs/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_site/
2+
api/
3+
.cache/

docs/docfx.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/dotnet/docfx/main/schemas/docfx.schema.json",
3+
"metadata": [
4+
{
5+
"src": [
6+
{
7+
"src": "..",
8+
"files": [
9+
"**/*.csproj"
10+
]
11+
}
12+
],
13+
"dest": "api"
14+
}
15+
],
16+
"build": {
17+
"content": [
18+
{
19+
"files": [
20+
"**/*.{md,yml}"
21+
],
22+
"exclude": [
23+
"_site/**"
24+
]
25+
}
26+
],
27+
"resource": [
28+
{
29+
"files": [
30+
"images/**"
31+
]
32+
}
33+
],
34+
"output": "_site",
35+
"template": [
36+
"default",
37+
"modern"
38+
],
39+
"globalMetadata": {
40+
"_appName": "PolyMod",
41+
"_appTitle": "PolyMod",
42+
"_enableSearch": true,
43+
"pdf": false
44+
}
45+
}
46+
}

docs/docs/introduction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Introduction

docs/docs/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- name: Introduction
2+
href: introduction.md

docs/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
_layout: landing
3+
---
4+
5+
# This is the **HOMEPAGE**.
6+
7+
Refer to [Markdown](http://daringfireball.net/projects/markdown/) for how to write markdown files.
8+
9+
## Quick Start Notes:
10+
11+
1. Add images to the *images* folder if the file is referencing an image.

docs/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- name: Docs
2+
href: docs/
3+
- name: API
4+
href: api/

src/Loader.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ internal record TypeMapping(Type type, bool shouldCreateCache = true);
6161
{
6262
if (duringEnumCacheCreation)
6363
{
64-
Registry.customTribes.Add((TribeType)Registry.autoidx);
64+
Registry.customTribes.Add((TribeType)(int)token["idx"]);
6565
token["style"] = Registry.climateAutoidx;
6666
token["climate"] = Registry.climateAutoidx;
6767
Registry.climateAutoidx++;
@@ -183,18 +183,21 @@ out TribeAbility.Type tribeAbilityType
183183
}
184184
else
185185
{
186+
string improvementId = Util.GetJTokenName(token);
186187
if (token["attractsResource"] != null)
187188
{
188-
string improvementId = Util.GetJTokenName(token);
189189
string attractsId = token["attractsResource"].ToString();
190190
Main.attractsResourceNames[improvementId] = attractsId;
191191
}
192192
if (token["attractsToTerrain"] != null)
193193
{
194-
string improvementId = Util.GetJTokenName(token);
195194
string attractsId = token["attractsToTerrain"].ToString();
196195
Main.attractsTerrainNames[improvementId] = attractsId;
197196
}
197+
if(token["infoOverride"] != null)
198+
{
199+
Loc.buildingsInfoOverrides[improvementId] = Loc.ReplaceDashesWithDots(token["infoOverride"].ToString());
200+
}
198201
}
199202
})
200203
},
@@ -912,6 +915,7 @@ internal static void ProcessGameLogicData(GameLogicData gameLogicData, JObject r
912915
try
913916
{
914917
CreateMappings(rootObject);
918+
ProcessCustomTribes();
915919
ProcessPrefabs();
916920
ProcessEmbarkOverrides();
917921
ProcessAttractOverrides();
@@ -922,6 +926,17 @@ internal static void ProcessGameLogicData(GameLogicData gameLogicData, JObject r
922926
}
923927
}
924928

929+
internal static void ProcessCustomTribes()
930+
{
931+
foreach (var tribe in Registry.customTribes)
932+
{
933+
if(!GameLogicData.legacyTribeTypesOrder.Contains(tribe))
934+
{
935+
GameLogicData.legacyTribeTypesOrder.Add(tribe);
936+
}
937+
}
938+
}
939+
925940
/// <summary>
926941
/// Creates EnumCache mappings for custom enum values and invokes type handlers.
927942
/// </summary>

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[] {

0 commit comments

Comments
 (0)