Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            font              = Content.Load <SpriteFont>("Arial");
            whiteTexture      = Content.Load <Texture2D>("white");
            pointerTexture    = Content.Load <Texture2D>("pointer");
            runningTexture    = Content.Load <Texture2D>("running");
            breakpointTexture = Content.Load <Texture2D>("breakpoint");
            runTexture        = Content.Load <Texture2D>("run");
            stepInTexture     = Content.Load <Texture2D>("stepin");
            stepOverTexture   = Content.Load <Texture2D>("stepover");
            stepOutTexture    = Content.Load <Texture2D>("stepout");
            restartTexture    = Content.Load <Texture2D>("restart");
            pinheadTexture    = Content.Load <Texture2D>("pinhead");

            ui = new UIContainer();
            UIButtonStyle defaultButtonStyle = UIButton.GetDefaultStyle(Content);

            ui.Add(new UIButton("Run (F5)", runTexture, new Rectangle(100, 650, 120, 40), defaultButtonStyle, DoRun));
            ui.Add(new UIButton("Step In (F11)", stepInTexture, new Rectangle(240, 650, 120, 40), defaultButtonStyle, DoStepIn));
            ui.Add(new UIButton("Step Over (F10)", stepOverTexture, new Rectangle(380, 650, 120, 40), defaultButtonStyle, DoStepOver));
            ui.Add(new UIButton("Step Out (^F11)", stepOutTexture, new Rectangle(520, 650, 120, 40), defaultButtonStyle, DoStepOut));
            ui.Add(new UIButton("Restart", restartTexture, new Rectangle(660, 650, 120, 40), defaultButtonStyle, DoRestart));

            DoRestart();
        }
Пример #2
0
        void slot_Clicked()
        {
            isOpen = !isOpen;

            if (weaponSlotStyle == null)
            {
                weaponSlotStyle = new UIButtonStyle(
                    new UIButtonAppearance(Game1.font, Color.White, TextureCache.castIronButton, Color.White, new Vector2(25, 0)),
                    new UIButtonAppearance(Game1.font, Color.White, TextureCache.castIronButton_hover, Color.White, new Vector2(25, 0)),
                    new UIButtonAppearance(Game1.font, Color.White, TextureCache.castIronButton_pressed, Color.White, new Vector2(25, 1)),
                    new UIButtonAppearance(Game1.font, Color.White, TextureCache.castIronButton, Color.White, new Vector2(25, 0))
                    );
            }

            const int BUTTONHEIGHT = 50;

            dropDown.Clear();
            Vector2 nextSelectablePos = new Vector2(frame.X, frame.Y - BUTTONHEIGHT * (availableWeapons.Count() - 1));

            foreach (Weapon w in availableWeapons)
            {
                if (w != slot.weapon)
                {
                    dropDown.Add(new UIWeaponSelectable(w, new Rectangle((int)nextSelectablePos.X, (int)nextSelectablePos.Y, 175, BUTTONHEIGHT), weaponSlotStyle, button_SelectWeapon));
                    nextSelectablePos.Y += BUTTONHEIGHT;
                }
            }
        }
Пример #3
0
 public UIButton(IRenderConfiguration setRenderConfig, string setText, SpriteFont setFont, UIButtonStyle setButtonStyle = UIButtonStyle.None)
     : base(setRenderConfig, setText, setFont)
 {
     Padding     = 5;
     ButtonStyle = setButtonStyle;
     isPressed   = false;
     BorderColor = Color.Black;
     BorderWidth = 1;
     Focusable   = true;
 }
Пример #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            font = Content.Load <SpriteFont>("Arial");

            JSONTable settings = new JSONTable("Settings.json");

            spriteBatch = new SpriteBatch(GraphicsDevice);
            TextureCache.Load(Content);
            inventory     = new Inventory();
            buttonStyle   = UIButton.GetDefaultStyle(Content);
            worldLevel    = new WorldLevel(settings.getJSON("cities"));
            platformLevel = new PlatformLevel();
            currentScreen = worldLevel.tutorialCity.cityLevel;
            splashes      = new SplashManager();
        }
