Esempio n. 1
0
    public override bool IsConcernedByEvent(Event gameEvent, Army army)
    {
        if (army == null || army.Empire == null)
        {
            return(false);
        }
        if (!army.Empire.SimulationObject.Tags.Contains("FactionTraitAffinityStrategic"))
        {
            return(false);
        }
        EventDiplomaticRelationStateChange eventDiplomaticRelationStateChange = gameEvent as EventDiplomaticRelationStateChange;

        if (eventDiplomaticRelationStateChange != null && eventDiplomaticRelationStateChange.Empire == army.Empire && eventDiplomaticRelationStateChange.DiplomaticRelationStateName != DiplomaticRelationState.Names.Unknown)
        {
            return(true);
        }
        EventDiplomaticContractStateChange eventDiplomaticContractStateChange = gameEvent as EventDiplomaticContractStateChange;

        if (eventDiplomaticContractStateChange != null && eventDiplomaticContractStateChange.DiplomaticContract != null && (eventDiplomaticContractStateChange.DiplomaticContract.EmpireWhichProposes == army.Empire || eventDiplomaticContractStateChange.DiplomaticContract.EmpireWhichReceives == army.Empire) && eventDiplomaticContractStateChange.DiplomaticContract.State == DiplomaticContractState.Signed)
        {
            return(true);
        }
        EventSwapCity eventSwapCity = gameEvent as EventSwapCity;

        return((eventSwapCity != null && eventSwapCity.Empire == army.Empire) || base.IsConcernedByEvent(gameEvent, army));
    }
    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;
        }
    }
    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();
        }
    }
Esempio n. 4
0
    private void OnDebugShowNotifCB(GameObject obj)
    {
        IGuiNotificationService service = Services.GetService <IGuiNotificationService>();

        for (int i = 0; i < service.GuiNotifications.Count; i++)
        {
            GuiNotificationDiplomaticContractStateChange guiNotificationDiplomaticContractStateChange = service.GuiNotifications[i] as GuiNotificationDiplomaticContractStateChange;
            if (guiNotificationDiplomaticContractStateChange != null)
            {
                EventDiplomaticContractStateChange eventDiplomaticContractStateChange = guiNotificationDiplomaticContractStateChange.RaisedEvent as EventDiplomaticContractStateChange;
                if (eventDiplomaticContractStateChange != null && this.existingContracts.Contains(eventDiplomaticContractStateChange.DiplomaticContract))
                {
                    return;
                }
            }
        }
        foreach (DiplomaticContract diplomaticContract in this.existingContracts)
        {
            IEventService service2 = Services.GetService <IEventService>();
            service2.Notify(new EventDiplomaticContractStateChange(diplomaticContract, diplomaticContract.State));
        }
    }