internal void OnRendered(object sender, RenderedEventArgs e) { if (this.serverManager.ServerEnabledWithHostServerMode) { //this.DrawTextBox(Game1.spriteBatch, 5, 100, Game1.dialogueFont, $"Server Mode On ({this.config.ServerToggleKey})"); //this.DrawTextBox(Game1.spriteBatch, 5, 260, Game1.dialogueFont, $"Profit Margin: {Game1.player.difficultyModifier}%"); //this.DrawTextBox(Game1.spriteBatch, 5, 340, Game1.dialogueFont, $"{Game1.server.connectionsCount} Clients"); //var inviteCode = Game1.server.getInviteCode(); //if (inviteCode != null) //{ // this.DrawTextBox(5, 420, Game1.dialogueFont, $"Invite Code: {inviteCode}"); //} } var rect = new Rectangle(0, 256, 60, 60); this.DrawTextBox(Game1.spriteBatch, rect, new Vector2(0, 0), new Vector2(28, 17), Game1.dialogueFont, $"AAAAA", Color.White, TextBoxAlignment.TopLeft); this.DrawTextBox(Game1.spriteBatch, rect, new Vector2(0, 0), new Vector2(60, 17), Game1.dialogueFont, $"AAAAA", Color.White, TextBoxAlignment.Top); this.DrawTextBox(Game1.spriteBatch, rect, new Vector2(0, 0), new Vector2(28, 17), Game1.dialogueFont, $"AAAAA", Color.White, TextBoxAlignment.TopRight); this.DrawTextBox(Game1.spriteBatch, rect, new Vector2(0, 0), new Vector2(28, 17), Game1.dialogueFont, $"AAAAA", Color.White, TextBoxAlignment.MidLeft); this.DrawTextBox(Game1.spriteBatch, rect, new Vector2(0, 0), new Vector2(28, 17), Game1.dialogueFont, $"AAAAA", Color.White, TextBoxAlignment.Mid); this.DrawTextBox(Game1.spriteBatch, rect, new Vector2(0, 0), new Vector2(28, 17), Game1.dialogueFont, $"AAAAA", Color.White, TextBoxAlignment.MidRight); this.DrawTextBox(Game1.spriteBatch, rect, new Vector2(0, 0), new Vector2(28, 17), Game1.dialogueFont, $"AAAAA", Color.White, TextBoxAlignment.BottomLeft); this.DrawTextBox(Game1.spriteBatch, rect, new Vector2(0, 0), new Vector2(28, 17), Game1.dialogueFont, $"AAAAA", Color.White, TextBoxAlignment.Bottom); this.DrawTextBox(Game1.spriteBatch, rect, new Vector2(0, 0), new Vector2(28, 17), Game1.dialogueFont, $"AAAAA", Color.White, TextBoxAlignment.BottomRight); }
private void Display_Rendered(object sender, RenderedEventArgs e) { if (debug) { this.manager.DebugDraw(e.SpriteBatch); } }
/// <inheritdoc cref="IDisplayEvents.Rendered"/> /// <param name="sender">The event sender.</param> /// <param name="e">The event data.</param> private void OnRendered(object sender, RenderedEventArgs e) { //if (!Context.IsWorldReady || locators == null) return; if (this.ShowLocators && Game1.activeClickableMenu == null) { this.DrawLocators(); } if (!this.DebugMode) { return; } foreach (var locPair in this.Locators) { foreach (var locator in locPair.Value) { if (!locator.IsOnScreen) { continue; } var npc = Game1.getCharacterFromName(locator.Name); float viewportX = Game1.player.position.X + Game1.pixelZoom * Game1.player.Sprite.SpriteWidth / 2 - Game1.viewport.X; float viewportY = Game1.player.position.Y - Game1.viewport.Y; float npcViewportX = npc.position.X + Game1.pixelZoom * npc.Sprite.SpriteWidth / 2 - Game1.viewport.X; float npcViewportY = npc.position.Y - Game1.viewport.Y; // Draw NPC sprite noodle connecting center of screen to NPC for debugging this.DrawLine(Game1.spriteBatch, new Vector2(viewportX, viewportY), new Vector2(npcViewportX, npcViewportY), npc.Sprite.Texture); } } }
private void Display_Rendered(object sender, RenderedEventArgs e) { foreach (var renderer in this.renderers) { renderer.Draw(); } }
/// <summary>The event called by SMAPI when rendering to the screen.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> public void OnRendered(object sender, RenderedEventArgs e) { if (this.ShowOverlay) { this.DrawOverlay(Game1.spriteBatch, Game1.smallFont, this.Pixel.Value); } }
private void OnRendered(object sender, RenderedEventArgs e) { if (Context.IsWorldReady && (Game1.activeClickableMenu is GameMenu || Game1.activeClickableMenu is ItemGrabMenu) && Game1.player.MaxItems >= 36) { float f = 1.0f; if (Game1.activeClickableMenu is GameMenu gm) { List <IClickableMenu> tabs = Helper.Reflection .GetField <List <IClickableMenu> >(Game1.activeClickableMenu, "pages").GetValue(); IClickableMenu curTab = tabs[((GameMenu)Game1.activeClickableMenu).currentTab]; if (curTab is InventoryPage inv) { f = Math.Min(0.1f + (Vector2.Distance(new Vector2(Game1.getMouseX(), Game1.getMouseY()), new Vector2(curTab.xPositionOnScreen + curTab.width - 100, curTab.yPositionOnScreen + curTab.height - 280)) / 200.0f), 1.0f); //Lets try hovering stuff int xval = curTab.xPositionOnScreen + curTab.width; int yval = curTab.yPositionOnScreen + curTab.height; if (Game1.getMouseX() > (xval - 100) && Game1.getMouseX() < (xval - 50) && Game1.getMouseY() > (yval - 100) && Game1.getMouseX() < (yval - 50)) { IClickableMenu c = Game1.activeClickableMenu; var b = Game1.spriteBatch; DrawSimpleTooltip(b, "Test", Game1.smallFont); //c.drawHoverText(b, "Test Hover", Game1.smallFont, 0, 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 0, (CraftingRecipe)null, (IList<Item>)null); } Game1.spriteBatch.Draw(backpack, new Vector2(curTab.xPositionOnScreen + curTab.width - 100, curTab.yPositionOnScreen + curTab.height - 100), new Rectangle?(new Rectangle(0, 0, backpack.Width, backpack.Height)), Color.White, 0.0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.5f); Game1.spriteBatch.Draw(Game1.mouseCursors, new Vector2(Game1.getMouseX(), Game1.getMouseY()), Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, Game1.options.SnappyMenus ? 44 : 0, 16, 16), Color.White * Game1.mouseCursorTransparency, 0.0f, Vector2.Zero, Game1.pixelZoom + Game1.dialogueButtonScale / 150f, SpriteEffects.None, 0.1f); } } } }
internal void OnRendered(object sender, RenderedEventArgs e) { var millisecondsSinceLastCall = DateTime.UtcNow.Subtract(_lastRenderingCall).TotalMilliseconds; _lastRenderingCall = DateTime.UtcNow; _numFramesRendered++; _frameRenderingTime += millisecondsSinceLastCall; // Check if the last FPS update was more than a second ago. If so, // recalculate the FPS and update the FPS string. if (DateTime.UtcNow.Subtract(_lastFPSUpdate).TotalSeconds >= 1) { _lastFPSUpdate = DateTime.UtcNow; var averageRenderingTimePerFrame = _frameRenderingTime / _numFramesRendered; _fpsString = $"{(1000 / averageRenderingTimePerFrame):F0}"; _frameRenderingTime = 0; _numFramesRendered = 0; } Utility.drawTextWithColoredShadow(e.SpriteBatch, $"{_fpsString} FPS", Game1.smallFont, new Vector2(10, 10), Color.LawnGreen, Color.Black, 1); }
//void OnButtonPressed(object sender, ButtonPressedEventArgs e) { // if (!Context.IsWorldReady) // return; // if (!Context.IsPlayerFree) // return; // if (e.Button.IsUseToolButton()) { // Vector2 tilePos = this.Helper.Input.GetCursorPosition().Tile; // AttemptCatchCritter(tilePos); // } //} private void OnRendered(object sender, RenderedEventArgs e) { if (!Context.IsWorldReady) { return; } if (!Context.IsPlayerFree) { return; } ICursorPosition cursorPos = this.Helper.Input.GetCursorPosition(); Critter c = GetCrittersAtPosition(cursorPos.AbsolutePixels, Game1.tileSize); string str = "Critter: None"; if (c != null) { str = "Critter: " + c.GetType().ToString(); } str += $"({cursorPos.AbsolutePixels})"; //string str = $"Mouse: {cursorPos.AbsolutePixels}"; Game1.spriteBatch.DrawString(Game1.smallFont, str, cursorPos.ScreenPixels, Color.Black); }
private void OnRendered(object sender, RenderedEventArgs e) { if (Context.IsPlayerFree && _hoverText != null) { DrawSimpleTooltip(Game1.spriteBatch, _hoverText, Game1.smallFont); } }
/// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnRendered(object sender, RenderedEventArgs e) { if (_mutex.WaitOne(0)) { try { // draw tile outlines foreach (var point in _effectiveArea.Value) { var position = new Vector2(point.X * Utility.ModifyCoordinateFromUIScale(Game1.tileSize), point.Y * Utility.ModifyCoordinateFromUIScale(Game1.tileSize)); Game1.spriteBatch.Draw( Game1.mouseCursors, Utility.ModifyCoordinatesForUIScale(Game1.GlobalToLocal(Utility.ModifyCoordinatesForUIScale(position))), new Rectangle(194, 388, 16, 16), Color.White * 0.7f, 0.0f, Vector2.Zero, Utility.ModifyCoordinateForUIScale(Game1.pixelZoom), SpriteEffects.None, 0.01f); } } finally { _mutex.ReleaseMutex(); } } }
/// <summary> /// Render the time if all of the conditions have been met (we should be in the minigame at this point) /// </summary> private void OnRenderedHandler(object sender, RenderedEventArgs args) { if (Game1.currentMinigame is AbigailGame && !AbigailGame.onStartMenu && Game1.getOnlineFarmers().Count > 1) { TimeDrawUtil.DrawTime(args.SpriteBatch); } }
private void OnRendered(object sender, RenderedEventArgs e) { if (_mutex.WaitOne(0)) { try { foreach (Point point in _effectiveArea) { Game1.spriteBatch.Draw( Game1.mouseCursors, Game1.GlobalToLocal(new Vector2(point.X * Game1.tileSize, point.Y * Game1.tileSize)), new Rectangle(194, 388, 16, 16), Color.White * 0.7f, 0.0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.01f); } } finally { _mutex.ReleaseMutex(); } } }
private void onRendered(object sender, RenderedEventArgs e) { if (isTitleMenuInteractable()) { ui.Draw(e.SpriteBatch); } }
/// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnRendered(object sender, RenderedEventArgs e) { if (Game1.activeClickableMenu is TitleMenu && this.ShouldDrawUpdateButton()) { this.button.Draw(e.SpriteBatch); } }
private void OnRendered(object sender, RenderedEventArgs e) { if (Context.IsWorldReady && Game1.activeClickableMenu == null) { HighlightRadius(Game1.spriteBatch); } }
private void OnRendered(object sender, RenderedEventArgs e) { if (Game1.player.currentLocation is DeepWoods deepWoods) { deepWoods.DrawLevelDisplay(); } }
private void OnRendered(object sender, RenderedEventArgs e) { if (displayNote == "") { return; } IClickableMenu.drawHoverText(Game1.spriteBatch, displayNote, Game1.smallFont, 0, 0, -1); }
/// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event data.</param> private void onRendered(object sender, RenderedEventArgs e) { if (m_curCmd != null && !m_curCmd.isFinish) { m_curCmd.updateGraphic(); return; } }
/// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event data.</param> private void OnRendered(object sender, RenderedEventArgs e) { foreach (TemporaryAnimatedSprite animatedSprite in temporaryAnimationList) { //animatedSprite.update(Game1.currentGameTime); animatedSprite.Position = new Vector2(Game1.player.Position.X, Game1.player.Position.Y - 160); } }
/// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnRendered(object sender, RenderedEventArgs e) { if (!Context.IsWorldReady) { return; } this.Cheats.OnRendered(this.Helper.Translation); }
private void OnRender(object sender, RenderedEventArgs e) { if (Game1.activeClickableMenu != null) { return; } try { foreach (var variable in GetCharacters()) { var tag = $"{variable.displayName}"; if (variable is Monster monster) { if (monster.MaxHealth < monster.Health) { monster.MaxHealth = monster.Health; } tag += $" {Helper.Translation.Get("nameTags.hp")}:{monster.Health}/{monster.MaxHealth} {Helper.Translation.Get("nameTags.damage")}:{monster.damageToFarmer}"; } else if (variable is Pet pet) { tag += $" {Helper.Translation.Get("nameTags.friendship")}:{pet.friendshipTowardFarmer / 200}"; } else if (variable is Horse) { } else if (variable is Child child) { tag += $" {Helper.Translation.Get("nameTags.daysOld")}:{child.daysOld}"; } else if (variable is Junimo junimo) { tag += $" {Helper.Translation.Get("nameTags.friendly")}:{junimo.friendly}"; } else { if (Game1.player.friendshipData.TryGetValue(variable.name, out var friendship)) { tag += $" {Helper.Translation.Get("nameTags.friendship")}:{(friendship?.Points ?? 0) / NPC.friendshipPointsPerHeartLevel}"; } } var screenLoc = variable.Position - new Vector2(Game1.viewport.X, Game1.viewport.Y) - new Vector2(variable.Sprite.SpriteWidth, variable.Sprite.SpriteHeight); Utility.drawTextWithShadow(e.SpriteBatch, tag, Game1.dialogueFont, new Vector2((int)screenLoc.X, (int)screenLoc.Y), ColorUtils.Instance.Get(Config.TextColor), 1f, -1f, -1, -1, 0.0f); } } catch (Exception exception) { ; } }
/// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnRendered(object sender, RenderedEventArgs e) { if (!Context.IsWorldReady) { return; } this.Cheats.OnRendered(); }
private void OnRendered(object?sender, RenderedEventArgs e) { if (Context.ScreenId != ScreenID) { return; } DrawUI(e.SpriteBatch); }
/// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event data.</param> private void OnRendered(object sender, RenderedEventArgs e) { Debug.Assert(this.CurrentGiftHelper != null, "OnPostRenderEvent listener invoked when currentGiftHelper is null."); if (this.CurrentGiftHelper.CanDraw()) { this.CurrentGiftHelper.OnDraw(); } }
private void OnViewUpdating(object sender, RenderedEventArgs e) { _menuUpdater.Update(e.Rendered); _statusBarListener.Update(); var appContext = _context as AppContext; appContext?.Broadcaster.BroadcastEvent(p => p.ViewUpdating_, sender, e); }
/// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnRendered(object sender, RenderedEventArgs e) { //if(this.i++ % 60 == 0) //{ this.currentMenu?.Update(); // this.i = 0; //} this.currentMenu?.Draw(Game1.spriteBatch); }
public void DrawTick(object sender, RenderedEventArgs e) { bool inCave = Game1.currentLocation is MineShaft || Game1.currentLocation is FarmCave; if (_showMessage) { //DrawTextBox(5, inCave ? 100 : 5, Game1.smallFont, fishName); DrawTextBox(5, (Game1.viewport.Height - 200), Game1.dialogueFont, _fishingMsg); } }
private void onRendered(object sender, RenderedEventArgs e) { if (Game1.activeClickableMenu is TitleMenu tm) { if (TitleMenu.subMenu == null && Helper.Reflection.GetField <bool>(tm, "titleInPosition").GetValue()) { configButton.Draw(e.SpriteBatch); } } }
private void Rendered(object sender, RenderedEventArgs e) { if (overlay.Value == null) { overlay.Value = new Overlay(this); } if (Context.IsWorldReady) { overlay.Value.Rendered(sender, e); } }
private void OnRendered(object sender, RenderedEventArgs args) { if (Game1.activeClickableMenu is TitleMenu titleMenu && TitleMenu.subMenu == null && !GetBool(titleMenu, "isTransitioningButtons") && GetBool(titleMenu, "titleInPosition") && !GetBool(titleMenu, "transitioningCharacterCreationMenu") || Game1.activeClickableMenu is GameMenu) { _modMenuButton.Title = Helper.Translation.Get("modMenu.button.modMenu"); _modMenuButton.Render(args.SpriteBatch); } }