Пример #5
0
        public PlatformLevel()
        {
            //InitObjects();

            ui = new UIContainer();
            ui.Add(new UIButton("Reset", new Rectangle(610, 30, 100, 50), Game1.buttonStyle, button_Reset));
            ui.Add(new UIButton("Cancel", new Rectangle(610, 90, 100, 50), Game1.buttonStyle, button_Cancel));

            saveButton = new UIButton("Save", new Rectangle(10, 302, 100, 40), Game1.buttonStyle, button_Save);
            ui.Add(saveButton);
            weaponSlots = new UIContainer();
            ui.Add(weaponSlots);

            weaponButtonStyle = new UIButtonStyle(
                new UIButtonAppearance(Game1.font, Color.White, TextureCache.steelButton, Color.White, new Vector2(20, 0)),
                new UIButtonAppearance(Game1.font, Color.White, TextureCache.steelButton_hover, Color.White, new Vector2(20, 0)),
                new UIButtonAppearance(Game1.font, Color.White, TextureCache.steelButton_pressed, Color.White, new Vector2(20, 1)),
                new UIButtonAppearance(Game1.font, Color.White, TextureCache.steelButton, Color.White, new Vector2(20, 0))
                );
        }
Пример #6
0
        void Init()
        {
            ui = new UIContainer();

            mode = CentrifugeMode.TurnRight;
            if (inputSignature != null)
            {
                UpdateOutputSignature();
            }

            UIButtonStyle centrifuge_button = new UIButtonStyle(new UIButtonAppearance(Game1.font, Color.Black, new RichImage(TextureCache.centrifuge_button_highlight), Color.Black, new Vector2(1, 0)),
                                                                new UIButtonAppearance(Game1.font, Color.Black, new RichImage(TextureCache.centrifuge_button_highlight), Color.Yellow, new Vector2(1, 0)),
                                                                new UIButtonAppearance(Game1.font, Color.Black, new RichImage(TextureCache.centrifuge_button_highlight), Color.Orange, new Vector2(1, 0)),
                                                                new UIButtonAppearance(Game1.font, Color.Black, new RichImage(TextureCache.centrifuge_button_highlight), Color.Black, new Vector2(1, 0)));

            ui.Add(new UIButton("", TextureCache.turnLeft, new Rectangle(-4, 42, 18, 18), centrifuge_button, button_SelectTurnLeft));
            ui.Add(new UIButton("", TextureCache.turn180, new Rectangle(14, 42, 18, 18), centrifuge_button, button_SelectTurn180));
            ui.Add(new UIButton("", TextureCache.turnRight, new Rectangle(33, 42, 18, 18), centrifuge_button, button_SelectTurnRight));

            SetPipeSocket(new Vector2(24, 13), 1);
            AddOutputPipe(new Vector2(14, 44));
            unlimitedPipes = true;
        }
Пример #7
0
        public void RenderMenu(UIButtonStyle butStyle, Point topLeft, int maxHeight, int maxWidth, string[] menuItems, int selectedItem)
        {
            menuBack.X = topLeft.X;
            menuBack.Y = topLeft.Y;
            menuBack.Width = maxWidth;
            menuBack.Height = maxHeight;

            Rock.SpriteBatch.Draw(blank, menuBack, DefaultMenuBackColor);

            int bWidth = maxWidth - 10;
            int bHeight = 28;

            buttonBack.Width = bWidth;
            buttonBack.Height = bHeight;
            buttonBack.X = menuBack.X + 5;

            for (int i = 0; i < menuItems.Length; i++)
            {
                buttonBack.Y = menuBack.Y + 5 + (28 + 5) * i;
                if (i == selectedItem)
                {
                    RenderButton(butStyle, menuItems[i], buttonBack, UIButtonState.Hovering);
                }
                else
                {
                    RenderButton(butStyle, menuItems[i], buttonBack, UIButtonState.Normal);
                }
            }
        }
Пример #8
0
        public void RenderButton(UIButtonStyle style, string text, Rectangle position, UIButtonState state)
        {
            //TODO: UI Styles
            Rock.SpriteBatch.Draw(blank, position, (state == UIButtonState.Hovering ? DefaultHoverColor : DefaultNormalColor));

            var stringSize = font.MeasureString(text);

            Rock.SpriteBatch.DrawString(font, text, new Vector2(position.X + position.Width / 2 - stringSize.X / 2, position.Y + position.Height / 2 - stringSize.Y / 2), DefaultTextColor);
        }
Пример #9
0
 public void RenderButton(UIButtonStyle style, string text, Rectangle position)
 {
     if (Hovering(position))
     {
         RenderButton(style, text, position, UIButtonState.Hovering);
     }
     else
     {
         RenderButton(style, text, position, UIButtonState.Normal);
     }
 }
Пример #10
0
 public UIWeaponSlot(Inventory.WeaponSlot slot, List <Weapon> availableWeapons, Texture2D buttonIcon, Rectangle frame, UIButtonStyle style) : base("", frame, style, null)
 {
     onPress               = slot_Clicked;
     this.slot             = slot;
     this.buttonIcon       = buttonIcon;
     this.availableWeapons = availableWeapons;
 }
