/// <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);
     ConstantHolder.textureLoader = TextureListXML.loadTextureXMLs("Content\\XMLs\\Textures\\Textures.xml");
     ActorTextureHolder.makeHolder(GraphicsDevice);
     EnvironmentTextureHolder.makeHolder(GraphicsDevice);
     InterfaceTextureHolder.makeHolder(Content, GraphicsDevice);
     Controls.Initialize();
     // TODO: use this.Content to load your game content here
 }
Example #2
0
 /// <summary>
 /// Constructs a box to display whatever text is needed.
 /// </summary>
 /// <param name="position">Top left of the box's position.</param>
 /// <param name="initalString">String to be displayed.</param>
 public TextBox(Rectangle position, string initalString = "")
 {
     this.position    = position;
     textBuffer       = initalString;
     holder           = InterfaceTextureHolder.Holder;
     font             = holder.Fonts[(int)ConstantHolder.Fonts.defaultFont];
     backgroundSprite = holder.GUISprites[(int)ConstantHolder.GUIMemberImages.ExperienceBar].copySprite();//TBI:An actual textbox background.
     maxVerticalLines = (int)(position.Height / font.MeasureString("The quick brown fox jumps over the lazy dog 0123456789!@#$%^&*{}[]()\"'\\").Y) + 4;
     textLines        = new string[maxVerticalLines];
     for (int i = 0; i < maxVerticalLines; i++)
     {
         textLines[i] = "\n";
     }
 }
Example #3
0
        /// <summary>
        /// Creates the options box.
        /// </summary>
        /// <param name="positon">Top left corner of the box.</param>
        /// <param name="InfoText">Text displayed above the buttons contained</param>
        /// <param name="buttonStrings">Array of the strings to put on the buttons</param>
        public OptionsBox(Rectangle positon, String InfoText, String[] buttonStrings)
        {
            InterfaceTextureHolder holder = InterfaceTextureHolder.Holder;

            font          = holder.Fonts[(int)ConstantHolder.Fonts.defaultFont];
            this.position = positon;
            GUIManager manager = GUIManager.getManager();

            displayText      = InfoText;
            buttons          = new Button[buttonStrings.Length];
            backgroundSprite = holder.GUISprites[(int)ConstantHolder.GUIMemberImages.AbilityBackground].copySprite();//TBI: actual background for an options box.
            for (int i = 0; i < buttonStrings.Length; ++i)
            {
                //buttons[i] = manager.MakeTextButton();
            }
        }
Example #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.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     ConstantHolder.textureLoader = TextureListXML.loadTextureXMLs("Content\\XMLs\\Textures\\Textures.xml");
     ActorHolder      = ActorTextureHolder.makeHolder(GraphicsDevice);
     CombatHolder     = CombatTextureHolder.makeHolder(GraphicsDevice);
     EnviroHolder     = EnvironmentTextureHolder.makeHolder(GraphicsDevice);
     InterfaceHolder  = InterfaceTextureHolder.makeHolder(Content, GraphicsDevice);
     currentLevelGrid = Level.loadLevelXML("Content\\XMLs\\level.xml").LevelGrid;
     GUIMan           = GUIManager.MakeManager();
     changeState(GameState.Gameplay_Combat);
     //currentLevelGrid = thing.SimpleLevelGrid;
     IsMouseVisible = true;
     changeState(GameState.Gameplay_Combat);
     //HexagonWidth = hex.Width;
     // TODO: use this.Content to load your game content here
 }
