Ejemplo n.º 1
0
        private void DrawTextComponent(TextObject component, GraphicObject parent)
        {
            component.offset.X = parent.Size.X / 100 * component.ioffset.X;
            component.offset.Y = parent.Size.Y / 100 * component.ioffset.Y;

            component.Init = true;

            //if (component.isCentered)

            string temp = "";

            Vector2 off = component.offset;

            if (component.Text.StartsWith("@"))
            {
                if (component.Text == "@currentRes")
                    temp = Configuration.Width.ToString() + "x" + Configuration.Height.ToString();

                // Number Of Items
                if (component.Text == "@NumberOfApples")
                {
                    if(GameHandler.Inventory.NumberOfApples > 0)
                        temp = "x" + Convert.ToString(GameHandler.Inventory.NumberOfApples);
                }
                if (component.Text == "@NumberOfChilli")
                {
                    if (GameHandler.Inventory.NumberOfChilli > 0)
                        temp = "x" + Convert.ToString(GameHandler.Inventory.NumberOfChilli);
                }
                if (component.Text == "@NumberOfGoldenApples")
                {
                    if (GameHandler.Inventory.NumberOfGoldenApples > 0)
                        temp = "x" + Convert.ToString(GameHandler.Inventory.NumberOfGoldenApples);
                }
                if (component.Text == "@NumberOfHoney")
                {
                    if (GameHandler.Inventory.NumberOfHoney > 0)
                        temp = "x" + Convert.ToString(GameHandler.Inventory.NumberOfHoney);
                }
                if (component.Text == "@NumberOfSpringWater")
                {
                    if (GameHandler.Inventory.NumberOfSpringWater > 0)
                        temp = "x" + Convert.ToString(GameHandler.Inventory.NumberOfSpringWater);
                }

                if (component.Text == "@Fullscreen")
                {
                    if (Configuration.Fullscreen)
                        temp = "Windowed";
                    else
                        temp = "Fullscreen";
                }

                // -- HOOK UP PLAYER STATISTICS HERE -- \\
                // Player Statistics
                if (component.Text == "@PlayerWeight")
                    temp = "Weight: " + GameHandler.Player.Dominant.Weight.Level + "/" + GameHandler.Player.Dominant.Weight.Maximum;
                if (component.Text == "@PlayerStrength")
                    temp = "Strength: " + GameHandler.Player.Dominant.Strength.Level + "/" + GameHandler.Player.Dominant.Strength.Maximum;
                if (component.Text == "@PlayerDexterity")
                    temp = "Dexterity: " + GameHandler.Player.Dominant.Dexterity.Level + "/" + GameHandler.Player.Dominant.Dexterity.Maximum;
                if (component.Text == "@PlayerEndurance")
                    temp = "Endurance: " + GameHandler.Player.Dominant.Endurance.Level + "/" + GameHandler.Player.Dominant.Endurance.Maximum;
                if (component.Text == "@PlayerHealth")
                    temp = "Health: " + GameHandler.Player.Dominant.Health.Level + "/" + GameHandler.Player.Dominant.Health.Maximum;
                if (component.Text == "@PlayerSpeed")
                    temp = "Speed: " + GameHandler.Player.Dominant.Speed.Level + "/" + GameHandler.Player.Dominant.Speed.Maximum;

                // Behavioural Traits
                if (component.Text == "@PlayerObedience")
                    temp = "Obedience: " + GameHandler.Player.Dominant.Obedience.Level + "/" + GameHandler.Player.Dominant.Obedience.Maximum;
                if (component.Text == "@PlayerAggressiveness")
                    temp = "Aggressiveness: " + GameHandler.Player.Dominant.Agressiveness.Level + "/" + GameHandler.Player.Dominant.Agressiveness.Maximum;
                if (component.Text == "@PlayerFocus")
                    temp = "Focus: " + GameHandler.Player.Dominant.Focus.Level + "/" + GameHandler.Player.Dominant.Strength.Maximum;

                // Physical Traits
                if (component.Text == "@PlayerSpinalColumns")
                    temp = "Spinal Columns: " + GameHandler.Player.Dominant.SpinalColumns.Level + "/"
                        + GameHandler.Player.Dominant.SpinalColumns.Maximum;
                if (component.Text == "@PlayerTailColumns")
                    temp = "Tail Columns: " + GameHandler.Player.Dominant.SpinalColumns.Level + "/"
                        + GameHandler.Player.Dominant.SpinalColumns.Maximum;

                // -- HOOK UP SELECTED STATISTICS HERE (USING GAMEHANDLER.INVENTORY.SelectedDNA) -- \\
                // Selected DNA Statistics
                if (GameHandler.Inventory.SelectedDNA != null)
                {
                    if (component.Text == "@SelectedWeight")
                        temp = "Weight: " + GameHandler.Inventory.SelectedDNA.Dominant.Weight.Level + "/" + GameHandler.Inventory.SelectedDNA.Dominant.Weight.Maximum;
                    if (component.Text == "@SelectedStrength")
                        temp = "Strength: " + GameHandler.Inventory.SelectedDNA.Dominant.Strength.Level + "/" + GameHandler.Inventory.SelectedDNA.Dominant.Strength.Maximum;
                    if (component.Text == "@SelectedDexterity")
                        temp = "Dexterity: " + GameHandler.Inventory.SelectedDNA.Dominant.Dexterity.Level + "/" + GameHandler.Inventory.SelectedDNA.Dominant.Dexterity.Maximum;
                    if (component.Text == "@SelectedEndurance")
                        temp = "Endurance: " + GameHandler.Inventory.SelectedDNA.Dominant.Endurance.Level + "/" + GameHandler.Inventory.SelectedDNA.Dominant.Endurance.Maximum;
                    if (component.Text == "@SelectedHealth")
                        temp = "Health: " + GameHandler.Inventory.SelectedDNA.Dominant.Health.Level + "/" + GameHandler.Inventory.SelectedDNA.Dominant.Health.Maximum;
                    if (component.Text == "@SelectedSpeed")
                        temp = "Speed: " + GameHandler.Inventory.SelectedDNA.Dominant.Speed.Level + "/" + GameHandler.Inventory.SelectedDNA.Dominant.Speed.Maximum;

                    // Selected DNA Behavioural Traits
                    if (component.Text == "@SelectedObedience")
                        temp = "Obedience: " + GameHandler.Inventory.SelectedDNA.Dominant.Obedience.Level + "/" + GameHandler.Inventory.SelectedDNA.Dominant.Obedience.Maximum;
                    if (component.Text == "@SelectedAggressiveness")
                        temp = "Aggressiveness: " + GameHandler.Inventory.SelectedDNA.Dominant.Agressiveness.Level + "/" + GameHandler.Inventory.SelectedDNA.Dominant.Agressiveness.Maximum;
                    if (component.Text == "@SelectedFocus")
                        temp = "Focus: " + GameHandler.Inventory.SelectedDNA.Dominant.Focus.Level + "/" + GameHandler.Inventory.SelectedDNA.Dominant.Focus.Maximum;
                }
                else
                {
                    if (component.Text == "@SelectedWeight")
                        temp = "Weight: -";
                    if (component.Text == "@SelectedStrength")
                        temp = "Strength: -";
                    if (component.Text == "@SelectedDexterity")
                        temp = "Dexterity: -";
                    if (component.Text == "@SelectedEndurance")
                        temp = "Endurance: -";
                    if (component.Text == "@SelectedHealth")
                        temp = "Health: -";
                    if (component.Text == "@SelectedSpeed")
                        temp = "Speed: -";

                    // Selected DNA Behavioural Traits
                    if (component.Text == "@SelectedObedience")
                        temp = "Obedience: -";
                    if (component.Text == "@SelectedAggressiveness")
                        temp = "Aggressiveness: -";
                    if (component.Text == "@SelectedFocus")
                        temp = "Focus: -";
                }

                // Player CURRENT Health
                if (component.Text == "@PlayerCurrentHealth")
                    temp = "Health: " + Convert.ToString(GameHandler.Player.Health) + "/" + GameHandler.Player.Dominant.Health.Level;

                // Enemy CURRENT Health
                if (component.Text == "@EnemyCurrentHealth")
                    temp = "Health: " + Convert.ToString(BattleHandler.Enemy.Health) + "/" + BattleHandler.Enemy.Dominant.Health.Level;

                // Selected Creature Health
                if (component.Text == "@SelectedCreatureHealth")
                    if(GameHandler.SelectedCreature != null)
                        temp = "Health: " + Convert.ToString(GameHandler.SelectedCreature.Health) + "/" + GameHandler.SelectedCreature.Dominant.Health.Level;

                // Selected Item
                if (GameHandler.Inventory.SelectedItem != null)
                {
                    if (component.Text == "@SelectedItemName")
                        temp = GameHandler.Inventory.SelectedItem.Name;
                    if (component.Text == "@SelectedItemDescription")
                        temp = GameHandler.Inventory.SelectedItem.Description;
                }

                // Sign text
                if (component.Text == "@CurrentSignText")
                    temp = GameHandler.CurrentMessageBoxText;

                // Battle text
                if (component.Text == "@LastPlayerMove")
                {
                    if (BattleHandler.LastPlayerAction != null)
                        temp = BattleHandler.LastPlayerAction;
                    else
                        temp = " ";
                }

                if (component.Text == "@LastEnemyMove")
                {
                    if (BattleHandler.LastEnemyAction != null)
                        temp = BattleHandler.LastEnemyAction;
                    else
                        temp = " ";
                }
            }
            else
                temp = component.Text;

            if (component.isCentered)
                off -= Game.Content.Load<SpriteFont>(component.Font).MeasureString(temp) / 2;

            if (parent.isClickable)
            {
                Rectangle TextureRectangle = new Rectangle((int)parent.Position.X, (int)parent.Position.Y, (int)parent.Size.X, (int)parent.Size.Y);
                if (TextureRectangle.Contains(new Point(InputHandler.MouseX, InputHandler.MouseY)))
                    SpriteManager.DrawString(Game.Content.Load<SpriteFont>(component.Font), temp, parent.Position + off, new Color(component.highlightColor));
                else
                    SpriteManager.DrawString(Game.Content.Load<SpriteFont>(component.Font), temp, parent.Position + off, new Color(component.fontColor));
            }
            else
                SpriteManager.DrawString(Game.Content.Load<SpriteFont>(component.Font), temp, parent.Position + off, new Color(component.fontColor));
        }
