예제 #1
0
        private AsyncRichImage Text_ImageProvider(string arg)
        {
            int   i;
            float x;
            float?y;

            switch (arg)
            {
            case "img:left":
                x = 0f;
                y = null;
                i = 0;
                break;

            case "img:bottomleft":
                x = 0f;
                y = 1f;
                i = 3;
                break;

            case "img:bottomright":
                x = 1f;
                y = 1f;
                i = 1;
                break;

            case "img:topright":
                x = 1f;
                y = 0f;
                i = 2;
                break;

            default:
                return(default(AsyncRichImage));
            }
            var tex = Images[i];
            var ri  = new RichImage {
                Texture = tex,
                HardHorizontalAlignment = x,
                HardVerticalAlignment   = y,
                DoNotAdjustLineSpacing  = true,
                Margin            = Vector2.One * 3f,
                CreateBox         = true,
                VerticalAlignment = y ?? 0f
            };

            return(new AsyncRichImage(ref ri));
        }
예제 #2
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
        }
예제 #3
0
        public static void Load(ContentManager Content)
        {
            block                       = Content.Load <Texture2D>("button3d");
            white                       = Content.Load <Texture2D>("white");
            character                   = Content.Load <Texture2D>("brunel");
            clear                       = Content.Load <Texture2D>("clear");
            check                       = Content.Load <Texture2D>("check");
            new_badge                   = Content.Load <Texture2D>("new_badge");
            silo                        = Content.Load <Texture2D>("small_drum");
            silo_hover                  = Content.Load <Texture2D>("small_drum_hover");
            grassy_silo                 = Content.Load <Texture2D>("grassy_silo");
            blueprint                   = Content.Load <Texture2D>("blueprint");
            plinth                      = Content.Load <Texture2D>("plinth");
            building_site               = Content.Load <Texture2D>("ghost_drum");
            chemIcon                    = Content.Load <Texture2D>("chemicon");
            pipe                        = Content.Load <Texture2D>("pipe");
            pipe_hover                  = Content.Load <Texture2D>("pipe_hover");
            grassy_pipe                 = Content.Load <Texture2D>("grassy_pipe");
            pipe_head                   = Content.Load <Texture2D>("pipe_head");
            pipe_end                    = Content.Load <Texture2D>("pipe_end");
            pipe_head_hover             = Content.Load <Texture2D>("pipe_head_hover");
            pipe_end_hover              = Content.Load <Texture2D>("pipe_end_hover");
            pipeHandle                  = Content.Load <Texture2D>("pipehandle");
            pipeHandle_hover            = Content.Load <Texture2D>("pipehandle_hover");
            inbox                       = Content.Load <Texture2D>("drum");
            outbox                      = Content.Load <Texture2D>("cardboard_box");
            warning                     = Content.Load <Texture2D>("warning");
            bubbleBlock                 = Content.Load <Texture2D>("bubble");
            glassBlock                  = Content.Load <Texture2D>("glassblock");
            wildcardBlock               = Content.Load <Texture2D>("wildcard");
            steelBlock                  = Content.Load <Texture2D>("steel");
            bubbleIcon                  = Content.Load <Texture2D>("bubbleicon");
            glassIcon                   = Content.Load <Texture2D>("glassicon");
            wildcardIcon                = Content.Load <Texture2D>("wildcard_icon");
            cement                      = Content.Load <Texture2D>("cement");
            cement_dark                 = Content.Load <Texture2D>("cement_dark");
            woodFloor                   = Content.Load <Texture2D>("woodfloor");
            buttonHood                  = Content.Load <Texture2D>("buttonhood");
            cuttingBeam                 = Content.Load <Texture2D>("cuttingbeam");
            bubblegun                   = Content.Load <Texture2D>("bubblegun");
            jetpack                     = Content.Load <Texture2D>("jetpack");
            depot                       = Content.Load <Texture2D>("depot");
            hourglass                   = Content.Load <Texture2D>("hourglass");
            hourglass_frozen            = Content.Load <Texture2D>("hourglass_frozen");
            rivetgun                    = Content.Load <Texture2D>("rivetgun");
            cutting_laser               = Content.Load <Texture2D>("cutting_laser");
            empty_core                  = Content.Load <Texture2D>("empty_core");
            drag_prompt                 = Content.Load <Texture2D>("drag_prompt");
            city                        = Content.Load <Texture2D>("city");
            mapBG                       = Content.Load <Texture2D>("England");
            processor                   = Content.Load <Texture2D>("processor");
            processor_rusty             = Content.Load <Texture2D>("processor_rusty");
            turnLeft                    = Content.Load <Texture2D>("turnleft");
            turnRight                   = Content.Load <Texture2D>("turnright");
            turn180                     = Content.Load <Texture2D>("turn180");
            centrifuge                  = Content.Load <Texture2D>("centrifuge");
            centrifuge_highlight        = Content.Load <Texture2D>("centrifuge_highlight");
            record_icon                 = Content.Load <Texture2D>("record_icon");
            sidejug                     = Content.Load <Texture2D>("sidejug");
            sidejug_right               = Content.Load <Texture2D>("sidejug_right");
            processor_highlight         = Content.Load <Texture2D>("processor_highlight");
            centrifuge_button_highlight = Content.Load <Texture2D>("centrifuge_button_highlight");
            spools                      = new Texture2D[]
            {
                Content.Load <Texture2D>("spool1"),
                Content.Load <Texture2D>("spool2"),
                Content.Load <Texture2D>("spool3"),
                Content.Load <Texture2D>("spool4")
            };
            cores = new Texture2D[]
            {
                Content.Load <Texture2D>("core_anim1"),
                Content.Load <Texture2D>("core_anim2"),
                Content.Load <Texture2D>("core_anim3"),
                Content.Load <Texture2D>("core_anim4"),
            };
            core_fill = Content.Load <Texture2D>("core_fill");

            lmb = Content.Load <Texture2D>("lmb");
            rmb = Content.Load <Texture2D>("rmb");

            shelf                  = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("shelf"), Color.White, RichImageDrawMode.TILED, 0, Rotation90.None));
            levelbg                = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("levelbg"), Color.White, RichImageDrawMode.TILED, 0, Rotation90.None));
            cores_bar              = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("cores_bar"), Color.White, RichImageDrawMode.TILEDPROGRESSBAR, 0, Rotation90.None));
            cores_bar_small        = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("cores_bar_small"), Color.White, RichImageDrawMode.TILEDPROGRESSBAR, 0, Rotation90.None));
            bad_cores_bar          = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("bad_cores_bar"), Color.White, RichImageDrawMode.TILEDPROGRESSBAR, 0, Rotation90.None));
            bad_cores_bar_small    = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("bad_cores_bar_small"), Color.White, RichImageDrawMode.TILEDPROGRESSBAR, 0, Rotation90.None));
            castIronButton         = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("castIronButton"), Color.White, RichImageDrawMode.STRETCHED9GRID, 0, Rotation90.None));
            castIronButton_hover   = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("castIronButton_hover"), Color.White, RichImageDrawMode.STRETCHED9GRID, 0, Rotation90.None));
            castIronButton_pressed = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("castIronButton_pressed"), Color.White, RichImageDrawMode.STRETCHED9GRID, 0, Rotation90.None));
            steelButton            = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("steelButton"), Color.White, RichImageDrawMode.STRETCHED9GRID, 0, Rotation90.None));
            steelButton_hover      = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("steelButton_hover"), Color.White, RichImageDrawMode.STRETCHED9GRID, 0, Rotation90.None));
            steelButton_pressed    = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("steelButton_pressed"), Color.White, RichImageDrawMode.STRETCHED9GRID, 0, Rotation90.None));
            outlined_square        = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("outlined_square"), Color.White, RichImageDrawMode.STRETCHED9GRID, 0, Rotation90.None));
            keyboard_key           = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("keyboard_key"), Color.White, RichImageDrawMode.STRETCHED9GRID, 0, Rotation90.None));
            screw_panel            = new RichImage(new RichImageLayer_Texture(Content.Load <Texture2D>("screw_panel"), Color.White, RichImageDrawMode.STRETCHED9GRID, 0, Rotation90.None));
        }
        public void DrawTooltip(SpriteBatch spriteBatch)
        {
            int     effectiveHeight = CardTooltipHeight + represented.textHeight;
            Vector2 pos;

            if (represented.zone.zoneId == ConvergeZoneId.Hand)
            {
                pos = new Vector2(gfxFrame.Center.X - CardTooltipWidth / 2, gfxFrame.Top - 10 - effectiveHeight);
            }
            else
            {
                pos = new Vector2(gfxFrame.Right + 10, gfxFrame.Center.Y - effectiveHeight / 2);
            }

            if (pos.Y < 10)
            {
                pos.Y = 10;
            }
            if (pos.X > 500)
            {
                pos.X = gfxFrame.Left - 10 - CardTooltipWidth;
            }

            RichImage chosenFrame = Game1.cardFrame;

            if (represented.cost != null)
            {
                switch (represented.cost.GetColor())
                {
                case ConvergeColor.Colorless:
                    chosenFrame = Game1.cardFrame;
                    break;

                case ConvergeColor.White:
                    chosenFrame = Game1.whiteFrame;
                    break;

                case ConvergeColor.Blue:
                    chosenFrame = Game1.blueFrame;
                    break;

                case ConvergeColor.Black:
                    chosenFrame = Game1.blackFrame;
                    break;

                case ConvergeColor.Red:
                    chosenFrame = Game1.redFrame;
                    break;

                case ConvergeColor.Green:
                    chosenFrame = Game1.greenFrame;
                    break;

                default:
                    chosenFrame = Game1.goldFrame;
                    break;
                }
            }

            spriteBatch.Draw(chosenFrame, new Rectangle((int)pos.X, (int)pos.Y, CardTooltipWidth, effectiveHeight), Color.White);
            spriteBatch.DrawString(Game1.font, represented.name, pos + new Vector2(10, 10), Color.Black);

            if (represented.cost != null)
            {
                represented.cost.DrawResources(spriteBatch, null, pos + new Vector2(CardTooltipWidth - 40, 10));
            }

            if (represented.keywordsText != "")
            {
                spriteBatch.DrawString(Game1.font, represented.cardType + " - " + represented.keywordsText, pos + new Vector2(10, 35), Color.Black);
            }
            else
            {
                spriteBatch.DrawString(Game1.font, "" + represented.cardType, pos + new Vector2(10, 35), Color.Black);
            }
            if (represented.produces != null)
            {
                represented.produces.DrawCost(spriteBatch, pos + new Vector2(90, 35));
            }
            spriteBatch.DrawString(Game1.font, represented.text, pos + new Vector2(10, 60), Color.Black);
        }