示例#1
0
    private void RedrawWindow()
    {
        int        statedCrystalsCount = 0, statedSuppliesCount = Expedition.MIN_SUPPLIES_COUNT;
        Color      redcolor = Color.red, whitecolor = Color.white;
        GameObject g;

        if (showingExpedition == null)
        {
            //подготовка новой экспедиции
            expLabel.text = Localization.GetExpeditionName(selectedDestination);
            bool readyToStart = true;

            PrepareCrewDropdown();
            if (selectedCrew != null)
            {
                readyToStart = selectedCrew.atHome;
                crewButton.SetActive(true);
            }
            else
            {
                readyToStart = false;
                crewButton.SetActive(false);
            }
            if (!crewDropdown.gameObject.activeSelf)
            {
                crewDropdown.gameObject.SetActive(true);
                crewStableName.enabled = false;
            }
            //supplies
            suppliesSlider.value = statedSuppliesCount;
            OnSuppliesSliderChanged(statedSuppliesCount);
            if (preparingMode != true)
            {
                suppliesSlider.gameObject.SetActive(true);
                suppliesStableValue.gameObject.SetActive(false);
            }
            //crystals
            crystalsSlider.value = statedCrystalsCount;
            OnCrystalsSliderChanged(statedCrystalsCount);
            if (preparingMode != true)
            {
                crystalsSlider.gameObject.SetActive(true);
                crystalsStableValue.gameObject.SetActive(false);
            }
            //transmitters:
            int c = QuantumTransmitter.GetFreeTransmittersCount();
            if (c > 0)
            {
                transmitterMarker.uvRect = UIController.GetIconUVRect(Icons.TaskCompleted);
                transmitterLabel.text    = Localization.GetPhrase(LocalizedPhrase.FreeTransmitters) + c.ToString();
                transmitterLabel.color   = whitecolor;
            }
            else
            {
                transmitterMarker.uvRect = UIController.GetIconUVRect(Icons.TaskFailed);
                transmitterLabel.text    = Localization.GetPhrase(LocalizedPhrase.NoTransmitters);
                transmitterLabel.color   = redcolor;
                readyToStart             = false;
            }
            //shuttles:
            c = Hangar.GetFreeShuttlesCount();
            if (c > 0)
            {
                shuttleMarker.uvRect = UIController.GetIconUVRect(Icons.TaskCompleted);
                shuttleLabel.text    = Localization.GetPhrase(LocalizedPhrase.FreeShuttles) + c.ToString();
                shuttleLabel.color   = whitecolor;
            }
            else
            {
                shuttleMarker.uvRect = UIController.GetIconUVRect(Icons.TaskFailed);
                shuttleLabel.text    = Localization.GetPhrase(LocalizedPhrase.NoShuttles);
                shuttleLabel.color   = redcolor;
                readyToStart         = false;
            }
            lastShuttlesListMarker = Hangar.listChangesMarkerValue;
            //fuel:
            if (FuelCheck() == false)
            {
                readyToStart = false;
            }
            if (preparingMode != true)
            {
                shuttleLine.gameObject.SetActive(true);
                fuelLine.gameObject.SetActive(true);
                minigameButton.SetActive(false);
            }
            //launch button
            launchButtonLabel.text    = Localization.GetWord(LocalizedWord.Launch);
            launchButton.interactable = readyToStart;
            launchButton.GetComponent <Image>().color = readyToStart ? lightcyan : Color.grey;
            launchButton.gameObject.SetActive(true);
            //
            preparingMode = true;
        }
        else
        {
            // отрисовка существующей
            expLabel.text          = Localization.GetExpeditionName(showingExpedition);
            statedCrystalsCount    = showingExpedition.crystalsCollected;
            statedSuppliesCount    = showingExpedition.suppliesCount;
            lastChangesMarkerValue = showingExpedition.changesMarkerValue;

            crewStableName.text = showingExpedition.crew.name;
            if (crewDropdown.gameObject.activeSelf)
            {
                crewDropdown.gameObject.SetActive(false);
                crewStableName.enabled = true;
            }
            //supplies
            suppliesStableValue.text  = statedSuppliesCount.ToString();
            suppliesStableValue.color = statedSuppliesCount > 0 ? whitecolor : redcolor;
            if (preparingMode != false)
            {
                suppliesSlider.gameObject.SetActive(false);
                suppliesStableValue.gameObject.SetActive(true);
            }
            //crystals
            crystalsStableValue.text = statedCrystalsCount.ToString();
            if (preparingMode != false)
            {
                crystalsSlider.gameObject.SetActive(false);
                crystalsStableValue.gameObject.SetActive(true);
            }
            //transmitter:
            if (showingExpedition.hasConnection)
            {
                transmitterMarker.uvRect = UIController.GetIconUVRect(Icons.TaskCompleted);
                transmitterLabel.text    = Localization.GetPhrase(LocalizedPhrase.ConnectionOK);
                transmitterLabel.color   = whitecolor;
            }
            else
            {
                transmitterMarker.uvRect = UIController.GetIconUVRect(Icons.TaskFailed);
                transmitterLabel.text    = Localization.GetPhrase(LocalizedPhrase.ConnectionLost);
                transmitterLabel.color   = redcolor;
            }
            //shuttle & fuel
            if (preparingMode != false)
            {
                shuttleLine.gameObject.SetActive(false);
                fuelLine.gameObject.SetActive(false);
            }
            //launchbutton
            if (showingExpedition.stage == Expedition.ExpeditionStage.OnMission | showingExpedition.stage == Expedition.ExpeditionStage.WayIn)
            {
                launchButtonLabel.text = Localization.GetPhrase(LocalizedPhrase.StopMission);
                launchButton.GetComponent <Image>().color = halfred;
                launchButton.interactable = true;
                launchButton.gameObject.SetActive(true);
            }
            else
            {
                launchButton.gameObject.SetActive(false);
            }

            minigameButton.SetActive(showingExpedition.stage == Expedition.ExpeditionStage.OnMission);

            preparingMode = false;
        }

        var edb = expDestinationButton;

        if (selectedDestination != null)
        {
            edb.transform.GetChild(0).GetComponent <RawImage>().uvRect = GlobalMapUI.GetMarkerRect(selectedDestination.type);
            edb.SetActive(workOnMainCanvas);
        }
        else
        {
            if (edb.activeSelf)
            {
                edb.SetActive(false);
            }
        }
    }