public void updateUI() { App app = UnityEngine.Object.FindObjectOfType <App>(); int playerIndex = app.GetHumanIndex(); Nation player = State.getNations()[playerIndex]; Debug.Log("Updating UI_______________"); turn.text = State.turn.ToString(); updateDevelopmentPanel(player); updateInventoryPanel(player); updateInformationPanel(player); if (ProductionPanel.activeSelf) { updateProductionPanel(player); } if (doctrineTab.activeSelf) { updateDoctrinePanel(player); } if (PlayerCalculator.canBuildTrain(player)) { addTrain.interactable = true; } else { addTrain.interactable = false; } }
private void updateTransportPanel() { Debug.Log("Begin Updating Transport Panel"); App app = UnityEngine.Object.FindObjectOfType <App>(); Nation player = State.getNations()[app.GetHumanIndex()]; int transportFlow = PlayerCalculator.calculateTransportFlow(player); int totalNumberProv = PlayerCalculator.getTotalNumberOfProvinces(player); int realTransportCapacity = PlayerCalculator.calculateMaxTransportFlow(player); Debug.Log("Transport Flow: " + transportFlow); Debug.Log("Current Transport Capacity: " + realTransportCapacity); // player.industry.setTransportFlow(PlayerCalculator.calculateTransportFlow(player)); float coalUsedForTransport = (transportFlow - totalNumberProv) * 0.2f; transportCapacity.text = transportFlow.ToString() + "/" + realTransportCapacity.ToString(); coalCapacity.text = player.getNumberResource(MyEnum.Resources.coal).ToString(); int remainingFlow = realTransportCapacity - transportFlow; Debug.Log("Remaining Flow Capacity: " + remainingFlow); if (PlayerCalculator.canBuildTrain(player)) { addTransportCapacityButton.interactable = true; } else { addTransportCapacityButton.interactable = false; } // Counter used for switching from first to second table in Production GUI int counter = 0; foreach (MyEnum.Resources res in Enum.GetValues(typeof(MyEnum.Resources))) { int producing = PlayerCalculator.getResourceProducing(player, res); int currentFlow = player.getResTransportFlow(res); Debug.Log("Resource is: " + res + "---------------------------------------------"); Debug.Log("Producing: " + producing); Debug.Log("Current Flow: " + currentFlow); //int systemFlow = player.industry.getTransportFlow(); int capacity = Math.Min(producing - currentFlow, remainingFlow); Debug.Log("Remaining " + res + " capacity: " + capacity); int max = currentFlow + capacity; Debug.Log("Max: " + max); if (counter <= 5) { Debug.Log("check 2553"); Text resFlow = resourceTableA.Rows[counter].Cells[1].GetComponentInChildren <Text>(); Slider resSlider = resourceTableA.Rows[counter].Cells[2].GetComponentInChildren <Slider>(); resFlow.text = currentFlow + "/" + producing; if (max == currentFlow && max < producing) { Debug.Log("poop"); resFlow.color = new Color32(170, 12, 12, 255); } else { resFlow.color = new Color32(0, 0, 0, 255); } resSlider.maxValue = max; resSlider.minValue = 0; resSlider.value = currentFlow; Debug.Log("check 2569"); } else { Debug.Log("check 2573"); Text resFlow = resourceTableB.Rows[counter % 6].Cells[1].GetComponentInChildren <Text>(); Slider resSlider = resourceTableB.Rows[counter % 6].Cells[2].GetComponentInChildren <Slider>(); resFlow.text = currentFlow + "/" + producing; if (max == currentFlow && max < producing) { Debug.Log("poop"); resFlow.color = new Color32(170, 12, 12, 255); } else { resFlow.color = new Color32(0, 0, 0, 255); } resSlider.maxValue = max; resSlider.minValue = 0; resSlider.value = currentFlow; } counter++; Debug.Log("Counter: " + counter); } }