/// Accepts a PrimaryInfoCardResourcesDollarsUpdate public void DollarsDidChange(PubSubListenerEvent e) { PrimaryInfoCardResourcesDollarsUpdate update = (PrimaryInfoCardResourcesDollarsUpdate)e.value; dollars.SetText(update.dollarsAmount.ToString("N0")); income.SetText(update.dollarsIncomePerSecond.ToString("N0") + "/s"); expenses.SetText(update.dolarsExpensesPerSecond.ToString("N0") + "/s"); }
void PublishMoneyUpdate() { PrimaryInfoCardResourcesDollarsUpdate dollarsUpdate = new PrimaryInfoCardResourcesDollarsUpdate { dollarsAmount = (decimal)CurrentMoney, dollarsIncomePerSecond = (decimal)incomeRunningAvg.CalculatedAverage(), dolarsExpensesPerSecond = (decimal)expensesRunningAvg.CalculatedAverage(), }; _sender.Publish("game.dollars.totals", dollarsUpdate); }