public override void Bind(TradeViewModel model) { base.Bind(model); Available?.Bind(model.Available); Mine?.Bind(model.Mine); Port?.Bind(ValueModel.New(new ButtonViewModel { Label = "Port", OnClick = model.BackToPort })); Monuments?.Bind(ValueModel.New(new ButtonViewModel { Label = "Monuments", OnClick = () => Globals.UI.Show <ShrinesView, ShrinesViewModel>(new ShrinesViewModel()) })); Info?.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => Globals.UI.Show <InfoScreen, InfoScreenModel>(new InfoScreenModel { Icon = model.PortCoin, Title = model.PortName, Subtitle = model.PortPopulationRank, Message = model.PortDescription }) })); Money.Bind(ValueModel.Wrap(Model.Money) .AsString() .Select(s => s + " dr") ); BuiltMonuments.Bind(new BoundModel <string>(Model.Ship, nameof(Model.Ship.builtMonuments))); }
public override void Bind(ICollectionModel <CargoInventoryViewModel> model) { base.Bind(model); CloseButton?.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => Globals.UI.Hide(this) })); }
public override void Bind(LoanViewModel model) { base.Bind(model); TakeLoanButton.Bind(ValueModel.New(new ButtonViewModel { OnClick = Model.GUI_TakeOutLoan })); }
public override void Bind(LoanViewModel model) { base.Bind(model); PayBackButton.Bind(ValueModel.New(new ButtonViewModel { OnClick = Model.GUI_PayBackLoan })); }
public override void Bind(PortViewModel model) { base.Bind(model); Hire?.Bind(model.CrewManagement.AvailableCrew); Fire?.Bind(model.CrewManagement.MyCrew); Sail?.Bind(ValueModel.New(new ButtonViewModel { Label = "Sail", OnClick = model.GUI_Button_TryToLeavePort })); Town?.Bind(ValueModel.New(new ButtonViewModel { Label = "Town", OnClick = model.GoToTown })); Town.Interactable = model.allowTownAccess; Info?.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => Globals.UI.Show <InfoScreen, InfoScreenModel>(new InfoScreenModel { Icon = model.PortCoin, Title = model.PortName, Subtitle = model.PortPopulationRank, Message = model.PortDescription }) })); Loans?.Bind(ValueModel.New(new ButtonViewModel { Label = "Loans", OnClick = () => Globals.UI.Show <LoanView, LoanViewModel>(new LoanViewModel()) })); Tavern?.Bind(ValueModel.New(new ButtonViewModel { Label = "Tavern", //OnClick = () => Globals.UI.Show<TavernView, TavernViewModel>(new TavernViewModel()) })); Repairs?.Bind(ValueModel.New(new ButtonViewModel { Label = "Shipyard", OnClick = () => Globals.UI.Show <RepairsView, RepairsViewModel>(new RepairsViewModel()) })); PortIcon?.Bind(new BoundModel <Sprite>(model, nameof(model.PortIcon))); PortName.Bind(ValueModel.New(Model.PortName)); Capacity.Bind(Model.CrewManagement.CrewCapacity .AsString() .Select(Model.CrewManagement.CrewCount, (cap, count) => count + " / " + cap + " crew")); Money.Bind(ValueModel.Wrap(Model.CrewManagement.Money) .AsString() .Select(s => s + " dr") ); }
public override void Bind(ShrineOptionModel model) { base.Bind(model); Name.Bind(ValueModel.New(model.Name)); BenefitHint.Bind(ValueModel.New(model.BenefitHint)); Buy.Bind(ValueModel.New(new ButtonViewModel { Label = model.Cost + " dr", OnClick = model.Buy })); }
public void Bind() { infoButton?.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => Globals.UI.Show <InfoScreen, InfoScreenModel>(new InfoScreenModel { Icon = crewImage.sprite, Title = crew.name, Subtitle = Globals.GameVars.GetJobClassEquivalency(crew.typeOfCrew), Message = crew.backgroundInfo }) })); }
public override void Bind(ICollectionModel <CrewManagementMemberViewModel> model) { base.Bind(model); // HACK: collectionwrappermodel has limited ordering features for now, so the *9999 simulates a orderby.thenby, and use a 1/(value) to simulate a desc sort List?.Bind(model .OrderBy(c => 1f / (c.CitiesInNetwork.Count(city => city.City.settlementID == Globals.Quests.CurrDestinationId) * 9999 + Globals.GameVars.Network.GetCrewMemberNetwork(c.Member).Count())) ); Close?.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => Globals.UI.Hide(this) })); }
public override void Bind(DashboardViewModel model) { base.Bind(model); CaptainsLogButton.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => Globals.UI.Show(CaptainsLogScreen, new MessageBoxViewModel { Message = Model.CaptainsLog, Cancel = new ButtonViewModel { Label = "Close", OnClick = () => Globals.UI.Hide(CaptainsLogScreen) } }) })); CargoButton.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => Globals.UI.Show(CargoList, Model.CargoList) })); CrewButton.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => Globals.UI.Show(CrewList, Model.CrewList) })); MainMenuButton.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => Globals.UI.Show <MainMenuScreen, GameViewModel>(new GameViewModel()) })); CloutButton.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => Globals.UI.Show <CrewDetailsScreen, CrewManagementMemberViewModel>( new CrewManagementMemberViewModel(model.Jason, model.OnCrewClicked, model.OnCrewCityClicked) ) })); // TODO: make 5000 max clout a const somewhere CloutSlider.Bind(Model.Clout.Select(c => c / 5000f)); CloutTitle.Bind(ValueModel.Wrap(Model.Clout) .Select(c => Globals.GameVars.GetCloutTitleEquivalency((int)c))); FoodInventory.Bind(Model.FoodInventory); WaterInventory.Bind(Model.WaterInventory); AnchorButton?.Bind(ValueModel.New(new ButtonViewModel { OnClick = Model.GUI_dropAnchor })); SailsButton?.Bind(model.SailsAreUnfurled.Select(b => new ButtonViewModel { Label = b ? "Furl Sails" : "Unfurl Sails", OnClick = model.GUI_furlOrUnfurlSails })); Objective.Bind(Model.Objective); }
public override void Bind(CityViewModel model) { base.Bind(model); Name?.Bind(new BoundModel <string>(Model, nameof(Model.PortName))); Ask?.Bind(ValueModel.New(new ButtonViewModel { Label = CityModel.CostForHint + " dr", OnClick = CityModel.GUI_BuyHint })); Hire?.Bind(ValueModel.New(new ButtonViewModel { Label = CityModel.CostToHire + " dr", OnClick = CityModel.GUI_HireANavigator })); }
public override void Bind(CrewManagementMemberViewModel model) { base.Bind(model); CrewMember?.Bind(model); Cities?.Bind(model.CitiesInNetwork); // TODO: This is null because we passed the model down from the tooltip which doesn't have this... FlavorText?.Bind(ValueModel.New(model.BackgroundInfo)); CloseButton?.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => { // the city tooltip might be up from clicking a city in a crew member's network if (Globals.UI.IsShown <CityView>()) { Globals.UI.Hide <CityView>(); } Globals.UI.Hide <CrewDetailsScreen>(); } })); }
public override void Bind(CityViewModel model) { base.Bind(model); if (model is CityDetailsViewModel) { var details = model as CityDetailsViewModel; Buy?.Bind(details.Buy); Sell?.Bind(details.Sell); Crew?.Bind(details.Crew); } PortName?.Bind(ValueModel.New(model.PortName)); Distance?.Bind(ValueModel.New(model.Distance) .Select(d => string.Format("{0} km away", Mathf.RoundToInt(d))) ); ActionButton?.Bind(ValueModel.New(new ButtonViewModel { OnClick = () => model.OnClick?.Invoke(Model) })); }
protected override void Refresh(object sender, string propertyChanged) { base.Refresh(sender, propertyChanged); PortName.Bind(ValueModel.New(Model.PortName)); Capacity.Bind(ValueModel.New(Model.Capacity)); SmallTxn.Bind(ValueModel.New(new ButtonViewModel { Label = Model.TradeAction == TradeAction.Buy ? ">" : "<", OnClick = Model.SmallTxn })); LargeTxn.Bind(ValueModel.New(new ButtonViewModel { Label = Model.TradeAction == TradeAction.Buy ? ">>" : "<<", OnClick = Model.LargeTxn })); AllTxn.Bind(ValueModel.New(new ButtonViewModel { Label = Model.TradeAction == TradeAction.Buy ? "All>" : "<All", OnClick = Model.AllTxn })); }
public override void Bind(CityViewModel model) { base.Bind(model); ds = CityModel.GetDS; Name?.Bind(new BoundModel <string>(Model, nameof(Model.PortName))); Ask?.Bind(ValueModel.New(new ButtonViewModel { Label = "Select", OnClick = () => { //CityModel.GUI_BuyHint ds.Storage.SetValue("$known_city", Model.PortName); ds.Storage.SetValue("$known_city_ID", Model.City.settlementID); Debug.Log("We have clicked on button."); Globals.UI.Hide <TavernView>(); } })); /*Hire?.Bind(ValueModel.New(new ButtonViewModel { * Label = CityModel.CostToHire + " dr", * OnClick = CityModel.GUI_HireANavigator * }));*/ }
public override void Bind(RepairsViewModel model) { base.Bind(model); ShipHealth.Bind(ValueModel.Wrap(model.shipHealth) .Select(h => Mathf.CeilToInt(Globals.GameVars.playerShipVariables.ship.health)) .AsString() ); RepairOneButton.Bind(ValueModel.New(new ButtonViewModel { Label = "Repair", OnClick = Model.GUI_RepairShipByOneHP })); RepairAllButton.Bind(ValueModel.New(new ButtonViewModel { Label = "Repair", OnClick = Model.GUI_RepairShipByAllHP })); UpgradeButton.Bind(ValueModel.New(new ButtonViewModel { Label = "Buy", OnClick = model.GUI_BuyNewShip })); }