private void drawLuckSkill(SkillsPage skills) { SpriteBatch b = Game1.spriteBatch; int j = 5; int num; int num2; num = skills.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 * Game1.tileSize - 8; num2 = skills.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - Game1.pixelZoom * 2; int num3 = 0; for (int i = 0; i < 10; i++) { bool flag = false; bool flag2 = false; string text = ""; int num4 = 0; Rectangle empty = Rectangle.Empty; flag = (Game1.player.LuckLevel > i); if (i == 0) { text = "Luck"; } num4 = Game1.player.LuckLevel; flag2 = (Game1.player.addedLuckLevel.Value > 0); empty = new Rectangle(50, 428, 10, 10); if (!text.Equals("")) { b.DrawString(Game1.smallFont, text, new Vector2((float)num - Game1.smallFont.MeasureString(text).X - (float)(Game1.pixelZoom * 4) - (float)Game1.tileSize, (float)(num2 + Game1.pixelZoom + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), Game1.textColor); b.Draw(Game1.mouseCursors, new Vector2((float)(num - Game1.pixelZoom * 16), (float)(num2 + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(empty), Color.Black * 0.3f, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.85f); b.Draw(Game1.mouseCursors, new Vector2((float)(num - Game1.pixelZoom * 15), (float)(num2 - Game1.pixelZoom + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(empty), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); } if (!flag && (i + 1) % 5 == 0) { b.Draw(Game1.mouseCursors, new Vector2((float)(num3 + num - Game1.pixelZoom + i * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num2 + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(145, 338, 14, 9)), Color.Black * 0.35f, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); b.Draw(Game1.mouseCursors, new Vector2((float)(num3 + num + i * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num2 - Game1.pixelZoom + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(145 + (flag ? 14 : 0), 338, 14, 9)), Color.White * (flag ? 1f : 0.65f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); } else if ((i + 1) % 5 != 0) { b.Draw(Game1.mouseCursors, new Vector2((float)(num3 + num - Game1.pixelZoom + i * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num2 + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(129, 338, 8, 9)), Color.Black * 0.35f, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.85f); b.Draw(Game1.mouseCursors, new Vector2((float)(num3 + num + i * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num2 - Game1.pixelZoom + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(129 + (flag ? 8 : 0), 338, 8, 9)), Color.White * (flag ? 1f : 0.65f), 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); } if (i == 9) { NumberSprite.draw(num4, b, new Vector2((float)(num3 + num + (i + 2) * (Game1.tileSize / 2 + Game1.pixelZoom) + Game1.pixelZoom * 3 + ((num4 >= 10) ? (Game1.pixelZoom * 3) : 0)), (float)(num2 + Game1.pixelZoom * 4 + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), Color.Black * 0.35f, 1f, 0.85f, 1f, 0, 0); NumberSprite.draw(num4, b, new Vector2((float)(num3 + num + (i + 2) * (Game1.tileSize / 2 + Game1.pixelZoom) + Game1.pixelZoom * 4 + ((num4 >= 10) ? (Game1.pixelZoom * 3) : 0)), (float)(num2 + Game1.pixelZoom * 3 + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), (flag2 ? Color.LightGreen : Color.SandyBrown) * ((num4 == 0) ? 0.75f : 1f), 1f, 0.87f, 1f, 0, 0); } if ((i + 1) % 5 == 0) { num3 += Game1.pixelZoom * 6; } } skills.drawMouse(b); }
private void DrawLevelTenProfessionCost(SpriteBatch spriteBatch) { var firstRowBottomLocation = _professionButtonRowStartLocation.Y + GetRowHeight <TierOneProfession>(); var costTextLocation = new Vector2(_professionButtonRowStartLocation.X, firstRowBottomLocation + CostTextYOffset <TierTwoProfession>() + _rowPadding); spriteBatch.DrawString(Game1.dialogueFont, CostText, costTextLocation, Game1.textColor); var pointNumberLocation = new Vector2(costTextLocation.X + Game1.dialogueFont.MeasureString(CostText).X + (NumberSprite.getWidth(PerSaveOptions.Instance.CostOfTierTwoPrestige) * 3.0).Ceiling(), costTextLocation.Y + Game1.pixelZoom * 5); NumberSprite.draw(PerSaveOptions.Instance.CostOfTierTwoPrestige, spriteBatch, pointNumberLocation, Color.SandyBrown, 1f, .85f, 1f, 0); }
public void SetScore(int score, NumberSprite number) { int score_x00 = score / 100; int score_0x0 = (score - score_x00 * 100) / 10; int score_00x = score - score_x00 * 100 - score_0x0 * 10; ScoreNum[0].sprite = number.NumberSpriteList[score_x00]; ScoreNum[1].sprite = number.NumberSpriteList[score_0x0]; ScoreNum[2].sprite = number.NumberSpriteList[score_00x]; }
public InformationBox(UserInformation u, PlayerUser pu) { Players = u.DefaultPlayers; Bombs = u.DefaultBombs; defb = Bombs; BackColor = CommonObjects.Colors.DimGray; FontColor = CommonObjects.Colors.White; Manager = new ObjectManager(2); user = pu; Y = 432; NumberScore = new NumberSprite(CommonObjects.ImageNumber32, 16, 32, 8) { X = 16 + 128, Y = 8, FillWithZero = true }; NumberFrames = new NumberSprite(CommonObjects.ImageNumber24, 12, 24, 4) { X = 572, Y = 20, }; NumberFps = new NumberSprite(CommonObjects.ImageNumber12White, 6, 12, 2) { X = 640 - 12, Y = 36, }; NumberPlayers = new NumberSprite(CommonObjects.ImageNumber16, 8, 16, 3) { X = 384, Y = 4, FillWithZero = true }; NumberBombs = new NumberSprite(CommonObjects.ImageNumber16, 8, 16, 3) { X = 524, Y = 4, FillWithZero = true }; NumberDestroy = new NumberSprite(CommonObjects.ImageNumber16, 8, 16, 4) { X = 376, Y = 28, FillWithZero = true }; NumberGraze = new NumberSprite(CommonObjects.ImageNumber16, 8, 16, 5) { X = 508, Y = 28, FillWithZero = true }; }
/// <summary> /// 根据坐标创建精灵格子 /// </summary> /// <param name="r">x坐标</param> /// <param name="c">y坐标</param> private void CreateSprite(int r, int c) { GameObject go = new GameObject(string.Format("{0},{1}", r, c)); go.transform.SetParent(transform, false); Image unused = go.AddComponent <Image>(); NumberSprite action = go.AddComponent <NumberSprite>(); numberSpriteArray[r, c] = action; action.SetImage(0); }
//キャンバス関連初期化===================================================== private void CanvasRelationInit() { m_Canvas = transform.GetComponentInChildren <Canvas>(); m_SoriteTimer = new TimeSprite(); m_SoriteTimer.Initialize(m_Canvas.transform, "Timer"); m_CountSprite = m_Canvas.transform.FindChild("Counter").GetComponent <NumberSprite>(); m_CountSprite.Initialize(); m_StartSprite = m_Canvas.transform.FindChild("Start").GetComponent <RectTransform>(); m_StartSprite.gameObject.SetActive(false); }
public override void draw(SpriteBatch b) { b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f); Game1.drawDialogueBox(xPositionOnScreen, yPositionOnScreen - 64 + 8, width + 21, height + 64, speaker: false, drawOnlyBox: true); foreach (ClickableComponent c in elevators) { b.Draw(Game1.mouseCursors, new Vector2(c.bounds.X - 4, c.bounds.Y + 4), new Rectangle((c.scale > 1f) ? 267 : 256, 256, 10, 10), Color.Black * 0.5f, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.865f); b.Draw(Game1.mouseCursors, new Vector2(c.bounds.X, c.bounds.Y), new Rectangle((c.scale > 1f) ? 267 : 256, 256, 10, 10), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.868f); NumberSprite.draw(position: new Vector2(c.bounds.X + 16 + NumberSprite.numberOfDigits(Convert.ToInt32(c.name)) * 6, c.bounds.Y + 24 - NumberSprite.getHeight() / 4), number: Convert.ToInt32(c.name), b: b, c: (Game1.CurrentMineLevel == Convert.ToInt32(c.name)) ? (Color.Gray * 0.75f) : Color.Gold, scale: 0.5f, layerDepth: 0.86f, alpha: 1f, secondDigitOffset: 0); } drawMouse(b); base.draw(b); }
private void DrawPrestigePoints(SpriteBatch spriteBatch) { const string pointText = "Prestige Points:"; var yOffset = 5 * Game1.pixelZoom; var textLocation = new Vector2(xPositionOnScreen + spaceToClearSideBorder / 2 + borderWidth, yPositionOnScreen + yOffset + (int)Math.Floor(Game1.tileSize * 3.15)); spriteBatch.DrawString(Game1.dialogueFont, pointText, textLocation, Game1.textColor); var pointNumberLocation = new Vector2(textLocation.X + Game1.dialogueFont.MeasureString(pointText).X + (int)Math.Floor(Game1.pixelZoom * 4.25) + NumberSprite.getWidth(_prestige.PrestigePoints), textLocation.Y + Game1.pixelZoom * 5); NumberSprite.draw(_prestige.PrestigePoints, spriteBatch, pointNumberLocation, Color.SandyBrown, 1f, .85f, 1f, 0); _professionButtonRowStartLocation = new Vector2(textLocation.X, textLocation.Y + Game1.dialogueFont.MeasureString(pointText).Y + _rowPadding); }
//キャンバス関連初期化===================================================== private void CanvasRelationInit() { m_Canvas = transform.GetComponentInChildren<Canvas>(); m_SoriteTimer = new TimeSprite(); m_SoriteTimer.Initialize(m_Canvas.transform, "Timer"); m_CountSprite = m_Canvas.transform.FindChild("Counter").GetComponent<NumberSprite>(); m_CountSprite.Initialize(); m_StartSprite = m_Canvas.transform.FindChild("Start").GetComponent<RectTransform>(); m_StartSprite.gameObject.SetActive(false); }
// Token: 0x06000F4B RID: 3915 RVA: 0x0013AFFC File Offset: 0x001391FC public override void draw(SpriteBatch b) { b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f); Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen - Game1.tileSize + Game1.tileSize / 8, this.width + Game1.tileSize / 3, this.height + Game1.tileSize, false, true, null, false); foreach (ClickableComponent c in this.elevators) { b.Draw(Game1.mouseCursors, new Vector2((float)(c.bounds.X - Game1.pixelZoom), (float)(c.bounds.Y + Game1.pixelZoom)), new Rectangle?(new Rectangle((c.scale > 1f) ? 267 : 256, 256, 10, 10)), Color.Black * 0.5f, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.865f); b.Draw(Game1.mouseCursors, new Vector2((float)c.bounds.X, (float)c.bounds.Y), new Rectangle?(new Rectangle((c.scale > 1f) ? 267 : 256, 256, 10, 10)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.868f); Vector2 textPosition = new Vector2((float)(c.bounds.X + 16 + NumberSprite.numberOfDigits(Convert.ToInt32(c.name)) * 6), (float)(c.bounds.Y + Game1.pixelZoom * 6 - NumberSprite.getHeight() / 4)); NumberSprite.draw(Convert.ToInt32(c.name), b, textPosition, ((Game1.mine.mineLevel == Convert.ToInt32(c.name) && Game1.currentLocation.Equals(Game1.mine)) || (Convert.ToInt32(c.name) == 0 && !Game1.currentLocation.Equals(Game1.mine))) ? (Color.Gray * 0.75f) : Color.Gold, 0.5f, 0.86f, 1f, 0, 0); } base.drawMouse(b); base.draw(b); }
private void DrawLevelFiveProfessionCost(SpriteBatch spriteBatch) { var costTextLocation = _professionButtonRowStartLocation; costTextLocation.Y += CostTextYOffset <TierOneProfession>(); spriteBatch.DrawString(Game1.dialogueFont, CostText, costTextLocation, Game1.textColor); var pointNumberLocation = new Vector2(costTextLocation.X + Game1.dialogueFont.MeasureString(CostText).X + (NumberSprite.getWidth(PerSaveOptions.Instance.CostOfTierOnePrestige) * 3.0).Ceiling(), costTextLocation.Y + Game1.pixelZoom * 5); NumberSprite.draw(PerSaveOptions.Instance.CostOfTierOnePrestige, spriteBatch, pointNumberLocation, Color.SandyBrown, 1f, .85f, 1f, 0); if (_leftProfessionStartingXLocation == 0) { _leftProfessionStartingXLocation = pointNumberLocation.X.Ceiling() + NumberSprite.digitWidth; } }
private void CreateSprite(int r, int c) { //Instantiate(); GameObject go = new GameObject(r.ToString() + "," + c.ToString()); go.AddComponent <Image>(); NumberSprite action = go.AddComponent <NumberSprite>(); //Awake立即执行 Start下一帧执行 //将引用存储到二维数组中 spriteActionArray[r, c] = action; action.SetImage(0); //创建的游戏对象,scale默认为1 go.transform.SetParent(this.transform, false); }
//创建一个方格Sprite private void CreateSprite(int r, int c) { //Instantiate(); GameObject go = new GameObject(r.ToString() + c.ToString()); //设置图片 go.AddComponent <Image>(); NumberSprite action = go.AddComponent <NumberSprite>(); //将引用存储到二维数组里spriteActionArray spriteActionArray[r, c] = action; action.SetImage(0); //创建游戏对象,Scale默认为1,设置为false表示相对父物体的坐标 go.transform.SetParent(this.transform, false); }
private static void drawElevator(SpriteBatch b, ClickableComponent elevator) { b.Draw(Game1.mouseCursors, new Vector2((elevator.bounds.X - 4), (elevator.bounds.Y + 4)), new Rectangle(elevator.scale > 1.0 ? 267 : 256, 256, 10, 10), Color.Black * 0.5f, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.865f); b.Draw(Game1.mouseCursors, new Vector2(elevator.bounds.X, elevator.bounds.Y), new Rectangle(elevator.scale > 1.0f ? 267 : 256, 256, 10, 10), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.868f); int floor = Convert.ToInt32(elevator.name); Vector2 vector2 = new Vector2((elevator.bounds.X + 16 + NumberSprite.numberOfDigits(floor) * 6), (elevator.bounds.Y + 24 - NumberSprite.getHeight() / 4)); bool skull = ((Game1.CurrentMineLevel == floor + 120) && Game1.currentLocation.Equals(Game1.mine)) || (floor == 0 && Game1.currentLocation.Name == "SkullCave"); NumberSprite.draw(floor, b, vector2, skull? Color.Gray * 0.75f : Color.Gold, 0.5f, 0.86f, 1f, 0, 0); }
public override void Draw(SpriteBatch spriteBatch) { Vector2 location = new Vector2(Bounds.X, Bounds.Y); spriteBatch.DrawString(Game1.smallFont, Text, location, Game1.textColor); location.Y += Game1.smallFont.MeasureString(Text).Y + _linePadding; _minusButton.Draw(spriteBatch, Value == Minimum ? Color.Gray : Color.White); Vector2 numberLocation = location; int controlAreaWidth = _plusButton.Bounds.X + _plusButton.Bounds.Width - Bounds.X; numberLocation.X += controlAreaWidth / 2 + GetNumberXOffset(Value) / 2; numberLocation.Y += _linePadding; NumberSprite.draw(Value, spriteBatch, numberLocation, Color.SandyBrown, 1f, .85f, 1f, 0); _plusButton.Draw(spriteBatch, Value == Maximum ? Color.Gray : Color.White); }
private void DrawPrestigePoints(SpriteBatch spriteBatch) { const string pointText = "Prestige Points:"; var yOffset = 5 * Game1.pixelZoom; var yLocation = yPositionOnScreen + yOffset + (Game1.tileSize * 3.15).Floor(); var textLocation = new Vector2(xPositionOnScreen + spaceToClearSideBorder / 2 + borderWidth, yLocation); spriteBatch.DrawString(Game1.dialogueFont, pointText, textLocation, Game1.textColor); var xPadding = (Game1.pixelZoom * 4.25).Floor(); var prestigePointWidth = (NumberSprite.getWidth(PerSaveOptions.Instance.CostOfTierTwoPrestige) * 3.0).Ceiling(); var pointNumberLocation = new Vector2(textLocation.X + Game1.dialogueFont.MeasureString(pointText).X + xPadding + prestigePointWidth, textLocation.Y + Game1.pixelZoom * 5); NumberSprite.draw(_prestige.PrestigePoints, spriteBatch, pointNumberLocation, Color.SandyBrown, 1f, .85f, 1f, 0); _professionButtonRowStartLocation = new Vector2(textLocation.X, textLocation.Y + Game1.dialogueFont.MeasureString(pointText).Y + _rowPadding); _prestigePointBonusLocation = new Vector2(pointNumberLocation.X + prestigePointWidth + xPadding, yLocation); }
public override void Draw(SpriteBatch spriteBatch) { var location = new Vector2(Bounds.X, Bounds.Y); spriteBatch.DrawString(Game1.smallFont, Text, location, Game1.textColor); location.Y += Game1.smallFont.MeasureString(Text).Y + _linePadding; _minusButton.Draw(spriteBatch, Value == Minimum ? Color.Gray : Color.White); var numberLocation = location; numberLocation.X += _minusButton.Bounds.Width * 3 + (int)Math.Ceiling(NumberSprite.getWidth(Value) * 1.5); numberLocation.Y += _linePadding; NumberSprite.draw(Value, spriteBatch, numberLocation, Color.SandyBrown, 1f, .85f, 1f, 0); _plusButton.Draw(spriteBatch, Value == Maximum ? Color.Gray : Color.White); }
public override void draw(SpriteBatch b) { Game1.spriteBatch.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black); b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f); Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen - 64 + 8, this.width + 21, this.height + 64, false, true, (string)null, false); foreach (ClickableComponent levelButton in this.levelButtons) { b.Draw(Game1.mouseCursors, new Vector2((float)(levelButton.bounds.X - 4), (float)(levelButton.bounds.Y + 4)), new Rectangle?(new Rectangle((double)levelButton.scale > 1.0 ? 267 : 256, 256, 10, 10)), Color.Black * 0.5f, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.865f); b.Draw(Game1.mouseCursors, new Vector2((float)levelButton.bounds.X, (float)levelButton.bounds.Y), new Rectangle?(new Rectangle((double)levelButton.scale > 1.0 ? 267 : 256, 256, 10, 10)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.868f); Vector2 position = new Vector2((float)(levelButton.bounds.X + 16 + NumberSprite.numberOfDigits(Convert.ToInt32(levelButton.name)) * 6), (float)(levelButton.bounds.Y + 24 - NumberSprite.getHeight() / 4)); NumberSprite.draw(Convert.ToInt32(levelButton.name), b, position, Game1.CurrentMineLevel == Convert.ToInt32(levelButton.name) ? Color.Gray * 0.75f : Color.Gold, 0.5f, 0.86f, 1f, 0, 0); } this.drawMouse(b); base.draw(b); }
public override void draw(SpriteBatch b) { base.draw(b); foreach (ClickableComponent current in this.elevators) { int floor = Convert.ToInt32(current.name); Vector2 vector2 = new Vector2(current.bounds.X + 16 + NumberSprite.numberOfDigits(floor) * 6, current.bounds.Y + 24 - NumberSprite.getHeight() / 4); bool skull = ((Game1.CurrentMineLevel == floor + 120) && Game1.currentLocation.Equals(Game1.mine)) || (floor == 0 && Game1.currentLocation.Name == "SkullCave"); NumberSprite.draw(floor, b, vector2, skull ? Color.Gray * 0.75f : Color.Gold, 0.5f, 0.86f, 1f, 0, 0); } this.drawMouse(b); }
public static void renderSkillBar(int x, int y, Texture2D iconTex, Rectangle icon, int level, float progress, Color skillCol) { if (!show) { return; } if (Game1.activeClickableMenu != null || Game1.eventUp || !Context.IsPlayerFree) { return; } var b = Game1.spriteBatch; if (skillBg == null || skillFg == null) { setupExpBars(); } b.Draw(iconTex, new Rectangle(x, y, 32, 32), icon, Color.White); int extra = 0; if (level > 9) { extra += 16; } if (level > 99) { extra += 20; } NumberSprite.draw(level, b, new Vector2(x + 32 + 4 + 16 + extra, y + 16), Color.White, 0.75f, 0, 1, 0); if (progress < 0 || progress > 100) { return; } Rectangle barRect = new Rectangle(x + 32 + 4 + 32 + extra + 4, y + (32 - BAR_HEIGHT) / 2 - 1, BAR_WIDTH * 2, BAR_HEIGHT * 2); b.Draw(skillBg, barRect, new Rectangle(0, 0, BAR_WIDTH, BAR_HEIGHT), Color.White); barRect.Width = (int)(barRect.Width * progress); b.Draw(skillFg, barRect, new Rectangle(0, 0, barRect.Width / 2, BAR_HEIGHT), skillCol); }
public IntegerEditor(string text, int startingNumber, int minimum, int maximum, Vector2 location, ClickCallback onClickCallback) { if (maximum <= minimum) { throw new ArgumentException($"{nameof(minimum)} value cannot exceed {nameof(maximum)} value."); } _onClick = onClickCallback; Value = startingNumber.Clamp(minimum, maximum); Minimum = minimum; Maximum = maximum; Text = text; var buttonYOffset = (int)Math.Ceiling(Game1.smallFont.MeasureString(text).Y) + _linePadding; _minusButton = new TextureButton(new Rectangle((int)Math.Floor(location.X), (int)Math.Floor(location.Y) + buttonYOffset, PixelsWide * Game1.pixelZoom, PixelsHigh * Game1.pixelZoom), Game1.mouseCursors, OptionsPlusMinus.minusButtonSource, MinusButtonClicked); var plusButtonOffset = (int)Math.Ceiling(NumberSprite.getWidth(Maximum) * 1.5) + _minusButton.Bounds.Width * 4; _plusButton = new TextureButton(new Rectangle((int)Math.Floor(location.X) + plusButtonOffset, (int)Math.Floor(location.Y) + buttonYOffset, PixelsWide * Game1.pixelZoom, PixelsHigh * Game1.pixelZoom), Game1.mouseCursors, OptionsPlusMinus.plusButtonSource, PlusButtonClicked); var maxWidth = new[] { _plusButton.Bounds.X + _plusButton.Bounds.Width - (int)Math.Floor(location.X), (int)Math.Ceiling(Game1.smallFont.MeasureString(text).X) }.Max(); var maxHeight = buttonYOffset + new[] { _minusButton.Bounds.Height, _plusButton.Bounds.Height, NumberSprite.getHeight() }.Max(); Bounds = new Rectangle((int)Math.Floor(location.X), (int)Math.Floor(location.Y), maxWidth, maxHeight); }
public override void draw(SpriteBatch b) { base.draw(b); Game1.drawDialogueBox(calculatorX, calculatorY, calculatorWidth, calculatorHeight, speaker: false, drawOnlyBox: true); foreach (ClickableComponent c in digits) { if (c.name == clear) { b.Draw(Game1.mouseCursors, new Vector2(c.bounds.X - 4, c.bounds.Y + 4), new Rectangle((c.scale > 1f) ? 267 : 256, 256, 10, 10), Color.Black * 0.5f, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.865f); b.Draw(Game1.mouseCursors, new Vector2(c.bounds.X, c.bounds.Y), new Rectangle((c.scale > 1f) ? 267 : 256, 256, 10, 10), Color.White * 0.6f, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.868f); Vector2 textPosition = new Vector2(c.bounds.X + c.bounds.Width / 2 - SpriteText.getWidthOfString(c.name) / 2, c.bounds.Y + c.bounds.Height / 2 - SpriteText.getHeightOfString(c.name) / 2 - 4); SpriteText.drawString(b, c.name, (int)textPosition.X, (int)textPosition.Y); } else { b.Draw(Game1.mouseCursors, new Vector2(c.bounds.X - 4, c.bounds.Y + 4), new Rectangle((c.scale > 1f) ? 267 : 256, 256, 10, 10), Color.Black * 0.5f, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.865f); b.Draw(Game1.mouseCursors, new Vector2(c.bounds.X, c.bounds.Y), new Rectangle((c.scale > 1f) ? 267 : 256, 256, 10, 10), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.868f); NumberSprite.draw(position: new Vector2(c.bounds.X + 16 + NumberSprite.numberOfDigits(Convert.ToInt32(c.name)) * 6, c.bounds.Y + 24 - NumberSprite.getHeight() / 4), number: Convert.ToInt32(c.name), b: b, c: Color.Gold, scale: 0.5f, layerDepth: 0.86f, alpha: 1f, secondDigitOffset: 0); } } drawMouse(b); }
// 创建一个 Sprite private void CreateSprite(int r, int c) { // UI 创建三步骤: // 1. 创建游戏对象,并赋予相应的名字 GameObject go = new GameObject(r.ToString() + c.ToString()); // 2. 添加 Image 组件 go.AddComponent <Image>(); // 在 4 * 4 的 GameObject 上添加 NumberSprite 脚本组件:用于 Sprite 的行为 // Awake 立即执行(创建之后立即执行),Start 下一帧执行, // 因为在当前脚本中的 Start 会调用当前函数,并且在下一行的 action.SetImage(0); 会访问 NumberSprite 中的 image 并对其进行修改, // 所以在 NumberSprite.cs 中 image = GetComponent<Image>(); 应该写在 Awake 中 而不是 Start 中。 NumberSprite action = go.AddComponent <NumberSprite>(); // 将引用存储到2维精灵行为类数组(4*4)中, // 存储创建的 NumberSprite 脚本类 Component 对象的引用,在每个对象创建后立即存入 spriteActionArray[r, c] = action; // 设置初始图片,没有数字的图片 action.SetImage(0); // 3. 设置当前 GameObject:GameController 为创建对象的父节点 // 创建的游戏对象时 scale 默认为 1,false 表示不使用世界坐标,1 表示相对于父节点 go.transform.SetParent(this.transform, false); }
public override void draw(SpriteBatch b) { this.UpdateInventory(); var currentPage = this.GetCurrentPage(); foreach (var c in currentPage.Keys) { if (c.hoverText.Equals(AVAILABLE)) { c.draw(b, Color.White, 0.89f); if (currentPage[c].numberProducedPerCraft > 1) { NumberSprite.draw(currentPage[c].numberProducedPerCraft, b, new Vector2((float)(c.bounds.X + 64 - 2), (float)(c.bounds.Y + 64 - 2)), Color.Red, (float)(0.5 * ((double)c.scale / 4.0)), 0.97f, 1f, 0, 0); } } else if (c.hoverText.Equals(UNKNOWN)) { c.draw(b, new Color(0f, 0f, 0f, 0.1f), 0.89f); } else { c.draw(b, Color.Gray * 0.4f, 0.89f); } } foreach (var c in this.categories.Keys) { var boxColor = Color.White; var textColor = Game1.textColor; if (c.name.Equals(UNAVAILABLE)) { boxColor = Color.Gray; } IClickableMenu.drawTextureBox(b, Game1.menuTexture, new Rectangle(0, 256, 60, 60), c.bounds.X, c.bounds.Y, c.bounds.Width, c.bounds.Height + Game1.tileSize / 16, boxColor); b.DrawString(Game1.smallFont, c.label, new Vector2(c.bounds.X + Game1.tileSize / 4, c.bounds.Y + Game1.tileSize / 4), textColor); } if (this.upButton != null) { this.upButton.draw(b); } if (this.downButton != null) { this.downButton.draw(b); } this.inventory.draw(b); this.oldButton.draw(b, this.readyToClose() ? Color.White : Color.Gray, 0.89f); this.trashCan.draw(b); b.Draw( Game1.mouseCursors, new Vector2(this.trashCan.bounds.X + 60, this.trashCan.bounds.Y + 40), new Rectangle(564 + Game1.player.trashCanLevel * 18, 129, 18, 10), Color.White, this.trashCanLidRotation, new Vector2(16f, 10f), 4f, SpriteEffects.None, 0.86f); if (this.hoverItem != null) { IClickableMenu.drawToolTip( b, this.hoverText, this.hoverTitle, this.hoverItem, this.heldItem != null); } else if (this.hoverText != null) { IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, (this.heldItem != null) ? Game1.tileSize : 0, (this.heldItem != null) ? Game1.tileSize : 0); } if (this.heldItem != null) { this.heldItem.drawInMenu(b, new Vector2( Game1.getOldMouseX() + Game1.tileSize / 4, Game1.getOldMouseY() + Game1.tileSize / 4), 1f); } if (this.hoverRecipe != null) { IEnumerable <Item> extraItems = this._materialContainers?.SelectMany(chest => chest.items); IClickableMenu.drawHoverText(b, " ", Game1.smallFont, Game1.tileSize * 3 / 4, Game1.tileSize * 3 / 4, -1, this.hoverRecipe.name, -1, null, null, 0, -1, -1, -1, -1, 1f, this.hoverRecipe, extraItems?.ToList()); } else if (this.categoryText != null) { IClickableMenu.drawHoverText(b, this.categoryText, Game1.smallFont); } }
public override void draw(SpriteBatch b) { if (this._standaloneMenu) { Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true, (string)null, false, true, -1, -1, -1); } this.drawHorizontalPartition(b, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256, false, -1, -1, -1); this.inventory.draw(b); if (this.trashCan != null) { this.trashCan.draw(b); b.Draw(Game1.mouseCursors, new Vector2((float)(this.trashCan.bounds.X + 60), (float)(this.trashCan.bounds.Y + 40)), new Rectangle?(new Rectangle(564 + Game1.player.trashCanLevel * 18, 129, 18, 10)), Color.White, this.trashCanLidRotation, new Vector2(16f, 10f), 4f, SpriteEffects.None, 0.86f); } b.End(); b.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.PointClamp, (DepthStencilState)null, (RasterizerState)null); foreach (ClickableTextureComponent key in this.pagesOfCraftingRecipes[this.currentCraftingPage].Keys) { if (key.hoverText.Equals("ghosted")) { key.draw(b, Color.Black * 0.35f, 0.89f, 0); } else if (!this.pagesOfCraftingRecipes[this.currentCraftingPage][key].doesFarmerHaveIngredientsInInventory(this.getContainerContents())) { key.draw(b, Color.LightGray * 0.4f, 0.89f, 0); if (this.pagesOfCraftingRecipes[this.currentCraftingPage][key].numberProducedPerCraft > 1) { NumberSprite.draw(this.pagesOfCraftingRecipes[this.currentCraftingPage][key].numberProducedPerCraft, b, new Vector2((float)(key.bounds.X + 64 - 2), (float)(key.bounds.Y + 64 - 2)), Color.LightGray * 0.75f, (float)(0.5 * ((double)key.scale / 4.0)), 0.97f, 1f, 0, 0); } } else { key.draw(b); if (this.pagesOfCraftingRecipes[this.currentCraftingPage][key].numberProducedPerCraft > 1) { NumberSprite.draw(this.pagesOfCraftingRecipes[this.currentCraftingPage][key].numberProducedPerCraft, b, new Vector2((float)(key.bounds.X + 64 - 2), (float)(key.bounds.Y + 64 - 2)), Color.White, (float)(0.5 * ((double)key.scale / 4.0)), 0.97f, 1f, 0, 0); } } } b.End(); b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, (DepthStencilState)null, (RasterizerState)null); if (this.hoverItem != null) { IClickableMenu.drawToolTip(b, this.hoverText, this.hoverTitle, this.hoverItem, this.heldItem != null, -1, 0, -1, -1, (CraftingRecipe)null, -1); } else if (!string.IsNullOrEmpty(this.hoverText)) { if (this.hoverAmount > 0) { IClickableMenu.drawToolTip(b, this.hoverText, this.hoverTitle, (Item)null, true, -1, 0, -1, -1, (CraftingRecipe)null, this.hoverAmount); } else { IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, this.heldItem != null ? 64 : 0, this.heldItem != null ? 64 : 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null, (IList <Item>)null); } } if (this.heldItem != null) { this.heldItem.drawInMenu(b, new Vector2((float)(Game1.getOldMouseX() + 16), (float)(Game1.getOldMouseY() + 16)), 1f); } base.draw(b); if (this.downButton != null && this.currentCraftingPage < this.pagesOfCraftingRecipes.Count - 1) { this.downButton.draw(b); } if (this.upButton != null && this.currentCraftingPage > 0) { this.upButton.draw(b); } if (this._standaloneMenu) { Game1.mouseCursorTransparency = 1f; this.drawMouse(b); } if (this.hoverRecipe == null) { return; } SpriteBatch b1 = b; SpriteFont smallFont = Game1.smallFont; int xOffset = this.heldItem != null ? 48 : 0; int yOffset = this.heldItem != null ? 48 : 0; string displayName = this.hoverRecipe.DisplayName; string[] buffIconsToDisplay; if (this.cooking && this.lastCookingHover != null) { if (Game1.objectInformation[(int)((NetFieldBase <int, NetInt>)(this.lastCookingHover as StardewValley.Object).parentSheetIndex)].Split('/').Length > 7) { buffIconsToDisplay = Game1.objectInformation[(int)((NetFieldBase <int, NetInt>)(this.lastCookingHover as StardewValley.Object).parentSheetIndex)].Split('/')[7].Split(' '); goto label_35; } } buffIconsToDisplay = (string[])null; label_35: Item lastCookingHover = this.lastCookingHover; CraftingRecipe hoverRecipe = this.hoverRecipe; IList <Item> containerContents = this.getContainerContents(); IClickableMenu.drawHoverText(b1, " ", smallFont, xOffset, yOffset, -1, displayName, -1, buffIconsToDisplay, lastCookingHover, 0, -1, -1, -1, -1, 1f, hoverRecipe, containerContents); }
public override void draw(SpriteBatch b) { Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true, (string)null, false); int num1 = this.xPositionOnScreen + 64 - 12; int num2 = this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder; b.Draw(Game1.timeOfDay >= 1900 ? Game1.nightbg : Game1.daybg, new Vector2((float)num1, (float)num2), Color.White); Game1.player.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame((bool)((NetFieldBase <bool, NetBool>)Game1.player.bathingClothes) ? 108 : this.playerPanelFrames[this.playerPanelIndex], 0, false, false, (AnimatedSprite.endOfAnimationBehavior)null, false), (bool)((NetFieldBase <bool, NetBool>)Game1.player.bathingClothes) ? 108 : this.playerPanelFrames[this.playerPanelIndex], new Rectangle(this.playerPanelFrames[this.playerPanelIndex] * 16, (bool)((NetFieldBase <bool, NetBool>)Game1.player.bathingClothes) ? 576 : 0, 16, 32), new Vector2((float)(num1 + 32), (float)(num2 + 32)), Vector2.Zero, 0.8f, 2, Color.White, 0.0f, 1f, Game1.player); if (Game1.timeOfDay >= 1900) { Game1.player.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(this.playerPanelFrames[this.playerPanelIndex], 0, false, false, (AnimatedSprite.endOfAnimationBehavior)null, false), this.playerPanelFrames[this.playerPanelIndex], new Rectangle(this.playerPanelFrames[this.playerPanelIndex] * 16, 0, 16, 32), new Vector2((float)(num1 + 32), (float)(num2 + 32)), Vector2.Zero, 0.8f, 2, Color.DarkBlue * 0.3f, 0.0f, 1f, Game1.player); } b.DrawString(Game1.smallFont, Game1.player.Name, new Vector2((float)(num1 + 64) - Game1.smallFont.MeasureString(Game1.player.Name).X / 2f, (float)(num2 + 192 + 4)), Game1.textColor); b.DrawString(Game1.smallFont, Game1.player.getTitle(), new Vector2((float)(num1 + 64) - Game1.smallFont.MeasureString(Game1.player.getTitle()).X / 2f, (float)(num2 + 256 - 32)), Game1.textColor); int num3 = LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru ? this.xPositionOnScreen + this.width - 448 - 48 : this.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256 - 8; int num4 = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - 8; int num5 = 0; for (int index1 = 0; index1 < 10; ++index1) { for (int index2 = 0; index2 < (SpaceCore.instance.Helper.ModRegistry.IsLoaded("spacechase0.LuckSkill") ? 6 : 5); ++index2) { bool flag1 = false; bool flag2 = false; string text = ""; int number = 0; Rectangle rectangle = Rectangle.Empty; switch (index2) { case 0: flag1 = Game1.player.FarmingLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11604"); } number = Game1.player.FarmingLevel; flag2 = (int)((NetFieldBase <int, NetInt>)Game1.player.addedFarmingLevel) > 0; rectangle = new Rectangle(10, 428, 10, 10); break; case 1: flag1 = Game1.player.MiningLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11605"); } number = Game1.player.MiningLevel; flag2 = (int)((NetFieldBase <int, NetInt>)Game1.player.addedMiningLevel) > 0; rectangle = new Rectangle(30, 428, 10, 10); break; case 2: flag1 = Game1.player.ForagingLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11606"); } number = Game1.player.ForagingLevel; flag2 = (int)((NetFieldBase <int, NetInt>)Game1.player.addedForagingLevel) > 0; rectangle = new Rectangle(60, 428, 10, 10); break; case 3: flag1 = Game1.player.FishingLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11607"); } number = Game1.player.FishingLevel; flag2 = (int)((NetFieldBase <int, NetInt>)Game1.player.addedFishingLevel) > 0; rectangle = new Rectangle(20, 428, 10, 10); break; case 4: flag1 = Game1.player.CombatLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11608"); } number = Game1.player.CombatLevel; flag2 = (int)((NetFieldBase <int, NetInt>)Game1.player.addedCombatLevel) > 0; rectangle = new Rectangle(120, 428, 10, 10); break; case 5: flag1 = Game1.player.LuckLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11609"); } number = Game1.player.LuckLevel; flag2 = (int)((NetFieldBase <int, NetInt>)Game1.player.addedLuckLevel) > 0; rectangle = new Rectangle(50, 428, 10, 10); break; } if (!text.Equals("")) { b.DrawString(Game1.smallFont, text, new Vector2((float)((double)num3 - (double)Game1.smallFont.MeasureString(text).X + 4.0 - 64.0), (float)(num4 + 4 + index2 * 56)), Game1.textColor); b.Draw(Game1.mouseCursors, new Vector2((float)(num3 - 56), (float)(num4 + index2 * 56)), new Rectangle?(rectangle), Color.Black * 0.3f, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.85f); b.Draw(Game1.mouseCursors, new Vector2((float)(num3 - 52), (float)(num4 - 4 + index2 * 56)), new Rectangle?(rectangle), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } if (!flag1 && (index1 + 1) % 5 == 0) { b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 - 4 + index1 * 36), (float)(num4 + index2 * 56)), new Rectangle?(new Rectangle(145, 338, 14, 9)), Color.Black * 0.35f, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 + index1 * 36), (float)(num4 - 4 + index2 * 56)), new Rectangle?(new Rectangle(145 + (flag1 ? 14 : 0), 338, 14, 9)), Color.White * (flag1 ? 1f : 0.65f), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } else if ((index1 + 1) % 5 != 0) { b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 - 4 + index1 * 36), (float)(num4 + index2 * 56)), new Rectangle?(new Rectangle(129, 338, 8, 9)), Color.Black * 0.35f, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.85f); b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 + index1 * 36), (float)(num4 - 4 + index2 * 56)), new Rectangle?(new Rectangle(129 + (flag1 ? 8 : 0), 338, 8, 9)), Color.White * (flag1 ? 1f : 0.65f), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } if (index1 == 9) { NumberSprite.draw(number, b, new Vector2((float)(num5 + num3 + (index1 + 2) * 36 + 12 + (number >= 10 ? 12 : 0)), (float)(num4 + 16 + index2 * 56)), Color.Black * 0.35f, 1f, 0.85f, 1f, 0, 0); NumberSprite.draw(number, b, new Vector2((float)(num5 + num3 + (index1 + 2) * 36 + 16 + (number >= 10 ? 12 : 0)), (float)(num4 + 12 + index2 * 56)), (flag2 ? Color.LightGreen : Color.SandyBrown) * (number == 0 ? 0.75f : 1f), 1f, 0.87f, 1f, 0, 0); } } if ((index1 + 1) % 5 == 0) { num5 += 24; } } ////////////////////////////////// int index2_ = SpaceCore.instance.Helper.ModRegistry.IsLoaded("spacechase0.LuckSkill") ? 6 : 5; foreach (var skillName in Skills.GetSkillList()) { num5 = 0; var skill = Skills.GetSkill(skillName); for (int index1 = 0; index1 < skill.ExperienceCurve.Length; ++index1) { bool flag1 = false; bool flag2 = false; string text = ""; int number = 0; flag1 = Game1.player.GetCustomSkillLevel(skill) > index1; if (index1 == 0) { text = skill.Name; } number = Game1.player.GetCustomSkillLevel(skill); // TODO: Detect skill buffs? Is that even possible? flag2 = false;// (int)((NetFieldBase<int, NetInt>)Game1.player.addedFarmingLevel) > 0; if (!text.Equals("")) { b.DrawString(Game1.smallFont, text, new Vector2((float)((double)num3 - (double)Game1.smallFont.MeasureString(text).X + 4.0 - 64.0), (float)(num4 + 4 + index2_ * 56)), Game1.textColor); if (skill.SkillsPageIcon != null) { b.Draw(skill.SkillsPageIcon, new Vector2((float)(num3 - 56), (float)(num4 + index2_ * 56)), null, Color.Black * 0.3f, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.85f); b.Draw(skill.SkillsPageIcon, new Vector2((float)(num3 - 52), (float)(num4 - 4 + index2_ * 56)), null, Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } } if (!flag1 && (index1 + 1) % 5 == 0) { b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 - 4 + index1 * 36), (float)(num4 + index2_ * 56)), new Rectangle?(new Rectangle(145, 338, 14, 9)), Color.Black * 0.35f, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 + index1 * 36), (float)(num4 - 4 + index2_ * 56)), new Rectangle?(new Rectangle(145 + (flag1 ? 14 : 0), 338, 14, 9)), Color.White * (flag1 ? 1f : 0.65f), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } else if ((index1 + 1) % 5 != 0) { b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 - 4 + index1 * 36), (float)(num4 + index2_ * 56)), new Rectangle?(new Rectangle(129, 338, 8, 9)), Color.Black * 0.35f, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.85f); b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 + index1 * 36), (float)(num4 - 4 + index2_ * 56)), new Rectangle?(new Rectangle(129 + (flag1 ? 8 : 0), 338, 8, 9)), Color.White * (flag1 ? 1f : 0.65f), 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } if (index1 == 9) { NumberSprite.draw(number, b, new Vector2((float)(num5 + num3 + (index1 + 2) * 36 + 12 + (number >= 10 ? 12 : 0)), (float)(num4 + 16 + index2_ * 56)), Color.Black * 0.35f, 1f, 0.85f, 1f, 0, 0); NumberSprite.draw(number, b, new Vector2((float)(num5 + num3 + (index1 + 2) * 36 + 16 + (number >= 10 ? 12 : 0)), (float)(num4 + 12 + index2_ * 56)), (flag2 ? Color.LightGreen : Color.SandyBrown) * (number == 0 ? 0.75f : 1f), 1f, 0.87f, 1f, 0, 0); } if ((index1 + 1) % 5 == 0) { num5 += 24; } } ++index2_; } ////////////////////////////////// foreach (ClickableTextureComponent skillBar in this.skillBars) { skillBar.draw(b); } foreach (ClickableTextureComponent skillBar in this.skillBars) { if ((double)skillBar.scale == 0.0) { IClickableMenu.drawTextureBox(b, skillBar.bounds.X - 16 - 8, skillBar.bounds.Y - 16 - 16, 96, 96, Color.White); if (skillBar.name.StartsWith("C")) { skillBar.scale = (float)Game1.pixelZoom; if (skillBar.containsPoint(Game1.getMouseX(), Game1.getMouseY()) && !skillBar.name.Equals("-1") && skillBar.hoverText.Length > 0) { var professions = Skills.skills.SelectMany(x => x.Value.Professions).ToList(); var profession = professions.Where(x => $"C{x.Id}" == skillBar.name).FirstOrDefault(); this.hoverText = profession.Description; this.hoverTitle = profession.Name; var actuallyAProfessionImage = profession.Icon; skillBar.scale = 0.0f; b.Draw(actuallyAProfessionImage, new Vector2((float)(skillBar.bounds.X - Game1.pixelZoom * 2), (float)(skillBar.bounds.Y - Game1.tileSize / 2 + Game1.tileSize / 4)), new Rectangle(0, 0, 16, 16), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); } } else { b.Draw(Game1.mouseCursors, new Vector2((float)(skillBar.bounds.X - 8), (float)(skillBar.bounds.Y - 32 + 16)), new Rectangle?(new Rectangle(this.professionImage % 6 * 16, 624 + this.professionImage / 6 * 16, 16, 16)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); } } } Game1.drawDialogueBox(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 32 + WALLET_MOVE_X, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + (int)((double)this.height / 2.0) - 32 + WALLET_MOVE_Y, this.width - 64 - IClickableMenu.spaceToClearSideBorder * 2 + WALLET_MOVE_W, this.height / 4 + 64 + WALLET_MOVE_H, false, true, (string)null, false); this.drawBorderLabel(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11610"), Game1.smallFont, this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 96 + WALLET_MOVE_X, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + (int)((double)this.height / 2.0) - 32 + WALLET_MOVE_Y); foreach (ClickableTextureComponent specialItem in this.specialItems) { specialItem.draw(b); } if (this.hoverText.Length <= 0) { return; } IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, 0, 0, -1, this.hoverTitle.Length > 0 ? this.hoverTitle : (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null); }
public override void draw(SpriteBatch b) { int x = xPositionOnScreen + 64 - 12; int y3 = yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder; b.Draw((Game1.timeOfDay >= 1900) ? Game1.nightbg : Game1.daybg, new Vector2(x, y3), Color.White); FarmerRenderer.isDrawingForUI = true; Game1.player.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(Game1.player.bathingClothes ? 108 : playerPanelFrames[playerPanelIndex], 0, secondaryArm: false, flip: false), Game1.player.bathingClothes ? 108 : playerPanelFrames[playerPanelIndex], new Rectangle(playerPanelFrames[playerPanelIndex] * 16, Game1.player.bathingClothes ? 576 : 0, 16, 32), new Vector2(x + 32, y3 + 32), Vector2.Zero, 0.8f, 2, Color.White, 0f, 1f, Game1.player); if (Game1.timeOfDay >= 1900) { Game1.player.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(playerPanelFrames[playerPanelIndex], 0, secondaryArm: false, flip: false), playerPanelFrames[playerPanelIndex], new Rectangle(playerPanelFrames[playerPanelIndex] * 16, 0, 16, 32), new Vector2(x + 32, y3 + 32), Vector2.Zero, 0.8f, 2, Color.DarkBlue * 0.3f, 0f, 1f, Game1.player); } FarmerRenderer.isDrawingForUI = false; b.DrawString(Game1.smallFont, Game1.player.Name, new Vector2((float)(x + 64) - Game1.smallFont.MeasureString(Game1.player.Name).X / 2f, y3 + 192 + 4), Game1.textColor); b.DrawString(Game1.smallFont, Game1.player.getTitle(), new Vector2((float)(x + 64) - Game1.smallFont.MeasureString(Game1.player.getTitle()).X / 2f, y3 + 256 - 32), Game1.textColor); x = ((LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.it) ? (xPositionOnScreen + width - 448 - 48) : (xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256 - 8)); y3 = yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - 8; int addedX = 0; for (int j = 0; j < 10; j++) { for (int i = 0; i < 5; i++) { bool drawRed = false; bool addedSkill = false; string skill = ""; int skillLevel = 0; Rectangle iconSource = Rectangle.Empty; switch (i) { case 0: drawRed = (Game1.player.FarmingLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11604"); } skillLevel = Game1.player.FarmingLevel; addedSkill = ((int)Game1.player.addedFarmingLevel > 0); iconSource = new Rectangle(10, 428, 10, 10); break; case 1: drawRed = (Game1.player.MiningLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11605"); } skillLevel = Game1.player.MiningLevel; addedSkill = ((int)Game1.player.addedMiningLevel > 0); iconSource = new Rectangle(30, 428, 10, 10); break; case 2: drawRed = (Game1.player.ForagingLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11606"); } skillLevel = Game1.player.ForagingLevel; addedSkill = ((int)Game1.player.addedForagingLevel > 0); iconSource = new Rectangle(60, 428, 10, 10); break; case 3: drawRed = (Game1.player.FishingLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11607"); } skillLevel = Game1.player.FishingLevel; addedSkill = ((int)Game1.player.addedFishingLevel > 0 || (Game1.player.CurrentTool != null && Game1.player.CurrentTool.hasEnchantmentOfType <MasterEnchantment>())); iconSource = new Rectangle(20, 428, 10, 10); break; case 4: drawRed = (Game1.player.CombatLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11608"); } skillLevel = Game1.player.CombatLevel; addedSkill = ((int)Game1.player.addedCombatLevel > 0); iconSource = new Rectangle(120, 428, 10, 10); break; case 5: drawRed = (Game1.player.LuckLevel > j); if (j == 0) { skill = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11609"); } skillLevel = Game1.player.LuckLevel; addedSkill = ((int)Game1.player.addedLuckLevel > 0); iconSource = new Rectangle(50, 428, 10, 10); break; } if (!skill.Equals("")) { b.DrawString(Game1.smallFont, skill, new Vector2((float)x - Game1.smallFont.MeasureString(skill).X + 4f - 64f, y3 + 4 + i * 56), Game1.textColor); b.Draw(Game1.mouseCursors, new Vector2(x - 56, y3 + i * 56), iconSource, Color.Black * 0.3f, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.85f); b.Draw(Game1.mouseCursors, new Vector2(x - 52, y3 - 4 + i * 56), iconSource, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } if (!drawRed && (j + 1) % 5 == 0) { b.Draw(Game1.mouseCursors, new Vector2(addedX + x - 4 + j * 36, y3 + i * 56), new Rectangle(145, 338, 14, 9), Color.Black * 0.35f, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); b.Draw(Game1.mouseCursors, new Vector2(addedX + x + j * 36, y3 - 4 + i * 56), new Rectangle(145 + (drawRed ? 14 : 0), 338, 14, 9), Color.White * (drawRed ? 1f : 0.65f), 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } else if ((j + 1) % 5 != 0) { b.Draw(Game1.mouseCursors, new Vector2(addedX + x - 4 + j * 36, y3 + i * 56), new Rectangle(129, 338, 8, 9), Color.Black * 0.35f, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.85f); b.Draw(Game1.mouseCursors, new Vector2(addedX + x + j * 36, y3 - 4 + i * 56), new Rectangle(129 + (drawRed ? 8 : 0), 338, 8, 9), Color.White * (drawRed ? 1f : 0.65f), 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.87f); } if (j == 9) { NumberSprite.draw(skillLevel, b, new Vector2(addedX + x + (j + 2) * 36 + 12 + ((skillLevel >= 10) ? 12 : 0), y3 + 16 + i * 56), Color.Black * 0.35f, 1f, 0.85f, 1f, 0); NumberSprite.draw(skillLevel, b, new Vector2(addedX + x + (j + 2) * 36 + 16 + ((skillLevel >= 10) ? 12 : 0), y3 + 12 + i * 56), (addedSkill ? Color.LightGreen : Color.SandyBrown) * ((skillLevel == 0) ? 0.75f : 1f), 1f, 0.87f, 1f, 0); } } if ((j + 1) % 5 == 0) { addedX += 24; } } foreach (ClickableTextureComponent skillBar in skillBars) { skillBar.draw(b); } foreach (ClickableTextureComponent c in skillBars) { if (c.scale == 0f) { IClickableMenu.drawTextureBox(b, c.bounds.X - 16 - 8, c.bounds.Y - 16 - 16, 96, 96, Color.White); b.Draw(Game1.mouseCursors, new Vector2(c.bounds.X - 8, c.bounds.Y - 32 + 16), new Rectangle(professionImage % 6 * 16, 624 + professionImage / 6 * 16, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); } } x = xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 32 + 16; y3 = yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + 320 - 8; if ((int)Game1.netWorldState.Value.GoldenWalnuts > 0) { b.Draw(Game1.objectSpriteSheet, new Vector2(x, y3), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 73, 16, 16), Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); x += 48; b.DrawString(Game1.smallFont, string.Concat((object)Game1.netWorldState.Value.GoldenWalnuts), new Vector2(x, y3), Game1.textColor); x += 64; } if (Game1.player.QiGems > 0) { b.Draw(Game1.objectSpriteSheet, new Vector2(x, y3), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 858, 16, 16), Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); x += 48; b.DrawString(Game1.smallFont, string.Concat(Game1.player.QiGems), new Vector2(x, y3), Game1.textColor); x += 64; } Game1.drawDialogueBox(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 32, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + (int)((float)height / 2f) - 32, width - 64 - IClickableMenu.spaceToClearSideBorder * 2, height / 4 + 64, speaker: false, drawOnlyBox: true); drawBorderLabel(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11610"), Game1.smallFont, xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 96, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + (int)((float)height / 2f) - 32); foreach (ClickableTextureComponent specialItem in specialItems) { specialItem?.draw(b); } if (hoverText.Length > 0) { IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont, 0, 0, -1, (hoverTitle.Length > 0) ? hoverTitle : null); } }
public override void draw(SpriteBatch b) { if (_standaloneMenu) { Game1.drawDialogueBox(xPositionOnScreen, yPositionOnScreen, width, height, speaker: false, drawOnlyBox: true); } drawHorizontalPartition(b, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256); inventory.draw(b); if (trashCan != null) { trashCan.draw(b); b.Draw(Game1.mouseCursors, new Vector2(trashCan.bounds.X + 60, trashCan.bounds.Y + 40), new Rectangle(564 + Game1.player.trashCanLevel * 18, 129, 18, 10), Color.White, trashCanLidRotation, new Vector2(16f, 10f), 4f, SpriteEffects.None, 0.86f); } b.End(); b.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); foreach (ClickableTextureComponent c in pagesOfCraftingRecipes[currentCraftingPage].Keys) { if (c.hoverText.Equals("ghosted")) { c.draw(b, Color.Black * 0.35f, 0.89f); } else if (!pagesOfCraftingRecipes[currentCraftingPage][c].doesFarmerHaveIngredientsInInventory(getContainerContents())) { c.draw(b, Color.DimGray * 0.4f, 0.89f); if (pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft > 1) { NumberSprite.draw(pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft, b, new Vector2(c.bounds.X + 64 - 2, c.bounds.Y + 64 - 2), Color.LightGray * 0.75f, 0.5f * (c.scale / 4f), 0.97f, 1f, 0); } } else { c.draw(b); if (pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft > 1) { NumberSprite.draw(pagesOfCraftingRecipes[currentCraftingPage][c].numberProducedPerCraft, b, new Vector2(c.bounds.X + 64 - 2, c.bounds.Y + 64 - 2), Color.White, 0.5f * (c.scale / 4f), 0.97f, 1f, 0); } } } b.End(); b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); if (hoverItem != null) { IClickableMenu.drawToolTip(b, hoverText, hoverTitle, hoverItem, heldItem != null); } else if (!string.IsNullOrEmpty(hoverText)) { if (hoverAmount > 0) { IClickableMenu.drawToolTip(b, hoverText, hoverTitle, null, heldItem: true, -1, 0, -1, -1, null, hoverAmount); } else { IClickableMenu.drawHoverText(b, hoverText, Game1.smallFont, (heldItem != null) ? 64 : 0, (heldItem != null) ? 64 : 0); } } if (heldItem != null) { heldItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 16, Game1.getOldMouseY() + 16), 1f); } base.draw(b); if (downButton != null && currentCraftingPage < pagesOfCraftingRecipes.Count - 1) { downButton.draw(b); } if (upButton != null && currentCraftingPage > 0) { upButton.draw(b); } if (_standaloneMenu) { Game1.mouseCursorTransparency = 1f; drawMouse(b); } if (hoverRecipe != null) { IClickableMenu.drawHoverText(b, " ", Game1.smallFont, (heldItem != null) ? 48 : 0, (heldItem != null) ? 48 : 0, -1, hoverRecipe.DisplayName + ((hoverRecipe.numberProducedPerCraft > 1) ? (" x" + hoverRecipe.numberProducedPerCraft) : ""), -1, (cooking && lastCookingHover != null && Game1.objectInformation[(lastCookingHover as Object).parentSheetIndex].Split('/').Length > 7) ? Game1.objectInformation[(lastCookingHover as Object).parentSheetIndex].Split('/')[7].Split(' ') : null, lastCookingHover, 0, -1, -1, -1, -1, 1f, hoverRecipe, getContainerContents()); } }
// Token: 0x06000E1D RID: 3613 RVA: 0x0011FC48 File Offset: 0x0011DE48 public override void draw(SpriteBatch b) { if (this.cooking) { Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true, null, false); } base.drawHorizontalPartition(b, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 * Game1.tileSize, false); this.inventory.draw(b); if (this.trashCan != null) { this.trashCan.draw(b); b.Draw(Game1.mouseCursors, new Vector2((float)(this.trashCan.bounds.X + 60), (float)(this.trashCan.bounds.Y + 40)), new Rectangle?(new Rectangle(686, 256, 18, 10)), Color.White, this.trashCanLidRotation, new Vector2(16f, 10f), (float)Game1.pixelZoom, SpriteEffects.None, 0.86f); } b.End(); b.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null); foreach (ClickableTextureComponent c in this.pagesOfCraftingRecipes[this.currentCraftingPage].Keys) { if (c.hoverText.Equals("ghosted")) { c.draw(b, Color.Black * 0.35f, 0.89f); } else if (!this.pagesOfCraftingRecipes[this.currentCraftingPage][c].doesFarmerHaveIngredientsInInventory(this.cooking ? Utility.getHomeOfFarmer(Game1.player).fridge.items : null)) { c.draw(b, Color.LightGray * 0.4f, 0.89f); } else { c.draw(b); if (this.pagesOfCraftingRecipes[this.currentCraftingPage][c].numberProducedPerCraft > 1) { NumberSprite.draw(this.pagesOfCraftingRecipes[this.currentCraftingPage][c].numberProducedPerCraft, b, new Vector2((float)(c.bounds.X + Game1.tileSize - 2), (float)(c.bounds.Y + Game1.tileSize - 2)), Color.Red, 0.5f * (c.scale / (float)Game1.pixelZoom), 0.97f, 1f, 0, 0); } } } b.End(); b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); if (this.hoverItem != null) { IClickableMenu.drawToolTip(b, this.hoverText, this.hoverTitle, this.hoverItem, this.heldItem != null, -1, 0, -1, -1, null, -1); } else if (this.hoverText != null) { IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, (this.heldItem != null) ? Game1.tileSize : 0, (this.heldItem != null) ? Game1.tileSize : 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null); } if (this.heldItem != null) { this.heldItem.drawInMenu(b, new Vector2((float)(Game1.getOldMouseX() + Game1.tileSize / 4), (float)(Game1.getOldMouseY() + Game1.tileSize / 4)), 1f); } base.draw(b); if (this.downButton != null && this.currentCraftingPage < this.pagesOfCraftingRecipes.Count - 1) { this.downButton.draw(b); } if (this.upButton != null && this.currentCraftingPage > 0) { this.upButton.draw(b); } if (this.cooking) { base.drawMouse(b); } if (this.hoverRecipe != null) { IClickableMenu.drawHoverText(b, " ", Game1.smallFont, (this.heldItem != null) ? (Game1.tileSize * 3 / 4) : 0, (this.heldItem != null) ? (Game1.tileSize * 3 / 4) : 0, -1, this.hoverRecipe.name, -1, (this.cooking && this.lastCookingHover != null && Game1.objectInformation[(this.lastCookingHover as Object).parentSheetIndex].Split(new char[] { '/' }).Length >= 7) ? Game1.objectInformation[(this.lastCookingHover as Object).parentSheetIndex].Split(new char[] { '/' })[6].Split(new char[] { ' ' }) : null, this.lastCookingHover, 0, -1, -1, -1, -1, 1f, this.hoverRecipe); } }
public override void draw(SpriteBatch b) { this.performHoverAction(Game1.getMouseX(), Game1.getMouseY()); int num3 = LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru ? this.xPositionOnScreen + this.width - Game1.tileSize * 7 - Game1.tileSize * 3 / 4 : this.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 * Game1.tileSize - 8; int num4 = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - Game1.pixelZoom * 2; int num5 = 0; //foreach skill rank... for (int index1 = 0; index1 < 10; ++index1) { //there's only one skill to draw here. int index2 = this.skillOrderIndex; bool flag1 = EquivalentExchange.instance.currentPlayerData.AlchemyLevel > index1; bool flag2 = EquivalentExchange.instance.showLevelUpMenusByRank.Count > 0; string text = (index1 == 0 ? "Alchemy" : ""); int number = EquivalentExchange.instance.currentPlayerData.AlchemyLevel; Rectangle rectangle = Rectangle.Empty; //alchemy skill text if (!text.Equals("")) { b.DrawString(Game1.smallFont, text, new Vector2((float)num3 - Game1.smallFont.MeasureString(text).X + (float)Game1.pixelZoom - (float)Game1.tileSize, (float)(num4 + Game1.pixelZoom + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), Game1.textColor); //I think this is the drop shadow for the skill icon b.Draw(DrawingUtil.alchemySkillIcon, new Vector2((float)(num3 - Game1.pixelZoom * 14), (float)(num4 + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle(0, 0, 10, 10), Color.Black * 0.3f, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.85f); //I think this is the actual skill icon. b.Draw(DrawingUtil.alchemySkillIcon, new Vector2((float)(num3 - Game1.pixelZoom * 13), (float)(num4 - Game1.pixelZoom + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle(0, 0, 10, 10), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); } //player has doesn't have the skill yet and the next square is a profession rank if (!flag1 && (index1 + 1) % 5 == 0) { //this is the drop shadow for profession rank 5/10 b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 - Game1.pixelZoom + index1 * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num4 + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(145, 338, 14, 9)), Color.Black * 0.35f, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); //this is the icon for profession rank 5/10 b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 + index1 * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num4 - Game1.pixelZoom + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(145 + (flag1 ? 14 : 0), 338, 14, 9)), Color.White * (flag1 ? 1f : 0.65f), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); } //the next square NOT a profession rank else if ((index1 + 1) % 5 != 0) { //I think this is the drop shadow for the level markers b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 - Game1.pixelZoom + index1 * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num4 + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(129, 338, 8, 9)), Color.Black * 0.35f, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.85f); //I think this is the golden bit that covers the drop shadow. b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 + index1 * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num4 - Game1.pixelZoom + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(129 + (flag1 ? 8 : 0), 338, 8, 9)), Color.White * (flag1 ? 1f : 0.65f), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); } //i == 9; (i + 1) == 10, not sure what this is doing. if (index1 == 9) { NumberSprite.draw(number, b, new Vector2((float)(num5 + num3 + (index1 + 2) * (Game1.tileSize / 2 + Game1.pixelZoom) + Game1.pixelZoom * 3 + (number >= 10 ? Game1.pixelZoom * 3 : 0)), (float)(num4 + Game1.pixelZoom * 4 + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), Color.Black * 0.35f, 1f, 0.85f, 1f, 0, 0); NumberSprite.draw(number, b, new Vector2((float)(num5 + num3 + (index1 + 2) * (Game1.tileSize / 2 + Game1.pixelZoom) + Game1.pixelZoom * 4 + (number >= 10 ? Game1.pixelZoom * 3 : 0)), (float)(num4 + Game1.pixelZoom * 3 + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), (flag2 ? Color.LightGreen : Color.SandyBrown) * (number == 0 ? 0.75f : 1f), 1f, 0.87f, 1f, 0, 0); } //makes the next square a fatty, I think. if ((index1 + 1) % 5 == 0) { num5 += Game1.pixelZoom * 6; } } foreach (ClickableTextureComponent skillBar in this.skillBars) { skillBar.draw(b); } foreach (ClickableTextureComponent skillBar in this.skillBars) { if ((double)skillBar.scale == 0.0) { IClickableMenu.drawTextureBox(b, skillBar.bounds.X - Game1.tileSize / 4 - Game1.pixelZoom * 2, skillBar.bounds.Y - Game1.tileSize / 4 - Game1.pixelZoom * 4, Game1.tileSize * 5 / 4 + Game1.pixelZoom * 4, Game1.tileSize * 5 / 4 + Game1.pixelZoom * 4, Color.White); //I think this is the hover over profession icon. b.Draw(professionImage, new Vector2((float)(skillBar.bounds.X - Game1.pixelZoom * 2), (float)(skillBar.bounds.Y - Game1.tileSize / 2 + Game1.tileSize / 4)), new Rectangle(0, 0, 16, 16), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); } } Game1.drawDialogueBox(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize / 2, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + (int)((double)this.height / 2.0) - Game1.tileSize / 2, this.width - Game1.tileSize - IClickableMenu.spaceToClearSideBorder * 2, this.height / 4 + Game1.tileSize, false, true, (string)null, false); this.drawBorderLabel(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11610"), Game1.smallFont, this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize * 3 / 2, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + (int)((double)this.height / 2.0) - Game1.tileSize / 2); if (this.hoverText.Length <= 0) { return; } IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, 0, 0, -1, this.hoverTitle.Length > 0 ? this.hoverTitle : (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null); }
public override void draw(SpriteBatch b) { if (cooking) { Game1.drawDialogueBox(xPositionOnScreen, yPositionOnScreen, width, height, false, true, null, false, false); } drawHorizontalPartition(b, yPositionOnScreen + borderWidth + spaceToClearTopBorder + 256, false); inventory.draw(b); if (trashCan != null) { trashCan.draw(b); b.Draw(Game1.mouseCursors, new Vector2(trashCan.bounds.X + 60, trashCan.bounds.Y + 40), new Rectangle(686, 256, 18, 10), Color.White, trashCanLidRotation, new Vector2(16f, 10f), 4f, SpriteEffects.None, 0.86f); } b.End(); b.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null, null, null); foreach (ClickableTextureComponent key in pagesOfCraftingRecipes[currentCraftingPage].Keys) { if (key.hoverText.Equals("ghosted")) { key.draw(b, Color.Black * 0.35f, 0.89f); } else if (!pagesOfCraftingRecipes[currentCraftingPage][key].doesFarmerHaveIngredientsInInventory(cooking ? fridge() : null)) { key.draw(b, Color.LightGray * 0.4f, 0.89f); } else { key.draw(b); if (pagesOfCraftingRecipes[currentCraftingPage][key].numberProducedPerCraft > 1) { NumberSprite.draw(pagesOfCraftingRecipes[currentCraftingPage][key].numberProducedPerCraft, b, new Vector2(key.bounds.X + 64 - 2, key.bounds.Y + 64 - 2), Color.Red, 0.5f * (key.scale / 4f), 0.97f, 1f, 0, 0); } } } b.End(); b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, null); if (hoverItem != null) { drawToolTip(b, hoverText, hoverTitle, hoverItem, heldItem != null, -1, 0, -1, -1, null, -1); } else if (!string.IsNullOrEmpty(hoverText)) { drawHoverText(b, hoverText, Game1.smallFont, (heldItem != null) ? 64 : 0, (heldItem != null) ? 64 : 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null); } if (heldItem != null) { heldItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 16, Game1.getOldMouseY() + 16), 1f); } base.draw(b); if (downButton != null && currentCraftingPage < pagesOfCraftingRecipes.Count - 1) { downButton.draw(b); } if (upButton != null && currentCraftingPage > 0) { upButton.draw(b); } if (cooking) { drawMouse(b); } if (hoverRecipe != null) { drawHoverText(b, " ", Game1.smallFont, (heldItem != null) ? 48 : 0, (heldItem != null) ? 48 : 0, -1, hoverRecipe.DisplayName, -1, (cooking && lastCookingHover != null && Game1.objectInformation[lastCookingHover.parentSheetIndex].Split('/').Length > 7) ? Game1.objectInformation[lastCookingHover.parentSheetIndex].Split('/')[7].Split(' ') : null, lastCookingHover, 0, -1, -1, -1, -1, 1f, hoverRecipe); } }
public override void draw(SpriteBatch b) { Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true, (string)null, false); int num1 = this.xPositionOnScreen + Game1.tileSize - Game1.pixelZoom * 3; int num2 = this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder; b.Draw(Game1.timeOfDay >= 1900 ? Game1.nightbg : Game1.daybg, new Vector2((float)num1, (float)num2), Color.White); Game1.player.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(Game1.player.bathingClothes ? 108 : this.playerPanelFrames[this.playerPanelIndex], 0, false, false, (AnimatedSprite.endOfAnimationBehavior)null, false), Game1.player.bathingClothes ? 108 : this.playerPanelFrames[this.playerPanelIndex], new Rectangle(this.playerPanelFrames[this.playerPanelIndex] * 16, Game1.player.bathingClothes ? 576 : 0, 16, 32), new Vector2((float)(num1 + Game1.tileSize / 2), (float)(num2 + Game1.tileSize / 2)), Vector2.Zero, 0.8f, 2, Color.White, 0.0f, 1f, Game1.player); if (Game1.timeOfDay >= 1900) { Game1.player.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(this.playerPanelFrames[this.playerPanelIndex], 0, false, false, (AnimatedSprite.endOfAnimationBehavior)null, false), this.playerPanelFrames[this.playerPanelIndex], new Rectangle(this.playerPanelFrames[this.playerPanelIndex] * 16, 0, 16, 32), new Vector2((float)(num1 + Game1.tileSize / 2), (float)(num2 + Game1.tileSize / 2)), Vector2.Zero, 0.8f, 2, Color.DarkBlue * 0.3f, 0.0f, 1f, Game1.player); } b.DrawString(Game1.smallFont, Game1.player.name, new Vector2((float)(num1 + Game1.tileSize) - Game1.smallFont.MeasureString(Game1.player.name).X / 2f, (float)(num2 + 3 * Game1.tileSize + 4)), Game1.textColor); b.DrawString(Game1.smallFont, Game1.player.getTitle(), new Vector2((float)(num1 + Game1.tileSize) - Game1.smallFont.MeasureString(Game1.player.getTitle()).X / 2f, (float)(num2 + 4 * Game1.tileSize - Game1.tileSize / 2)), Game1.textColor); int num3 = LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru ? this.xPositionOnScreen + this.width - Game1.tileSize * 7 - Game1.tileSize * 3 / 4 : this.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 * Game1.tileSize - 8; int num4 = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - Game1.pixelZoom * 2; int num5 = 0; for (int index1 = 0; index1 < 10; ++index1) { for (int index2 = 0; index2 < 5; ++index2) { bool flag1 = false; bool flag2 = false; string text = ""; int number = 0; Rectangle rectangle = Rectangle.Empty; switch (index2) { case 0: flag1 = Game1.player.FarmingLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11604"); } number = Game1.player.FarmingLevel; flag2 = Game1.player.addedFarmingLevel > 0; rectangle = new Rectangle(10, 428, 10, 10); break; case 1: flag1 = Game1.player.MiningLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11605"); } number = Game1.player.MiningLevel; flag2 = Game1.player.addedMiningLevel > 0; rectangle = new Rectangle(30, 428, 10, 10); break; case 2: flag1 = Game1.player.ForagingLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11606"); } number = Game1.player.ForagingLevel; flag2 = Game1.player.addedForagingLevel > 0; rectangle = new Rectangle(60, 428, 10, 10); break; case 3: flag1 = Game1.player.FishingLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11607"); } number = Game1.player.FishingLevel; flag2 = Game1.player.addedFishingLevel > 0; rectangle = new Rectangle(20, 428, 10, 10); break; case 4: flag1 = Game1.player.CombatLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11608"); } number = Game1.player.CombatLevel; flag2 = Game1.player.addedCombatLevel > 0; rectangle = new Rectangle(120, 428, 10, 10); break; case 5: flag1 = Game1.player.LuckLevel > index1; if (index1 == 0) { text = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11609"); } number = Game1.player.LuckLevel; flag2 = Game1.player.addedLuckLevel > 0; rectangle = new Rectangle(50, 428, 10, 10); break; } if (!text.Equals("")) { b.DrawString(Game1.smallFont, text, new Vector2((float)num3 - Game1.smallFont.MeasureString(text).X + (float)Game1.pixelZoom - (float)Game1.tileSize, (float)(num4 + Game1.pixelZoom + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), Game1.textColor); b.Draw(Game1.mouseCursors, new Vector2((float)(num3 - Game1.pixelZoom * 14), (float)(num4 + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(rectangle), Color.Black * 0.3f, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.85f); b.Draw(Game1.mouseCursors, new Vector2((float)(num3 - Game1.pixelZoom * 13), (float)(num4 - Game1.pixelZoom + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(rectangle), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); } if (!flag1 && (index1 + 1) % 5 == 0) { b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 - Game1.pixelZoom + index1 * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num4 + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(145, 338, 14, 9)), Color.Black * 0.35f, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 + index1 * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num4 - Game1.pixelZoom + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(145 + (flag1 ? 14 : 0), 338, 14, 9)), Color.White * (flag1 ? 1f : 0.65f), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); } else if ((index1 + 1) % 5 != 0) { b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 - Game1.pixelZoom + index1 * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num4 + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(129, 338, 8, 9)), Color.Black * 0.35f, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.85f); b.Draw(Game1.mouseCursors, new Vector2((float)(num5 + num3 + index1 * (Game1.tileSize / 2 + Game1.pixelZoom)), (float)(num4 - Game1.pixelZoom + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), new Rectangle?(new Rectangle(129 + (flag1 ? 8 : 0), 338, 8, 9)), Color.White * (flag1 ? 1f : 0.65f), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.87f); } if (index1 == 9) { NumberSprite.draw(number, b, new Vector2((float)(num5 + num3 + (index1 + 2) * (Game1.tileSize / 2 + Game1.pixelZoom) + Game1.pixelZoom * 3 + (number >= 10 ? Game1.pixelZoom * 3 : 0)), (float)(num4 + Game1.pixelZoom * 4 + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), Color.Black * 0.35f, 1f, 0.85f, 1f, 0, 0); NumberSprite.draw(number, b, new Vector2((float)(num5 + num3 + (index1 + 2) * (Game1.tileSize / 2 + Game1.pixelZoom) + Game1.pixelZoom * 4 + (number >= 10 ? Game1.pixelZoom * 3 : 0)), (float)(num4 + Game1.pixelZoom * 3 + index2 * (Game1.tileSize / 2 + Game1.pixelZoom * 6))), (flag2 ? Color.LightGreen : Color.SandyBrown) * (number == 0 ? 0.75f : 1f), 1f, 0.87f, 1f, 0, 0); } } if ((index1 + 1) % 5 == 0) { num5 += Game1.pixelZoom * 6; } } foreach (ClickableTextureComponent skillBar in this.skillBars) { skillBar.draw(b); } foreach (ClickableTextureComponent skillBar in this.skillBars) { if ((double)skillBar.scale == 0.0) { IClickableMenu.drawTextureBox(b, skillBar.bounds.X - Game1.tileSize / 4 - Game1.pixelZoom * 2, skillBar.bounds.Y - Game1.tileSize / 4 - Game1.pixelZoom * 4, Game1.tileSize * 5 / 4 + Game1.pixelZoom * 4, Game1.tileSize * 5 / 4 + Game1.pixelZoom * 4, Color.White); b.Draw(Game1.mouseCursors, new Vector2((float)(skillBar.bounds.X - Game1.pixelZoom * 2), (float)(skillBar.bounds.Y - Game1.tileSize / 2 + Game1.tileSize / 4)), new Rectangle?(new Rectangle(this.professionImage % 6 * 16, 624 + this.professionImage / 6 * 16, 16, 16)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); } } Game1.drawDialogueBox(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize / 2, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + (int)((double)this.height / 2.0) - Game1.tileSize / 2, this.width - Game1.tileSize - IClickableMenu.spaceToClearSideBorder * 2, this.height / 4 + Game1.tileSize, false, true, (string)null, false); this.drawBorderLabel(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11610"), Game1.smallFont, this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize * 3 / 2, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + (int)((double)this.height / 2.0) - Game1.tileSize / 2); foreach (ClickableTextureComponent specialItem in this.specialItems) { specialItem.draw(b); } if (this.hoverText.Length <= 0) { return; } IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont, 0, 0, -1, this.hoverTitle.Length > 0 ? this.hoverTitle : (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null); }