public buyAlert(Rectangle rectangle, Texture2D texture, BaseEquip equip, String method, Object[] param) : base(rectangle, texture) { //fuente font = Fonts.arial_12; //Language language = new Language(); //Equipo this.equip = equip; //Filas y columnas columns = new float[] { Globals.gameSize.X * 0.31f, Globals.gameSize.X * 0.62f }; rows = new float[] { Globals.gameSize.Y * 0.35f, Globals.gameSize.Y * 0.4f, Globals.gameSize.Y * 0.7f }; //posicionamiento del alert. alertPos = new Vector2( PaintToWinUtils.centerArea(new Vector2(rectangle.X, Globals.gameSize.X), new Vector2(0, rectangle.Width)), PaintToWinUtils.centerArea(new Vector2(rectangle.Y, Globals.gameSize.Y), new Vector2(0, rectangle.Height))); //tamaño, posicionamiento y creación del boton. buttonSize = new Vector2(150, 30); Vector2 buttonPos = new Vector2( PaintToWinUtils.centerArea(new Vector2(alertPos.X, alertPos.X + rectangle.Width), new Vector2(0, buttonSize.X)), rectangle.Height * 0.75f + alertPos.Y); acceptButton = new Button <T>(new Rectangle((int)(buttonPos.X - Globals.gameSize.X * 0.1f), (int)buttonPos.Y, (int)buttonSize.X, (int)buttonSize.Y), texture, Textures.hoverButton, method, param, "gameMenuMarket_buy", true); cancelButton = new Button <T>(new Rectangle((int)(buttonPos.X + Globals.gameSize.X * 0.1f), (int)buttonPos.Y, (int)buttonSize.X, (int)buttonSize.Y), texture, Textures.hoverButton, method, param, "optionsscreen_exit", true); }
public override void Draw() { Globals.spriteBatch.Begin(); //Posicionamiento del texto textPos = new Vector2( PaintToWinUtils.centerTextX(new Vector2(0, Globals.gameSize.X), font, text), PaintToWinUtils.centerTextY(new Vector2(0, Globals.gameSize.Y), font, text)); //Dibujado del texto Globals.spriteBatch.DrawString(font, text, textPos, Color.White); Globals.spriteBatch.End(); }
public StageMap(Vector2 mapSize) { //idioma language = new Language(); //tamaño mapa this.mapSize = mapSize; //tamaño casilla tileSize = Tile.TILE_SIZE; //camara y player camera = new Camera(); player = new Player(camera, new Vector2(10, 5)); player.loadPlayer(); //mapa loadScenario(); loadElements(); //Texto del trigger message = language.getMessage("trigger_talk"); messagePos = PaintToWinUtils.centerTextX(new Vector2(0, Globals.gameSize.X), Fonts.arial_12, message); //Calcula cuanto dinero recibirá el jugador si gana la partida if (GameScreen.playerWin) { int k = 0; switch (Globals.difficult) { case 0: k = 400; break; case 1: k = 300; break; case 2: k = 200; break; } player.setMoney(player.getMoney() + player.getLvlGame() * k); player.setLvlGame(player.getLvlGame() + 1); } }
public override void Draw() { String text = ""; int posTextX; Globals.spriteBatch.Begin(); foreach (Component c in components) { c.draw(); } //Resolución Globals.spriteBatch.DrawString(font, language.getMessage("optionsscreen_resolution"), new Vector2(columns[0], rows[1]), Color.White); text = resolutions[resPos].X + "x" + resolutions[resPos].Y; posTextX = PaintToWinUtils.centerTextX(new Vector2(columns[1] + buttonSize, columns[3]), font, text); Globals.spriteBatch.DrawString(font, text, new Vector2(posTextX, rows[1]), Color.White); //Modo de visualización Globals.spriteBatch.DrawString(font, language.getMessage("optionsscreen_mode"), new Vector2(columns[0], rows[2]), Color.White); text = modes[modePos]; posTextX = PaintToWinUtils.centerTextX(new Vector2(columns[1] + buttonSize, columns[3]), font, text); Globals.spriteBatch.DrawString(font, text, new Vector2(posTextX, rows[2]), Color.White); //Dificultad Globals.spriteBatch.DrawString(font, language.getMessage("optionsscreen_dificult"), new Vector2(columns[0], rows[3]), Color.White); text = difficults[diffPos]; posTextX = PaintToWinUtils.centerTextX(new Vector2(columns[1] + buttonSize, columns[3]), font, text); Globals.spriteBatch.DrawString(font, text, new Vector2(posTextX, rows[3]), Color.White); //Idioma Globals.spriteBatch.DrawString(font, language.getMessage("optionsscreen_language"), new Vector2(columns[0], rows[4]), Color.White); text = languages[langPos]; posTextX = PaintToWinUtils.centerTextX(new Vector2(columns[1] + buttonSize, columns[3]), font, text); Globals.spriteBatch.DrawString(font, text, new Vector2(posTextX, rows[4]), Color.White); foreach (Component c in components) { if (c is Alert <OptionsScreen> ) { c.draw(); } } Globals.spriteBatch.End(); }
public Button(Rectangle rectangle, Texture2D texture, Texture2D hoverTexture, String method, Object[] param, String codeText, Boolean border) : base(rectangle, texture) { content = typeof(T).GetMethod(method); this.param = param; hover = false; font = Fonts.arial_12; if (codeText != null) { this.text = new Language().getMessage(codeText); textPos = new Vector2( PaintToWinUtils.centerTextX(new Vector2(rectangle.X, rectangle.X + rectangle.Width), font, text), PaintToWinUtils.centerTextY(new Vector2(rectangle.Y, rectangle.Y + rectangle.Height), font, text)); } borderButton = border; this.hoverTexture = hoverTexture; }
public override void Draw() { //Posición texto textPos = new Vector2( PaintToWinUtils.centerTextX(new Vector2(columns[0], columns[0] + columns[1]), font, text), PaintToWinUtils.centerTextY(new Vector2(rows[0], rows[0] + rows[1]), font, text)); Globals.spriteBatch.Begin(); //Dibuja todos los componentes foreach (Component c in components) { c.draw(); } //Texto Globals.spriteBatch.DrawString(Fonts.arial_12, text, textPos, Color.Black); Globals.spriteBatch.End(); }
/** Dibuja las lineas entre skills */ private void drawSkillLines() { int textX; //de primera a segunda Color c1T2 = calculateColorSkillLine(skills[0], skills[1]); Globals.spriteBatch.Draw(Textures.skillLine, new Rectangle(150 + 32, 90 + 32, 3, 3), new Rectangle(0, 3, 3, 3), c1T2); Globals.spriteBatch.Draw(Textures.skillLine, new Rectangle(150 + 32, 93 + 32, 3, 75), new Rectangle(3, 0, 3, 3), c1T2); Globals.spriteBatch.Draw(Textures.skillLine, new Rectangle(153 + 32, 90 + 32, 168 - 3, 3), new Rectangle(0, 0, 3, 3), c1T2); textX = PaintToWinUtils.centerTextX(new Vector2(150 + 32, 150 + 32 + 168), Fonts.arial_12, "0 / 0"); Globals.spriteBatch.DrawString(Fonts.arial_12, skills[0].getLevel().X + " / " + skills[1].getRequirements(), new Vector2(textX, 106), c1T2); //de segunda a tercera Color c2T3 = calculateColorSkillLine(skills[1], skills[2]); Globals.spriteBatch.Draw(Textures.skillLine, new Rectangle(350 + 64, 90 + 32, 136, 3), new Rectangle(0, 0, 3, 3), c2T3); textX = PaintToWinUtils.centerTextX(new Vector2(350 + 64, 350 + 64 + 136), Fonts.arial_12, "0 / 0"); Globals.spriteBatch.DrawString(Fonts.arial_12, skills[1].getLevel().X + " / " + skills[2].getRequirements(), new Vector2(textX, 106), c2T3); //de primera a cuarta Color c1T4 = calculateColorSkillLine(skills[0], skills[3]); Globals.spriteBatch.Draw(Textures.skillLine, new Rectangle(150 + 64, 200 + 32, 136, 3), new Rectangle(0, 0, 3, 3), c1T4); textX = PaintToWinUtils.centerTextX(new Vector2(150 + 64, 150 + 64 + 136), Fonts.arial_12, "0 / 0"); Globals.spriteBatch.DrawString(Fonts.arial_12, skills[0].getLevel().X + " / " + skills[3].getRequirements(), new Vector2(textX, 216), c1T4); //de primera a quinta Color c1T5 = calculateColorSkillLine(skills[0], skills[4]); Globals.spriteBatch.Draw(Textures.skillLine, new Rectangle(150 + 32, 310 + 32, 3, 3), new Rectangle(3, 3, 3, 3), c1T5); Globals.spriteBatch.Draw(Textures.skillLine, new Rectangle(150 + 32, 200 + 64, 3, 78), new Rectangle(3, 0, 3, 3), c1T5); Globals.spriteBatch.Draw(Textures.skillLine, new Rectangle(153 + 32, 310 + 32, 165, 3), new Rectangle(0, 0, 3, 3), c1T5); textX = PaintToWinUtils.centerTextX(new Vector2(150 + 32, 150 + 32 + 168), Fonts.arial_12, "0 / 0"); Globals.spriteBatch.DrawString(Fonts.arial_12, skills[0].getLevel().X + " / " + skills[4].getRequirements(), new Vector2(textX, 326), c1T5); }
public Alert(Rectangle rectangle, Texture2D texture, String text, String method, Object[] param) : base(rectangle, texture) { //fuente font = Fonts.arial_12; //posicionamiento del alert. alertPos = new Vector2( PaintToWinUtils.centerArea(new Vector2(0, Globals.gameSize.X), new Vector2(0, rectangle.Width)), PaintToWinUtils.centerArea(new Vector2(0, Globals.gameSize.Y), new Vector2(0, rectangle.Height))); //texto y posicionamiento del texto del alert. this.text = text; textPos = new Vector2( PaintToWinUtils.centerTextX(new Vector2(alertPos.X, alertPos.X + rectangle.Width), Fonts.arial_12, text), PaintToWinUtils.centerTextY(new Vector2(alertPos.Y, alertPos.Y + rectangle.Height), Fonts.arial_12, text)); //tamaño, posicionamiento y creacion del boton. buttonSize = new Vector2(150, 30); Vector2 buttonPos = new Vector2( PaintToWinUtils.centerArea(new Vector2(alertPos.X, alertPos.X + rectangle.Width), new Vector2(0, buttonSize.X)), rectangle.Height * 0.75f + alertPos.Y); button = new Button <T>(new Rectangle((int)buttonPos.X, (int)buttonPos.Y, (int)buttonSize.X, (int)buttonSize.Y), texture, Textures.hoverButton, method, param, "optionsscreen_accept", true); }
/** Centrar texto en X */ private int centerText(String text, SpriteFont font) { return(PaintToWinUtils.centerTextX(new Vector2(0, Globals.gameSize.X), font, text)); }
/** Inicializacion del reload */ private void reloadInit() { reloadState = 1; reloadNedle = 0; reloadValue = PaintToWinUtils.generateRandomNumber(50, 100 - (5 + reloadSkillArea)); }