Esempio n. 1
0
        public MainWindow()
        {
            InitializeComponent();
            window = this;

            IKernel kernel;

            kernel = new StandardKernel(new NinjectConfigModule());

            resourceRepo = kernel.Get <IResourceRepository>();
            planetRepo   = kernel.Get <IPlanetRepository>();
            missionRepo  = kernel.Get <IMissionRepository>();
            fractionRepo = kernel.Get <IFractionRepository>();
            typeRepo     = kernel.Get <IMissionTypeRepository>();
            pausedRepo   = kernel.Get <IPausedMissionRepository>();
            endedRepo    = kernel.Get <IEndedMissionRepository>();
            planetSer    = kernel.Get <IPlanetService>();
            missionSer   = kernel.Get <IMissionService>();
            resourceSer  = kernel.Get <IResourceService>();

            resourceCollection = new ObservableCollection <string>();
            planetCollection   = new ObservableCollection <string>();
            missionCollection  = new ObservableCollection <string>();

            resourcesListBox.ItemsSource = resourceCollection;
            planetsListBox.ItemsSource   = planetCollection;
            missionsListBox.ItemsSource  = missionCollection;

            resourcesListBox.SelectionChanged += new SelectionChangedEventHandler(ResourceListBox_Click);
            planetsListBox.SelectionChanged   += new SelectionChangedEventHandler(PlanetListBox_Click);
            missionsListBox.SelectionChanged  += new SelectionChangedEventHandler(MissionListBox_Click);

            FillDatabase();
            LoadResources();
        }
Esempio n. 2
0
 public PlanetInfo(int id, IBosServiceCollection services)
 {
     this.Id            = id;
     this.services      = services;
     this.planetService = services.GetService <IPlanetService>();
     UpdateData();
 }
Esempio n. 3
0
        public PlanetModule(IPlanetService planetService)
            : base("/api/planets")
        {
            _planetService = planetService;

            Get["/"]       = _ => GetPlanets();
            Get["/{name}"] = args => GetPlanet(args.name);
        }
Esempio n. 4
0
        private bool IsMoonOpening(IBosServiceCollection services)
        {
            IPlanetService planets    = services.PlanetService;
            var            moonPlanet = planets.GetPlanet(PlanetConst.MOON_ID);

            return(moonPlanet.State == PlanetState.Opening ||
                   moonPlanet.State == PlanetState.ReadyToOpen);
        }
 public override void OnEnable()
 {
     base.OnEnable();
     planetService = Services.PlanetService;
     if (planetService.IsOpened(planetId))
     {
         GetComponent <RectTransform>().anchoredPosition = fixAnchoredPosition;
     }
 }
        private void UpdateLevelProgressesSprites()
        {
            IPlanetService planetService   = Services.GetService <IPlanetService>();
            int            currentPlanetId = planetService.CurrentPlanet.Id;

            if (currentPlanetId > PlanetConst.EARTH_ID)
            {
                PlanetType planetType   = (PlanetType)currentPlanetId;
                string     fillSpriteId = ResourceUtils.LevelProgressPlanetMap[planetType];
                levelProgressEmptyImage.overrideSprite = Services.ResourceService.GetSpriteByKey(ResourceUtils.LevelEmptyProgressForPlanets);
                levelProgressFullImage.overrideSprite  = Services.ResourceService.GetSpriteByKey(fillSpriteId);
            }
        }
Esempio n. 7
0
    public override void OnEnable()
    {
        base.OnEnable();
        IPlanetService planetService = Services.GetService <IPlanetService>();
        ISoundService  soundService  = Services.GetService <ISoundService>();

        WheelPageButton.SetListener(() => {
            treasureObjects.Deactivate();
            raceUnavailableView.Deactivate();
            breakLinerObjects.Deactivate();

            prizeWheelObjects.Activate();
            soundService.PlayOneShot(SoundName.click);
        });

        BreakLinerPageButton.SetListener(() => {
            if (planetService.IsMoonOpened)
            {
                prizeWheelObjects.Deactivate();
                treasureObjects.Deactivate();
                breakLinerObjects.Activate();
                raceUnavailableView.Deactivate();
            }
            else
            {
                prizeWheelObjects.Deactivate();
                treasureObjects.Deactivate();
                breakLinerObjects.Deactivate();
                raceUnavailableView.Activate();
            }

            soundService.PlayOneShot(SoundName.click);
        });

        TresurePageButton.SetListener(() => {
            prizeWheelObjects.Deactivate();
            treasureObjects.Activate();
            raceUnavailableView.Deactivate();
            breakLinerObjects.Deactivate();
            soundService.PlayOneShot(SoundName.click);
            GameEvents.OnTutorialEvent(new TutorialEventData(TutorialEventName.ChestTabOpened));
        });

        closeButton.SetListener(() => {
            Services.ViewService.Remove(Type);
            Services.SoundService.PlayOneShot(SoundName.click);
        });

        GameEvents.PlanetStateChanged += OnPlanetStateChanged;
        GameEvents.OnTutorialEvent(new TutorialEventData(TutorialEventName.MiniGameOpened));
    }
