mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Hn mapmode and subtitle borked (#816)
## Bug fixes - Fix ship log map mode auto/manual placement - Fix subtitle becoming invisible when image width is smaller than EOTE subtitle
This commit is contained in:
commit
bb662a610a
@ -30,7 +30,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
{
|
||||
if (body.Config.ShipLog == null) continue;
|
||||
|
||||
if (body.Config.ShipLog?.mapMode?.manualPosition == null)
|
||||
if (body.Config.ShipLog.mapMode?.manualPosition == null)
|
||||
{
|
||||
flagAutoPositionUsed = true;
|
||||
}
|
||||
@ -45,6 +45,12 @@ namespace NewHorizons.Builder.ShipLog
|
||||
}
|
||||
}
|
||||
|
||||
// If they're both false, just default to auto (this means that no planets even have ship log info)
|
||||
if (!flagManualPositionUsed && !flagAutoPositionUsed)
|
||||
{
|
||||
flagAutoPositionUsed = true;
|
||||
}
|
||||
|
||||
var isBaseSolarSystem = systemName == "SolarSystem";
|
||||
|
||||
// Default to MANUAL in Base Solar System (we can't automatically fix them so it might just break, but AUTO breaks even more!)
|
||||
|
||||
1
NewHorizons/External/Configs/PlanetConfig.cs
vendored
1
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -213,7 +213,6 @@ namespace NewHorizons.External.Configs
|
||||
// Always have to have a base module
|
||||
if (Base == null) Base = new BaseModule();
|
||||
if (Orbit == null) Orbit = new OrbitModule();
|
||||
if (ShipLog == null) ShipLog = new ShipLogModule();
|
||||
if (ReferenceFrame == null) ReferenceFrame = new ReferenceFrameModule();
|
||||
}
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
class SubtitlesHandler : MonoBehaviour
|
||||
{
|
||||
public static int SUBTITLE_HEIGHT = 97;
|
||||
public static int SUBTITLE_WIDTH = 669; // nice
|
||||
public static float SUBTITLE_HEIGHT = 97;
|
||||
public static float SUBTITLE_WIDTH = 669; // nice
|
||||
|
||||
public float fadeSpeed = 0.005f;
|
||||
public float fade = 1;
|
||||
@ -45,7 +45,7 @@ namespace NewHorizons.Handlers
|
||||
if (eoteSprite != null)
|
||||
{
|
||||
// Don't make it appear first actually because we have mods to display!
|
||||
possibleSubtitles.Add(eoteSprite);
|
||||
possibleSubtitles.Add(eoteSprite);
|
||||
}
|
||||
eoteSubtitleHasBeenInserted = true;
|
||||
}
|
||||
@ -67,7 +67,7 @@ namespace NewHorizons.Handlers
|
||||
CheckForEOTE();
|
||||
|
||||
// We add our subtitles as a child object so that their sizing doesnt shift the layout of the main menu
|
||||
_subtitleDisplay = new GameObject().AddComponent<Image>();
|
||||
_subtitleDisplay = new GameObject("SubtitleDisplay").AddComponent<Image>();
|
||||
_subtitleDisplay.transform.parent = transform;
|
||||
_subtitleDisplay.transform.localPosition = new Vector3(0, 0, 0);
|
||||
_subtitleDisplay.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f);
|
||||
@ -173,9 +173,12 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
subtitleIndex = (subtitleIndex + 1) % possibleSubtitles.Count;
|
||||
|
||||
_subtitleDisplay.sprite = possibleSubtitles[subtitleIndex];
|
||||
var ratio = SUBTITLE_WIDTH / _subtitleDisplay.sprite.texture.width;
|
||||
_subtitleDisplay.rectTransform.sizeDelta = new Vector2(_subtitleDisplay.sprite.texture.width, _subtitleDisplay.sprite.texture.height) * ratio;
|
||||
var subtitle = possibleSubtitles[subtitleIndex];
|
||||
_subtitleDisplay.sprite = subtitle;
|
||||
var width = subtitle.texture.width;
|
||||
var height = subtitle.texture.height;
|
||||
var ratio = SUBTITLE_WIDTH / width; // one of these needs to be a float so that compiler doesn't think "oh 2 integers! let's round to nearest whole"
|
||||
_subtitleDisplay.rectTransform.sizeDelta = new Vector2(width, height) * ratio;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user