Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The method that edits the visuals when a user selects an icon from the "editing" popup.
/// <summary>
/// Updates the card visual based on its status number...
/// </summary>
public void UpdateCardVisuals()
{
if (!status.Equals(0))
{
if (status.ToString().Length.Equals(1))
{
_icons[1].SetActive(false);
_icons[0].SetActive(true);
_icons[0].GetComponent<Image>().color = _scm.elements.colors[status - 1];
_icons[0].GetComponentsInChildren<Image>()[1].sprite = _scm.elements.icons[status - 1];
_icons[0].GetComponentsInChildren<Image>()[1].enabled = true;
}
else
{
if (!StringHelper.Get(1, status).Equals(0))
{
_icons[0].SetActive(false);
_icons[1].SetActive(true);
_icons[1].transform.GetChild(0).GetComponentsInChildren<Image>()[0].color = _scm.elements.colors[As.Int(StringHelper.Get(0, status)) - 1];
_icons[1].transform.GetChild(0).GetComponentsInChildren<Image>()[1].sprite = _scm.elements.icons[As.Int(StringHelper.Get(0, status)) - 1];
_icons[1].transform.GetChild(0).GetComponentsInChildren<Image>()[1].enabled = true;
_icons[1].transform.GetChild(1).GetComponentsInChildren<Image>()[0].color = _scm.elements.colors[As.Int(StringHelper.Get(1, status)) - 1];
_icons[1].transform.GetChild(1).GetComponentsInChildren<Image>()[1].sprite = _scm.elements.icons[As.Int(StringHelper.Get(1, status)) - 1];
_icons[1].transform.GetChild(1).GetComponentsInChildren<Image>()[1].enabled = true;
}
else
{
_icons[1].SetActive(false);
_icons[0].SetActive(true);
_icons[0].GetComponent<Image>().color = _scm.elements.colors[status - 1];
_icons[0].GetComponentsInChildren<Image>()[1].sprite = _scm.elements.icons[status - 1];
_icons[0].GetComponentsInChildren<Image>()[1].enabled = true;
}
}
}
else
{
_icons[1].SetActive(false);
_icons[0].SetActive(true);
_icons[0].GetComponentsInChildren<Image>()[1].enabled = false;
GetComponentInChildren<CarterGames.Utilities.DarkModeUI>().UpdateDarkModeUI();
cardIcon.sprite = null;
cardIcon.enabled = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment