Exemple #1
0
        public override void Initialize(SharpDX.Direct3D11.DeviceContext context)
        {
            var startUpComponent = _iocContainer.Get <StartUpComponent>();
            var inputsManager    = _iocContainer.Get <InputsManager>();

            _webApi = _iocContainer.Get <ClientWebApi>();

            inputsManager.KeyboardManager.IsRunning = true;

            //Get the list of Slides
            List <FileInfo> slides = new List <FileInfo>();

            foreach (var slide in Directory.GetFiles(@"Images\StartUpSlides\", "StartUpSlide*.*"))
            {
                slides.Add(new FileInfo(slide));
            }

            startUpComponent.SetSlideShows(slides.ToArray(), 3000);

            startUpComponent.SlideShowFinished += StartUpComponentSlideShowFinished;

            //Prepare Async SystemComponentState
            GameState systemComponentState = StatesManager.GetByName("SystemComponents");

            systemComponentState.StateInitialized += SystemComponentStateStateInitialized;

            StatesManager.PrepareStateAsync(systemComponentState);

            _webApi.TokenVerified += WebApiTokenVerified;
            if (!string.IsNullOrEmpty(ClientSettings.Current.Settings.Token))
            {
                _webApi.OauthVerifyTokenAsync(ClientSettings.Current.Settings.Token);
            }
            else
            {
                _nextState = "Login";
            }

            AddComponent(startUpComponent);
            AddComponent(inputsManager);
            base.Initialize(context);
        }