Esempio n. 8
0
 private void UpdateTabState(IPlanetService planetService)
 {
     //Now rocket game available also on Earth
     if (planetService.IsMoonOpened)
     {
         raceTabCarIconImage.overrideSprite = raceAvailableIconSprite;
         tabMoonImage.Deactivate();
     }
     else
     {
         raceTabCarIconImage.overrideSprite = raceNotAvailableIconSprite;
         tabMoonImage.Activate();
     }
 }
Esempio n. 9
0
    private void OnPlanetStateChanged(PlanetState oldState, PlanetState newState, PlanetInfo planetInfo)
    {
        IPlanetService planetService = Services.GetService <IPlanetService>();

        if (planetService.IsMoonOpened)
        {
            //UpdateTabState(planetService);
            if (raceUnavailableView.gameObject.activeSelf)
            {
                raceUnavailableView.Deactivate();
                prizeWheelObjects.Deactivate();
                treasureObjects.Activate();
            }
        }
    }
 public DiscoveriesController(
     IDiscoveryService discoveryService,
     IPlanetService planetService,
     IStarService starService,
     ITelescopeService telescopeService,
     IUserService userService,
     UserManager <User> userManager)
 {
     this.discoveryService = discoveryService;
     this.planetService    = planetService;
     this.starService      = starService;
     this.telescopeService = telescopeService;
     this.userService      = userService;
     this.userManager      = userManager;
 }
        public PlanetQueries(IPlanetService planetService)
        {
            FieldAsync <ListPlanetsQueryModelType>(
                SEARCH_REQUEST_ENDPOINT,
                "Returns a paginated list of planets",
                new QueryArguments(
                    new QueryArgument <NonNullGraphType <PagedRequestType> > {
                Name = PAGINATION_ARGUMENT_NAME, Description = PagedRequestType.Description
            },
                    new QueryArgument <NonNullGraphType <OrderedRequestType> > {
                Name = ORDERING_ARGUMENT_NAME, Description = OrderedRequestType.Description
            },
                    new QueryArgument <NonNullGraphType <FilteredRequestType <Planet> > > {
                Name = FILTERING_ARGUMENT_NAME, Description = FilteredRequestType <Planet> .Description
            }
                    ),
                async context =>
            {
                var pagination = context.GetArgument <Pagination>(PAGINATION_ARGUMENT_NAME);
                var ordering   = context.GetArgument <Ordering>(ORDERING_ARGUMENT_NAME);
                var filtering  = context.GetArgument <PlanetFilter>(FILTERING_ARGUMENT_NAME);

                var(totalCount, items) = await planetService.SearchPlanetAsync(pagination, ordering, filtering);
                try
                {
                    return(new ListResponse <Planet>
                    {
                        TotalCount = totalCount,
                        Items = items
                    });
                }
                catch (Exception e)
                {
                    context.Errors.Add(new ExecutionError("Server Error"));
                    return(null);
                }
            }
                );
        }
Esempio n. 12
0
        private void UpdateMiscImages()
        {
            IPlanetService planetService = Services.GetService <IPlanetService>();

            if (planetService.IsOpened(PlanetConst.MARS_ID))
            {
                marsImage.Deactivate();
            }
            else
            {
                marsImage.Activate();
            }

            if (planetService.IsOpened(PlanetConst.MOON_ID))
            {
                moonImage.Deactivate();
            }
            else
            {
                moonImage.Activate();
            }
        }
Esempio n. 13
0
        private void UpdateViews()
        {
            IPlanetService planetService  = Services.PlanetService;
            int            currenPlanetId = planetService.CurrentPlanet.Id;

            foreach (var view in planetViews)
            {
                int  targetPlanetId = GeneratorId2PlanetId(view.generatorId);
                bool isActivate     = false;
                if (IsNotTitanTransportActive(targetPlanetId) || IsTitanTransportActive(targetPlanetId))
                {
                    isActivate = true;
                }
                if (isActivate)
                {
                    view.Activate();
                }
                else
                {
                    view.Deactivate();
                }
            }
        }
Esempio n. 14
0
 public PlanetController(IMapper mapper, IPlanetService service, ICharacterService characterService)
 {
     _planetService    = service;
     _mapper           = mapper;
     _characterService = characterService;
 }
Esempio n. 15
0
 public HomeController(IPlanetService planetService)
 {
     _planetService = planetService;
 }
Esempio n. 16
0
 public PlanetController(PlanetService planetService)
 {
     _planetService = planetService;
 }
