Example #1
0
        public LoadingMenu(string title, Job job, GameState gameState) : base(gameState)
        {
            _job = job;

            PauseGame = true;

            _progressLabel = new WidgetLabel
            {
                Anchor     = Anchor.Center,
                Font       = Resources.FontRomulus,
                Origine    = Anchor.Center,
                Text       = "",
                UnitOffset = new Point(0, -16)
            };

            _progressBar = new WidgetProgress
            {
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitBound  = new Rectangle(0, 0, 320 + 64, 8),
                UnitOffset = new Point(0, 16)
            };

            Content = new LayoutDock
            {
                Children =
                {
                    new WidgetLabel
                    {
                        Text       = title,
                        Anchor     = Anchor.Center,
                        Origine    = Anchor.Center,
                        UnitOffset = new Point(0),
                        Font       = Resources.FontAlagard,
                        TextSize   = 1f,
                    },
                    new WidgetFancyPanel
                    {
                        Anchor  = Anchor.Bottom,
                        Origine = Anchor.Bottom,
                        Content = new LayoutDock{
                            Children ={ _progressBar,                    _progressLabel }
                        },
                        Dock       = Rise.Platform.Family == Framework.Platform.PlatformFamily.Mobile ? Dock.Fill : Dock.None,
                        UnitBound  = new Rectangle(0, 0, 512, 96),
                        UnitOffset = new Point(0, -32)
                    }
                }
            };

            _job.Start(true);

            _job.Finish += (sender, e) =>
            {
                if (!_job.Canceled)
                {
                    gameState.CurrentMenu = new MenuInGame(gameState);
                }
            };
        }
Example #2
0
        public override void Load()
        {
            _progressLabel = new WidgetLabel
            {
                Anchor     = Anchor.Center,
                Font       = Resources.FontRomulus,
                Origine    = Anchor.Center,
                Text       = "Loading...",
                UnitOffset = new Point(0, -24)
            };

            _progressBar = new WidgetProgress
            {
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitBound  = new Rectangle(0, 0, 320, 8),
                UnitOffset = new Point(0, 24)
            };

            var _cancelButton = new WidgetSprite()
            {
                Anchor     = Anchor.TopRight,
                Origine    = Anchor.Center,
                Sprite     = new Sprite(Resources.TileGui, new Point(7, 7)),
                UnitBound  = new Rectangle(0, 0, 48, 48),
                UnitOffset = new Point(-48, 48)
            }.RegisterMouseClickEvent((sender) =>
            {
                _job.Cancel();
                Game.GoToMainMenu();
            });

            Container = new LayoutDock
            {
                Padding  = new Spacing(16),
                Children =
                {
                    new WidgetFancyPanel
                    {
                        Anchor  = Anchor.Center,
                        Content = new LayoutDock{
                            Children ={ _progressBar,                    _progressLabel, _cancelButton }
                        },
                        Dock      = Rise.Platform.Family == Framework.Platform.PlatformFamily.Mobile ? Dock.Fill : Dock.None,
                        Origine   = Anchor.Center,
                        UnitBound = new Rectangle(0, 0, 840, 256),
                    }
                }
            };

            _job.Start(true);
        }