add offsets dictionary
This commit is contained in:
13
Class1.cs
13
Class1.cs
@@ -58,7 +58,10 @@ namespace StrategicMapPlus
|
||||
if (textureLookup.ContainsKey(texName))
|
||||
{
|
||||
Texture2D tex = textureLookup[texName];
|
||||
Texture2D roundTex = MakeTextureTransparent(tex);
|
||||
Textures.IconOffset offset = null;
|
||||
if (Textures.IconsOffsets.ContainsKey(logicKey)) offset = Textures.IconsOffsets[logicKey];
|
||||
|
||||
Texture2D roundTex = MakeTextureTransparent(tex, offset);
|
||||
Sprite s = Sprite.Create(roundTex, new Rect(0, 0, roundTex.width, roundTex.height), new Vector2(0.5f, 0.5f));
|
||||
SpriteCache[logicKey] = s;
|
||||
loadedCount++;
|
||||
@@ -177,7 +180,7 @@ namespace StrategicMapPlus
|
||||
}
|
||||
|
||||
// Función auxiliar que podrías llamar desde tu parche de Harmony
|
||||
public static Texture2D MakeTextureTransparent(Texture originalTexture)
|
||||
public static Texture2D MakeTextureTransparent(Texture originalTexture, Textures.IconOffset offset = null)
|
||||
{
|
||||
if (originalTexture == null) return null;
|
||||
|
||||
@@ -207,6 +210,12 @@ namespace StrategicMapPlus
|
||||
Vector2 center = new Vector2(width / 2f, height / 2f);
|
||||
float radius = (Mathf.Min(width, height) / 2f); // Radio máximo
|
||||
|
||||
if (offset != null)
|
||||
{
|
||||
center += new Vector2(offset.x, offset.y);
|
||||
if (offset.size > 0) radius = offset.size / 2f;
|
||||
}
|
||||
|
||||
for (int i = 0; i < pixels.Length; i++)
|
||||
{
|
||||
// --- Opción A: Máscara Redonda (Matemática) ---
|
||||
|
||||
14
Textures.cs
14
Textures.cs
@@ -39,5 +39,19 @@ namespace StrategicMapPlus
|
||||
};
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
static public Dictionary<string, IconOffset> IconsOffsets = new Dictionary<string, IconOffset>() { };
|
||||
|
||||
public class IconOffset
|
||||
{
|
||||
public float x; public float y;
|
||||
public float size;
|
||||
|
||||
public IconOffset(float x, float y, float size)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StrategicView-Plus")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+132b1baedc3e76f674b00252e91ab05982ba6455")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9153fd763e579199d54cab0a432ff9090b4c64e9")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StrategicView-Plus")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StrategicView-Plus")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
6324d5e6ed883eb594c7f064c6899c6620ec3f6f4b54e50bf9c693a1c9798e38
|
||||
32d9cb21f9105a306e788f865867ce1cabf7e1239b4f80ba170e98b961bae87f
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user