Ejemplo n.º 2
0
        private void ClickableComponent(GraphicObject component)
        {
            Rectangle TextureRectangle = new Rectangle((int)component.Position.X, (int)component.Position.Y, (int)component.Size.X, (int)component.Size.Y);

            if (TextureRectangle.Contains(InputHandler.MouseX, InputHandler.MouseY)&&InputHandler.LeftClickPressed)
            {
                #region Main Menu Actions
                if (component.Action.Equals("continue"))
                {
                    currentScreen = Screens.Loading;
                    lastScreen = Screens.Loading;
                    temp = (Game.Content.Load<GameLibrary.Interface>("Interface/LoadingScreen"));
                }
                if (component.Action.Equals("Quit"))
                    Game.Exit();
                if (component.Action.Equals("Options"))
                    subMenu = Game.Content.Load<GameLibrary.Interface>("Interface/SubMenuOptions");
                if (component.Action.Equals("DeleteSubMenu"))
                    CloseSubMenu();
                if (component.Action.Equals("PlusRes"))
                {
                    DisplayMode tmp = dm[ResID];
                    Configuration.Width = tmp.Width;
                    Configuration.Height = tmp.Height;

                    ResID++;
                    if (ResID >= Game.GraphicsDevice.Adapter.SupportedDisplayModes.Count<DisplayMode>())
                        ResID = 0;
                }
                if (component.Action.Equals("MinusRes"))
                {
                    DisplayMode tmp = dm[ResID];
                    Configuration.Width = tmp.Width;
                    Configuration.Height = tmp.Height;

                    if (ResID <= 0)
                        ResID = (short)(Game.GraphicsDevice.Adapter.SupportedDisplayModes.Count<DisplayMode>());
                    ResID--;
                }
                if (component.Action.Equals("Fullscreen"))
                {
                    Configuration.Toggle();
                }
                if (component.Action.Equals("DeleteSaveGame"))
                    SaveHandler.DeleteSave();
                if (component.Action.Equals("openDeleteSaveBox"))
                    subMenu = Game.Content.Load<GameLibrary.Interface>("Interface/DeleteSaveBox");

                if (component.Action.Equals("OpenControls"))
                    temp = Game.Content.Load<GameLibrary.Interface>("Interface/Help/Controls");
                if (component.Action.Equals("OpenInstructions"))
                    temp = Game.Content.Load<GameLibrary.Interface>("Interface/Help/Instructions");
                if (component.Action.Equals("OpenHelpMenu"))
                {
                    temp = Game.Content.Load<GameLibrary.Interface>("Interface/Help/HelpMenu");
                    prevScreen = currentScreen;
                }
                #endregion

                #region Customizer Actions
                // ADD BUILD IDs HERE
                if (component.Action.Equals("SelectStrengthBuild") || component.Action.Equals("SelectSpeedBuild") || component.Action.Equals("SelectEnduranceBuild"))
                {
                    if (component.Action.Equals("SelectStrengthBuild"))
                        GameHandler.Player = new Creature(0024, Game.Content.Load<Texture2D>("Sprites/handler"), GameHandler.TileMap.PlayerSpawn, 2f, 32, 32, 100); // Strength Build ugh i can't find the strength to continue my search
                    if (component.Action.Equals("SelectSpeedBuild"))
                        GameHandler.Player = new Creature(0012, Game.Content.Load<Texture2D>("Sprites/handler"), GameHandler.TileMap.PlayerSpawn, 2f, 32, 32, 100); // Speed Build
                    if (component.Action.Equals("SelectEnduranceBuild"))
                        GameHandler.Player = new Creature(0005, Game.Content.Load<Texture2D>("Sprites/handler"), GameHandler.TileMap.PlayerSpawn, 2f, 32, 32, 100); // Endurance Build
                    //1024 == All traits

                    GameHandler.Enabled = true;
                    GameHandler.Visible = true;
                    Interface.currentScreen = Screens.LevelMenu;
                    SaveHandler.SaveGame(); // Save out creature details
                }
                #endregion

                #region Lab Menu Actions
                if (component.Action.Equals("Creature"))
                    subMenu = Game.Content.Load<GameLibrary.Interface>("Interface/SubMenuCreatureInfo");
                if (component.Action.Equals("OpenDNAInventory"))
                    subMenu = Game.Content.Load<GameLibrary.Interface>("Interface/SubMenuDNAInventory");
                if (component.Action.Equals("BreedCurrentSelection"))
                {
                    GameHandler.Inventory.UseDNA();
                    ResetListBoxes(subMenu.content);
                    subMenu = new GameLibrary.Interface();
                    ToggleAnimations();
                }
                if (component.Action.Equals("exit"))
                    Interface.currentScreen = Screens.LevelMenu;
                if (component.Action.Equals("ExitHelp"))
                {
                    if (prevScreen == Screens.MainMenu)
                        temp = Game.Content.Load<GameLibrary.Interface>("Interface/MainMenu");
                    else
                        temp = Game.Content.Load<GameLibrary.Interface>("Interface/LevelMenu");
                }
                #endregion

                #region Global Dial Actions
                if(component.Action.Equals("Inventory"))
                    subMenu = Game.Content.Load<GameLibrary.Interface>("Interface/SubMenuInventory");
                #endregion

                #region Inventory Actions
                if (component.Action.Equals("UseSelectedItem"))
                    if(GameHandler.Inventory.SelectedItem != null)
                        GameHandler.Inventory.UseItem(GameHandler.Inventory.SelectedItem.ID);
                if (component.Action.Equals("SelectApple"))
                    if (GameHandler.Inventory.NumberOfApples > 0)
                        GameHandler.Inventory.SetItem((int)Item.ItemName.Apple, Game.Content);
                if (component.Action.Equals("SelectGoldenApple"))
                    if (GameHandler.Inventory.NumberOfGoldenApples > 0)
                        GameHandler.Inventory.SetItem((int)Item.ItemName.Golden_Apple, Game.Content);
                if (component.Action.Equals("SelectChilli"))
                    if (GameHandler.Inventory.NumberOfChilli > 0)
                        GameHandler.Inventory.SetItem((int)Item.ItemName.Chilli, Game.Content);
                if (component.Action.Equals("SelectSpringWater"))
                    if (GameHandler.Inventory.NumberOfSpringWater > 0)
                        GameHandler.Inventory.SetItem((int)Item.ItemName.Spring_Water, Game.Content);
                if (component.Action.Equals("SelectHoney"))
                    if (GameHandler.Inventory.NumberOfHoney > 0)
                        GameHandler.Inventory.SetItem((int)Item.ItemName.Honey, Game.Content);
                #endregion

                #region Level Menu Actions
                if (component.Action.Equals("openExitBox"))
                    subMenu = Game.Content.Load<GameLibrary.Interface>("Interface/ExitBox");
                if (component.Action.Equals("exitGame"))
                    Game.Exit();
                #endregion

                #region Game Over Actions
                if (component.Action.Equals("OpenMenu"))
                    temp = Game.Content.Load<GameLibrary.Interface>("Interface/MainMenu");
                #endregion

                #region Battle Actions
                if (component.Action.Equals("Defend"))
                {
                    BattleHandler.ActionSelected = true;
                    BattleHandler.PlayerActionType = BattleHandler.ActionType.Defend;
                }
                if (component.Action.Equals("Flee"))
                {
                    if (BattleHandler.CanSelectAction)
                    {
                        BattleHandler.ActionSelected = true;
                        BattleHandler.PlayerActionType = BattleHandler.ActionType.Flee;
                    }
                    else
                    {
                        GameHandler.CurrentMessageBoxText = "You cannot do that right now!";
                        ShowMessageBox();
                    }
                }
                #endregion

                DebugLog.WriteLine(string.Format("Button Clicked Action =  {0} ", component.Action));
            }
        }
