use SpriteMeshType.FullRect for all sprites cuz that makes it faster apparently

This commit is contained in:
JohnCorby 2025-02-13 21:49:13 -08:00
parent b8d7af90f1
commit ed011f1732
6 changed files with 12 additions and 11 deletions

View File

@ -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<Image>().enabled = false;
astroObject._outlineObj.GetComponent<Image>().enabled = false;
astroObject._unviewedObj.GetComponent<Image>().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;

View File

@ -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)
{

View File

@ -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)

View File

@ -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
{

View File

@ -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);
}

View File

@ -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<Texture2D>();
_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);