Esempio n. 17
0
 public MapPlanet(IPlanetService planetService)
 {
     _planetService = planetService;
 }
Esempio n. 18
0
 public PlanetController(IPlanetService planetService)
 {
     this.planetService = planetService;
 }
Esempio n. 19
0
 public PreviewController(IShardService shardService, IPlanetService planetService)
 {
     this.shardService = shardService;
     this.planetService = planetService;
 }
Esempio n. 20
0
 public SpeciesService(IPeopleService peopleService, IPlanetService planetService, IMapper mapper)
 {
     this.peopleService = peopleService;
     this.planetService = planetService;
     this.mapper        = mapper;
 }
 public PlanetController(ApplicationContext _context, IPlanetService planetService)
 {
     this.Context       = _context;
     this.PlanetService = planetService;
 }
Esempio n. 22
0
 public PlanetsController(IPlanetService service, ILogger <PlanetsController> logger)
 {
     _service = service;
     _logger  = logger;
 }
Esempio n. 23
0
 public int ResearchPrice(IPlanetService planets)
 => LocalData.GetResearchPrice(planets.CurrentPlanetId.Id).Match(() => int.MaxValue, val => val.price);
 public PeopleService(IPlanetService planetService, IMapper mapper)
 {
     this.planetService = planetService;
     this.mapper        = mapper;
 }
Esempio n. 25
0
 public HomeController(ISpaceshipService spaceshipService, IPlanetService planetService)
 {
     this._spaceshipService = spaceshipService;
     this._planetService    = planetService;
 }
Esempio n. 26
0
 public ShardsController(IPlanetService planetService, IShardService shardService)
 {
     this.planetService = planetService;
     this.shardService = shardService;
 }
Esempio n. 27
0
 public SendRobotsToPlanetRequestProcessor(IPlanetService planetService, IRabbitHandler handler, IOptions <AppSettings> appSettings)
 {
     m_planetService = planetService;
     m_handler       = handler;
     m_appSettings   = appSettings.Value;
 }
Esempio n. 28
0
 public PlanetsController(IPlanetService planetService)
 {
     _planetService = planetService;
 }
        public PlanetMutations(IPlanetService service)
        {
            FieldAsync <ActionResponseType>(
                CREATE_REQUEST_ENDPOINT,
                "Creates a new Planet",
                new QueryArguments(
                    new QueryArgument <NonNullGraphType <PlanetCreateViewModel> >
            {
                Name = UPDATE_CREATE_ARGUMENT_NAME, Description = "Planet Entity to be Created"
            }),
                async context =>
            {
                var planet = context.GetArgument <Planet>(UPDATE_CREATE_ARGUMENT_NAME);

                try
                {
                    await service.CreatePlanetAsync(planet);
                }
                catch (ValidationException e)
                {
                    context.Errors.Add(new ExecutionError(e.Message));
                    return(new ActionResponse(false));
                }
                catch (Exception)
                {
                    context.Errors.Add(new ExecutionError("Server Error"));
                    return(new ActionResponse(false));
                }

                return(new ActionResponse(true, planet.Id));
            });

            FieldAsync <ActionResponseType>(
                UPDATE_REQUEST_ENDPOINT,
                "Updates an existing Planet",
                new QueryArguments(
                    new QueryArgument <NonNullGraphType <PlanetUpdateViewModel> >
            {
                Name = UPDATE_CREATE_ARGUMENT_NAME, Description = "Planet to be Updated"
            }),
                async context =>
            {
                var planet = context.GetArgument <Planet>(UPDATE_CREATE_ARGUMENT_NAME);
                try
                {
                    await service.UpdatePlanetAsync(planet);
                }
                catch (ValidationException e)
                {
                    context.Errors.Add(new ExecutionError(e.Message));
                    return(new ActionResponse(false));
                }
                catch (Exception)
                {
                    context.Errors.Add(new ExecutionError("Server Error"));
                    return(new ActionResponse(false));
                }

                return(new ActionResponse(true, planet.Id));
            });

            FieldAsync <ActionResponseType>(
                DELETE_REQUEST_ENDPOINT,
                "Removes an existing Planet",
                new QueryArguments(
                    new QueryArgument <GuidGraphType>
            {
                Name = DELETE_ARGUMENT_NAME, Description = "Planet Id used to identify which planet will be deleted"
            }),
                async context =>
            {
                var id = context.GetArgument <Guid>(DELETE_ARGUMENT_NAME);
                try
                {
                    await service.DeletePlanetAsync(id);
                }
                catch (ValidationException e)
                {
                    context.Errors.Add(new ExecutionError(e.Message));
                    return(new ActionResponse(false));
                }
                catch (Exception)
                {
                    context.Errors.Add(new ExecutionError("Server Error"));
                    return(new ActionResponse(false));
                }

                return(new ActionResponse(true));
            });
        }
 public PlanetController(IPlanetService planetService)
 {
     PlanetService = planetService;
 }
