show icon on press key V
This commit is contained in:
22
Class1.cs
22
Class1.cs
@@ -183,6 +183,18 @@ namespace StrategicMapPlus
|
||||
private Image iconImage;
|
||||
private TextMeshProUGUI debugText;
|
||||
private bool isInitialized = false;
|
||||
private bool hasContent = false;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (!isInitialized || displayObj == null) return;
|
||||
|
||||
bool shouldShow = hasContent && Input.GetKey(KeyCode.V);
|
||||
if (displayObj.activeSelf != shouldShow)
|
||||
{
|
||||
displayObj.SetActive(shouldShow);
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
@@ -224,6 +236,9 @@ namespace StrategicMapPlus
|
||||
// CRUCIAL: Ponemos el icono al final de la lista de hijos para que se pinte ENCIMA
|
||||
displayObj.transform.SetAsLastSibling();
|
||||
|
||||
// Inicialmente oculto
|
||||
displayObj.SetActive(false);
|
||||
|
||||
isInitialized = true;
|
||||
}
|
||||
catch (System.Exception e)
|
||||
@@ -236,6 +251,7 @@ namespace StrategicMapPlus
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
hasContent = false;
|
||||
if (displayObj != null && displayObj.activeSelf) displayObj.SetActive(false);
|
||||
}
|
||||
|
||||
@@ -247,13 +263,12 @@ namespace StrategicMapPlus
|
||||
// Aseguramos orden de dibujado (Encima de todo)
|
||||
displayObj.transform.SetAsLastSibling();
|
||||
|
||||
if (!displayObj.activeSelf) displayObj.SetActive(true);
|
||||
|
||||
if (s != null)
|
||||
{
|
||||
iconImage.sprite = s;
|
||||
iconImage.enabled = true;
|
||||
if (debugText != null) debugText.text = "";
|
||||
hasContent = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,10 +279,9 @@ namespace StrategicMapPlus
|
||||
|
||||
displayObj.transform.SetAsLastSibling();
|
||||
|
||||
if (!displayObj.activeSelf) displayObj.SetActive(true);
|
||||
|
||||
if (iconImage != null) iconImage.enabled = false;
|
||||
if (debugText != null) debugText.text = t;
|
||||
hasContent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,12 @@
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>..\..\..\..\SteamLibrary\steamapps\common\A Game of Thrones The Board Game\AGameOfThronesTheBoardGame_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.InputLegacyModule">
|
||||
<HintPath>..\..\..\..\SteamLibrary\steamapps\common\A Game of Thrones The Board Game\AGameOfThronesTheBoardGame_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.InputModule">
|
||||
<HintPath>..\..\..\..\SteamLibrary\steamapps\common\A Game of Thrones The Board Game\AGameOfThronesTheBoardGame_Data\Managed\UnityEngine.InputModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>..\..\..\..\SteamLibrary\steamapps\common\A Game of Thrones The Board Game\AGameOfThronesTheBoardGame_Data\Managed\UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -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+ae0a5853b586351c17dcfa88c3344792a4628614")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3a2fe72742c02070b8b8e2c10245e8e1041d44ff")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StrategicView-Plus")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StrategicView-Plus")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
2b75dcbe8616bb42f12edaec3fc9bc49fdb1555dee5fe1f058109fdefbb47f6b
|
||||
6ca3cc0d9cf2ddd856703ea11f553a16eee2ab4b27a2c5b712fe31e12d397fe0
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
3cb9f30b2f7cdc911644f787aa9d0bd1dec3a38c35c65d0087457f82898e73da
|
||||
b51faeaabe4023883c8e279a84563b68bea28fdd80c39c2b396ab61d047966dc
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user