Example #1
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);
                }
            }
        }
    }
    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();
        }
    }