Esempio n. 31
0
 public RoverController(PlanetService planetService, RoverService roverService)
 {
     _planetService = planetService;
     _roverService  = roverService;
 }
Esempio n. 32
0
 public RoverService(ILogger <IRoverService> logger, PlanetService planetService)
 {
     _logger        = logger;
     _planetService = planetService;
 }
Esempio n. 33
0
        public override void Setup(ViewData data)
        {
            base.Setup(data);
            this.managerId = (int)data.UserData;

            reportsAlert.Setup(managerId);
            mechanicsAlert.Setup(managerId);

            GameEvents.OnTutorialEvent(new TutorialEventData(TutorialEventName.ManagementViewOpenedForManager, managerId));

            ActivateSwipeController();

            officeToggle.SetListener((isOn) => {
                if (isOn)
                {
                    DeactivateAndChangeManager();
                    activeTab = ActiveTab.Office;
                    ActivateSwipeController();
                    Services.GetService <ISoundService>().PlayOneShot(SoundName.click);
                    UpdateLeftRightManagersButton(managerId);
                }

                OfficeText.color = isOn ? EnableTabColor : DisableTabColor;
            });

            garageToggle.SetListener((isOn) => {
                if (isOn)
                {
                    if (Planets.IsOpened(PlanetConst.MARS_ID))
                    {
                        DeactivateAndChangeManager();
                        garageViewUnavailable.Deactivate();
                        activeTab = ActiveTab.Garage;
                        ActivateSwipeController();
                        GameEvents.OnTutorialEvent(new TutorialEventData(TutorialEventName.MechanicOpened));
                    }
                    else
                    {
                        DeactivateAndChangeManager();
                        activeTab = ActiveTab.Garage;
                        garageViewUnavailable.Activate();
                    }
                    garageIconImage.overrideSprite = activeGarageIconSprite;
                    Services.GetService <ISoundService>().PlayOneShot(SoundName.click);
                    UpdateLeftRightManagersButton(managerId);
                }
                else
                {
                    garageIconImage.overrideSprite = notActiveGarageIconSprite;
                    garageViewUnavailable.Deactivate();
                }

                GarageText.color = isOn ? EnableTabColor : DisableTabColor;
            });

            reportsToggle.SetListener((isOn) => {
                if (isOn)
                {
                    IPlanetService planetService = Services.GetService <IPlanetService>();
                    if (planetService.IsOpened(PlanetConst.MOON_ID))
                    {
                        DeactivateAndChangeManager();
                        reportsViewUnavailable.Deactivate();
                        activeTab = ActiveTab.Accaunt;
                        ActivateSwipeController();
                        GameEvents.OnTutorialEvent(new TutorialEventData(TutorialEventName.SecretariesOpened));
                    }
                    else
                    {
                        DeactivateAndChangeManager();
                        activeTab = ActiveTab.Accaunt;
                        reportsViewUnavailable.Activate();
                    }



                    accountingIconImage.overrideSprite = activeAccountingIconSprite;
                    Services.GetService <ISoundService>().PlayOneShot(SoundName.click);
                    UpdateLeftRightManagersButton(managerId);
                }
                else
                {
                    reportsViewUnavailable.Deactivate();
                    accountingIconImage.overrideSprite = notActiveAccountingIconSprite;
                }

                AccauntText.color = isOn ? EnableTabColor : DisableTabColor;
            });

            closeButton.SetListener(() => {
                Services.ViewService.Remove(ViewType.ManagementView, 0.2f);
                Services.GetService <ISoundService>().PlayOneShot(SoundName.click);
            });

            garageViewUnavailable.Deactivate();
            reportsViewUnavailable.Deactivate();

            UpdateView(managerId);
            UpdateLeftRightManagersButton(managerId);
            leftManagerButton.SetListener(() => {
                var swipeControl = GetSwipeController(activeTab);
                if (!swipeControl.IsTransitionStarted)
                {
                    swipeControl.MakeTransitionProgrammatically(SwipeResultAction.MoveToRight);
                    leftManagerButton.SetInteractable(false);
                    rightManagerButton.SetInteractable(false);
                    Sounds.PlayOneShot(SoundName.panel_slide);
                }
            });
            rightManagerButton.SetListener(() => {
                var swipeControl = GetSwipeController(activeTab);
                if (!swipeControl.IsTransitionStarted)
                {
                    swipeControl.MakeTransitionProgrammatically(SwipeResultAction.MoveToLeft);
                    leftManagerButton.SetInteractable(false);
                    rightManagerButton.SetInteractable(false);
                    Sounds.PlayOneShot(SoundName.panel_slide);
                }
            });
        }