Skip to content

Commit

Permalink
Added auto zoom to map size
Browse files Browse the repository at this point in the history
  • Loading branch information
thespbgamer committed Jan 23, 2023
1 parent fea87b4 commit 45c0bdf
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 13 deletions.
23 changes: 12 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

### Added

- Ability to change the camera position, you can also reset it to the default position.
- Ability to change the camera position, you can also reset it to the default position
- Auto Zoom to approximate map size

### Fixed

Expand All @@ -13,7 +14,7 @@

### Added

- Ability to change to zoom level to the approximate current map size.
- Ability to change to zoom level to the approximate current map size

### Changed

Expand Down Expand Up @@ -49,7 +50,7 @@

### Added

- Option that hides the UI at a certain zoom level.
- Option that hides the UI at a certain zoom level

### Fixed

Expand All @@ -59,21 +60,21 @@

### Added

- Toggle UI.
- Toggle UI

## [1.9.0] - 2022-01-27

### Added

- Max and Min UI or Zoom.
- Max and Min UI or Zoom

### Changed

- Config variable names

### Improvements

- Updated API for the optional Generic Mod Config Menu → [Here](https://www.nexusmods.com/stardewvalley/mods/5098).
- Updated API for the optional Generic Mod Config Menu → [Here](https://www.nexusmods.com/stardewvalley/mods/5098)
- README file

### Fixed
Expand All @@ -84,32 +85,32 @@

### Improvements

- Added support for the new API version.
- Added support for the new API version

## [1.7.0] - 2021-05-17

### Added

- Reset UI or Zoom.
- Reset UI or Zoom

## [1.6.0] - 2021-05-01

### Added

- Control Zoom and UI levels anywhere if activated.
- Control Zoom and UI levels anywhere if activated

## [1.5.1] - 2021-04-12

### Fixed

- Support for the optional Generic Mod Config Menu → [Here](https://www.nexusmods.com/stardewvalley/mods/5098).
- Support for the optional Generic Mod Config Menu → [Here](https://www.nexusmods.com/stardewvalley/mods/5098)
- Some text typos

## [1.5.0] - 2021-04-11

### Added

- Support for the optional Generic Mod Config Menu → [Here](https://www.nexusmods.com/stardewvalley/mods/5098).
- Support for the optional Generic Mod Config Menu → [Here](https://www.nexusmods.com/stardewvalley/mods/5098)

### Changed

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Here's what you can change:
`ZoomAndUIControlEverywhere` | `false` | If activated you can control your Zoom and UI Level anywhere.
`IsHideUIWithCertainZoom` | `false` | If activated your UI hides when it reaches a certain zoom level.
`PressAnyButtonToCenterCamera` | `true` | If activated any key you press will center the Camera.
`AutoZoomToMapSize` | `false` | If activated it auto zooms to map size.

## Compatibility
ZoomLevel is compatible with Stardew Valley 1.5+ on Linux/Mac/Windows, both single-player, local co-op and multiplayer.
Expand Down
3 changes: 2 additions & 1 deletion ZoomLevel/ModConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ internal class ModConfig
public bool SuppressControllerButton { get; set; } = true;
public bool ZoomAndUIControlEverywhere { get; set; } = false;
public bool IsHideUIWithCertainZoom { get; set; } = false;

public bool PressAnyButtonToCenterCamera { get; set; } = true;

public bool AutoZoomToMapSize { get; set; } = false;
}
}
23 changes: 22 additions & 1 deletion ZoomLevel/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,28 @@ public override void Entry(IModHelper helper)
{
configsForTheMod = helper.ReadConfig<ModConfig>();

helper.Events.GameLoop.GameLaunched += OnLaunched;
helper.Events.GameLoop.GameLaunched += this.OnLaunched;
helper.Events.Input.ButtonPressed += this.Events_Input_ButtonPressed;

//On area change and on load save
helper.Events.Player.Warped += this.Player_Warped;
helper.Events.GameLoop.DayStarted += this.GameLoop_DayStarted;
}

private void GameLoop_DayStarted(object sender, DayStartedEventArgs e)
{
if (configsForTheMod.AutoZoomToMapSize == true)
{
ChangeZoomLevelToCurrentMapSize();
}
}

private void Player_Warped(object sender, WarpedEventArgs e)
{
if (configsForTheMod.AutoZoomToMapSize == true)
{
ChangeZoomLevelToCurrentMapSize();
}
}

private void OnLaunched(object sender, GameLaunchedEventArgs e)
Expand Down Expand Up @@ -64,6 +84,7 @@ private void OnLaunched(object sender, GameLaunchedEventArgs e)
genericModConfigMenuAPI.AddBoolOption(ModManifest, () => configsForTheMod.ZoomAndUIControlEverywhere, (bool val) => configsForTheMod.ZoomAndUIControlEverywhere = val, () => Helper.Translation.Get("others.ZoomAndUIAnywhere.name"), () => Helper.Translation.Get("others.ZoomAndUIAnywhere.description"));
genericModConfigMenuAPI.AddBoolOption(ModManifest, () => configsForTheMod.IsHideUIWithCertainZoom, (bool val) => configsForTheMod.IsHideUIWithCertainZoom = val, () => Helper.Translation.Get("others.HideUIWithCertainZoom.name"), () => Helper.Translation.Get("others.HideUIWithCertainZoom.description"));
genericModConfigMenuAPI.AddBoolOption(ModManifest, () => configsForTheMod.PressAnyButtonToCenterCamera, (bool val) => configsForTheMod.PressAnyButtonToCenterCamera = val, () => Helper.Translation.Get("others.PressAnyButtonToCenterCamera.name"), () => Helper.Translation.Get("others.PressAnyButtonToCenterCamera.description"));
genericModConfigMenuAPI.AddBoolOption(ModManifest, () => configsForTheMod.AutoZoomToMapSize, (bool val) => configsForTheMod.AutoZoomToMapSize = val, () => Helper.Translation.Get("others.AutoZoomToMapSize.name"), () => Helper.Translation.Get("others.AutoZoomToMapSize.description"));
}
}

Expand Down
2 changes: 2 additions & 0 deletions ZoomLevel/i18n/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@
"others.HideUIWithCertainZoom.description": "If activated your UI hides when it reaches a certain zoom level.\nIt can be changed by the 'Toggle Hide UI at Certain Zoom'.",
"others.PressAnyButtonToCenterCamera.name": "Press Button to Center Camera",
"others.PressAnyButtonToCenterCamera.description": "If activated your camera centers if any key is pressed.\nIf not, you will need to press the 'Reset Camera Movement' key.",
"others.AutoZoomToMapSize.name": "Auto Zoom to Map Size",
"others.AutoZoomToMapSize.description": "If activated it auto zooms to map size.\nIf not, it will not do that.",
"hudMessages.HideUIWithCertainZoomIs.message": "Hide UI With Certain Zoom is now: {{value}}"
}
2 changes: 2 additions & 0 deletions ZoomLevel/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@
"others.HideUIWithCertainZoom.description": "If activated your UI hides when it reaches a certain zoom level.\nIt can be changed by the 'Toggle Hide UI at Certain Zoom'.",
"others.PressAnyButtonToCenterCamera.name": "Press Button to Center Camera",
"others.PressAnyButtonToCenterCamera.description": "If activated your camera centers if any key is pressed.\nIf not, you will need to press the 'Reset Camera Movement' key.",
"others.AutoZoomToMapSize.name": "Auto Zoom to Map Size",
"others.AutoZoomToMapSize.description": "If activated it auto zooms to map size.\nIf not, it will not do that.",
"hudMessages.HideUIWithCertainZoomIs.message": "Hide UI With Certain Zoom is now: {{value}}"
}

0 comments on commit 45c0bdf

Please sign in to comment.