예제 #1
0
 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();
     }
 }
예제 #2
0
 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();
     }
 }