public static void GetIconInfo(this QuestIcon iconType, ref Texture icon, ref Rect rect) { //use subIndex where stores construction info // switch (iconType) { case QuestIcon.FoundationRouteIcon: { icon = UIController.iconsTexture; rect = UIController.GetIconUVRect(Icons.FoundationRoute); break; } case QuestIcon.PeopleIcon: { icon = UIController.iconsTexture; rect = UIController.GetIconUVRect(Icons.Citizen); break; } case QuestIcon.TutorialIcon: { icon = UIController.iconsTexture; rect = UIController.GetIconUVRect(Icons.SecretKnowledgeIcon); break; } default: { icon = GlobalMapCanvasController.GetMapMarkersTexture(); rect = GlobalMapCanvasController.GetMarkerRect(MapPointType.QuestMark); break; } } }
public void ExpeditionsButtonsRedraw() { var elist = Expedition.expeditionsList; var c = elist.Count; if (c > 0) { int i = 0, l = expeditionsFastButtons.Length; Button b; Expedition e; if (c != l) { if (c > l) { //увеличение списка var nb = new Button[c]; for (; i < l; i++) { b = expeditionsFastButtons[i]; b.onClick.RemoveAllListeners(); e = elist[i]; int id = e.ID; b.onClick.AddListener(() => this.SelectExpedition(id)); b.transform.GetChild(0).GetComponent <RawImage>().uvRect = GlobalMapCanvasController.GetMarkerRect(e.GetDestinationIcon()); b.gameObject.SetActive(true); nb[i] = b; } RectTransform rt = null; for (; i < c; i++) { b = Instantiate(expeditionsFastButtons[0], expeditionFastButtonsPanel); rt = b.GetComponent <RectTransform>(); rt.anchorMin = new Vector2(0f, 0.95f - 0.05f * i); rt.anchorMax = new Vector2(1f, 1f - i * 0.05f); rt.anchoredPosition = Vector2.zero; rt.sizeDelta = Vector2.zero; b.onClick.RemoveAllListeners(); e = elist[i]; int id = e.ID; b.onClick.AddListener(() => this.SelectExpedition(id)); b.transform.GetChild(0).GetComponent <RawImage>().uvRect = GlobalMapCanvasController.GetMarkerRect(e.GetDestinationIcon()); b.gameObject.SetActive(true); nb[i] = b; } expeditionsFastButtons = nb; } else { // сужение списка for (i = 0; i < c; i++) { b = expeditionsFastButtons[i]; b.onClick.RemoveAllListeners(); e = elist[i]; int id = e.ID; b.onClick.AddListener(() => this.SelectExpedition(id)); b.transform.GetChild(0).GetComponent <RawImage>().uvRect = GlobalMapCanvasController.GetMarkerRect(e.GetDestinationIcon()); b.gameObject.SetActive(true); } for (; i < l; i++) { expeditionsFastButtons[i].gameObject.SetActive(false); } } } else { // просто перезапись for (i = 0; i < l; i++) { b = expeditionsFastButtons[i]; b.onClick.RemoveAllListeners(); e = elist[i]; int id = e.ID; b.onClick.AddListener(() => this.SelectExpedition(id)); b.transform.GetChild(0).GetComponent <RawImage>().uvRect = GetMarkerRect(e.GetDestinationIcon()); b.gameObject.SetActive(true); } } expeditionFastButtonsPanel.gameObject.SetActive(true); } else { expeditionFastButtonsPanel.gameObject.SetActive(false); } needExpeditionsRedraw = false; PreparePointDescription(); }
private void RedrawWindow() { Color redcolor = Color.red, whitecolor = Color.white; GameObject g; if (observingExpedition == 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(observingExpedition); statedCrystalsCount = observingExpedition.crystalsCollected; statedSuppliesCount = observingExpedition.suppliesCount; lastChangesMarkerValue = observingExpedition.changesMarkerValue; crewStableName.text = observingExpedition.crew?.name ?? Localization.GetPhrase(LocalizedPhrase.NoCrew); 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 (observingExpedition.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 (observingExpedition.stage == Expedition.ExpeditionStage.OnMission | observingExpedition.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(observingExpedition.stage == Expedition.ExpeditionStage.OnMission); lastDrawnStage = observingExpedition.stage; preparingMode = false; } var edb = expDestinationButton; if (selectedDestination != null) { edb.transform.GetChild(0).GetComponent <RawImage>().uvRect = GlobalMapCanvasController.GetMarkerRect(selectedDestination.type); //edb.SetActive(workOnMainCanvas); } else { if (edb.activeSelf) { edb.SetActive(false); } } }