Ejemplo n.º 3
0
        private void DrawGraphicComponent(GraphicObject component, ref Object2D parent)
        {
            if (component.TextureLocation != "")
            {
                if (component.TextureLocation.StartsWith("@"))
                {
                    if (component.TextureLocation == "@AppleTexture")
                    {
                        if (GameHandler.Inventory.NumberOfApples > 0)
                            component.Texture = Game.Content.Load<Texture2D>("Sprites\\Apple");
                        else
                            component.Texture = Game.Content.Load<Texture2D>("Sprites\\NullItems\\NullApple");
                    }
                    if(component.TextureLocation == "@GoldenAppleTexture")
                    {
                        if (GameHandler.Inventory.NumberOfGoldenApples > 0)
                            component.Texture = Game.Content.Load<Texture2D>("Sprites\\GoldenApple");
                        else
                            component.Texture = Game.Content.Load<Texture2D>("Sprites\\NullItems\\NullGoldenApple");
                    }
                    if(component.TextureLocation == "@SpringWaterTexture")
                    {
                        if (GameHandler.Inventory.NumberOfSpringWater > 0)
                            component.Texture = Game.Content.Load<Texture2D>("Sprites\\SpringWater");
                        else
                            component.Texture = Game.Content.Load<Texture2D>("Sprites\\NullItems\\NullSpringWater");
                    }
                    if(component.TextureLocation == "@HoneyTexture")
                    {
                        if (GameHandler.Inventory.NumberOfHoney > 0)
                            component.Texture = Game.Content.Load<Texture2D>("Sprites\\Honey");
                        else
                            component.Texture = Game.Content.Load<Texture2D>("Sprites\\NullItems\\NullHoney");
                    }
                    if (component.TextureLocation == "@ChilliTexture")
                    {
                        if (GameHandler.Inventory.NumberOfChilli > 0)
                            component.Texture = Game.Content.Load<Texture2D>("Sprites\\Chilli");
                        else
                            component.Texture = Game.Content.Load<Texture2D>("Sprites\\NullItems\\NullChilli");
                    }
                    if (component.TextureLocation == "@PlayerCanFlyIcon")
                    {
                        if (GameHandler.Player.canFly)
                            component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/FlyingIcon");
                        else
                            component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/BlankIcon");
                    }
                    if (component.TextureLocation == "@PlayerCanClimbIcon")
                    {
                        if (GameHandler.Player.canClimb)
                            component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/ClimingIcon");
                        else
                            component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/BlankIcon");
                    }
                    if (component.TextureLocation == "@PlayerCanSwimIcon")
                    {
                        if (GameHandler.Player.canSwim)
                            component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/SwimmingIcon");
                        else
                            component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/BlankIcon");
                    }
                    if (component.TextureLocation == "@SelectedCanFly")
                    {
                        if (GameHandler.Inventory.SelectedDNA != null)
                        {
                            if (GameHandler.Inventory.SelectedDNA.canFly)
                                component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/FlyingIcon");
                            else
                                component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/BlankIcon");
                        }
                        else
                            component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/BlankIcon");
                    }
                    if (component.TextureLocation == "@SelectedCanClimb")
                    {
                        if (GameHandler.Inventory.SelectedDNA != null)
                        {
                            if (GameHandler.Inventory.SelectedDNA.canClimb)
                                component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/ClimingIcon");
                            else
                                component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/BlankIcon");
                        }
                        else
                            component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/BlankIcon");
                    }
                    if (component.TextureLocation == "@SelectedCanSwim")
                    {
                        if (GameHandler.Inventory.SelectedDNA != null)
                        {
                            if (GameHandler.Inventory.SelectedDNA.canSwim)
                                component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/SwimmingIcon");
                            else
                                component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/BlankIcon");
                        }
                        else
                            component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/BlankIcon");
                    }
                    if (component.TextureLocation == "@CurrentAttributeInUse")
                    {
                        if (GameHandler.CurrentAttributeInUse != Attributes.None)
                        {
                            if(GameHandler.Player.canFly)
                                component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/FlyingIcon");
                            else
                            {
                                if (GameHandler.CurrentAttributeInUse == Attributes.FlyingAndClimbing)
                                    component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/ClimingIcon");
                                if (GameHandler.CurrentAttributeInUse == Attributes.FlyingAndSwimming)
                                    component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/SwimmingIcon");
                            }
                        }
                        else
                        {
                            component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/Icons/IconBackground");
                        }
                    }
                }
                else if (component.Texture == null)
                    component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/" + (component as GraphicObject).TextureLocation);
                }
                else if (component.Texture == null)
                    component.Texture = new Texture2D(Game.GraphicsDevice, 1, 1);

                if (((component.GetType() == typeof(GraphicObject)) || component.GetType() == typeof(Scroller)) && (parent.GetType() == typeof(GraphicObject)))
                {
                    component.Size.X = ((parent as GraphicObject).Size.X / 100 * component.iSize.X);
                    component.Size.Y = ((parent as GraphicObject).Size.Y / 100 * component.iSize.Y);
                    component.Position.X = ((parent as GraphicObject).Size.X / 100 * component.iPosition.X) - (component.Size.X / 2);
                    component.Position.Y = ((parent as GraphicObject).Size.Y / 100 * component.iPosition.Y) - (component.Size.Y / 2);
                    component.Position += (parent as GraphicObject).Position;
                }

                /*
                if(component.isCentered)
                    component.offset = new Vector2(component.Size.X, component.Size.Y) / 2;
                */

            if (component.fullscreen)
            {
                component.Position.X = 0;
                component.Position.Y = 0;
                component.Size.X = Game.GraphicsDevice.Viewport.Width;
                component.Size.Y = Game.GraphicsDevice.Viewport.Height;

                SpriteManager.Draw(component.Texture, Configuration.Bounds, Color.White);
            }
            else
            {
                if (component.isClickable)
                {
                    Rectangle textureRect = new Rectangle((int)component.Position.X, (int)component.Position.Y, (int)component.Size.X, (int)component.Size.Y);
                    if(textureRect.Contains(new Point(InputHandler.MouseX, InputHandler.MouseY)))
                        SpriteManager.Draw(component.Texture, new Rectangle((int)component.Position.X - 10, (int)component.Position.Y - 10, (int)component.Size.X+20, (int)component.Size.Y+20), null, Color.White);
                    else
                        SpriteManager.Draw(component.Texture, new Rectangle((int)component.Position.X, (int)component.Position.Y, (int)component.Size.X, (int)component.Size.Y), null, Color.White);
                }
                else
                    SpriteManager.Draw(component.Texture, new Rectangle((int)component.Position.X, (int)component.Position.Y, (int)component.Size.X, (int)component.Size.Y), null, Color.White);
            }
        }
Ejemplo n.º 4
0
        public void DrawAnimatedObject(AnimatedObject component, GraphicObject parent)
        {
            if (component.Texture == null)
            {
                component.Texture = Game.Content.Load<Texture2D>("Interface/Assets/" + component.TextureLocation);
                component.FrameRect = new Rectangle(0, 0, component.FrameSize.X, component.FrameSize.Y);
            }

            component.Size.X = parent.Size.X / 100 * component.iSize.X;
            component.Size.Y = parent.Size.Y / 100 * component.iSize.Y;
            component.Position.X = parent.Size.X / 100 * component.iPosition.X - (component.Size.X / 2);
            component.Position.Y = parent.Size.Y / 100 * component.iPosition.Y - (component.Size.Y / 2);
            component.Position += parent.Position;

            SpriteManager.Draw(component.Texture, new Rectangle((int)component.Position.X, (int)component.Position.Y, (int)component.Size.X, (int)component.Size.Y), component.FrameRect, Color.White);
        }