Exemplo n.º 1
0
        public void newGame()
        {
            GameGUIComponent g = guiComponent as GameGUIComponent;

            g.current = g.credits;
#if false
#endif
        }
Exemplo n.º 2
0
 public StatusBar(GameGUIComponent guiComponent)
     : base(guiComponent)
 {
     overlay         = guiComponent.guiTextures[6];
     goldOverlay     = guiComponent.guiTextures[7];
     healthBar       = guiComponent.guiTextures[8];
     manaBar         = guiComponent.guiTextures[9];
     badassBar       = guiComponent.guiTextures[10];
     killCount       = new Label(guiComponent, "Kills: 0");
     killCount.color = Color.AntiqueWhite;
 }
Exemplo n.º 3
0
        public MainMenu(GameGUIComponent theInterface) : base(theInterface)
        {
            menu = new MenuContainer(theInterface, ListContainer.Orientation.VERTICAL);
            MenuItem graven = new MenuItem(theInterface, "");

            graven.bgImage = guiComponent.guiTextures[0];

            menu.Add(graven);
            happyImage = new Label(theInterface);
            /* Dynamically display available maps */
            foreach (var m in guiComponent.tileEngine.resourceComponent.worldNames)
            {
                string p   = m.Key;
                string str = Path.GetFileNameWithoutExtension(m.Key);
                str = str.Substring(str.IndexOf('_') + 1);
                MenuItem map = new MenuItem(theInterface, str);

                map.selectHandler += () => { guiComponent.tileEngine.setWorld(p); guiComponent.tileEngine.audioComponent.stopSoundEngine(); };

                menu.Add(map);
            }

            MenuItem controls = new MenuItem(theInterface, "Controls");
            MenuItem credits  = new MenuItem(theInterface, "Credits");
            MenuItem exit     = new MenuItem(theInterface, "Exit");

            credits.selectHandler += () => { guiComponent.current = (guiComponent as GameGUIComponent).credits; };
            exit.selectHandler    += () => { guiComponent.tileEngine.Exit(); };

            menu.Add(controls);
            menu.Add(credits);
            menu.Add(exit);

            menu.top            = 1;
            menu.selected       = 1;
            menu.forcedLocation = new Microsoft.Xna.Framework.Vector2(25, 50);
            menu.forcedSize     = new Microsoft.Xna.Framework.Vector2(0, 0);
            children.Add(menu);
            children.Add(happyImage);
            happyImage.stretch        = false;
            happyImage.forcedLocation = new Vector2(100, 160);
            happyImage.forcedSize     = new Vector2(512, 512);
            menu.happy = null;
            stretch    = true;
            //bgImage = theInterface.guiTextures[6];
            bindings = menu.bindings;
        }
        public MenuContainer(GameGUIComponent theInterface, Orientation orientation = Orientation.HORIZONTAL)
            : base(theInterface, orientation)
        {
            top    = 0;
            bottom = 0;
            GameInput input = this.guiComponent.tileEngine.inputComponent as GameInput;

            bindings = new InputBinding[Enum.GetValues(typeof(MenuContainerBindings)).Length];

            //Default Menu Bindings
            InputComponent iComp = guiComponent.graphics.tileEngine.inputComponent;

            bindings[(int)MenuContainerBindings.SELECT] = new SinglePressBinding(iComp,
                                                                                 new List <Keys> {
                Keys.Space, Keys.Enter
            }, new List <Buttons> {
                Buttons.Start, Buttons.A
            }, null);
            bindings[(int)MenuContainerBindings.UP] = new SinglePressBinding(iComp,
                                                                             new List <Keys> {
                Keys.W, Keys.Up
            }, new List <Buttons> {
                Buttons.DPadUp, Buttons.LeftThumbstickUp
            }, null);
            bindings[(int)MenuContainerBindings.DOWN] = new SinglePressBinding(iComp,
                                                                               new List <Keys> {
                Keys.S, Keys.Down
            }, new List <Buttons> {
                Buttons.DPadDown, Buttons.LeftThumbstickDown
            }, null);


            (bindings[(int)MenuContainerBindings.DOWN] as SinglePressBinding).downEvent   += OnDown;
            (bindings[(int)MenuContainerBindings.UP] as SinglePressBinding).downEvent     += OnUp;
            (bindings[(int)MenuContainerBindings.SELECT] as SinglePressBinding).downEvent += OnSelect;
        }