コード例 #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]);
             }
         }
     }
 }
コード例 #2
0
    protected override IEnumerator OnShow(params object[] parameters)
    {
        yield return(base.OnShow(parameters));

        ISessionService service   = Services.GetService <ISessionService>();
        int             lobbyData = service.Session.GetLobbyData <int>("NumberOfMajorFactions", 0);

        this.scoreGraphsPanel.HideUnknownEmpires = true;
        EmpireInfo[] array = new EmpireInfo[lobbyData];
        for (int i = 0; i < lobbyData; i++)
        {
            array[i] = EmpireInfo.Read(service.Session, i);
            if (array[i].IsActiveOrLocalPlayer && array[i].EmpireEliminated)
            {
                this.scoreGraphsPanel.HideUnknownEmpires = false;
            }
        }
        Services.GetService <IEndTurnService>().GameClientStateChange += this.EndTurnService_GameClientStateChange;
        DepartmentOfForeignAffairs agency = base.PlayerController.Empire.GetAgency <DepartmentOfForeignAffairs>();

        if (agency != null)
        {
            agency.DiplomaticRelationStateChange += this.DepartmentOfForeignAffairs_DiplomaticRelationStateChange;
        }
        this.scoreGraphsPanel.Show(new object[]
        {
            array
        });
        this.RefreshContent();
        yield break;
    }