Пример #1
0
 private void EventService_EventRaise(object sender, EventRaiseEventArgs e)
 {
     if (e.RaisedEvent.EventName == EventNewEraGlobal.Name)
     {
         KaijuCouncil.UpdateTameCosts();
     }
 }
 private void EventService_EventRaise(object sender, EventRaiseEventArgs e)
 {
     if (e.RaisedEvent is EventBeginTurn)
     {
         if (Amplitude.Unity.Framework.Application.Preferences.EnableModdingTools)
         {
             Diagnostics.Log("SynchronousJobRepository Registered Turn start {0} {1}", new object[]
             {
                 base.Game != null,
                 this.playerControllerservice != null
             });
         }
         this.numberOfLivingEmpires = 0;
         int num = 0;
         while (num < base.Game.Empires.Length && base.Game.Empires[num] is MajorEmpire)
         {
             if (!(base.Game.Empires[num] as MajorEmpire).ELCPIsEliminated && base.Game.Empires[num].IsControlledByAI)
             {
                 this.numberOfLivingEmpires++;
             }
             num++;
         }
         this.tickLimit = 5;
         if (this.playerControllerservice.ActivePlayerController.Empire == null || (this.playerControllerservice.ActivePlayerController.Empire is MajorEmpire && (this.playerControllerservice.ActivePlayerController.Empire as MajorEmpire).IsEliminated))
         {
             this.tickLimit += 5 + this.numberOfLivingEmpires;
         }
     }
 }
Пример #3
0
 private void EventService_EventRaise(object sender, EventRaiseEventArgs e)
 {
     if (e.RaisedEvent is EventBeginTurn)
     {
         TutorialInstructionPanel.Show(TutorialInstructionPanel.WaitingInstruction.Title, TutorialInstructionPanel.WaitingInstruction.Content, TutorialInstructionPanel.WaitingInstruction.Action, TutorialInstructionPanel.WaitingInstruction.Modal, TutorialInstructionPanel.WaitingInstruction.WheelGrabber, TutorialInstructionPanel.WaitingInstruction.DisplayNextButton, TutorialInstructionPanel.WaitingInstruction.OverNotifications, TutorialInstructionPanel.WaitingInstruction.OverModals, TutorialInstructionPanel.WaitingInstruction.WaitForPanelTypeName, TutorialInstructionPanel.WaitingInstruction.WaitForPanelName, TutorialInstructionPanel.WaitingInstruction.Placement);
         this.eventService.EventRaise -= this.EventService_EventRaise;
         if (!string.IsNullOrEmpty(TutorialHighlightPanel.WaitingHighlight.TargetName))
         {
             AgeTransform ageTransform             = null;
             Amplitude.Unity.Gui.GuiPanel guiPanel = null;
             if (this.guiService.TryGetGuiPanelByName(TutorialHighlightPanel.WaitingHighlight.TargetName, out guiPanel) && guiPanel != null)
             {
                 ageTransform = guiPanel.AgeTransform;
             }
             else
             {
                 Transform transform = (this.guiService as global::GuiManager).transform.Search(TutorialHighlightPanel.WaitingHighlight.TargetName);
                 if (transform != null)
                 {
                     ageTransform = transform.GetComponent <AgeTransform>();
                 }
             }
             if (ageTransform != null)
             {
                 TutorialHighlightPanel.ShowHighlight(TutorialHighlightPanel.WaitingHighlight.Content, ageTransform, TutorialHighlightPanel.WaitingHighlight.RectangularHighlight);
             }
             else
             {
                 Diagnostics.LogWarning("Could not restore highlight on: " + TutorialHighlightPanel.WaitingHighlight.TargetName);
             }
         }
     }
 }
