Ejemplo n.º 1
0
 private void OnQuitResult(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Yes)
     {
         IRuntimeService service = Services.GetService <IRuntimeService>();
         if (service != null)
         {
             ISessionService service2 = Services.GetService <ISessionService>();
             Diagnostics.Assert(service2 != null);
             Diagnostics.Assert(service2.Session != null);
             Diagnostics.Assert(service.Runtime != null);
             Diagnostics.Assert(service.Runtime.FiniteStateMachine != null);
             if (!TutorialManager.IsActivated)
             {
                 int          lobbyData = service2.Session.GetLobbyData <int>("NumberOfMajorFactions", 0);
                 EmpireInfo[] array     = new EmpireInfo[lobbyData];
                 for (int i = 0; i < lobbyData; i++)
                 {
                     array[i] = EmpireInfo.Read(service2.Session, i);
                 }
                 service.Runtime.FiniteStateMachine.PostStateChange(typeof(RuntimeState_OutGame), new object[]
                 {
                     "GameEnded",
                     array
                 });
             }
             else
             {
                 service.Runtime.FiniteStateMachine.PostStateChange(typeof(RuntimeState_OutGame), new object[0]);
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void DoCancelRequest(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Yes)
     {
         base.HandleCancelRequest();
     }
 }
Ejemplo n.º 3
0
 private void OnExitDesktopResult(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Yes)
     {
         Amplitude.Unity.Framework.Application.Quit();
     }
 }
Ejemplo n.º 4
0
 private void DoClose(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Yes)
     {
         this.Hide(false);
     }
 }
Ejemplo n.º 5
0
    private void OnDestroyCityImprovementResult(object sender, MessagePanelResultEventArgs e)
    {
        MessagePanelResult result = e.Result;

        if (result == MessagePanelResult.Ok)
        {
            List <ConstructedBuildingGuiItem> children = this.CityImprovementsTable.GetChildren <ConstructedBuildingGuiItem>(true);
            for (int i = 0; i < children.Count; i++)
            {
                if (children[i].Toggle.State && this.playerControllerRepository != null)
                {
                    base.AgeTransform.Enable = false;
                    OrderDestroyCityImprovement order = new OrderDestroyCityImprovement(this.City.Empire.Index, children[i].CityImprovement);
                    Ticket ticket;
                    this.playerControllerRepository.ActivePlayerController.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.OnOrderResponse));
                }
            }
            List <ConstructedBuildingGuiItem> children2 = this.RegionBuildingsTable.GetChildren <ConstructedBuildingGuiItem>(true);
            for (int j = 0; j < children2.Count; j++)
            {
                if (children2[j].Toggle.State && this.playerControllerRepository != null)
                {
                    base.AgeTransform.Enable = false;
                    OrderDestroyPointOfInterestImprovement order2 = new OrderDestroyPointOfInterestImprovement(this.City.Empire.Index, children2[j].PointOfInterest);
                    Ticket ticket2;
                    this.playerControllerRepository.ActivePlayerController.PostOrder(order2, out ticket2, new EventHandler <TicketRaisedEventArgs>(this.OnOrderResponse));
                }
            }
        }
        this.RefreshContent();
    }
 private void OnConfirmCreateCustomFaction(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Yes)
     {
         this.CreateCustomFaction();
     }
 }
Ejemplo n.º 7
0
 private void OnDisbandUnitsConfirmation(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Yes)
     {
         this.DisbandSelectedUnits();
     }
 }
Ejemplo n.º 8
0
 private void OnPostOrderBuyoutAndActivateBooster(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Yes && this.guiStackedBooster.BoosterDefinition.Target != BoosterDefinition.TargetType.City)
     {
         this.PostOrderBuyoutAndActivateBooster(GameEntityGUID.Zero);
     }
 }
Ejemplo n.º 9
0
 private void OnConfirmOpenActivationPanel(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Ok)
     {
         base.GuiService.Show(typeof(ActivateRuntimeModulesModalPanel), new object[]
         {
             this.SelectedLobby.RuntimeConfiguration,
             this.SelectedLobby.SteamIDLobby
         });
     }
 }
Ejemplo n.º 10
0
    private void OnConfirmFileDelete(object sender, MessagePanelResultEventArgs e)
    {
        MessagePanelResult result = e.Result;

        if (result == MessagePanelResult.Ok || result == MessagePanelResult.Yes)
        {
            File.Delete(this.GameSaveDescriptor.SourceFileName);
            this.GameSaveDescriptor = null;
            this.RefreshContent();
        }
    }
