private void BackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { while (true) { WoodText.Invoke(() => WoodText.Text = String.Format("Wood ({0})", GameMemoryAdresses.GetPlayerWood())); CrystalsText.Invoke(() => CrystalsText.Text = String.Format("Crystals ({0})", GameMemoryAdresses.GetPlayerCrystals())); MercuryText.Invoke(() => MercuryText.Text = String.Format("Mercury ({0})", GameMemoryAdresses.GetPlayerMercury())); GemsText.Invoke(() => GemsText.Text = String.Format("Gems ({0})", GameMemoryAdresses.GetPlayerGems())); StonesText.Invoke(() => StonesText.Text = String.Format("Stones ({0})", GameMemoryAdresses.GetPlayerStones())); SulfurText.Invoke(() => SulfurText.Text = String.Format("Sulfur ({0})", GameMemoryAdresses.GetPlayerSulfur())); GoldText.Invoke(() => GoldText.Text = String.Format("Gold ({0})", GameMemoryAdresses.GetPlayerGold())); } }
//Called in the update method; assigns player UI elements to their correct values void UpdatePlayerStats() { HealthText.SetText(this.HP.ToString()); TavernHealthText.SetText(this.HP.ToString()); TavernGoldText.SetText(gold.ToString()); GoldText.SetText(gold.ToString()); XPText.SetText(xp.ToString()); LevelText.SetText(level.ToString()); TurnsText.SetText(turnNumber.ToString()); }