Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonathanMCarter/1b2a3154559c81a4fac5e5e4ce1f9ab5 to your computer and use it in GitHub Desktop.
Save JonathanMCarter/1b2a3154559c81a4fac5e5e4ce1f9ab5 to your computer and use it in GitHub Desktop.
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