public void OnOpening(object enterInformation) { var translation = GameInstance.GetService <TranslationProvider>(); _overlay = new UiOverlay(); _pokeballSprite = _overlay.AddElement(new Image(GameInstance.Content.Load <Texture2D>(ResourceNames.Textures.Pokeball))); _pokeballSprite.SetPosition(new Vector2(GameInstance.ScreenBounds.Width, GameInstance.ScreenBounds.Height) * 0.5f); _pokeballSprite.SetOriginPercentage(new Vector2(0.5f)); _pokeballSprite.EnterAnimation = new UiScaleAnimation(0.5f, Vector2.Zero, Vector2.One); _pokeballSprite.LeaveAnimation = new UiScaleAnimation(0.5f, Vector2.One, Vector2.Zero); _pokeballSprite.Scale = Vector2.Zero; _pokeballSprite.AddCustomAnimation("Rotating", new UiRotationAnimation(0.5f, 0.0f, MathHelper.TwoPi), true); var loadingText = _overlay.AddElement(new StaticText(GameInstance.Content.Load <SpriteFont>(ResourceNames.Fonts.BigFont), translation.CreateValue("System", "GameLoadingMessage"))); loadingText.SetPosition(new Vector2(GameInstance.ScreenBounds.Width * 0.5f, 400)); loadingText.SetOriginPercentage(new Vector2(0.5f, 0.0f)); loadingText.EnterAnimation = new UiAlphaAnimation(0.4f, 0.0f, 1.0f); loadingText.LeaveAnimation = new UiAlphaAnimation(0.4f, 1.0f, 0.0f); loadingText.Alpha = 0.0f; _overlay.Showed += OverlayOnShowed; _overlay.Hidden += OnHidden; _overlay.Show(); }
protected override void OnEntered(object enterInformation) { _stateChangeInformation = StateChangeInformation.Empty; _mainOverlay.Show(); if (enterInformation is bool && (bool)enterInformation) { _splash.Start("Server Connection Lost", 1.5f); } }
public void OnUpdate(GameTime gameTime) { ActiveWorld.Update(gameTime); _renderStatisticsOverlay.Update(gameTime); lock (_uiElements) _uiElements.ForEach(e => { if (e.IsActive) { e.Update(gameTime); } }); if (_inputSystem.Keyboard.IsKeyDown(Keys.Escape)) { _screenManager.SetScreen(typeof(MainMenuScreen), typeof(BlendTransition)); } if (_inputSystem.Keyboard.IsKeyDownOnce(Keys.L)) { _sceneRenderer.EnablePostProcessing = !_sceneRenderer.EnablePostProcessing; } if (_inputSystem.Keyboard.IsKeyDownOnce(Keys.F12)) { _showRenderStatistics = !_showRenderStatistics; if (_showRenderStatistics) { _renderStatisticsOverlay.Show(); } else { _renderStatisticsOverlay.Hide(); } } if (_inputSystem.Keyboard.IsKeyDownOnce(Keys.X) || _inputSystem.GamePad.IsButtonDownOnce(Buttons.X)) { _screenManager.SetScreen(typeof(GameMenu.GameMenuScreen)); } }
public void OnOpening(object enterInformation) { var graphicsDeviceManager = GameInstance.GetService <GraphicsDeviceManager>(); graphicsDeviceManager.PreferMultiSampling = true; graphicsDeviceManager.ApplyChanges(); _mainOverlay = new UiOverlay(); var translation = GameInstance.GetService <TranslationProvider>(); _mainOverlay.AddElement(new HexagonBackground()); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "StartNewGame"), new Vector2(26, 45), OnStartNewGame)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "LoadGame"), new Vector2(26, 107), OnLoadGame)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "Gamejolt"), new Vector2(26, 169), null)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "Options"), new Vector2(26, 231), null)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "QuitGame"), new Vector2(26, 293), OnExitGame)); _mainOverlay.AddInputController(new KeyboardUiInputController()); _mainOverlay.AutoEnumerateTabIndices(); _closeDialog = new SelectionDialog(translation.CreateValue("System", "ReallyQuitGameQuestion"), translation.CreateValue("System", "UnsavedChangesLost"), new[] { new LeftSideButton(translation.CreateValue("System", "No"), new Vector2(50, 50), b => { _mainOverlay.CloseModal(); }), new LeftSideButton(translation.CreateValue("System", "Yes"), new Vector2(50, 100), b => { GameInstance.GetService <ScreenManager>().NotifyQuitGame(); }) }); var bar = new ControlBar(); bar.AddEntry(translation.CreateValue("System", "Select"), Buttons.A, Keys.Enter); _mainOverlay.AddElement(bar); _mainOverlay.Show(); }
public void OnOpening(object enterInformation) { _overlay = new UiOverlay(); var logoSprite = _overlay.AddElement(new Image(GameInstance.Content.Load<Texture2D>(ResourceNames.Textures.SquareLogo_256px))); logoSprite.SetPosition(new Vector2(GameInstance.ScreenBounds.Width * 0.5f, GameInstance.ScreenBounds.Height * 0.5f)); logoSprite.SetOriginPercentage(new Vector2(0.5f)); var highlightSprite = _overlay.AddElement(new Image(GameInstance.Content.Load<Texture2D>(ResourceNames.Textures.highlight))); highlightSprite.Alpha = 0.0f; highlightSprite.AddCustomAnimation("Highlight", new UiCustomDeltaAnimation(1.5f, OnUpdateHighlightPass)); highlightSprite.CustomAnimationFinshed += CustomAnimationFinished; highlightSprite.SetPosition(new Vector2(GameInstance.ScreenBounds.Width * 0.5f+30, GameInstance.ScreenBounds.Height * 0.5f-160)); logoSprite.EnterAnimation = new UiMultiAnimation(new UiAnimation[] { new UiAlphaAnimation(1.0f, 0.0f, 1.0f), new UiRotationAnimation(1.0f, 0.0f, MathHelper.TwoPi), }); _overlay.Showed += () => highlightSprite.PlayCustomAnimation("Highlight"); _overlay.Show(); }
protected override void LoadContent() { base.LoadContent(); IsMouseVisible = true; var renderSettings = new RenderSettings { EnableShadows = _gameConfig.ShadowsEnabled, EnableSoftShadows = _gameConfig.SoftShadows, ShadowMapSize = 1024 // todo: reenable }; RegisterService(GraphicsDevice); _renderer = RegisterService(SceneRendererFactory.Create(this, new WindowsSceneEffect(Content), renderSettings)); RegisterService(new GameModeManager()); _spriteBatch = RegisterService(new SpriteBatch(GraphicsDevice)); _inputSystem = RegisterService(new InputSystem()); RegisterService(new ShapeRenderer(_spriteBatch)); _screenManager = RegisterService(new ScreenManager()); RegisterService <TranslationProvider>(new TranslationProviderImp()); _collisionManager = RegisterService(new CollisionManager()); _notificationBarOverlay = new UiOverlay(); RegisterService(_notificationBarOverlay.AddElement(new NotificationBar(400))); _notificationBarOverlay.Show(); #if DEBUG_RENDERING _collisionManager.DrawDebugShapes = true; #endif #if DEBUG GetService <ScreenManager>().SetScreen(typeof(MainMenuScreen)); #else ScreenManager.SetScreen(typeof(IntroScreen)); #endif GraphicsDevice.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents; }
public void OnOpening(object enterInformation) { var graphicsDeviceManager = GameInstance.GetService<GraphicsDeviceManager>(); graphicsDeviceManager.PreferMultiSampling = true; graphicsDeviceManager.ApplyChanges(); _mainOverlay = new UiOverlay(); var translation = GameInstance.GetService<TranslationProvider>(); _mainOverlay.AddElement(new HexagonBackground()); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "StartNewGame"), new Vector2(26, 45), OnStartNewGame)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "LoadGame"), new Vector2(26, 107), OnLoadGame)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "Gamejolt"), new Vector2(26, 169), null)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "Options"), new Vector2(26, 231), null)); _mainOverlay.AddElement(new LeftSideButton(translation.CreateValue("System", "QuitGame"), new Vector2(26, 293), OnExitGame)); _mainOverlay.AddInputController(new KeyboardUiInputController()); _mainOverlay.AutoEnumerateTabIndices(); _closeDialog = new SelectionDialog(translation.CreateValue("System", "ReallyQuitGameQuestion"), translation.CreateValue("System", "UnsavedChangesLost"), new[] { new LeftSideButton(translation.CreateValue("System", "No"), new Vector2(50, 50), b => { _mainOverlay.CloseModal(); }), new LeftSideButton(translation.CreateValue("System", "Yes"), new Vector2(50, 100), b => { GameInstance.GetService<ScreenManager>().NotifyQuitGame(); }) }); var bar = new ControlBar(); bar.AddEntry(translation.CreateValue("System", "Select"), Buttons.A, Keys.Enter); _mainOverlay.AddElement(bar); _mainOverlay.Show(); }
public void OnOpening(object enterInformation) { _overlay = new UiOverlay(); var logoSprite = _overlay.AddElement(new Image(GameInstance.Content.Load <Texture2D>(ResourceNames.Textures.SquareLogo_256px))); logoSprite.SetPosition(new Vector2(GameInstance.ScreenBounds.Width * 0.5f, GameInstance.ScreenBounds.Height * 0.5f)); logoSprite.SetOriginPercentage(new Vector2(0.5f)); var highlightSprite = _overlay.AddElement(new Image(GameInstance.Content.Load <Texture2D>(ResourceNames.Textures.highlight))); highlightSprite.Alpha = 0.0f; highlightSprite.AddCustomAnimation("Highlight", new UiCustomDeltaAnimation(1.5f, OnUpdateHighlightPass)); highlightSprite.CustomAnimationFinshed += CustomAnimationFinished; highlightSprite.SetPosition(new Vector2(GameInstance.ScreenBounds.Width * 0.5f + 30, GameInstance.ScreenBounds.Height * 0.5f - 160)); logoSprite.EnterAnimation = new UiMultiAnimation(new UiAnimation[] { new UiAlphaAnimation(1.0f, 0.0f, 1.0f), new UiRotationAnimation(1.0f, 0.0f, MathHelper.TwoPi), }); _overlay.Showed += () => highlightSprite.PlayCustomAnimation("Highlight"); _overlay.Show(); }