Example #1
0
        public PauseMenu (Application app, CompositorColorCorrectionNode colorCorrectionNode, Base parent,
            Action onContinue, Action onPause)
        {
            this.onContinue = onContinue;
            this.onPause = onPause;
            this.colorCorrectionNode = colorCorrectionNode;
            this.application = app;
            this.parent = parent;

            settings = new SettingsMenu (app, parent, colorCorrectionNode);

            window = new WindowControl (parent, Localizer.Instance.GetValueForName("pause"));
            window.DisableResizing();
            window.IsMoveable = false;
            window.OnClose += (sender, arguments) => Hide();
            window.Width = BUTTON_WIDTH + 20;
            window.Hide();

            continueButton = new Button (window);
            continueButton.Text = Localizer.Instance.GetValueForName("back_to_game");
            continueButton.Width = BUTTON_WIDTH;
            continueButton.X = 10;
            continueButton.Y = 10;
            continueButton.Clicked += (sender, arguments) => Hide();

            settingsButton = new Button (window);
            settingsButton.Text = Localizer.Instance.GetValueForName("settings");
            settingsButton.Width = BUTTON_WIDTH;
            settingsButton.X = 10;
            settingsButton.Y = 10 + continueButton.Y + continueButton.Height;
            settingsButton.Clicked += (sender, arguments) => settings.Show();

            exitButton = new Button (window);
            exitButton.Text = Localizer.Instance.GetValueForName("quit_game");
            exitButton.Width = BUTTON_WIDTH;
            exitButton.X = 10;
            exitButton.Y = 10 + settingsButton.Y + settingsButton.Height;
            exitButton.Clicked += (sender, arguments) => application.Window.Close ();

            window.Height += exitButton.Y + exitButton.Height + 10;
            window.X = (parent.Width - window.Width) / 2;
            window.Y = (parent.Height - window.Height) / 2;

            ValidMessages = new int[] { (int) MessageId.WindowResize, (int) MessageId.UpdateLocale,
                (int) MessageId.Input };

            app.MessageManager += this;
        }
Example #2
0
        public MainMenu (Application application, Action onPlayGame, CompositorColorCorrectionNode colorCorrectionNode)
        {
            this.application = application;
            this.onPlayGame = onPlayGame;

            ValidMessages = new[] { (int) MessageId.WindowResize, (int) MessageId.UpdateLocale };
            application.MessageManager += this;

            canvas = application.RendererContext.Canvas;
            var input = new FreezingArcherInput(application, application.MessageManager);
            input.Initialize (canvas);

            canvas.SetSize(application.Window.Size.X, application.Window.Size.Y);
            canvas.ShouldDrawBackground = false;

            settings = new SettingsMenu (application, canvas, colorCorrectionNode);
            tutorial = new TutorialMenu (application, canvas);

            background = new ImagePanel (canvas);
            background.ImageName = "Content/MainMenu.jpg";
            updateBackground();

            exitButton = new Button (canvas);
            exitButton.Text = Localizer.Instance.GetValueForName("quit_game");
            exitButton.Width = BUTTON_WIDTH;
            exitButton.X = 40;
            exitButton.Y = canvas.Height - exitButton.Height - 60;
            exitButton.Clicked += (sender, arguments) => application.Window.Close ();

            settingsButton = new Button (canvas);
            settingsButton.Text = Localizer.Instance.GetValueForName("settings");
            settingsButton.Width = BUTTON_WIDTH;
            settingsButton.X = 40;
            settingsButton.Y = exitButton.Y - settingsButton.Height - 40;
            settingsButton.Clicked += (sender, arguments) => settings.Show();

            tutorialButton = new Button (canvas);
            tutorialButton.Text = Localizer.Instance.GetValueForName("tutorial");
            tutorialButton.Width = BUTTON_WIDTH;
            tutorialButton.X = 40;
            tutorialButton.Y = settingsButton.Y - tutorialButton.Height - 40;
            tutorialButton.Clicked += (sender, arguments) => tutorial.Show();

            startButton = new Button (canvas);
            startButton.Text = Localizer.Instance.GetValueForName("start_game");
            startButton.Width = BUTTON_WIDTH;
            startButton.X = 40;
            startButton.Y = tutorialButton.Y - startButton.Height - 40;
            startButton.Clicked += (sender, arguments) => {
                application.MessageManager.UnregisterMessageConsumer(this);
                application.MessageManager.UnregisterMessageConsumer(settings);
                settings.Destroy();
                canvas.Dispose();
                onPlayGame();
            };

            acagamicsFoo = new ImagePanel (canvas);
            acagamicsFoo.ImageName = "Content/figure_color.png";
            acagamicsFoo.Width = 64;
            acagamicsFoo.Height = 106;
            acagamicsFoo.X = canvas.Width - acagamicsFoo.Width - 10;
            acagamicsFoo.Y = canvas.Height - acagamicsFoo.Height - 10;
        }