Example #1
0
        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();
        }