Ejemplo n.º 11
0
 private void OnConfirmDeleteCustomFaction(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Ok)
     {
         this.DestroyFactionButton.AgeTransform.Enable = false;
         if (this.SelectedGuiFaction != null && this.SelectedGuiFaction.Faction != null)
         {
             if (!string.IsNullOrEmpty(this.SelectedGuiFaction.Faction.FileName))
             {
                 try
                 {
                     File.Delete(this.SelectedGuiFaction.Faction.FileName);
                 }
                 catch
                 {
                 }
             }
             IDatabase <Faction> database = Databases.GetDatabase <Faction>(false);
             if (database != null)
             {
                 database.Remove(this.SelectedGuiFaction.Faction.Name);
             }
             IDownloadableContentService service = Services.GetService <IDownloadableContentService>();
             base.GuiService.GetGuiPanel <MenuNewGameScreen>().OnCustomFactionDeleted(this.SelectedGuiFaction.Faction.Name);
             this.guiFactions.Remove(this.SelectedGuiFaction);
             if (this.guiFactions.Count > 0)
             {
                 this.SelectedGuiFaction = this.guiFactions[0];
                 if (service != null)
                 {
                     bool flag = false;
                     if (!service.TryCheckAgainstRestrictions(DownloadableContentRestrictionCategory.LobbyFaction, this.guiFactions[0].Name, out flag) || !flag)
                     {
                         Faction faction = database.FirstOrDefault((Faction iterator) => iterator.IsStandard && !iterator.IsHidden);
                         for (int i = 0; i < this.guiFactions.Count; i++)
                         {
                             if (this.guiFactions[i].Faction.Name == faction.Name)
                             {
                                 this.SelectedGuiFaction = this.guiFactions[i];
                                 break;
                             }
                         }
                     }
                 }
             }
             else
             {
                 this.SelectedGuiFaction = null;
             }
         }
     }
     this.RefreshContent();
 }
Ejemplo n.º 12
0
 private void ConfirmAssignment(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Yes && this.selectedHero != null)
     {
         IGameService service = Services.GetService <IGameService>();
         IPlayerControllerRepositoryService service2 = service.Game.Services.GetService <IPlayerControllerRepositoryService>();
         OrderChangeHeroAssignment          order    = new OrderChangeHeroAssignment(this.Army.Empire.Index, this.selectedHero.GUID, this.Army.GUID);
         Ticket ticket;
         service2.ActivePlayerController.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.OnOrderResponse));
     }
     this.selectedHero = null;
 }
Ejemplo n.º 13
0
 private void DoCancelRequest(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Yes)
     {
         this.modified = false;
         base.GuiService.GetGuiPanel <MenuFactionScreen>().ShowWhenFinishedHiding(new object[]
         {
             this.empireIndex,
             this.givenFaction
         });
     }
 }
Ejemplo n.º 14
0
 private void OnConfirmDownloadModulesBeforeActivation(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Ok)
     {
         this.Hide(false);
         base.GuiService.Show(typeof(ActivateRuntimeModulesModalPanel), new object[]
         {
             this.GameSaveDescriptor.RuntimeModules,
             this.GameSaveDescriptor,
             this
         });
     }
 }
Ejemplo n.º 15
0
    private static void SteamMatchMaking_OnConfirmOpenActivationPanel(object sender, MessagePanelResultEventArgs e)
    {
        global::IGuiService service = Services.GetService <global::IGuiService>();

        if (e.Result == MessagePanelResult.Ok && service != null)
        {
            service.Show(typeof(ActivateRuntimeModulesModalPanel), new object[]
            {
                ELCPUtilities.SelectedLobby.RuntimeConfiguration,
                ELCPUtilities.SelectedLobby.SteamIDLobby
            });
        }
        ELCPUtilities.SelectedLobby = null;
    }
Ejemplo n.º 16
0
    private void OnConfirmFileSaveOverwrite(object sender, MessagePanelResultEventArgs e)
    {
        MessagePanelResult result = e.Result;

        if (result == MessagePanelResult.Ok || result == MessagePanelResult.Yes)
        {
            string text           = this.TextInputLabel.Text;
            string outputFileName = System.IO.Path.Combine(global::Application.GameSaveDirectory, string.Format("{0}.sav", text));
            this.saving = UnityCoroutine.StartCoroutine(this, this.SaveGameAsync(text, outputFileName), new EventHandler <CoroutineExceptionEventArgs>(this.SaveGameAsync_CoroutineExceptionHandler));
            if (this.saving.IsFinished)
            {
                this.saving = null;
            }
        }
    }
Ejemplo n.º 17
0
 private void ConfirmAction(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Yes && this.City != null)
     {
         this.DoRazeInfectedCity();
     }
     this.ActionToogle.State = (this.GetCurrentConstructionRaze() != null);
     if (this.ActionToogle.State && !this.ModifierSector.IsStarted())
     {
         this.ModifierSector.StartAnimation();
     }
     else if (!this.ActionToogle.State && this.ModifierSector.IsStarted())
     {
         this.ModifierSector.Reset();
     }
 }