So obviously I would like to have this displayed value to update dynamically as the value changes during transactions. Problem is that when I have tried various attempts and methods that I could think of to do this, they have all resulted in the same thing, that being the displayed value getting layered upon each other every-time I have the value set to "update" resulting in the gif example below.
Looking for examples, one that uses the "textlabel" method specifically is, "DaggerfallTravelMapWindow.cs" that being the part that displays the name of the Region you are moused over in the top-center of the screen.
Code: Select all
// Add region label
regionLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(0, 2), string.Empty, NativePanel);
regionLabel.HorizontalAlignment = HorizontalAlignment.Center;
// Updates the text label at top of screen
void UpdateRegionLabel()
{
if (RegionSelected == false)
regionLabel.Text = GetRegionName(mouseOverRegion);
else if (locationSelected)
regionLabel.Text = string.Format("{0} : {1}", DaggerfallUnity.ContentReader.MapFileReader.GetRegionName(mouseOverRegion), currentDFRegion.MapNames[locationSummary.MapIndex]);
else if (MouseOverOtherRegion)
regionLabel.Text = string.Format("Switch To: {0} Region", DaggerfallUnity.ContentReader.MapFileReader.GetRegionName(mouseOverRegion));
else
regionLabel.Text = GetRegionName(mouseOverRegion);
}
Code: Select all
public override void Refresh(bool refreshPaperDoll = true)
{
if (!IsSetup)
return;
base.Refresh(refreshPaperDoll);
UpdateRepairTimes(false);
UpdateCostAndGold();
UpdateShopGoldDisplay();
}
// Refresh is called earlier for initial display
public void UpdateShopGoldDisplay()
{
int currentBuildingID = GameManager.Instance.PlayerEnterExit.BuildingDiscoveryData.buildingKey;
int goldSupply = 0;
foreach (KeyValuePair<int, SaveDataTestingScript1.ShopData> kvp in SaveDataTestingScript1.SaveDataTestingScript1.ShopBuildingData)
{
if (kvp.Key == currentBuildingID)
goldSupply = kvp.Value.CurrentGoldSupply;
}
localTextLabelTwo = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(263, 41), string.Empty, NativePanel);
localTextLabelTwo.TextScale = 0.85f;
localTextLabelTwo.Text = "Shop Gold: " + goldSupply.ToString();
}
If anybody knows what i'm doing wrong here, assistance would be much appreciated, trying to mess with the UI and windows has been a damn nightmare for me so far, lol.
Thanks for reading.