void RefreshResourcesData() { if (infoPanel_InUpgradeMode) { ResourceContainer[] cost = observingBuilding.GetUpgradeCost(); if (cost != null && cost.Length != 0) { float[] storageVolume = GameMaster.realMaster.colonyController.storage.standartResources; for (int i = 0; i < resourceCostIndicator.Length; i++) { if (i < cost.Length) { resourceCostIndicator[i].GetComponent <RawImage>().uvRect = ResourceType.GetResourceIconRect(cost[i].type.ID); Text t = resourceCostIndicator[i].transform.GetChild(0).GetComponent <Text>(); t.text = Localization.GetResourceName(cost[i].type.ID) + " : " + string.Format("{0:0.##}", cost[i].volume); t.color = cost[i].volume > storageVolume[cost[i].type.ID] ? Color.red : Color.white; savedResourcesValues[i] = new Vector2(cost[i].type.ID, cost[i].volume); resourceCostIndicator[i].SetActive(true); } else { resourceCostIndicator[i].SetActive(false); } } } } else { ResourceContainer[] cost = ResourcesCost.GetAdditionalSettlementBuildingCost(observingBuilding.level); if (cost != null && cost.Length != 0) { float[] storageVolume = GameMaster.realMaster.colonyController.storage.standartResources; for (int i = 0; i < resourceCostIndicator.Length; i++) { if (i < cost.Length) { resourceCostIndicator[i].GetComponent <RawImage>().uvRect = ResourceType.GetResourceIconRect(cost[i].type.ID); Text t = resourceCostIndicator[i].transform.GetChild(0).GetComponent <Text>(); t.text = Localization.GetResourceName(cost[i].type.ID) + " : " + string.Format("{0:0.##}", cost[i].volume); t.color = cost[i].volume > storageVolume[cost[i].type.ID] ? Color.red : Color.white; savedResourcesValues[i] = new Vector2(cost[i].type.ID, cost[i].volume); resourceCostIndicator[i].SetActive(true); } else { resourceCostIndicator[i].SetActive(false); } } } } }
void RefreshResourcesData() { var storage = GameMaster.realMaster.colonyController.storage; if (infoPanel_InUpgradeMode) { displayingCost = observingBuilding.GetUpgradeCost(); costLength = displayingCost?.Length ?? 0; if (costLength != 0) { for (int i = 0; i < resourceCostIndicator.Length; i++) { if (i < costLength) { resourceCostIndicator[i].GetComponent <RawImage>().uvRect = ResourceType.GetResourceIconRect(displayingCost[i].type.ID); Text t = resourceCostIndicator[i].transform.GetChild(0).GetComponent <Text>(); t.text = Localization.GetResourceName(displayingCost[i].type.ID) + " : " + string.Format("{0:0.##}", displayingCost[i].volume); t.color = displayingCost[i].volume > storage.GetResourceCount(displayingCost[i].type) ? Color.red : Color.white; resourceCostIndicator[i].SetActive(true); } else { resourceCostIndicator[i].SetActive(false); } } } } else { displayingCost = ResourcesCost.GetAdditionalSettlementBuildingCost(observingBuilding.level); costLength = displayingCost?.Length ?? 0; if (costLength != 0) { for (int i = 0; i < resourceCostIndicator.Length; i++) { if (i < costLength) { resourceCostIndicator[i].GetComponent <RawImage>().uvRect = ResourceType.GetResourceIconRect(displayingCost[i].type.ID); Text t = resourceCostIndicator[i].transform.GetChild(0).GetComponent <Text>(); t.text = Localization.GetResourceName(displayingCost[i].type.ID) + " : " + string.Format("{0:0.##}", displayingCost[i].volume); t.color = displayingCost[i].volume > storage.GetResourceCount(displayingCost[i].type) ? Color.red : Color.white; resourceCostIndicator[i].SetActive(true); } else { resourceCostIndicator[i].SetActive(false); } } } } }