Example #5
0
        /// <summary>
        /// Grid constructor, X by Y
        /// </summary>
        /// <param name="xDim">Width</param>
        /// <param name="yDim">Height</param>
        public Grid(int xDim, int yDim)
        {
            originScreenPos = minGridOrigin;    //Defaults the view to the top left
            maxGridOrigin   = new Vector2(3.0f / 4 * ConstantHolder.HexagonGrid_HexSizeX * (xDim) - ConstantHolder.GAME_WIDTH,
                                          ConstantHolder.HexagonGrid_HexSizeY * (yDim + 0.5f) - ConstantHolder.GAME_HEIGHT);
            //Set the grid position limits to keep it on the screen.
            maxGridOrigin.X += ConstantHolder.HexagonGrid_HexSizeX / 4 + ConstantHolder.GAME_WIDTH / 10;
            //Allow more distance, to let players see the edges more easily
            maxGridOrigin.Y += ConstantHolder.GAME_HEIGHT / 4;
            spaceArray       = new GridSpace[xDim, yDim];
            connections      = new bool[xDim, yDim, xDim, yDim];
            movementCosts    = new int[xDim, yDim, xDim, yDim];
            sizeX            = xDim;
            sizeY            = yDim;
            numSpaces        = sizeX * sizeY;
            Vector2 minimapDimensions = new Vector2(ConstantHolder.GAME_WIDTH * ConstantHolder.relativeMinimapSizeX,
                                                    ConstantHolder.GAME_HEIGHT * ConstantHolder.relativeMinimapSizeY);
            float emptySpaceWidth;

            if (minimapDimensions.X / ((sizeX * 3.0 + 1) / 4) > minimapDimensions.Y / (sizeY + 0.5f))
            {
                mGridspaceWidth = minimapDimensions.Y / (sizeY + 0.5f);
                minimapOrigin.Y = ConstantHolder.GAME_HEIGHT * (1 - ConstantHolder.relativeMinimapSizeY);
                emptySpaceWidth = minimapDimensions.X - ((3.0f / 4 * sizeX + 0.25f) * mGridspaceWidth);
                minimapOrigin.X = emptySpaceWidth / 2 + ConstantHolder.GAME_WIDTH * (1 - ConstantHolder.relativeMinimapSizeX);
            }
            else            //This choice will determine whether the minimap fills horizontally (else) or vertically (if)
            {
                mGridspaceWidth = minimapDimensions.X / ((sizeX * 3.0f + 1) / 4);
                minimapOrigin.X = ConstantHolder.GAME_WIDTH * (1 - ConstantHolder.relativeMinimapSizeX);
                emptySpaceWidth = minimapDimensions.Y - ((sizeY + 0.5f) * mGridspaceWidth);
                minimapOrigin.Y = emptySpaceWidth / 2 + ConstantHolder.GAME_HEIGHT * (1 - ConstantHolder.relativeMinimapSizeY);
            }
            minimapSpaceDim            = new Vector2(mGridspaceWidth, mGridspaceWidth);
            selectionRect.Width        = (int)(mGridspaceWidth * (float)ConstantHolder.GAME_WIDTH / (ConstantHolder.HexagonGrid_HexSizeX));
            selectionRectDefaultSize.X = selectionRect.Width;
            selectionRect.Height       = (int)(mGridspaceWidth * ((float)ConstantHolder.GAME_HEIGHT / (ConstantHolder.HexagonGrid_HexSizeY)));
            selectionRectDefaultSize.Y = selectionRect.Height;
            InterfaceTextureHolder holder = InterfaceTextureHolder.Holder;

            minimapBackground = holder.GUISprites[(int)ConstantHolder.GUIMemberImages.MinimapBackground].copySprite();
            minimapSelect     = holder.GUISprites[(int)ConstantHolder.GUIMemberImages.MinimapSelection].copySprite();
            visited           = new bool[sizeX, sizeY];
        }
