public bool SetupRequirement(Transform elementRoot, Requirement req, int currentAmount) { Image imageResIcon = elementRoot.transform.Find("res_icon").GetComponent <Image>(); Text textResName = elementRoot.transform.Find("res_name").GetComponent <Text>(); Text textResAmount = elementRoot.transform.Find("res_amount").GetComponent <Text>(); UITooltip uiTooltip = elementRoot.GetComponent <UITooltip>(); if (req.m_resItem != null) { imageResIcon.gameObject.SetActive(value: true); textResName.gameObject.SetActive(value: true); textResAmount.gameObject.SetActive(value: true); imageResIcon.sprite = req.m_resItem.m_itemData.GetIcon(); imageResIcon.color = Color.white; uiTooltip.m_text = Localization.instance.Localize(req.m_resItem.m_itemData.m_shared.m_name); textResName.text = Localization.instance.Localize(req.m_resItem.m_itemData.m_shared.m_name); int requiredAmount = req.GetAmount(0); int playerAmount = PlayerGetResourceCount(Player.m_localPlayer, req.m_resItem.m_itemData.m_shared.m_name); int remaining = requiredAmount - currentAmount; textResAmount.text = currentAmount + "/" + requiredAmount; if (remaining > 0 && playerAmount == 0) { imageResIcon.color = Color.gray; textResAmount.color = ((Mathf.Sin(Time.time * 10f) > 0f) ? Color.red : Color.white); } else { imageResIcon.color = Color.white; textResAmount.color = Color.white; } } return(true); }