public void PrepareHangarWindow() { showingStatus = observingHangar.status; switch (showingStatus) { case Hangar.HangarStatus.ShuttleOnMission: { if (buildWindow.activeSelf) { buildWindow.SetActive(false); } if (mycanvas.progressPanelMode == ProgressPanelMode.Hangar) { mycanvas.DeactivateProgressPanel(ProgressPanelMode.Hangar); } shuttleLabel.GetChild(0).GetComponent <RawImage>().uvRect = UIController.GetIconUVRect(Icons.GuidingStar); shuttleLabel.GetChild(1).GetComponent <Text>().text = Localization.GetPhrase(LocalizedPhrase.ShuttleOnMission); if (!shuttleLabel.gameObject.activeSelf) { shuttleLabel.gameObject.SetActive(true); } break; } case Hangar.HangarStatus.ShuttleInside: { if (buildWindow.activeSelf) { buildWindow.SetActive(false); } if (mycanvas.progressPanelMode == ProgressPanelMode.Hangar) { mycanvas.DeactivateProgressPanel(ProgressPanelMode.Hangar); } shuttleLabel.GetChild(0).GetComponent <RawImage>().uvRect = UIController.GetIconUVRect(Icons.ShuttleGoodIcon); shuttleLabel.GetChild(1).GetComponent <Text>().text = Localization.GetPhrase(LocalizedPhrase.ShuttleReady); if (!shuttleLabel.gameObject.activeSelf) { shuttleLabel.gameObject.SetActive(true); } break; } case Hangar.HangarStatus.ConstructingShuttle: { if (buildWindow.activeSelf) { buildWindow.SetActive(false); } mycanvas.ActivateProgressPanel(ProgressPanelMode.Hangar); if (shuttleLabel.gameObject.activeSelf) { shuttleLabel.gameObject.SetActive(false); } break; } case Hangar.HangarStatus.NoShuttle: default: { if (!buildWindow.activeSelf) { buildWindow.SetActive(true); } if (mycanvas.progressPanelMode == ProgressPanelMode.Hangar) { mycanvas.DeactivateProgressPanel(ProgressPanelMode.Hangar); } if (shuttleLabel.gameObject.activeSelf) { shuttleLabel.gameObject.SetActive(false); } displayingCost = ResourcesCost.GetCost(ResourcesCost.SHUTTLE_BUILD_COST_ID); costLength = displayingCost?.Length ?? 0; var storage = GameMaster.realMaster.colonyController.storage; int rid; for (int i = 0; i < resourceCostContainer.transform.childCount; i++) { Transform t = resourceCostContainer.GetChild(i); if (i < costLength) { rid = displayingCost[i].type.ID; t.GetComponent <RawImage>().uvRect = ResourceType.GetResourceIconRect(rid); Text tx = t.GetChild(0).GetComponent <Text>(); tx.text = Localization.GetResourceName(rid) + " : " + displayingCost[i].volume.ToString(); if (storage.GetResourceCount(rid) < displayingCost[i].volume) { tx.color = Color.red; } else { tx.color = Color.white; } t.gameObject.SetActive(true); } else { t.gameObject.SetActive(false); } } lastStorageDrawnValue = storage.operationsDone; break; } } }
public void PrepareHangarWindow() { var uc = UIController.current; var rcc = resourceCostContainer.gameObject; showingStatus = observingHangar.status; switch (showingStatus) { case Hangar.HangarStatus.ShuttleOnMission: { if (rcc.activeSelf) { rcc.SetActive(false); } if (uc.progressPanelMode == ProgressPanelMode.Hangar) { uc.DeactivateProgressPanel(ProgressPanelMode.Hangar); } shuttleLabel.GetChild(0).GetComponent <RawImage>().uvRect = UIController.GetIconUVRect(Icons.GuidingStar); shuttleLabel.GetChild(1).GetComponent <Text>().text = Localization.GetPhrase(LocalizedPhrase.ShuttleOnMission); if (!shuttleLabel.gameObject.activeSelf) { shuttleLabel.gameObject.SetActive(true); } break; } case Hangar.HangarStatus.ShuttleInside: { if (rcc.activeSelf) { rcc.SetActive(false); } if (uc.progressPanelMode == ProgressPanelMode.Hangar) { uc.DeactivateProgressPanel(ProgressPanelMode.Hangar); } shuttleLabel.GetChild(0).GetComponent <RawImage>().uvRect = UIController.GetIconUVRect(Icons.ShuttleGoodIcon); shuttleLabel.GetChild(1).GetComponent <Text>().text = Localization.GetPhrase(LocalizedPhrase.ShuttleReady); if (!shuttleLabel.gameObject.activeSelf) { shuttleLabel.gameObject.SetActive(true); } break; } case Hangar.HangarStatus.ConstructingShuttle: { if (rcc.activeSelf) { rcc.SetActive(false); } UIController.current.ActivateProgressPanel(ProgressPanelMode.Hangar); if (shuttleLabel.gameObject.activeSelf) { shuttleLabel.gameObject.SetActive(false); } break; } case Hangar.HangarStatus.NoShuttle: default: { if (!rcc.activeSelf) { rcc.SetActive(true); } if (uc.progressPanelMode == ProgressPanelMode.Hangar) { uc.DeactivateProgressPanel(ProgressPanelMode.Hangar); } if (shuttleLabel.gameObject.activeSelf) { shuttleLabel.gameObject.SetActive(false); } ResourceContainer[] rc = ResourcesCost.GetCost(ResourcesCost.SHUTTLE_BUILD_COST_ID); var st = GameMaster.realMaster.colonyController.storage; float[] storageResources = st.standartResources; for (int i = 1; i < resourceCostContainer.transform.childCount; i++) { Transform t = resourceCostContainer.GetChild(i); if (i < rc.Length) { int rid = rc[i].type.ID; t.GetComponent <RawImage>().uvRect = ResourceType.GetResourceIconRect(rid); Text tx = t.GetChild(0).GetComponent <Text>(); tx.text = Localization.GetResourceName(rid) + " : " + rc[i].volume.ToString(); showingResourcesCount[i] = new Vector2(rid, rc[i].volume); if (storageResources[rid] < rc[i].volume) { tx.color = Color.red; } else { tx.color = Color.white; } t.gameObject.SetActive(true); } else { t.gameObject.SetActive(false); } } lastStorageDrawnValue = st.operationsDone; break; } } }