public void drawMoneyBox(SpriteBatch b, int overrideX = -1, int overrideY = -1) { updatePosition(); b.Draw(Game1.mouseCursors, ((overrideY != -1) ? new Vector2((overrideX == -1) ? position.X : ((float)overrideX), overrideY - 172) : position) + new Vector2(28 + ((moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0), 172 + ((moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0)), new Rectangle(340, 472, 65, 17), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); moneyDial.draw(b, ((overrideY != -1) ? new Vector2((overrideX == -1) ? position.X : ((float)overrideX), overrideY - 172) : position) + new Vector2(68 + ((moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0), 196 + ((moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0)), Game1.player.Money); if (moneyShakeTimer > 0) { moneyShakeTimer -= Game1.currentGameTime.ElapsedGameTime.Milliseconds; } }
public virtual void Draw(SpriteBatch b) { if (_currentDisplayedCurrency != null && !(currentPosition <= 0f)) { Vector2 draw_position = GetUpperLeft(); b.Draw(Game1.mouseCursors2, draw_position, new Rectangle(48, 176, 52, 26), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0f); int displayed_value = _currentDisplayedCurrency.netIntDelta.Value; if (currentPosition < 0.5f) { displayed_value = _moneyDial.previousTargetValue; } _moneyDial.draw(b, draw_position + new Vector2(108f, 40f), displayed_value); if (drawSprite != null) { drawSprite(b, draw_position + new Vector2(4f, 6f) * 4f); } } }
public override void draw(SpriteBatch b) { IReadOnlyList <ITask> tasks = _taskManager.Tasks; Vector2 moneyBoxPosition = new Vector2(moneyBox.bounds.X - 36, moneyBox.bounds.Y); scrollComponent.BeginScissorTest(b); if (tasks.Count > 0) { int scrollOffset = scrollComponent.ScrollAmount / scrollComponent.ScrollDistance; for (int i = 0; i < maxEntries && i + scrollOffset < tasks.Count; i++) { taskEntries[i].Draw(b, tasks[i + scrollOffset]); } } else { string helpText = Translation.Get("ui.tasks.help"); Vector2 helpTextSize = Game1.dialogueFont.MeasureString(helpText); Vector2 textPosition = new Vector2(xPositionOnScreen + (width / 2) - (helpTextSize.X / 2), yPositionOnScreen + (height / 2) - helpTextSize.Y); textPosition = new Vector2(textPosition.X - (textPosition.X % 4), textPosition.Y - (textPosition.Y % 4)); Utility.drawTextWithShadow(b, helpText, Game1.dialogueFont, textPosition, EmptyListTextColor); } scrollComponent.EndScissorTest(b); scrollComponent.DrawScrollBar(b); addTaskButton.draw(b); b.Draw(DeluxeJournalMod.UiTexture, moneyBoxPosition, new Rectangle(16, 32, 68, 17), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); if (_moneyButtonVisible) { moneyButton.draw(b); } int money = _config.MoneyViewNetWealth ? Game1.player.Money : 0; foreach (ITask task in tasks) { if (!task.Complete) { money -= task.GetPrice(); } } if (money < 0) { moneyDial.draw(b, moneyBoxPosition + new Vector2(68, 24), Math.Abs(money)); int signOffset = (int)Math.Log10(moneyDial.currentValue) * 24; b.Draw(DeluxeJournalMod.UiTexture, moneyBoxPosition + new Vector2(212 - signOffset, 24), new Rectangle(91, 37, 5, 8), Color.Maroon, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); } else { moneyDial.draw(b, moneyBoxPosition + new Vector2(68, 24), money); } if (ChildHasFocus()) { _childMenu.draw(b); } }