Example #1
0
        protected override async Task AddAdditionalControls()
        {
            await base.AddAdditionalControls();

            StorageHelper = ScreenManager.Game.Services.GetService <IExternalStorageHelper>();

            if (null == StorageHelper)
            {
                throw new Exception("You need to add the IExternalStorageHelper to Game.Services");
            }

            Listener = ScreenManager.Game.Services.GetService <IClutchPlayListener>();

            if (null == Listener)
            {
                throw new Exception("You need to add the IClutchPlayListener to Game.Services");
            }

            //add a shim between the text and the buttons
            ControlStack.AddItem(new Shim()
            {
                Size = new Vector2(0, 56f)
            });

            //add the gif image
            var pp = ScreenManager.Game.GraphicsDevice.PresentationParameters;

            ControlStack.AddItem(new AnimatedGifImage(Listener.CurrentClutchPlay, ScreenManager.Game.GraphicsDevice)
            {
                Size       = new Vector2(pp.BackBufferWidth / 3, pp.BackBufferHeight / 3),
                Horizontal = HorizontalAlignment.Center,
                Vertical   = VerticalAlignment.Center,
            });
        }