Example #6
0
        /// <summary>
        /// Creates a GUI element to show information about the selected Person and their abilities.
        /// </summary>
        /// <param name="CharacterLifeRect">Game screen area to draw the portrait, life and energy bars, any AbilityEffect icons, and level information</param>
        /// <param name="abilityAreaRect">Area to display the ability buttons, as well as the experience bar if the selected person is a hero.</param>
        public CharacterBox(Rectangle CharacterLifeRect, Rectangle abilityAreaRect)
        {
            Options = new TextButton[4];

            HealthBox = CharacterLifeRect;
            ExpBarBox = abilityAreaRect;
            Rectangle buttonRect = new Rectangle(ExpBarBox.X + 10, ExpBarBox.Y + 10, (ExpBarBox.Width - 25) / 4, ExpBarBox.Height - 50);

            interfaceHolder = InterfaceTextureHolder.Holder;
            combatHolder    = CombatTextureHolder.Holder;

            Options[0] = new TextButton(buttonRect, interfaceHolder.ButtonSprites[(int)ConstantHolder.ButtonBackgrounds.Exit].copySprite(),
                                        buttonZero, interfaceHolder.Fonts[(int)ConstantHolder.Fonts.defaultFont],
                                        "Yo, dawg.");

            buttonRect.X += (ExpBarBox.Width - 25) / 4 + 5;

            Options[1] = new TextButton(buttonRect, interfaceHolder.ButtonSprites[(int)ConstantHolder.ButtonBackgrounds.Exit].copySprite(),
                                        buttonOne, interfaceHolder.Fonts[(int)ConstantHolder.Fonts.defaultFont], "Sup, son.");

            buttonRect.X += (ExpBarBox.Width - 25) / 4 + 5;
            Options[2]    = new TextButton(buttonRect, interfaceHolder.ButtonSprites[(int)ConstantHolder.ButtonBackgrounds.Exit].copySprite(),
                                           buttonTwo, interfaceHolder.Fonts[(int)ConstantHolder.Fonts.defaultFont], "I heard you liek mudkips");

            buttonRect.X += (ExpBarBox.Width - 25) / 4 + 5;
            Options[3]    = new TextButton(buttonRect, interfaceHolder.ButtonSprites[(int)ConstantHolder.ButtonBackgrounds.Exit].copySprite(),
                                           buttonThree, interfaceHolder.Fonts[(int)ConstantHolder.Fonts.defaultFont], "Bro do you even lift?");


            healthPanelBackground  = interfaceHolder.GUISprites[(int)ConstantHolder.GUIMemberImages.PortraitBackground].copySprite();
            abilityPanelBackground = interfaceHolder.GUISprites[(int)ConstantHolder.GUIMemberImages.AbilityBackground].copySprite();
            mouseoverBackground    = interfaceHolder.GUISprites[(int)ConstantHolder.GUIMemberImages.MouseOverBackground].copySprite();
            healthPanelFrame       = interfaceHolder.GUISprites[(int)ConstantHolder.GUIMemberImages.PortraitFrame].copySprite();
            abilityPanelFrame      = interfaceHolder.GUISprites[(int)ConstantHolder.GUIMemberImages.AbilityFrame].copySprite();
            mouseOverFrame         = interfaceHolder.GUISprites[(int)ConstantHolder.GUIMemberImages.MouseOverFrame].copySprite();
            healthBar     = interfaceHolder.GUISprites[(int)ConstantHolder.GUIMemberImages.HealthBar].copySprite();
            healthBarM    = interfaceHolder.GUISprites[(int)ConstantHolder.GUIMemberImages.HealthBar].copySprite();
            energyBar     = interfaceHolder.GUISprites[(int)ConstantHolder.GUIMemberImages.EnergyBar].copySprite();
            energyBarM    = interfaceHolder.GUISprites[(int)ConstantHolder.GUIMemberImages.EnergyBar].copySprite();
            experienceBar = interfaceHolder.GUISprites[(int)ConstantHolder.GUIMemberImages.ExperienceBar].copySprite();
        }
Example #7
0
 /// <summary>
 /// Gets the TextureHolder, and sets up the list of views.
 /// </summary>
 private GUIManager()
 {
     buttons       = new List <Button>();
     textureHolder = InterfaceTextureHolder.Holder;
 }