Skip to content

Commit

Permalink
[FishPreview] Ready for v1.0.0 release!
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonqora committed Jun 27, 2020
1 parent ccaf576 commit 73c31e8
Show file tree
Hide file tree
Showing 19 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion FishPreview/ModConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ namespace FishPreview
{
class ModConfig
{
public bool ShowFishName { get; set; } = true;
public string FishDisplayPosition { get; set; } = "UpperRight";
public bool ShowFishName { get; set; } = true;
public bool ShowUncaughtFishSpecies { get; set; } = false;
public bool AlwaysShowLegendaryFish { get; set; } = false;
}
Expand Down
28 changes: 12 additions & 16 deletions FishPreview/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public class ModEntry : Mod
private string textValue;
private IList<string> displayOrder;
private Vector2 textSize;
private int margin = 18;
private int margin = 18;
private int spriteSize = 64;
private float scale = 0.7f;
private int boxwidth;
private int boxheight;
Expand All @@ -39,7 +40,6 @@ public override void Entry(IModHelper helper)
{
Config = Helper.ReadConfig<ModConfig>();

helper.Events.Input.ButtonPressed += this.OnButtonPressed;
helper.Events.GameLoop.GameLaunched += this.OnGameLaunched;
helper.Events.Display.MenuChanged += this.OnMenuChanged;
helper.Events.Display.RenderedActiveMenu += this.OnRenderMenu;
Expand All @@ -49,25 +49,18 @@ public override void Entry(IModHelper helper)
/*********
** Private methods
*********/
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
/// <summary>Raised after the game is launched, right before the first update tick.</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>
private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
{
// ignore if player hasn't loaded a save yet
if (!Context.IsWorldReady)
return;

// print button presses to the console window
// this.Monitor.Log($"{Game1.player.Name} pressed {e.Button}.", LogLevel.Debug);
}

private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
{
// read the Config for display position and get list priority for displayOrder
RefreshConfig();
}

/// <summary>Raised after a game menu is opened, closed, or replaced.</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>
private void OnMenuChanged(object sender, MenuChangedEventArgs e)
{
if (Game1.player == null || !Game1.player.IsLocalPlayer)
Expand All @@ -93,6 +86,9 @@ private void OnMenuChanged(object sender, MenuChangedEventArgs e)
}
}

/// <summary>When a menu is open, raised after that menu is drawn to the sprite batch but before it's rendered to the screen.</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>
private void OnRenderMenu(object sender, RenderedActiveMenuEventArgs e)
{
if (Game1.player == null || !Game1.player.IsLocalPlayer)
Expand Down Expand Up @@ -243,19 +239,19 @@ private void DetermineCoordinates(IList<string> positions, BobberBar bar, out in
}

private void DrawAtCoordinates(int x, int y)
{
{
// draw box of height and width at location
IClickableMenu.drawTextureBox(Game1.spriteBatch, x, y, boxwidth, boxheight, Color.White);

// if showFish, center the fish x
if (showFish)
{
fishSprite.drawInMenu(Game1.spriteBatch, new Vector2(x + (boxwidth / 2) - 32, y + 18), 1.0f, 1.0f, 1.0f, StackDrawType.Hide);
fishSprite.drawInMenu(Game1.spriteBatch, new Vector2(x + (boxwidth / 2) - (spriteSize / 2), y + margin), 1.0f, 1.0f, 1.0f, StackDrawType.Hide);

// if showFish and showText, center the text x below the fish
if (showText)
{
Game1.spriteBatch.DrawString(Game1.dialogueFont, textValue, new Vector2(x + (boxwidth / 2) - ((int)textSize.X / 2), y + 82), Color.Black, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f);
Game1.spriteBatch.DrawString(Game1.dialogueFont, textValue, new Vector2(x + (boxwidth / 2) - ((int)textSize.X / 2), y + spriteSize + margin), Color.Black, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f);
}
}
// else (if not showFish), center the text x&y
Expand Down
Binary file added FishPreview/images/FishPreviewMod.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FishPreview/images/FishPreviewMod2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FishPreview/images/display_options2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FishPreview/images/display_options_small.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FishPreview/images/extra_images.xcf
Binary file not shown.
Binary file added FishPreview/images/extra_languages.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FishPreview/images/extra_morenewfish.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FishPreview/images/extra_sardine.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FishPreview/images/flounder_catching.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FishPreview/images/header_image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FishPreview/images/header_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FishPreview/images/header_image.xcf
Binary file not shown.
Binary file added FishPreview/images/small_flounder.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FishPreview/images/small_images.xcf
Binary file not shown.
Binary file added FishPreview/images/small_unknown.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion FishPreview/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"UniqueID": "Jonqora.FishPreview",
"EntryDll": "FishPreview.dll",
"MinimumApiVersion": "3.0.0",
"UpdateKeys": []
"UpdateKeys": [6303]
}
File renamed without changes.

0 comments on commit 73c31e8

Please sign in to comment.