Пример #4
0
    private void EventService_EventRaise(object sender, EventRaiseEventArgs e)
    {
        if (!base.AgeTransform.Visible)
        {
            return;
        }
        EventTechnologyEnded eventTechnologyEnded = e.RaisedEvent as EventTechnologyEnded;

        if (eventTechnologyEnded != null)
        {
            TechnologyDefinition technologyDefinition = eventTechnologyEnded.ConstructibleElement as TechnologyDefinition;
            if (technologyDefinition.Name == "TechnologyDefinitionMarketplaceHeroes" || technologyDefinition.Name == "TechnologyDefinitionMarketplaceMercenaries" || technologyDefinition.Name == "TechnologyDefinitionMarketplaceResources")
            {
                this.RefreshEmpireFilters();
                this.RefreshContent();
            }
        }
        EventHeroInfiltrated eventHeroInfiltrated = e.RaisedEvent as EventHeroInfiltrated;

        if (eventHeroInfiltrated != null)
        {
            this.RefreshEmpireFilters();
            this.RefreshContent();
        }
        EventHeroExfiltrated eventHeroExfiltrated = e.RaisedEvent as EventHeroExfiltrated;

        if (eventHeroExfiltrated != null)
        {
            this.RefreshEmpireFilters();
            this.RefreshContent();
        }
    }
Пример #5
0
    private void EventService_EventRaise(object sender, EventRaiseEventArgs eventArgs)
    {
        EventEmpireEliminated eventEmpireEliminated = eventArgs.RaisedEvent as EventEmpireEliminated;

        if (eventEmpireEliminated == null)
        {
            return;
        }
        Amplitude.Unity.Game.Empire eliminatedEmpire = eventEmpireEliminated.EliminatedEmpire;
        DepartmentOfForeignAffairs  agency           = eliminatedEmpire.GetAgency <DepartmentOfForeignAffairs>();

        Diagnostics.Assert(agency != null);
        for (int i = 0; i < this.majorEmpires.Length; i++)
        {
            global::Empire empire = this.majorEmpires[i];
            if (i != eliminatedEmpire.Index)
            {
                DiplomaticRelation diplomaticRelation = agency.GetDiplomaticRelation(empire);
                Diagnostics.Assert(diplomaticRelation != null && diplomaticRelation.State != null);
                if (diplomaticRelation.State.Name != DiplomaticRelationState.Names.Dead)
                {
                    OrderChangeDiplomaticRelationState order = new OrderChangeDiplomaticRelationState(eliminatedEmpire.Index, i, DiplomaticRelationState.Names.Dead);
                    this.PlayerController.PostOrder(order);
                }
            }
        }
    }
Пример #6
0
 private void EventService_EventRaise(object sender, EventRaiseEventArgs e)
 {
     Amplitude.Unity.Event.Event raisedEvent = e.RaisedEvent;
     Diagnostics.Assert(raisedEvent != null);
     if (raisedEvent is EventEmpireWorldTerraformed)
     {
         this.OnWorldTerraformed(raisedEvent as EventEmpireWorldTerraformed);
     }
 }
Пример #7
0
 private void EventService_EventRaise(object sender, EventRaiseEventArgs e)
 {
     if (!base.IsVisible)
     {
         return;
     }
     if (e.RaisedEvent != null && (e.RaisedEvent is EventTechnologyEnded || e.RaisedEvent is EventELCPSpectator))
     {
         this.UpdateButtonsAvailability();
     }
 }
    private void EventService_EventRaise(object sender, EventRaiseEventArgs e)
    {
        if (!base.IsVisible)
        {
            return;
        }
        EventQuestUpdated eventQuestUpdated = e.RaisedEvent as EventQuestUpdated;

        if (eventQuestUpdated != null && eventQuestUpdated.Quest.GUID == this.Quest.GUID)
        {
            this.RefreshContent();
        }
    }
Пример #9
0
    private void EventService_EventRaise(object sender, EventRaiseEventArgs e)
    {
        EventDiplomaticRelationStateChange eventDiplomaticRelationStateChange = e.RaisedEvent as EventDiplomaticRelationStateChange;
        EventDiplomaticContractStateChange eventDiplomaticContractStateChange = e.RaisedEvent as EventDiplomaticContractStateChange;

        if (eventDiplomaticRelationStateChange != null)
        {
            if (base.Empire == eventDiplomaticRelationStateChange.Empire || base.Empire == eventDiplomaticRelationStateChange.EmpireWithWhichTheStatusChange)
            {
                base.NeedRefresh = true;
                return;
            }
        }
        else if (eventDiplomaticContractStateChange != null && eventDiplomaticContractStateChange.DiplomaticContract != null && eventDiplomaticContractStateChange.DiplomaticContract.State == DiplomaticContractState.Signed && (eventDiplomaticContractStateChange.DiplomaticContract.EmpireWhichReceives.Index == base.Empire.Index || eventDiplomaticContractStateChange.DiplomaticContract.EmpireWhichProposes.Index == base.Empire.Index))
        {
            base.NeedRefresh = true;
        }
    }
