public BuildingPicker() { SelectedBuildingGoldCost = new CalculatedValue <int>(() => Core.Data.Balance.GetBuildingGoldCost(SelectedBuildingType), SelectedBuildingType); CurrentBuildingName = new CalculatedValue <string>( () => Core.Data.Localization.BuildingNames.Get()[(int)SelectedBuildingType.Get()], Core.Data.Localization.BuildingNames, SelectedBuildingType); CurrentBuildingPrice = new CalculatedValue <string>( () => Core.Data.Balance.GetBuildingGoldCost(SelectedBuildingType).ToString(), SelectedBuildingType); CurrentBuildingDescription = new CalculatedValue <string>( () => Core.Data.Localization.BuildingDescriptions.Get()[(int)SelectedBuildingType.Get()], Core.Data.Localization.BuildingDescriptions, SelectedBuildingType); }
protected void SelectPreviousBuildingType() { var n = Enum.GetNames(typeof(BuildingTypes)).Length; SelectedBuildingType.Set((BuildingTypes)(((int)SelectedBuildingType.Get() - 1 + n) % n)); }