-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
205 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
namespace SCANsat.Unity | ||
{ | ||
public struct MapLabelInfo | ||
{ | ||
public string label; | ||
public Sprite image; | ||
public Vector2 pos; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
namespace SCANsat.Unity.Unity | ||
{ | ||
public class SCAN_MapLabel : MonoBehaviour | ||
{ | ||
[SerializeField] | ||
private Image m_Image = null; | ||
[SerializeField] | ||
private TextHandler m_Label = null; | ||
|
||
private Guid _id; | ||
private RectTransform rect; | ||
|
||
public Guid ID | ||
{ | ||
get { return _id; } | ||
} | ||
|
||
private void Awake() | ||
{ | ||
rect = GetComponent<RectTransform>(); | ||
} | ||
|
||
public void Setup(Guid id, string label, Sprite image, Vector2 pos) | ||
{ | ||
_id = id; | ||
|
||
UpdateLabel(label); | ||
|
||
UpdateImage(image); | ||
|
||
UpdatePosition(pos); | ||
} | ||
|
||
public void UpdateLabel(string l) | ||
{ | ||
if (!string.IsNullOrEmpty(l) && m_Label != null) | ||
m_Label.OnTextUpdate.Invoke(l); | ||
} | ||
|
||
public void UpdateImage(Sprite s) | ||
{ | ||
if (m_Image != null) | ||
m_Image.sprite = s; | ||
} | ||
|
||
public void UpdatePosition(Vector2 p) | ||
{ | ||
if (rect != null) | ||
rect.anchoredPosition = p; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters