public void Disappear() // INDEV // экспедиция исчезает { if (stage == ExpeditionStage.Dismissed | stage == ExpeditionStage.Disappeared) { return; } else { if (crew != null) { crew.Disappear(); } QuantumTransmitter.StopTransmission(transmissionID); Hangar.ReturnShuttle(shuttleID); if (destination != null) { destination.DeassignExpedition(this); } //if (expeditionsList.Contains(this)) expeditionsList.Remove(this); stage = ExpeditionStage.Disappeared; if (subscribedToUpdate & !GameMaster.sceneClearing) { GameMaster.realMaster.labourUpdateEvent -= this.LabourUpdate; subscribedToUpdate = false; } expeditionsList.Remove(this); changesMarkerValue++; } changesMarkerValue++; GlobalMapCanvasController.needExpeditionsRedraw = true; }
public static void AddToList(QuantumTransmitter qt) { if (qt == null) { return; } if (transmittersList.Count == 0) { transmittersList.Add(qt); } else { int i = 0; while (i < transmittersList.Count) { if (transmittersList[i] == null) { transmittersList.RemoveAt(i); continue; } else { if (transmittersList[i] == qt) { return; } } i++; } transmittersList.Add(qt); } }
public static void ResetToDefaults_Static() { OakTree.ResetToDefaults_Static_OakTree(); Corn.ResetToDefaults_Static_Corn(); Hospital.ResetToDefaults_Static_Hospital(); Dock.ResetToDefaults_Static_Dock(); RecruitingCenter.ResetToDefaults_Static_RecruitingCenter(); QuantumTransmitter.ResetToDefaults_Static_QuantumTransmitter(); Hangar.ResetToDefaults_Static_Hangar(); }
public void Dismiss() // экспедиция вернулась домой и распускается { //зависимость : Disappear() if (stage == ExpeditionStage.Disappeared | stage == ExpeditionStage.Dismissed) { return; } else { GameLogUI.MakeAnnouncement(Localization.GetCrewAction(LocalizedCrewAction.Returned, crew)); if (crew != null) { crew.CountMission(missionCompleted); crew.SetCurrentExpedition(null); crew = null; } QuantumTransmitter.StopTransmission(transmissionID); Hangar.ReturnShuttle(shuttleID); if (destination != null) { destination.DeassignExpedition(this); } if (suppliesCount > 0) { GameMaster.realMaster.colonyController.storage.AddResource(ResourceType.Supplies, suppliesCount); } if (expeditionsList.Contains(this)) { expeditionsList.Remove(this); } if (crystalsCollected > 0) { GameMaster.realMaster.colonyController.AddEnergyCrystals(crystalsCollected); crystalsCollected = 0; } stage = ExpeditionStage.Dismissed; if (missionCompleted) { expeditionsSucceed++; Knowledge.GetCurrent()?.ExpeditionsCheck(expeditionsSucceed); } expeditionsList.Remove(this); if (subscribedToUpdate & !GameMaster.sceneClearing) { GameMaster.realMaster.labourUpdateEvent -= this.LabourUpdate; subscribedToUpdate = false; } changesMarkerValue++; } }
public void LaunchButton() { if (observingExpedition == null) { if (selectedCrew != null && selectedCrew.atHome) { var storage = colony.storage; bool TESTMODE = GameMaster.realMaster.weNeedNoResources; if (TESTMODE || suppliesSlider.value <= storage.GetResourceCount(ResourceType.Supplies) && crystalsSlider.value <= colony.energyCrystalsCount && storage.GetResourceCount(ResourceType.Fuel) >= FUEL_BASE_COST ) { int shID = Hangar.GetFreeShuttleID(); if (shID != Hangar.NO_SHUTTLE_VALUE) { var t = QuantumTransmitter.GetFreeTransmitter(); if (t != null) { if (storage.TryGetResources(ResourceType.Fuel, FUEL_BASE_COST)) { var e = new Expedition(selectedDestination, selectedCrew, shID, t, storage.GetResources(ResourceType.Supplies, suppliesSlider.value), colony.GetEnergyCrystals(crystalsSlider.value)); var mc = mycanvas.uicontroller; if (mc.currentMode == UIMode.Standart) { observingExpedition = e; } else { observingExpedition = e; RedrawWindow(); mc.ShowExpedition(e); } } else { AnnouncementCanvasController.MakeAnnouncement(Localization.GetExpeditionErrorText(ExpeditionComposingErrors.NotEnoughFuel)); } RedrawWindow(); } } } } } else { observingExpedition.EndMission(); } }
public void LaunchButton() { if (showingExpedition == null) { if (selectedCrew != null && selectedCrew.atHome) { var storage = colony.storage; var res = storage.standartResources; if (suppliesSlider.value <= res[ResourceType.SUPPLIES_ID] && crystalsSlider.value <= colony.energyCrystalsCount && res[ResourceType.FUEL_ID] >= FUEL_BASE_COST) { int shID = Hangar.GetFreeShuttleID(); if (shID != Hangar.NO_SHUTTLE_VALUE) { var t = QuantumTransmitter.GetFreeTransmitter(); if (t != null) { if (storage.TryGetResources(ResourceType.Fuel, FUEL_BASE_COST)) { var e = new Expedition(selectedDestination, selectedCrew, shID, t, storage.GetResources(ResourceType.Supplies, suppliesSlider.value), colony.GetEnergyCrystals(crystalsSlider.value)); if (workOnMainCanvas) { showingExpedition = e; } else { showingExpedition = null; selectedCrew = null; GameMaster.realMaster.globalMap.observer.GetComponent <GlobalMapUI>().PreparePointDescription(); gameObject.SetActive(false); } } else { GameLogUI.MakeAnnouncement(Localization.GetExpeditionErrorText(ExpeditionComposingErrors.NotEnoughFuel)); } RedrawWindow(); } } } } } else { showingExpedition.EndMission(); } }
public static void RemoveFromList(QuantumTransmitter qt) { if (qt == null | transmittersList.Count == 0) { return; } int i = 0; while (i < transmittersList.Count) { if (transmittersList[i] == null | transmittersList[i] == qt) { transmittersList.RemoveAt(i); continue; } i++; } }
/// =============================== public Expedition(PointOfInterest i_destination, Crew c, int i_shuttleID, QuantumTransmitter transmitter, float i_supplies, float i_crystals) { // СДЕЛАТЬ: проверка компонентов и вывод ошибок ID = nextID++; stage = ExpeditionStage.WayIn; destination = i_destination; destination.AssignExpedition(this); crew = c; c.SetCurrentExpedition(this); if (Hangar.OccupyShuttle(i_shuttleID)) { shuttleID = i_shuttleID; } else { AnnouncementCanvasController.MakeAnnouncement(Localization.GetExpeditionErrorText(ExpeditionComposingErrors.ShuttleUnavailable)); Dismiss(); } if (transmitter != null) { transmissionID = transmitter.StartTransmission(); hasConnection = true; } else { transmissionID = QuantumTransmitter.NO_TRANSMISSION_VALUE; hasConnection = false; } suppliesCount = (byte)i_supplies; crystalsCollected = (ushort)i_crystals; //#creating map marker GlobalMap gmap = GameMaster.realMaster.globalMap; mapMarker = new FlyingExpedition(this, gmap.cityPoint, destination, FLY_SPEED); gmap.AddPoint(mapMarker, true); // expeditionsList.Add(this); listChangesMarker++; }
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); } } }
public void SetTransmitter(QuantumTransmitter qt) { transmitter = qt; }