From ed011f17328f5bc1861792bc3a55733549f9348d Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Thu, 13 Feb 2025 21:49:13 -0800 Subject: [PATCH] use SpriteMeshType.FullRect for all sprites cuz that makes it faster apparently --- NewHorizons/Builder/ShipLog/MapModeBuilder.cs | 10 +++++----- NewHorizons/Builder/ShipLog/RumorModeBuilder.cs | 2 +- NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs | 4 ++-- NewHorizons/Handlers/PlanetCreationHandler.cs | 2 +- NewHorizons/Handlers/SubtitlesHandler.cs | 2 +- NewHorizons/Handlers/VesselCoordinatePromptHandler.cs | 3 ++- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs index 9d66447f..372400cf 100644 --- a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs @@ -28,7 +28,7 @@ namespace NewHorizons.Builder.ShipLog if (_astroObjectToMapModeInfo.TryGetValue(slao, out var mapModeInfo)) { return mapModeInfo; - } + } else { return null; @@ -149,7 +149,7 @@ namespace NewHorizons.Builder.ShipLog Rect rect = new Rect(0, 0, texture.width, texture.height); Vector2 pivot = new Vector2(texture.width / 2, texture.height / 2); - newImage.sprite = Sprite.Create(texture, rect, pivot); + newImage.sprite = Sprite.Create(texture, rect, pivot, 100, 0, SpriteMeshType.FullRect, Vector4.zero, false); return newImageGO; } @@ -190,7 +190,7 @@ namespace NewHorizons.Builder.ShipLog Texture2D image = null; Texture2D outline = null; - + string imagePath = body.Config.ShipLog?.mapMode?.revealedSprite; string outlinePath = body.Config.ShipLog?.mapMode?.outlineSprite; @@ -591,7 +591,7 @@ namespace NewHorizons.Builder.ShipLog GameObject newNodeGO = CreateMapModeGameObject(node.mainBody, parent, layer, position); ShipLogAstroObject astroObject = AddShipLogAstroObject(newNodeGO, node.mainBody, greyScaleMaterial, layer); if (node.mainBody.Config.FocalPoint != null) - { + { astroObject._imageObj.GetComponent().enabled = false; astroObject._outlineObj.GetComponent().enabled = false; astroObject._unviewedObj.GetComponent().enabled = false; @@ -687,7 +687,7 @@ namespace NewHorizons.Builder.ShipLog } private static void ReplaceExistingMapModeIcon(NewHorizonsBody body, ModBehaviour mod, MapModeInfo info) - { + { var astroObject = _astroObjectToShipLog[body.Object]; var gameObject = astroObject.gameObject; var layer = gameObject.layer; diff --git a/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs b/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs index 7f4d28f2..daab11bb 100644 --- a/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs @@ -246,7 +246,7 @@ namespace NewHorizons.Builder.ShipLog Texture2D newTexture = ImageUtilities.GetTexture(body.Mod, relativePath); Rect rect = new Rect(0, 0, newTexture.width, newTexture.height); Vector2 pivot = new Vector2(newTexture.width / 2, newTexture.height / 2); - return Sprite.Create(newTexture, rect, pivot); + return Sprite.Create(newTexture, rect, pivot, 100, 0, SpriteMeshType.FullRect, Vector4.zero, false); } catch (Exception) { diff --git a/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs b/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs index cc5636eb..0ee7a574 100644 --- a/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs +++ b/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs @@ -63,7 +63,7 @@ namespace NewHorizons.Components.ShipLog } } - /* + /* if(VesselCoordinatePromptHandler.KnowsEyeCoordinates()) { AddSystemCard("EyeOfTheUniverse"); @@ -279,7 +279,7 @@ namespace NewHorizons.Components.ShipLog { var rect = new Rect(0, 0, texture.width, texture.height); var pivot = new Vector2(texture.width / 2, texture.height / 2); - return Sprite.Create(texture, rect, pivot); + return Sprite.Create(texture, rect, pivot, 100, 0, SpriteMeshType.FullRect, Vector4.zero, false); } private void OnTargetReferenceFrame(ReferenceFrame referenceFrame) diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 4de7e6a2..75cfd0ba 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -168,7 +168,7 @@ namespace NewHorizons.Handlers // I don't remember doing this why is it exceptions what am I doing GameObject existingPlanet = null; - if (body.Config.checkForExisting) + if (false && body.Config.checkForExisting) { try { diff --git a/NewHorizons/Handlers/SubtitlesHandler.cs b/NewHorizons/Handlers/SubtitlesHandler.cs index 1a42bc79..326b2e0c 100644 --- a/NewHorizons/Handlers/SubtitlesHandler.cs +++ b/NewHorizons/Handlers/SubtitlesHandler.cs @@ -109,7 +109,7 @@ namespace NewHorizons.Handlers var tex = ImageUtilities.GetTexture(mod, filepath, false); if (tex == null) return; - var sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f), 100.0f); + var sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f), 100, 0, SpriteMeshType.FullRect, Vector4.zero, false); AddSubtitle(sprite); } diff --git a/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs b/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs index d53eb875..a55be9c9 100644 --- a/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs +++ b/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; using UnityEngine; +using UnityEngine.UI; using static NewHorizons.External.Configs.StarSystemConfig; namespace NewHorizons.Handlers @@ -47,7 +48,7 @@ namespace NewHorizons.Handlers if (_textureCache == null) _textureCache = new List(); _textureCache.Add(texture); - var sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(texture.width / 2f, texture.height / 2f)); + var sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(texture.width / 2f, texture.height / 2f), 100, 0, SpriteMeshType.FullRect, Vector4.zero, false); var name = ShipLogStarChartMode.UniqueIDToName(systemID);