|
3 | 3 | using HarmonyLib; |
4 | 4 | using I2.Loc; |
5 | 5 | using Il2CppInterop.Runtime; |
| 6 | +using Polytopia.Data; |
6 | 7 | using TMPro; |
7 | 8 | using UnityEngine; |
8 | 9 | using UnityEngine.EventSystems; |
@@ -182,6 +183,35 @@ static void PolyModHubButtonClicked(int buttonId, BaseEventData eventData) |
182 | 183 | } |
183 | 184 | } |
184 | 185 | } |
| 186 | + foreach (TribeData.Type type in Enum.GetValues(typeof(TribeData.Type))) |
| 187 | + { |
| 188 | + List<Visual.PreviewTile> previewTiles = new(); |
| 189 | + SelectTribePopup popup = PopupManager.GetSelectTribePopup(); |
| 190 | + for (int x = -3; x <= 3; x++) |
| 191 | + { |
| 192 | + for (int y = -7; y <= 7; y++) |
| 193 | + { |
| 194 | + Vector2Int pos = new Vector2Int(x, y); |
| 195 | + if (popup.UIWorldPreview.worldPreviewData.TryGetData(pos, type, out UITileData tileData)) |
| 196 | + { |
| 197 | + Visual.PreviewTile previewTile = new Visual.PreviewTile |
| 198 | + { |
| 199 | + x = tileData.Position.x, |
| 200 | + y = tileData.Position.y, |
| 201 | + terrainType = tileData.terrainType, |
| 202 | + resourceType = tileData.resourceType, |
| 203 | + unitType = tileData.unitType, |
| 204 | + improvementType = tileData.improvementType |
| 205 | + }; |
| 206 | + previewTiles.Add(previewTile); |
| 207 | + } |
| 208 | + } |
| 209 | + } |
| 210 | + File.WriteAllTextAsync( |
| 211 | + Path.Combine(Plugin.DUMPED_DATA_PATH, $"preview_{type}.json"), |
| 212 | + JsonSerializer.Serialize(previewTiles, new JsonSerializerOptions { WriteIndented = true }) |
| 213 | + ); |
| 214 | + } |
185 | 215 | NotificationManager.Notify(Localization.Get("polymod.hub.dumped")); |
186 | 216 | }), |
187 | 217 | closesPopup: false |
|
0 commit comments