Пример #11
0
 public UIWeaponSelectable(Weapon weapon, Rectangle frame, UIButtonStyle style, OnWeaponDelegate onWeaponPress) : base(weapon.name, frame, style, null)
 {
     this.weapon        = weapon;
     this.onWeaponPress = onWeaponPress;
 }
Пример #12
0
 public UIWeaponButton(Weapon weapon, Inventory.WeaponSlot lmbSlot, Inventory.WeaponSlot rmbSlot, Rectangle frame, UIButtonStyle style) : base("", frame, style, null)
 {
     this.weapon  = weapon;
     this.lmbSlot = lmbSlot;
     this.rmbSlot = rmbSlot;
 }
Пример #13
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            data = new JSONTable("Content/data.json");

            mouseOverGlow = new RichImage(data.getJSON("mouseOverGlow"), Content);
            cardFrame     = new RichImage(data.getJSON("cardFrame"), Content);
            whiteFrame    = new RichImage(data.getJSON("whiteFrame"), Content);
            blueFrame     = new RichImage(data.getJSON("blueFrame"), Content);
            blackFrame    = new RichImage(data.getJSON("blackFrame"), Content);
            redFrame      = new RichImage(data.getJSON("redFrame"), Content);
            greenFrame    = new RichImage(data.getJSON("greenFrame"), Content);
            goldFrame     = new RichImage(data.getJSON("goldFrame"), Content);

            font             = Content.Load <SpriteFont>("Arial");
            shieldbg         = Content.Load <Texture2D>("shieldbg");
            powerbg          = Content.Load <Texture2D>("powerbg");
            woundbg          = Content.Load <Texture2D>("woundbg");
            tappedicon       = Content.Load <Texture2D>("tapped");
            abilityHighlight = Content.Load <Texture2D>("abilityHighlight");
            targetArrow      = Content.Load <Texture2D>("targetArrow");
            targetBeam       = Content.Load <Texture2D>("targetBeam");
            badTargetArrow   = Content.Load <Texture2D>("badTargetArrow");
            badTargetBeam    = Content.Load <Texture2D>("badTargetBeam");
            attackBeam       = Content.Load <Texture2D>("attackBeam");

            resourceTextures = new Texture2D[]
            {
                Content.Load <Texture2D>("total_resources"),
                Content.Load <Texture2D>("white_hats"),
                Content.Load <Texture2D>("blue_science"),
                Content.Load <Texture2D>("black_hats"),
                Content.Load <Texture2D>("red_munitions"),
                Content.Load <Texture2D>("green_seeds"),
            };

            ui = new UIContainer();

            self              = new ConvergePlayer(data.getJSON("self"), Content);
            opponent          = new ConvergePlayer(data.getJSON("opponent"), Content);
            self.opponent     = opponent;
            opponent.opponent = self;

            ui.Add(new ConvergeUIObject(self.homeBase));
            ui.Add(new ConvergeUIObject(opponent.homeBase));

            UIButtonStyle defaultStyle = UIButton.GetDefaultStyle(Content);

            endTurnButton = new UIButton("End Turn", new Rectangle(600, 400, 80, 40), defaultStyle, EndTurn_action, uiActions);
            ui.Add(endTurnButton);

            UIButton newHandButton = new UIButton("Cheat:New Hand", new Rectangle(600, 300, 80, 40), defaultStyle, NewHand_action, uiActions);

            ui.Add(newHandButton);

            JSONTable allCardsTemplate = data.getJSON("cards");

            foreach (string cardName in allCardsTemplate.Keys)
            {
                ConvergeCardSpec newSpec = new ConvergeCardSpec();
                ConvergeCardSpec.allCards.Add(cardName, newSpec);

                newSpec.Init(allCardsTemplate.getJSON(cardName), Content);
            }

            foreach (string cardName in data.getArray("mydeck").asStrings())
            {
                //ConvergeObject handCard =
                new ConvergeObject(ConvergeCardSpec.allCards[cardName], self.laboratory);
                //ui.Add(new ConvergeUIObject(handCard));
            }

            foreach (string cardName in data.getArray("oppdeck").asStrings())
            {
                //ConvergeObject handCard =
                new ConvergeObject(ConvergeCardSpec.allCards[cardName], opponent.laboratory);
                //ui.Add(new ConvergeUIObject(handCard));
            }


            UpdateZoneChanges();

            self.BeginGame();
            opponent.BeginGame();

            activePlayer = self;
            self.BeginMyTurn();
            opponent.numLandsPlayed = 1; // can't play a land in your first response phase
        }
Пример #14
0
 public UIBuyButton(string label, int price, Rectangle frame, UIButtonStyle style, OnPressDelegate onPress) : base(label, frame, style, onPress)
 {
     this.baseLabel = label;
     this.price     = price;
 }