public ReservationsViewModel(INavigation navigation, IMechanicService mechanicService)
 {
     _navigation                = navigation;
     _mechanicService           = mechanicService;
     _mechanicReservations      = new ObservableCollection <ReservationDTO>();
     this.ToAddWorksheetCommand = new DelegateCommand <ReservationDTO>((reservation) => ToAddWorksheet(reservation));
     _navigation.EventAggregator.GetEvent <WorksheetCreatedSuccessfullyEvent>().Subscribe(message => this.SuccessMessage = message);
     _navigation.EventAggregator.GetEvent <UnexpectedErrorEvent>().Subscribe(message => this.ErrorMessage = message);
 }
Example #2
0
        public void Setup(int managerId)
        {
            IMechanicService        mechanicService = Services.GetService <IMechanicService>();
            ILocalizationRepository localization    = Services.ResourceService.Localization;

            manager = Services.GetService <IManagerService>().GetManager(managerId);
            tempMechanicView.Setup(Services.GenerationService.GetGetenerator(managerId));
            UpdateBrokenedAndIncomeTexts();

            buyMechanicButton.SetListener(() => {
                BosError error = BosError.Ok;
                if (mechanicService.IsAllowBuyMechanic(manager.Id, out error))
                {
                    BosError status = mechanicService.BuyMechanic(manager.Id);
                    if (status == BosError.Ok)
                    {
                        Services.GetService <ISoundService>().PlayOneShot(SoundName.buyCoins);
                    }
                    else
                    {
                        Services.GetService <ISoundService>().PlayOneShot(SoundName.slotFail);
                    }
                }
                else if (error == BosError.NoEnoughCoins)
                {
                    ViewService.Show(ViewType.CoinRequiredView, new ViewData {
                        UserData  = mechanicService.GetNextMechanicPrice(manager.Id),
                        ViewDepth = ViewService.NextViewDepth
                    });
                    Sounds.PlayOneShot(SoundName.click);
                }
                else
                {
                    Debug.LogError("some error");
                }
            });
            UpdateBuyButtonState();
            UpdateMechanicPriceText();
            UpdateMechanicCountText();


            speedUpRepairx2Text.text = string.Format(
                localization.GetString("fmt_speed_up_x2"),
                "x".Colored("#FDEE21").Size(24),
                "2".Colored("#F9F7BC").Size(36));

            CreateConstMechanicAnimObject();
        }
Example #3
0
 public MechanicsController(IMechanicService mechanicService)
 {
     _mechanicService = mechanicService;
 }
 public MechanicController(IMechanicService service)
 {
     _service = service;
 }