internal IconTitleDescriptionChevron(Bindable <string> iconBinding, Bindable <string> titleBinding, Bindable <string> descriptionBinding, Bindable <string> chevronBinding)
 {
     Title.Bind("Text", () => titleBinding);
     Description.Bind("Text", () => descriptionBinding);
     Chevron.Bind("Text", () => chevronBinding);
     Icon.Bind("Path", () => iconBinding);
 }
Esempio n. 2
0
    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")
                   );
    }
Esempio n. 3
0
    public override void Bind(CargoItemTradeViewModel model)
    {
        base.Bind(model);

        Interactable = GetComponent <InteractableBehaviour>();

        Amount?.Bind(new BoundModel <int>(Model, nameof(Model.AmountKg)).AsString());
        Name?.Bind(new BoundModel <string>(Model, nameof(Model.Name)));
        Icon?.Bind(new BoundModel <Sprite>(Model, nameof(Model.Icon)));
        Price?.Bind(new BoundModel <string>(Model, nameof(Model.PriceStr)));
        Hint?.Bind(new BoundModel <string>(Model, nameof(Model.HintStr)));

        if (SelectedHandle != null)
        {
            Unsubscribe(SelectedHandle);
        }
        SelectedHandle = Subscribe(() => model.Parent.PropertyChanged += OnSelectedChanged, () => model.Parent.PropertyChanged -= OnSelectedChanged);
        RefreshSelection();
    }
Esempio n. 4
0
 void Bind()
 {
     ctx = new BindingContext();
     ctx.Add(logoImage.Bind(vm => ((HomeViewModel)vm).LogoIcon));
 }
Esempio n. 5
0
 internal IconTextChevron(Bindable <string> iconBinding, Bindable <string> textBinding, Bindable <string> chevronBinding)
 {
     Text.Bind("Text", () => textBinding);
     Chevron.Bind("Text", () => chevronBinding);
     Icon.Bind("Path", () => iconBinding);
 }
Esempio n. 6
0
 internal TitleIcon(Bindable <string> titleBinding, Bindable <string> iconBinding)
 {
     Title.Bind("Text", () => titleBinding);
     Icon.Bind("Path", () => iconBinding);
 }
Esempio n. 7
0
 void Bind()
 {
     ctx = new BindingContext();
     ctx.Add(logoImage.Bind(vm => ((HomeViewModel)vm).LogoIcon));
     ctx.Add(preferencesbutton.Bind(vm => ((HomeViewModel)vm).PreferencesCommand));
 }
Esempio n. 8
0
 internal TextIcon(Bindable <string> textBinding, Bindable <string> iconBinding)
 {
     Text.Bind("Text", () => textBinding);
     Icon.Bind("Path", () => iconBinding);
 }