//////////////////////////////////////// public override void draw(SpriteBatch b) { //////////////////////////////////////// if (loading && timerToLoad <= 1) { if (!didModeSelect) { int x = xPositionOnScreen + width / 4; int y = yPositionOnScreen + (int)(height / 5 * 0.5); int w = width / 2; int h = height / 5; buttonX = x; buttonH = h; buttonW = w; buttonY1 = y; IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, "Singleplayer", x + w / 2 - SpriteText.getWidthOfString("Singleplayer") / 2, y + h / 2 - SpriteText.getHeightOfString("Singleplayer") / 2); y += (int)(h * 1.25); buttonY2 = y; IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, "Host", x + w / 2 - SpriteText.getWidthOfString("Host") / 2, y + h / 2 - SpriteText.getHeightOfString("Host") / 2); y += (int)(h * 1.25); buttonY3 = y; IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, "Client", x + w / 2 - SpriteText.getWidthOfString("Client") / 2, y + h / 2 - SpriteText.getHeightOfString("Client") / 2); } else if (modeInit == null) { int x = buttonX, y = buttonY3, w = buttonW, h = buttonH; String str = (Multiplayer.mode == Mode.Host ? "Listen" : "Connect"); if (ipBox != null) { SpriteText.drawString(b, "IP Address:", ipBox.X - SpriteText.getWidthOfString("IP Address:") - 20, ipBox.Y); ipBox.Draw(b); } if (portBox != null) { SpriteText.drawString(b, "Port:", portBox.X - SpriteText.getWidthOfString("IP Address:") - 20, portBox.Y); portBox.Draw(b); } IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, str, x + w / 2 - SpriteText.getWidthOfString(str) / 2, y + h / 2 - SpriteText.getHeightOfString(str) / 2); } else if (Multiplayer.problemStarting) { int x = buttonX, y = buttonY1, w = buttonW, h = buttonH; String str = "Error"; SpriteText.drawString(b, str, x + w / 2 - SpriteText.getWidthOfString(str) / 2, y + h / 2 - SpriteText.getHeightOfString(str) / 2); y = buttonY2; // y = buttonY3; str = "Back"; IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, str, x + w / 2 - SpriteText.getWidthOfString(str) / 2, y + h / 2 - SpriteText.getHeightOfString(str) / 2); } else if (Multiplayer.server != null) { int x = buttonX, y = buttonY1, w = buttonW, h = buttonH; String str = "Start"; /*Util.drawStr("Other players: ", x, buttonY1, Color.White); * foreach ( Server.Client client in Multiplayer.server.clients ) * { * String str_ = "<Client " + ( int )( client.id ) + ">"; * if ( client.farmer != null ) * str_ = client.farmer.name; * * y += 30; * Util.drawStr(str_, x + 25, y, Color.White); * }*/ y = buttonY3; IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, str, x + w / 2 - SpriteText.getWidthOfString(str) / 2, y + h / 2 - SpriteText.getHeightOfString(str) / 2); } else if (Multiplayer.client != null) { int x = buttonX, y = buttonY1, w = buttonW, h = buttonH; /*Util.drawStr("Other players: ", x, buttonY1, Color.White); * foreach (KeyValuePair< byte, Farmer > other in Multiplayer.client.others) * { * String str_ = "<Client " + (int)(other.Key) + ">"; * if (other.Value != null) * str_ = other.Value.name; * * y += 30; * Util.drawStr(str_, x + 25, y, Color.White); * }*/ } base.draw(b); ChatMenu.drawChat(false); return; } //////////////////////////////////////// IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height + Game1.tileSize / 2, Color.White, (float)Game1.pixelZoom, true); for (int i = 0; i < this.gamesToLoadButton.Count <ClickableComponent>(); i++) { if (this.currentItemIndex + i < this.saveGames.Count <Farmer>()) { IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 396, 15, 15), this.gamesToLoadButton[i].bounds.X, this.gamesToLoadButton[i].bounds.Y, this.gamesToLoadButton[i].bounds.Width, this.gamesToLoadButton[i].bounds.Height, ((this.currentItemIndex + i == this.selected && this.timerToLoad % 150 > 75 && this.timerToLoad > 1000) || (this.selected == -1 && this.gamesToLoadButton[i].containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()) && !this.scrolling && !this.deleteConfirmationScreen)) ? (this.deleteButtons[i].containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.White : Color.Wheat) : Color.White, (float)Game1.pixelZoom, false); SpriteText.drawString(b, this.currentItemIndex + i + 1 + ".", this.gamesToLoadButton[i].bounds.X + Game1.pixelZoom * 7 + Game1.tileSize / 2 - SpriteText.getWidthOfString(this.currentItemIndex + i + 1 + ".") / 2, this.gamesToLoadButton[i].bounds.Y + Game1.pixelZoom * 9, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); SpriteText.drawString(b, this.saveGames[this.currentItemIndex + i].Name, this.gamesToLoadButton[i].bounds.X + Game1.tileSize * 2 + Game1.pixelZoom * 9, this.gamesToLoadButton[i].bounds.Y + Game1.pixelZoom * 9, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); b.Draw(Game1.shadowTexture, new Vector2((float)(this.gamesToLoadButton[i].bounds.X + Game1.tileSize + Game1.tileSize - Game1.pixelZoom), (float)(this.gamesToLoadButton[i].bounds.Y + Game1.tileSize * 2 + Game1.pixelZoom * 4)), new Rectangle?(Game1.shadowTexture.Bounds), Color.White, 0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, 0.8f); this.saveGames[this.currentItemIndex + i].FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(0, 0, false, false, null, false), 0, new Rectangle(0, 0, 16, 32), new Vector2((float)(this.gamesToLoadButton[i].bounds.X + Game1.tileSize / 4 + Game1.tileSize + Game1.pixelZoom * 3), (float)(this.gamesToLoadButton[i].bounds.Y + Game1.pixelZoom * 5)), Vector2.Zero, 0.8f, 2, Color.White, 0f, 1f, this.saveGames[this.currentItemIndex + i]); Utility.drawTextWithShadow(b, this.saveGames[this.currentItemIndex + i].dateStringForSaveGame, Game1.dialogueFont, new Vector2((float)(this.gamesToLoadButton[i].bounds.X + Game1.tileSize * 2 + Game1.pixelZoom * 8), (float)(this.gamesToLoadButton[i].bounds.Y + Game1.tileSize + Game1.pixelZoom * 10)), Game1.textColor, 1f, -1f, -1, -1, 1f, 3); Utility.drawTextWithShadow(b, this.saveGames[this.currentItemIndex + i].farmName + " Farm", Game1.dialogueFont, new Vector2((float)(this.gamesToLoadButton[i].bounds.X + this.width - Game1.tileSize * 2) - Game1.dialogueFont.MeasureString(this.saveGames[this.currentItemIndex + i].farmName + " Farm").X, (float)(this.gamesToLoadButton[i].bounds.Y + Game1.pixelZoom * 11)), Game1.textColor, 1f, -1f, -1, -1, 1f, 3); int num = (int)Game1.dialogueFont.MeasureString(Utility.getNumberWithCommas(this.saveGames[this.currentItemIndex + i].Money) + "g").X; Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2((float)(this.gamesToLoadButton[i].bounds.X + this.width - Game1.tileSize * 3 - Game1.pixelZoom * 25 - num), (float)(this.gamesToLoadButton[i].bounds.Y + Game1.tileSize + Game1.pixelZoom * 11)), new Rectangle(193, 373, 9, 9), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, false, 1f, -1, -1, 0.35f); Utility.drawTextWithShadow(b, Utility.getNumberWithCommas(this.saveGames[this.currentItemIndex + i].Money) + "g", Game1.dialogueFont, new Vector2((float)(this.gamesToLoadButton[i].bounds.X + this.width - Game1.tileSize * 3 - Game1.pixelZoom * 15 - num), (float)(this.gamesToLoadButton[i].bounds.Y + Game1.tileSize + Game1.pixelZoom * 11)), Game1.textColor, 1f, -1f, -1, -1, 1f, 3); Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2((float)(this.gamesToLoadButton[i].bounds.X + this.width - Game1.tileSize * 3 - Game1.pixelZoom * 11), (float)(this.gamesToLoadButton[i].bounds.Y + Game1.tileSize + Game1.pixelZoom * 9)), new Rectangle(595, 1748, 9, 11), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, false, 1f, -1, -1, 0.35f); Utility.drawTextWithShadow(b, Utility.getHoursMinutesStringFromMilliseconds(this.saveGames[this.currentItemIndex + i].millisecondsPlayed), Game1.dialogueFont, new Vector2((float)(this.gamesToLoadButton[i].bounds.X + this.width - Game1.tileSize * 3 - Game1.pixelZoom), (float)(this.gamesToLoadButton[i].bounds.Y + Game1.tileSize + Game1.pixelZoom * 11)), Game1.textColor, 1f, -1f, -1, -1, 1f, 3); if (this.deleteButtons.Count <ClickableTextureComponent>() > i) { this.deleteButtons[i].draw(b, Color.White * 0.75f, 1f); } } } if (this.saveGames.Count <Farmer>() == 0) { SpriteText.drawStringHorizontallyCenteredAt(b, "No Saved Games Found", Game1.graphics.GraphicsDevice.Viewport.Bounds.Center.X, Game1.graphics.GraphicsDevice.Viewport.Bounds.Center.Y, 999999, -1, 999999, 1f, 0.88f, false, -1); } this.upArrow.draw(b); this.downArrow.draw(b); if (this.saveGames.Count <Farmer>() > 4) { IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(403, 383, 6, 6), this.scrollBarRunner.X, this.scrollBarRunner.Y, this.scrollBarRunner.Width, this.scrollBarRunner.Height, Color.White, (float)Game1.pixelZoom, false); this.scrollBar.draw(b); } if (this.deleteConfirmationScreen) { b.Draw(Game1.staminaRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), Color.Black * 0.75f); SpriteText.drawString(b, "Really delete file: " + this.saveGames[this.selectedForDelete].name + "?", (int)Utility.getTopLeftPositionForCenteringOnScreen(Game1.tileSize * 8, Game1.tileSize, 0, 0).X, (int)Utility.getTopLeftPositionForCenteringOnScreen(Game1.tileSize * 3, Game1.tileSize, 0, 0).Y, 9999, -1, 9999, 1f, 1f, false, -1, "", 4); this.okDeleteButton.draw(b); this.cancelDeleteButton.draw(b); } base.draw(b); if (this.hoverText.Count <char>() > 0) { IClickableMenu.drawHoverText(b, this.hoverText, Game1.dialogueFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null); } if (this.selected != -1 && this.timerToLoad < 1000) { b.Draw(Game1.staminaRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), Color.Black * (1f - (float)this.timerToLoad / 1000f)); } ChatMenu.drawChat(true); }
public override void draw(SpriteBatch b) { if (!didModeSelect) { int x = xPositionOnScreen + width / 4; int y = yPositionOnScreen + (int)(height / 5 * 0.5); int w = width / 2; int h = height / 5; buttonX = x; buttonH = h; buttonW = w; buttonY1 = y; IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, "Singleplayer", x + w / 2 - SpriteText.getWidthOfString("Singleplayer") / 2, y + h / 2 - SpriteText.getHeightOfString("Singleplayer") / 2); y += (int)(h * 1.25); buttonY2 = y; IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, "Host", x + w / 2 - SpriteText.getWidthOfString("Host") / 2, y + h / 2 - SpriteText.getHeightOfString("Host") / 2); y += (int)(h * 1.25); buttonY3 = y; IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, "Client", x + w / 2 - SpriteText.getWidthOfString("Client") / 2, y + h / 2 - SpriteText.getHeightOfString("Client") / 2); } else if (modeInit == null) { int x = buttonX, y = buttonY3, w = buttonW, h = buttonH; String str = (Multiplayer.mode == Mode.Host ? "Listen" : "Connect"); if (ipBox != null) { SpriteText.drawString(b, "IP Address:", ipBox.X - SpriteText.getWidthOfString("IP Address:") - 20, ipBox.Y); ipBox.Draw(b); } if (portBox != null) { SpriteText.drawString(b, "Port:", portBox.X - SpriteText.getWidthOfString("IP Address:") - 20, portBox.Y); portBox.Draw(b); } IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, str, x + w / 2 - SpriteText.getWidthOfString(str) / 2, y + h / 2 - SpriteText.getHeightOfString(str) / 2); } else if (Multiplayer.problemStarting) { int x = buttonX, y = buttonY1, w = buttonW, h = buttonH; String str = "Error"; SpriteText.drawString(b, str, x + w / 2 - SpriteText.getWidthOfString(str) / 2, y + h / 2 - SpriteText.getHeightOfString(str) / 2); y = buttonY2; // y = buttonY3; str = "Back"; IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, str, x + w / 2 - SpriteText.getWidthOfString(str) / 2, y + h / 2 - SpriteText.getHeightOfString(str) / 2); } else if (Multiplayer.server != null) { int x = buttonX, y = buttonY1, w = buttonW, h = buttonH; String str = "Start"; /*Util.drawStr("Other players: ", x, buttonY1, Color.White); * foreach ( Server.Client client in Multiplayer.server.clients ) * { * String str_ = "<Client " + ( int )( client.id ) + ">"; * if ( client.farmer != null ) * str_ = client.farmer.name; * * y += 30; * Util.drawStr(str_, x + 25, y, Color.White); * }*/ y = buttonY3; IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), x, y, w, h, new Rectangle(x, y, w, h).Contains(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, (float)Game1.pixelZoom, true); SpriteText.drawString(b, str, x + w / 2 - SpriteText.getWidthOfString(str) / 2, y + h / 2 - SpriteText.getHeightOfString(str) / 2); } else if (Multiplayer.client != null) { int x = buttonX, y = buttonY1, w = buttonW, h = buttonH; /*Util.drawStr("Other players: ", x, buttonY1, Color.White); * foreach (KeyValuePair< byte, SFarmer > other in Multiplayer.client.others) * { * String str_ = "<Client " + (int)(other.Key) + ">"; * if (other.Value != null) * str_ = other.Value.name; * * y += 30; * Util.drawStr(str_, x + 25, y, Color.White); * }*/ } base.draw(b); ChatMenu.drawChat(false); }