Пример #10
0
    private void EventService_EventRaise(object sender, EventRaiseEventArgs e)
    {
        if (!base.IsVisible)
        {
            return;
        }
        EventDiplomaticContractStateChange eventDiplomaticContractStateChange = e.RaisedEvent as EventDiplomaticContractStateChange;

        if (eventDiplomaticContractStateChange != null && (eventDiplomaticContractStateChange.DiplomaticContract.EmpireWhichProposes.Index == base.Empire.Index || eventDiplomaticContractStateChange.DiplomaticContract.EmpireWhichReceives.Index == base.Empire.Index))
        {
            base.NeedRefresh = true;
            return;
        }
        EventEmpireEliminated eventEmpireEliminated = e.RaisedEvent as EventEmpireEliminated;

        if (eventEmpireEliminated != null && this.SelectedEmpire != null && this.SelectedEmpire.Index == eventEmpireEliminated.EliminatedEmpire.Index)
        {
            this.HandleCancelRequest();
        }
    }
Пример #11
0
    protected void EventService_EventRaise(object sender, EventRaiseEventArgs e)
    {
        bool isHosting = Services.GetService <ISessionService>().Session.IsHosting;

        if (e.RaisedEvent is EventSwapCity)
        {
            EventSwapCity eventSwapCity = e.RaisedEvent as EventSwapCity;
            if (isHosting)
            {
                this.CheckVictoryQuestForEmpire(base.Game.Empires[eventSwapCity.OldOwnerEmpireIndex]);
                return;
            }
        }
        else if (e.RaisedEvent is EventSettlerDied)
        {
            Empire empire = (e.RaisedEvent as EventSettlerDied).Empire as Empire;
            if (empire != null && empire is MajorEmpire && isHosting)
            {
                this.CheckVictoryQuestForEmpire(empire);
            }
        }
    }
Пример #12
0
 private void EventService_EventRaise(object sender, EventRaiseEventArgs e)
 {
     if (e.RaisedEvent is EventBeginTurn)
     {
         this.numberOfLivingEmpires = 0;
         int num = 0;
         while (num < base.Game.Empires.Length && base.Game.Empires[num] is MajorEmpire)
         {
             if (!(base.Game.Empires[num] as MajorEmpire).ELCPIsEliminated && base.Game.Empires[num].IsControlledByAI)
             {
                 this.numberOfLivingEmpires++;
             }
             num++;
         }
         this.tickLimit        = 9;
         this.tickLimitOutGame = 20;
         this.tickLimitBattle  = Mathf.Max(0, this.numberOfLivingEmpires - 5) / 2;
         if (this.playerControllerservice.ActivePlayerController.Empire == null || (this.playerControllerservice.ActivePlayerController.Empire is MajorEmpire && (this.playerControllerservice.ActivePlayerController.Empire as MajorEmpire).IsEliminated))
         {
             this.tickLimit             += 5 + this.numberOfLivingEmpires;
             this.tickLimitOutGame      += this.numberOfLivingEmpires;
             this.lastEndTurnRequestTurn = base.Game.Turn;
         }
         if (Amplitude.Unity.Framework.Application.Preferences.EnableModdingTools)
         {
             Diagnostics.Log("ELCP TickableRepository registered new turn {0}, {1} AI empires are still alive, setting tick limits to {2},{3} and {4}", new object[]
             {
                 (e.RaisedEvent as EventBeginTurn).Turn,
                 this.numberOfLivingEmpires,
                 this.tickLimit,
                 this.tickLimitOutGame,
                 this.tickLimitBattle
             });
         }
     }
 }