コード例 #1
0
 /// <summary>
 /// Constructs a ol/loot track token
 /// </summary>
 /// <param name="content"></param>
 /// <param name="spriteName"></param>
 /// <param name="incTile"></param>
 /// <param name="xLoc"></param>
 /// <param name="yLoc"></param>
 public Token(Rectangle sourceRect, string tokenName, Tracks incTile, int xLoc, int yLoc)
 {
     sourceRectangle = sourceRect; name = tokenName; drawRectangle = new Rectangle(incTile.DrawRectangle.X + xLoc, incTile.DrawRectangle.Y + yLoc, GameConstants.GRID_SIZE, GameConstants.GRID_SIZE);
 }
コード例 #2
0
ファイル: Token.cs プロジェクト: Rostaen/c-sharp-project
 /// <summary>
 /// Constructs a ol/loot track token
 /// </summary>
 /// <param name="content"></param>
 /// <param name="spriteName"></param>
 /// <param name="incTile"></param>
 /// <param name="xLoc"></param>
 /// <param name="yLoc"></param>
 public Token(Rectangle sourceRect, string tokenName, Tracks incTile, int xLoc, int yLoc)
 {
     sourceRectangle = sourceRect; name = tokenName; drawRectangle = new Rectangle(incTile.DrawRectangle.X + xLoc, incTile.DrawRectangle.Y + yLoc, GameConstants.GRID_SIZE, GameConstants.GRID_SIZE);
 }
