Пример #1
0
 public GameplayScreen(BesmashScreen parent)
     : base(parent)
 {
     MainContainer.PercentWidth  = 100;
     MainContainer.PercentHeight = 100;
     // MainContainer.Color = Color.Black;
 }
Пример #2
0
        public SaveMenuScreen(BesmashScreen parent)
            : base(parent)
        {
            tiNewGame    = new TextItem("+ New Game", "fonts/menu_font1");
            backKey      = GameManager.Configuration.KeyMaps["menu"]["menu_cancel"].TriggerKeys[0];
            backButton   = GameManager.Configuration.KeyMaps["menu"]["menu_cancel"].TriggerButtons[0];
            deleteKey    = GameManager.Configuration.KeyMaps["menu"]["menu_option"].TriggerKeys[0];
            deleteButton = GameManager.Configuration.KeyMaps["menu"]["menu_option"].TriggerButtons[0];

            Dictionary <Keys, string>    keyInfoMap    = new Dictionary <Keys, string>();
            Dictionary <Buttons, string> buttonInfoMap = new Dictionary <Buttons, string>();

            inputInfoPane            = new InputInfoPane(keyInfoMap, buttonInfoMap);
            inputInfoPane.VAlignment = VAlignment.Bottom;
            inputInfoPane.HAlignment = HAlignment.Left;

            // TODO
            // config.KeyMaps["menu"]["menu_option"].TriggerKeys
            //     .ForEach(key => keyInfoMap.Add(key, "Delete Savegame"));

            // config.KeyMaps["menu"]["menu_option"].TriggerButtons
            //     .ForEach(btn => buttonInfoMap.Add(btn, "Delete Savegame"));

            // temp solution
            keyInfoMap.Add(deleteKey, "Delete Savegame");
            keyInfoMap.Add(backKey, "Return to Main Menu");
            buttonInfoMap.Add(deleteButton, "Delete Savegame");
            buttonInfoMap.Add(backButton, "Return to Main Menu");

            initMainContainer();
        }
Пример #3
0
        public ConfirmDialog(BesmashScreen parent,
                             Callback onConfirm, params string[] messageLines) : base(parent)
        {
            VPane vpMessage = new VPane();

            foreach (string line in messageLines)
            {
                vpMessage.add(new TextItem(line, "fonts/menu_font1"));
            }

            HList hlAnswers = new HList(
                new TextItem("Yes", "fonts/menu_font1"),
                new TextItem("No", "fonts/menu_font1"),
                new TextItem("Cancel", "fonts/menu_font1")
                );

            hlAnswers.ActionEvent += (sender, args) => {
                onConfirm(args.SelectedIndex);
                Alpha = 0;
                ExitScreen();
            };

            VPane vpMain = new VPane(vpMessage, hlAnswers);

            vpMain.Color        = Color.Black;
            vpMain.PercentWidth = 100;
            vpMain.Alpha        = 0.7f;

            hlAnswers.select(0);
            hlAnswers.IsFocused = true;
            MainContainer.Alpha = 0.5f;
            MainContainer.Color = Color.Black;
            MainContainer.add(vpMain);
        }
Пример #4
0
        public BesmashScreen(BesmashScreen parent, GameManager gameManager) : base(new VPane())
        {
            MainContainer.PercentWidth  = 100;
            MainContainer.PercentHeight = 100;
            ParentScreen = parent;
            Alpha        = 1;

            GameManager = gameManager == null && parent != null
                ?  parent.GameManager : gameManager;
        }
Пример #5
0
        public MessagePane(BesmashScreen parent, string message)
        {
            Color       = Color.Gray;
            EffectAlpha = 0.5f;

            add(new TextItem(parent.GameManager
                             .Configuration.Language
                             .translate(message),
                             "fonts/menu_font1"));

            // TODO (test)
            PixelPerSecond             = -1;
            Children[0].PixelPerSecond = -1;
        }
Пример #6
0
        public InputDialog(BesmashScreen parent, UserInput input,
                           string message, int time, Callback callback) : base(parent)
        {
            this.time     = time;
            this.input    = input;
            this.message  = message;
            this.callback = callback;

            tiTime    = new TextItem(time + "", "fonts/menu_font1");
            tiMessage = new TextItem("", "fonts/menu_font1");

            // TODO make this somehow accessible from outside
            VPane vpMain = new VPane(tiMessage, tiTime);

            vpMain.Color        = Color.Black;
            vpMain.PercentWidth = 100;
            vpMain.Alpha        = 0.7f;

            MainContainer.Color = Color.Black;
            MainContainer.Alpha = 0.5f;
            MainContainer.add(vpMain);
        }
