Skip to content

Commit

Permalink
CitySize input fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Nova791 committed Dec 25, 2023
1 parent 4d4843d commit c2394f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions AnyCitySizeHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TMPro;
using UnityEngine;

namespace DensityMod
Expand Down Expand Up @@ -30,10 +31,12 @@ public static void Postfix()

// Copy the city name input box as our template
var inputTemplate = GameObject.Find("MenuCanvas").transform.Find("MainMenu/GenerateCityPanel/GenerateNewCityComponents/CityNameInput").gameObject;
//This is a bandaid fix, till I get a proper solution
var popupMessageObject = GameObject.Find("TooltipCanvas").transform.Find("PopupMessage").gameObject;

if (inputTemplate != null)
{
if (inputTemplate != null) {
var newInputBox = GameObject.Instantiate(inputTemplate.gameObject);
newInputBox.name = "CitySizeInput";
newInputBox.SetActive(true);

// Change the label in front
Expand All @@ -52,6 +55,11 @@ public static void Postfix()
PopupMessageController.Instance.OnRightButton = (PopupMessageController.RightButton)HandlePopupSubmit;
PopupMessageController.Instance.PopupMessage("Enter city width.", true, true, RButton: "Confirm", enableInputField: true);


//This is a temporary fix, that forces the title text
var title = popupMessageObject.transform.Find("Header/PanelTitle").gameObject;
title.GetComponent<TextMeshProUGUI>().text = "Enter City Size";

}));

newSizeTMPButtonLabel = newInputBoxButton.GetComponentInChildren<TMPro.TextMeshProUGUI>();
Expand Down
2 changes: 1 addition & 1 deletion DensityMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>DensityMod</AssemblyName>
<Description>A mod by Nova to allow you to set the range of density allowed when generating a city</Description>
<Version>2.0.0</Version>
<Version>2.0.3</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources>
Expand Down

0 comments on commit c2394f2

Please sign in to comment.