protected override bool IsUserRemoteFleetMenuItemDisabledFor(FleetDirective directive) {
     switch (directive) {
         case FleetDirective.Attack:
             return !(_planetoidMenuOperator as IUnitAttackable).IsAttackByAllowed(_user)
                 || !(_remoteUserOwnedSelectedItem as AUnitCmdItem).IsAttackCapable;
         case FleetDirective.Move:
         case FleetDirective.FullSpeedMove:
             return false;
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(directive));
     }
 }
 protected override bool IsUserRemoteFleetMenuItemDisabledFor(FleetDirective directive) {
     switch (directive) {
         // Note: Systems without an owner are by definition explorable, guardable and patrollable
         case FleetDirective.Explore:
             var explorableSystem = _systemMenuOperator as IFleetExplorable;
             return explorableSystem.IsFullyExploredBy(_user) || !explorableSystem.IsExploringAllowedBy(_user);
         case FleetDirective.Move:
         case FleetDirective.FullSpeedMove:
         case FleetDirective.Patrol:
             return !(_systemMenuOperator as IPatrollable).IsPatrollingAllowedBy(_user);
         case FleetDirective.Guard:
             return !(_systemMenuOperator as IGuardable).IsGuardingAllowedBy(_user);
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(directive));
     }
 }
 protected override bool IsUserRemoteFleetMenuItemDisabledFor(FleetDirective directive) {
     switch (directive) {
         case FleetDirective.Explore:
             var explorableSector = _sector as IFleetExplorable;
             return !explorableSector.IsExploringAllowedBy(_user) || explorableSector.IsFullyExploredBy(_user);
         case FleetDirective.Move:
         case FleetDirective.FullSpeedMove:
             return false;
         case FleetDirective.Patrol:
             return !(_sector as IPatrollable).IsPatrollingAllowedBy(_user);
         case FleetDirective.Guard:
             return !(_sector as IGuardable).IsGuardingAllowedBy(_user);
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(directive));
     }
 }
Beispiel #4
0
 protected override bool IsUserRemoteFleetMenuItemDisabledFor(FleetDirective directive) {
     switch (directive) {
         case FleetDirective.Explore:
             // A fleet may explore a star(system) if not at war and not already explored
             var explorableSystem = _starMenuOperator.ParentSystem as IFleetExplorable;
             return explorableSystem.IsFullyExploredBy(_user) || !explorableSystem.IsExploringAllowedBy(_user);
         case FleetDirective.Move:
         case FleetDirective.FullSpeedMove:
             // A fleet may move to any star without regard to Diplo state
             return false;
         case FleetDirective.Patrol:
             return !(_starMenuOperator.ParentSystem as IPatrollable).IsPatrollingAllowedBy(_user);
         case FleetDirective.Guard:
             return !(_starMenuOperator.ParentSystem as IGuardable).IsGuardingAllowedBy(_user);
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(directive));
     }
 }
 protected override bool IsUserRemoteFleetMenuItemDisabledFor(FleetDirective directive) {
     switch (directive) {
         case FleetDirective.Attack:
             return !(_settlement as IUnitAttackable).IsAttackByAllowed(_user)
                 || !(_remoteUserOwnedSelectedItem as AUnitCmdItem).IsAttackCapable;
         case FleetDirective.Explore:
             var explorableSystem = _systemMenuOperator as IFleetExplorable;
             return !explorableSystem.IsExploringAllowedBy(_user) || explorableSystem.IsFullyExploredBy(_user);
         case FleetDirective.Patrol:
             return !(_systemMenuOperator as IPatrollable).IsPatrollingAllowedBy(_user);
         case FleetDirective.Guard:
             return !(_systemMenuOperator as IGuardable).IsGuardingAllowedBy(_user);
         case FleetDirective.Move:
         case FleetDirective.FullSpeedMove:
             return false;
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(directive));
     }
 }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FleetOrder" /> class.
 /// </summary>
 /// <param name="directive">The order directive.</param>
 /// <param name="source">The source of this order.</param>
 /// <param name="target">The target of this order. Default is null.</param>
 public FleetOrder(FleetDirective directive, OrderSource source, IFleetNavigable target = null) {
     D.AssertNotEqual(OrderSource.Captain, source);
     Directive = directive;
     Source = source;
     Target = target;
 }
Beispiel #7
0
 protected virtual bool IsUserRemoteFleetMenuItemDisabledFor(FleetDirective directive) { return false; }
Beispiel #8
0
 private void __ValidateKnowledgeOfOrderTarget(IFleetNavigable target, FleetDirective directive) {
     if (directive == FleetDirective.Retreat || directive == FleetDirective.Withdraw || directive == FleetDirective.Disband
         || directive == FleetDirective.Refit || directive == FleetDirective.Repair || directive == FleetDirective.StopAttack) {
         // directives aren't yet implemented
         return;
     }
     if (target is StarItem || target is SystemItem || target is UniverseCenterItem) {
         // unnecessary check as all players have knowledge of these targets
         return;
     }
     if (directive == FleetDirective.AssumeFormation) {
         D.Assert(target == null || target is StationaryLocation || target is MobileLocation);
         return;
     }
     if (directive == FleetDirective.Scuttle) {
         D.AssertNull(target);
         return;
     }
     if (target is ISector) {
         return; // IMPROVE currently PlayerKnowledge does not keep track of Sectors
     }
     if (!OwnerAIMgr.HasKnowledgeOf(target as IItem_Ltd)) {
         D.Error("{0} received {1} order with Target {2} that {3} has no knowledge of.", DebugName, directive.GetValueName(), target.DebugName, Owner.LeaderName);
     }
 }