internal override void SetInitialRelationship_Internal(Player unmetPlayer, DiplomaticRelationship initialRelationship) { throw new NotImplementedException("SetInitialRelationship_Internal() is not implemented in {0}.".Inject(DebugName)); }
/// <summary> /// Gets the AIPlayers that the User has not yet met, that have been assigned the initialUserRelationship to begin with when they do meet. /// </summary> /// <param name="initialUserRelationship">The initial user relationship.</param> /// <returns></returns> public IEnumerable<Player> __GetUnmetAiPlayersWithInitialUserRelationsOf(DiplomaticRelationship initialUserRelationship) { D.Assert(_gameMgr.IsRunning, "This method should only be called when the User manually changes a unit's user relationship in the editor."); Player userPlayer = _gameMgr.UserPlayer; IList<Player> aiPlayersWithSpecifiedInitialUserRelations; if (_aiPlayerInitialUserRelationsLookup.TryGetValue(initialUserRelationship, out aiPlayersWithSpecifiedInitialUserRelations)) { return aiPlayersWithSpecifiedInitialUserRelations.Except(userPlayer.OtherKnownPlayers); } return Enumerable.Empty<Player>(); }
public override IEnumerable<Player> GetOtherPlayersWithRelationship(DiplomaticRelationship relations) { throw new NotImplementedException("GetOtherPlayersWithRelationship() is not implemented in {0}.".Inject(DebugName)); }
public override void SetInitialRelationship(Player unmetPlayer, DiplomaticRelationship initialRelationship = DiplomaticRelationship.Neutral) { throw new NotImplementedException("SetInitialRelationship() is not implemented in {0}.".Inject(DebugName)); }
public override void SetRelationsWith(Player player, DiplomaticRelationship relation) { throw new NotImplementedException("SetRelationswith() is not implemented in {0}.".Inject(DebugName)); }
internal override void SetRelationsWith_Internal(Player player, DiplomaticRelationship newRelationship) { throw new NotImplementedException("SetRelationswith() is not implemented in {0}.".Inject(DebugName)); }
public bool IsPriorRelationshipWith(Player player, DiplomaticRelationship relationship) { return GetPriorRelations(player) == relationship; }
public bool IsPriorRelationshipWith(Player player, DiplomaticRelationship relationship1, DiplomaticRelationship relationship2, DiplomaticRelationship relationship3) { var priorRelations = GetPriorRelations(player); return priorRelations == relationship1 || priorRelations == relationship2 || priorRelations == relationship3; }
// 12.6.16 Removed params to avoid heap memory allocations public bool IsRelationshipWith(Player player, DiplomaticRelationship relationship) { return GetCurrentRelations(player) == relationship; }
public bool IsRelationshipWith(Player player, DiplomaticRelationship relationship1, DiplomaticRelationship relationship2, DiplomaticRelationship relationship3) { var currentRelations = GetCurrentRelations(player); return currentRelations == relationship1 || currentRelations == relationship2 || currentRelations == relationship3; }
public virtual IEnumerable<Player> GetOtherPlayersWithRelationship(DiplomaticRelationship relationship) { D.AssertNotEqual(DiplomaticRelationship.Self, relationship); IList<Player> playersWithRelations = new List<Player>(); foreach (Player knownPlayer in OtherKnownPlayers) { if (IsRelationshipWith(knownPlayer, relationship)) { playersWithRelations.Add(knownPlayer); } } return playersWithRelations; }
/// <summary> /// Sets the DiplomaticRelationship between this player and <c>otherPlayer</c> who have already met. /// Then synchronizes <c>otherPlayer</c>'s DiploRelations state with this player, finally raising a /// <c>relationsChanged</c> event after both states are synchronized. Internal version intended for Player to Player coordination. /// <remarks>Done this way to allow both player's DiploRelationship state to be /// synchronized BEFORE either raises a relationsChanged event.</remarks> /// </summary> /// <param name="otherPlayer">The otherPlayer.</param> /// <param name="newRelationship">The relationship.</param> internal virtual void SetRelationsWith_Internal(Player otherPlayer, DiplomaticRelationship newRelationship) { D.AssertNotEqual(otherPlayer, TempGameValues.NoPlayer); D.AssertNotEqual(otherPlayer, this, "OtherPlayer not allowed to be self."); D.AssertNotEqual(newRelationship, DiplomaticRelationship.None); D.AssertNotEqual(newRelationship, DiplomaticRelationship.Self); if (!IsKnown(otherPlayer)) { D.Error("{0}: {1} not yet met.", DebugName, otherPlayer); } DiplomaticRelationship existingRelationship = _currentRelationship[otherPlayer]; D.Assert(existingRelationship != DiplomaticRelationship.None && newRelationship != DiplomaticRelationship.Self); if (existingRelationship == newRelationship) { D.Warn("{0} is attempting to set Relations to {1}, a value it already has.", DebugName, newRelationship.GetValueName()); return; } _priorRelationship[otherPlayer] = existingRelationship; _currentRelationship[otherPlayer] = newRelationship; OnRelationsChanged(otherPlayer); }
internal virtual void SetInitialRelationship_Internal(Player unmetPlayer, DiplomaticRelationship initialRelationship) { if (_initialRelationship.ContainsKey(unmetPlayer)) { D.Error("{0} already has initial relationship {1} with {2}.", DebugName, _initialRelationship[unmetPlayer].GetValueName(), unmetPlayer); } if (_priorRelationship.ContainsKey(unmetPlayer)) { D.Error("{0} already has prior relationship {1} with {2}.", DebugName, _priorRelationship[unmetPlayer].GetValueName(), unmetPlayer); } if (_currentRelationship.ContainsKey(unmetPlayer)) { D.Error("{0} already has current relationship {1} with {2}.", DebugName, _currentRelationship[unmetPlayer].GetValueName(), unmetPlayer); } _initialRelationship.Add(unmetPlayer, initialRelationship); _priorRelationship.Add(unmetPlayer, DiplomaticRelationship.None); _currentRelationship.Add(unmetPlayer, DiplomaticRelationship.None); }
private static NewOwnerUserRelationshipChoices Convert(DiplomaticRelationship ownerUserRelationship) { switch (ownerUserRelationship) { case DiplomaticRelationship.Self: return NewOwnerUserRelationshipChoices.BecomeUser; case DiplomaticRelationship.Alliance: return NewOwnerUserRelationshipChoices.Alliance; case DiplomaticRelationship.Friendly: return NewOwnerUserRelationshipChoices.Friendly; case DiplomaticRelationship.Neutral: return NewOwnerUserRelationshipChoices.Neutral; case DiplomaticRelationship.ColdWar: return NewOwnerUserRelationshipChoices.ColdWar; case DiplomaticRelationship.War: return NewOwnerUserRelationshipChoices.War; case DiplomaticRelationship.None: return default(NewOwnerUserRelationshipChoices); default: throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(ownerUserRelationship)); } }
private void SyncUserRelationsFieldsTo(DiplomaticRelationship ownerUserRelationship) { _allowNewOwnerUserRelationsCheck = false; _currentOwnerUserRelations = ownerUserRelationship; _newOwnerUserRelationsChoice = Convert(ownerUserRelationship); _allowNewOwnerUserRelationsCheck = true; }