コード例 #3
0
ファイル: Game1.cs プロジェクト: Rostaen/c-sharp-project
        /// <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);

            // Loading Fonts
            windlassFont6 = Content.Load<SpriteFont>("Fonts/Windlass 6");
            windlassFont14 = Content.Load<SpriteFont>("Fonts/Windlass 14");
            windlassFont23 = Content.Load<SpriteFont>("Fonts/Windlass 23");
            windlassFont36 = Content.Load<SpriteFont>("Fonts/Windlass 36");
            Arial14 = Content.Load<SpriteFont>("Fonts/Arial18");

            // Loading background image
            endToken = new Token(new Rectangle(0, 0, GameConstants.WINDOW_WIDTH, GameConstants.WINDOW_HEIGHT), 0, GameConstants.WINDOW_WIDTH - 200, 50, new Rectangle(768, 712, 150, 64));
            background = Content.Load<Texture2D>("Misc/dirt bg");
            spriteSheet1 = Content.Load<Texture2D>("sprite sheet 1"); classSheet1 = Content.Load<Texture2D>("Classes/class sheet 1"); classSheet2 = Content.Load<Texture2D>("Classes/class sheet 2");
            heroSheet1 = Content.Load<Texture2D>("Hero_Items/hero sheets 1"); heroSheet2 = Content.Load<Texture2D>("Hero_Items/hero sheets 2");
            shopSheet = Content.Load<Texture2D>("shop sheet");
            barBGSource = new Rectangle(0, 996, 246, 28); hpBarSource = new Rectangle(0, 972, 244, 24); stamBarSource = new Rectangle(0, 948, 244, 24);
            bar1BGLocation = new Rectangle(GameConstants.HALF_WINDOW_WIDTH() - 411, GameConstants.WINDOW_HEIGHT - 225, 246, 28);
            hpBarLocation = new Rectangle(GameConstants.HALF_WINDOW_WIDTH() - 407, GameConstants.WINDOW_HEIGHT - 223, 244, 24);
            bar2BGLocation = new Rectangle(GameConstants.HALF_WINDOW_WIDTH() + 165, GameConstants.WINDOW_HEIGHT - 225, 246, 28);
            stamBarLocation = new Rectangle(GameConstants.HALF_WINDOW_WIDTH() + 169, GameConstants.WINDOW_HEIGHT - 224, 244, 24);
            bar1BG = new Token(bar1BGLocation, 0, 0, 0, barBGSource); bar2BG = new Token(bar2BGLocation, 0, 0, 0, barBGSource);

            // Adding Yes/No buttons for familiar activation
            yesNoList.Add(new Token(new Rectangle(0, 0, GameConstants.WINDOW_WIDTH, GameConstants.WINDOW_HEIGHT), 0, GameConstants.WINDOW_WIDTH / 2 - 25, 240, new Rectangle(360, 352, 40, 40)));
            yesNoList.Add(new Token(new Rectangle(0, 0, GameConstants.WINDOW_WIDTH, GameConstants.WINDOW_HEIGHT), 1, GameConstants.WINDOW_WIDTH / 2 + 25, 240, new Rectangle(400, 352, 40, 40)));

            // Adding Loot track and OL track items to the game
            Texture2D lootSprite = Content.Load<Texture2D>("Misc/Loot Tracker");
            lootTrack = new Tracks(Content, lootSprite, 10, GameConstants.WINDOW_HEIGHT / 2 - lootSprite.Height / 2);
            // TODO: Set for testing gaining equipment, delete after done testing
            int xPosition = GameConstants.HP_TOKEN_START_X + lootTrack.DrawRectangle.Height, yPosition = GameConstants.HP_TOKEN_START_Y + lootTrack.DrawRectangle.Height;
            for (int x = 0; x < 3; x++) lootTrackTokens.Add(new Token(lootTrack.DrawRectangle, lootTrackTokens.Count + 1, GameConstants.HP_TOKEN_START_X, yPosition + (GameConstants.HP_TOKEN_BUFFER_Y * lootTrackTokens.Count), hpTokenSource));
            //
            staminaTokenSource = new Rectangle(721, 224, 43, 40); hpTokenSource = new Rectangle(721, 264, 40, 36);
            masterMonsterKillToken = new Token(lootTrack.DrawRectangle, 1, lootTrack.DrawRectangle.Width - 110, lootTrack.DrawRectangle.Height - 58, staminaTokenSource);
            Texture2D overlordSprite = Content.Load<Texture2D>("Misc/Overlord Tracker");
            overlordTrack = new Tracks(Content, overlordSprite, GameConstants.WINDOW_WIDTH / 2 - overlordSprite.Width / 2, 0);
            overlordTokens.Add(new Token(new Rectangle(640, 256, 40, 40),"doom", overlordTrack, overlordSprite.Width - 105, overlordSprite.Height - 80));
            overlordTokens.Add(new Token(new Rectangle(680, 256, 40, 40), "fate", overlordTrack, 42, overlordSprite.Height - 80));
            lootOLButtons.Add(new Token(new Rectangle(0, 0, GameConstants.WINDOW_WIDTH, GameConstants.WINDOW_HEIGHT), 0, 10, 10, new Rectangle(480, 352, 40, 40)));
            lootOLButtons.Add(new Token(new Rectangle(0, 0, GameConstants.WINDOW_WIDTH, GameConstants.WINDOW_HEIGHT), 1, 60, 10, new Rectangle(440, 352, 40, 40)));
            lootOLTrackMessages.Add(new Message("Loot Track", windlassFont14, new Vector2(60, 20), 0));
            lootOLTrackMessages.Add(new Message("Overlord Track", windlassFont14, new Vector2(200, 20), 1));

            // Adding the background, initial tiles/endcap/doors and monster overlay
            bgFill.Load(GraphicsDevice, background);
            tiles.Add(new Tile(Content,
                (GameConstants.WINDOW_WIDTH / 2) - (GameConstants.TILE_SIZE[9,0] / 2), (GameConstants.WINDOW_HEIGHT / 2) - (GameConstants.TILE_SIZE[9,1] / 2), GameConstants.TILE_SIZE[9,0], GameConstants.TILE_SIZE[9,1],
                GameConstants.TILE_ENT_EXIT_REC[9, 0], GameConstants.TILE_ENT_EXIT_REC[9, 1], GameConstants.TILE_ENT_EXIT_REC[9, 2],
                GameConstants.TILE_NAMES[9, 2], GameConstants.TILE_NAMES[9, 3], GameConstants.TILE_NAMES[9, 4],
                GameConstants.TILE_NAMES[9, 0], false, 0));
            endCaps.Add(new Tile(Content, tiles[0].X + GameConstants.TILE_SIZE[9, 0], tiles[0].Y, GameConstants.TILE_SIZE[9, 0], GameConstants.TILE_SIZE[9, 1],
                GameConstants.TILE_ENT_EXIT_REC[9, 2], GameConstants.TILE_NAMES[9, 2], 0));
            tiles.Add(new Tile(Content, tiles[0].X - 64, tiles[0].Y + 64, 64, 128, new Vector2(64f, 64f), new Vector2(0f, 64f), new Vector2(), "E", "W", "", "Tile - Conn b", false, 1));
            doors.Add(new Tile(Content, "Door Yellow", false, tiles[1].Exit1, tiles[1].ExitSide1, tiles[1].X, tiles[1].Y, tiles[1].Height, tiles[1].Width));
            monsterOverlay = new OverlayBG(Content);

            // Setting up background for character creation
            creationBG = Content.Load<Texture2D>("Start Up Items/selection bg");
            creationRec = new Rectangle(GameConstants.HALF_WINDOW_WIDTH() - creationBG.Width / 2, GameConstants.HALF_WINDOW_HEIGHT() - creationBG.Height / 2, creationBG.Width, creationBG.Height);

            // loading archetype tokens
            chooseArchetype.Add(new Token(creationRec, 1, (int)(creationRec.Width * 0.2f), (int)(creationRec.Height * 0.55f) - 50, new Rectangle(512, 64, 64, 64)));
            chooseArchetype.Add(new Token(creationRec, 2, (int)(creationRec.Width * 0.4f), (int)(creationRec.Height * 0.55f) - 50, new Rectangle(576, 64, 64, 64)));
            chooseArchetype.Add(new Token(creationRec, 3, (int)(creationRec.Width * 0.6f), (int)(creationRec.Height * 0.55f) - 50, new Rectangle(640, 64, 64, 64)));
            chooseArchetype.Add(new Token(creationRec, 4, (int)(creationRec.Width * 0.8f), (int)(creationRec.Height * 0.55f) - 50, new Rectangle(704, 64, 64, 64)));

            // Setting up action menu
            actionChoiceSprite = Content.Load<Texture2D>("Misc/hero action paper");
            actionChoiceRect = new Rectangle(GameConstants.WINDOW_WIDTH - (actionChoiceSprite.Width + 30), 30, actionChoiceSprite.Width, actionChoiceSprite.Height);
            addActionMessageButton("Attack", "Hero Actions/attack", 0); addActionMessageButton("Search", "Hero Actions/search", 1); addActionMessageButton("Move", "Hero Actions/move", 2);
            addActionMessageButton("Special", "Hero Actions/special", 3); addActionMessageButton("Rest", "Hero Actions/rest", 4); addActionMessageButton("Stand Up", "Hero Actions/stand", 5);
            addActionMessageButton("Perform ability/skill", "Hero Actions/ability skill", 6); addActionMessageButton("Open or close a door", "Hero Actions/door", 7); addActionMessageButton("Revive a hero", "Hero Actions/revive", 8);

            // Adding vector2 info for the action window top/bottom message locations
            actionWindowTop = new Vector2((float)(actionChoiceRect.X + (actionChoiceRect.Width / 2)), (float)(actionChoiceRect.Y + 60));
            actionWindowBottom = new Vector2((float)(actionChoiceRect.X + (actionChoiceRect.Width / 2)), (float)(actionChoiceRect.Y + actionChoiceRect.Height - 60));

            // Setting up movement buttons
            Rectangle menuButtonRect = new Rectangle(GameConstants.WINDOW_WIDTH - 300, 50, 150, 300);
            movementButtons.Add(new Token(menuButtonRect, 1, 0, 0, new Rectangle(768, 584, 150, 64)));
            movementButtons.Add(new Token(menuButtonRect, 2, 0, 69, new Rectangle(768, 648, 150, 64)));
            movementButtons.Add(new Token(menuButtonRect, 3, 0, 138, new Rectangle(768, 712, 150, 64)));

            // Setting up Decks
            searchDeck = new Deck("Search", "");
            searchDeck.Shuffle(random);
            perilDeck = new Deck("Peril", "Forgotten Souls");
            perilDeck.Shuffle(random);
            shop1Deck = new Deck("Shop 1", "");
            shop1Deck.Shuffle(random);
            shop2Deck = new Deck("Shop 2", "");
            shop2Deck.Shuffle(random);
            roomDeck = new Deck("Room", "Forgotten Souls"); // no shuffling of this deck, it is done upon construction
        }