Пример #7
0
        public SettingsScreen(BesmashScreen parent)
            : base(parent)
        {
            IsPopup = true; // TODO test

            VList vlItems = new VList(
                new TextItem("Video", PRIMARY_FONT),
                new TextItem("Audio", PRIMARY_FONT),
                new TextItem("Controls", PRIMARY_FONT),
                new TextItem("Gameplay", PRIMARY_FONT),
                new TextItem("Back", PRIMARY_FONT)
                );

            Config = new GameConfig(GameManager.Configuration);
            VideoSettingsPane    vsPane     = new VideoSettingsPane(Config);
            AudioSettingsPane    asPane     = new AudioSettingsPane(Config);
            ControlSettingsPane  csPane     = new ControlSettingsPane(Config);
            GameplaySettingsPane gsPane     = new GameplaySettingsPane(Config);
            MessagePane          msPane     = new MessagePane(this, "Return to Main Menu");
            StackPane            spSettings = new StackPane(vsPane, asPane, csPane, gsPane, msPane);
            HPane hpMain = new HPane(vlItems, spSettings);

            hpMain.PercentWidth      = 100;
            hpMain.PercentHeight     = 100;
            spSettings.PercentWidth  = 100;
            spSettings.PercentHeight = 100;
            spSettings.HAlignment    = HAlignment.Left;

            vlItems.ActionEvent += (sender, args) => {
                showPane(vlItems.SelectedIndex, vsPane, asPane, csPane, gsPane);
                vlItems.IsFocused = args.SelectedIndex == 4;
                if (args.SelectedIndex == 4)
                {
                    close();
                }
            };

            vsPane.PercentWidth    = 80;
            vsPane.PercentHeight   = 100;
            vsPane.HAlignment      = HAlignment.Left;
            vsPane.FocusLossEvent += (sender, args)
                                     => vlItems.IsFocused = true;

            asPane.PercentWidth    = 80;
            asPane.PercentHeight   = 100;
            asPane.HAlignment      = HAlignment.Left;
            asPane.FocusLossEvent += (sender, args)
                                     => vlItems.IsFocused = true;

            gsPane.PercentWidth    = 80;
            gsPane.PercentHeight   = 100;
            gsPane.HAlignment      = HAlignment.Left;
            gsPane.FocusLossEvent += (sender, args)
                                     => vlItems.IsFocused = true;

            csPane.PercentWidth    = 80;
            csPane.PercentHeight   = 100;
            csPane.HAlignment      = HAlignment.Left;
            csPane.FocusLossEvent += (sender, args)
                                     => vlItems.IsFocused = true;

            msPane.PercentWidth  = 80;
            msPane.PercentHeight = 100;
            msPane.HAlignment    = HAlignment.Left;

            vlItems.SelectedEvent += (sender, args) => {
                if (args.SelectedIndex == 0)
                {
                    vsPane.show(false, 0.5f);
                }
                if (args.SelectedIndex == 1)
                {
                    asPane.show(false, 0.5f);
                }
                if (args.SelectedIndex == 2)
                {
                    csPane.show(false, 0.5f);
                }
                if (args.SelectedIndex == 3)
                {
                    gsPane.show(false, 0.5f);
                }
                if (args.SelectedIndex == 4)
                {
                    msPane.show(false, 0.5f);
                }
            };

            vlItems.DeselectedEvent += (sender, args) => {
                if (args.SelectedIndex == 0)
                {
                    vsPane.hide(false);
                }
                if (args.SelectedIndex == 1)
                {
                    asPane.hide(false);
                }
                if (args.SelectedIndex == 2)
                {
                    csPane.hide(false);
                }
                if (args.SelectedIndex == 3)
                {
                    gsPane.hide(false);
                }
                if (args.SelectedIndex == 4)
                {
                    msPane.hide(false);
                }
            };

            vlItems.CancelEvent += (sender, args)
                                   => close();

            vlItems.Color         = Color.DarkSlateBlue;
            vlItems.Alpha         = 0.3f;
            vlItems.IsFocused     = true;
            vlItems.IsStatic      = true;
            vlItems.PercentHeight = 100;
            vlItems.PercentWidth  = 20;
            vlItems.HAlignment    = HAlignment.Left;

            asPane.hide();
            csPane.hide();
            gsPane.hide();
            msPane.hide();
            vlItems.select(0);
            MainContainer.add(hpMain);
        }
Пример #8
0
 public InputDialog(BesmashScreen parent, UserInput input,
                    string message, int time) : this(parent, input, message, time, a => {})
 {
 }
Пример #9
0
 public InputDialog(BesmashScreen parent, UserInput input,
                    string message) : this(parent, input, message, 4)
 {
 }
Пример #10
0
        private int ignTime = 500;  // time in millis any input
                                    // will be ignored initially

        public InputDialog(BesmashScreen parent, UserInput input)
            : this(parent, input, "Press a new Key or Button")
        {
        }
Пример #11
0
 public BesmashDialog(BesmashScreen parent, GameManager gameManager)
     : base(parent, gameManager)
 {
     IsPopup    = true;
     HideParent = false;
 }
Пример #12
0
 public BesmashDialog(BesmashScreen parent) : this(parent, null)
 {
 }