Skip to content

Commit

Permalink
Added images for Flank, Rotate, and Stop maneuvers
Browse files Browse the repository at this point in the history
Added Support for DS9 complete movement grid
Added more "key maneuvers": spin, all stop, rotate, and fast (white speed 5+)
New iOS Build
  • Loading branch information
Robert George authored and Robert George committed Nov 23, 2014
1 parent 3187907 commit 8611a97
Show file tree
Hide file tree
Showing 53 changed files with 284 additions and 11 deletions.
168 changes: 168 additions & 0 deletions Space Dock.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file added images/green-left-45-degree-rotate.pdf
Binary file not shown.
Binary file added images/green-left-45-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/green-left-90-degree-rotate.pdf
Binary file not shown.
Binary file added images/green-left-90-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/green-left-flank.pdf
Binary file not shown.
Binary file added images/green-left-flank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/green-right-45-degree-rotate.pdf
Binary file not shown.
Binary file added images/green-right-45-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/green-right-90-degree-rotate.pdf
Binary file not shown.
Binary file added images/green-right-90-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/green-right-flank.pdf
Binary file not shown.
Binary file added images/green-right-flank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/green-stop.pdf
Binary file not shown.
Binary file added images/green-stop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/red-left-45-degree-rotate.pdf
Binary file not shown.
Binary file added images/red-left-45-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/red-left-90-degree-rotate.pdf
Binary file not shown.
Binary file added images/red-left-90-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/red-left-flank.pdf
Binary file not shown.
Binary file added images/red-left-flank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/red-right-45-degree-rotate.pdf
Binary file not shown.
Binary file added images/red-right-45-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/red-right-90-degree-rotate.pdf
Binary file not shown.
Binary file added images/red-right-90-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/red-right-flank.pdf
Binary file not shown.
Binary file added images/red-right-flank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/red-stop.pdf
Binary file not shown.
Binary file added images/red-stop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/white-left-45-degree-rotate.pdf
Binary file not shown.
Binary file added images/white-left-45-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/white-left-90-degree-rotate.pdf
Binary file not shown.
Binary file added images/white-left-90-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/white-left-flank.pdf
Binary file not shown.
Binary file added images/white-left-flank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/white-right-45-degree-rotate.pdf
Binary file not shown.
Binary file added images/white-right-45-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/white-right-90-degree-rotate.pdf
Binary file not shown.
Binary file added images/white-right-90-degree-rotate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/white-right-flank.pdf
Binary file not shown.
Binary file added images/white-right-flank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/white-stop.pdf
Binary file not shown.
Binary file added images/white-stop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions ios/DockMoveGridView.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ -(void)drawRect:(CGRect)rect

NSArray* moveValues = @[@5, @4, @3, @2, @1, @-1, @-2];
NSSet* speeds = _ship.shipClassDetails.speeds;
if ([speeds containsObject:@0] && [speeds containsObject:@5]) {
moveValues = @[@5, @4, @3, @2, @1, @0, @-1, @-2];
} else if ([speeds containsObject:@0] && ![speeds containsObject:@5]) {
moveValues = @[@4, @3, @2, @1, @0, @-1, @-2];
}
if ([speeds containsObject:@-3]) {
if (![speeds containsObject:@5]) {
moveValues = [moveValues subarrayWithRange: NSMakeRange(1, moveValues.count - 1)];
Expand Down Expand Up @@ -85,6 +90,8 @@ -(void)drawRect:(CGRect)rect
DockShipClassDetails* details = _ship.shipClassDetails;
if (details.hasSpins) {
kinds = @[@"", @"left-spin", @"straight", @"right-spin", @"", @""];
} else if (details.hasFlanks) {
kinds = @[@"left-90-degree-rotate", @"left-flank", @"straight", @"right-flank", @"right-90-degree-rotate", @""];
}

for (int i = 0; i < moveValues.count; ++i) {
Expand Down Expand Up @@ -117,6 +124,15 @@ -(void)drawRect:(CGRect)rect
}
} else if (details != nil) {
NSString* kind = kinds[j - 1];
if (speed == 0) {
if ([kind isEqualToString:@"left-flank"]) {
kind = @"left-45-degree-rotate";
} else if ([kind isEqualToString:@"right-flank"]) {
kind = @"right-45-degree-rotate";
} else if ([kind isEqualToString:@"straight"]) {
kind = @"stop";
}
}
DockManeuver* maneuver = [details getDockManeuver: speed kind: kind];

if (maneuver != nil) {
Expand All @@ -126,6 +142,14 @@ -(void)drawRect:(CGRect)rect

if (speed < 0) {
directionName = @"backup";
} else if (speed == 0) {
if ([directionName isEqualToString:@"left-flank"]) {
directionName = @"left-45-degree-rotate";
} else if ([directionName isEqualToString:@"right-flank"]) {
directionName = @"right-45-degree-rotate";
} else if ([directionName isEqualToString:@"straight"]) {
directionName = @"stop";
}
}

NSString* fileName = [NSString stringWithFormat: @"%@-%@", color, directionName];
Expand Down
9 changes: 7 additions & 2 deletions ios/DockTopMenuViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ - (void)viewDidAppear:(BOOL)animated
if (_managedObjectContext == nil) {
_loadingAlert = [[UIAlertView alloc] initWithTitle:@"Loading Data" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
[_loadingAlert show];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
indicator.center = CGPointMake(_loadingAlert.bounds.size.width / 2, _loadingAlert.bounds.size.height - 50);
[indicator startAnimating];
[_loadingAlert addSubview:indicator];
Expand Down Expand Up @@ -96,6 +96,12 @@ -(void)prepareForSegue:(UIStoryboardSegue*)segue sender:(id)sender
controller.managedObjectContext = self.managedObjectContext;
controller.upType = @"Borg";
controller.upgradeTypeName = @"Borg Upgrades";
} else if ([[segue identifier] isEqualToString: @"GoToSquadron"]) {
id destination = [segue destinationViewController];
DockUpgradesViewController* controller = (DockUpgradesViewController*)destination;
controller.managedObjectContext = self.managedObjectContext;
controller.upType = @"Squadron";
controller.upgradeTypeName = @"Squadron Upgrades";
} else if ([[segue identifier] isEqualToString: @"GoToTech"]) {
id destination = [segue destinationViewController];
DockUpgradesViewController* controller = (DockUpgradesViewController*)destination;
Expand Down Expand Up @@ -153,7 +159,6 @@ -(void)showSquad:(DockSquad*)squad
}
-(void)refresh:(UIRefreshControl *)refresh
{
NSLog(@"Refreshing");
DockDataUpdater* updater = [[DockDataUpdater alloc] init];
[updater checkForNewData:^(NSString *remoteVersion, NSData *downloadData, NSError *error) {
/*
Expand Down
2 changes: 1 addition & 1 deletion ios/Space Dock iOS-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>93</string>
<string>94</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
Expand Down
25 changes: 23 additions & 2 deletions ios/SpaceDock.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14B17" targetRuntime="iOS.CocoaTouch" variant="6xAndEarlier" propertyAccessControl="none" initialViewController="CGb-hD-QBi">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" variant="6xAndEarlier" propertyAccessControl="none" initialViewController="CGb-hD-QBi">
<dependencies>
<deployment version="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
Expand Down Expand Up @@ -565,6 +565,27 @@
</subviews>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" rowHeight="50" id="VMT-Gh-Y0h">
<rect key="frame" x="0.0" y="700" width="320" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="VMT-Gh-Y0h" id="0gw-1c-Q2Y">
<rect key="frame" x="0.0" y="0.0" width="320" height="49"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="fy7-4P-D48">
<rect key="frame" x="20" y="3" width="280" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<state key="normal" title="Squadrons">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<segue destination="ItA-jp-4hr" kind="push" identifier="GoToSquadron" id="dvW-QN-6FE"/>
</connections>
</button>
</subviews>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" rowHeight="50" id="T8Z-7A-8NK">
<rect key="frame" x="0.0" y="400" width="320" height="50"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down Expand Up @@ -1670,8 +1691,8 @@
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
<inferredMetricsTieBreakers>
<segue reference="ba4-FO-r4X"/>
<segue reference="me1-T8-16w"/>
<segue reference="xuh-dp-0tA"/>
<segue reference="TwX-09-xdF"/>
<segue reference="YvD-5N-V1B"/>
</inferredMetricsTieBreakers>
Expand Down
24 changes: 24 additions & 0 deletions mac/DockMoveGrid.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ -(void)drawRect:(NSRect)dirtyRect

NSArray* moveValues = @[@5, @4, @3, @2, @1, @-1, @-2];
NSSet* speeds = _ship.shipClassDetails.speeds;
if ([speeds containsObject:@0] && [speeds containsObject:@5]) {
moveValues = @[@5, @4, @3, @2, @1, @0, @-1, @-2];
} else if ([speeds containsObject:@0] && ![speeds containsObject:@5]) {
moveValues = @[@4, @3, @2, @1, @0, @-1, @-2];
}
if ([speeds containsObject: @-3]) {
if (![speeds containsObject:@5]) {
moveValues = [moveValues subarrayWithRange: NSMakeRange(1, moveValues.count - 1)];
Expand Down Expand Up @@ -103,6 +108,8 @@ -(void)drawRect:(NSRect)dirtyRect
DockShipClassDetails* details = _ship.shipClassDetails;
if (details.hasSpins) {
kinds = @[@"", @"left-spin", @"straight", @"right-spin", @"", @""];
} else if (details.hasFlanks) {
kinds = @[@"left-90-degree-rotate", @"left-flank", @"straight", @"right-flank", @"right-90-degree-rotate", @""];
}

for (int i = (int)moveValues.count - 1; i >= 0; --i) {
Expand All @@ -124,6 +131,15 @@ -(void)drawRect:(NSRect)dirtyRect
[move drawInRect: moveRect withAttributes: attr];
} else if (details != nil) {
NSString* kind = kinds[j - 1];
if (speed == 0) {
if ([kind isEqualToString:@"left-flank"]) {
kind = @"left-45-degree-rotate";
} else if ([kind isEqualToString:@"right-flank"]) {
kind = @"right-45-degree-rotate";
} else if ([kind isEqualToString:@"straight"]) {
kind = @"stop";
}
}
DockManeuver* maneuver = [details getDockManeuver: speed kind: kind];

if (maneuver != nil) {
Expand All @@ -133,6 +149,14 @@ -(void)drawRect:(NSRect)dirtyRect

if (speed < 0) {
directionName = @"backup";
} else if (speed == 0) {
if ([directionName isEqualToString:@"left-flank"]) {
directionName = @"left-45-degree-rotate";
} else if ([directionName isEqualToString:@"right-flank"]) {
directionName = @"right-45-degree-rotate";
} else if ([directionName isEqualToString:@"straight"]) {
directionName = @"stop";
}
}

NSString* fileName = [NSString stringWithFormat: @"%@-%@", color, directionName];
Expand Down
14 changes: 9 additions & 5 deletions src/Data.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Data version="2014-11-21@23-29">
<Data version="2014-11-23@20-26">
<ShipClassDetails>
<ShipClassDetail>
<Name>Galaxy Class</Name>
Expand Down Expand Up @@ -395,13 +395,17 @@
<Name>Nor Class Orbital Space Station</Name>
<Id>5017</Id>
<Maneuvers>
<Maneuver speed="2" kind="left-flank" color="red" />
<Maneuver speed="2" kind="straight" color="red" />
<Maneuver speed="2" kind="flank" color="red" />
<Maneuver speed="2" kind="right-flank" color="red" />
<Maneuver speed="1" kind="left-flank" color="white" />
<Maneuver speed="1" kind="straight" color="white" />
<Maneuver speed="1" kind="flank" color="white" />
<Maneuver speed="0" kind="90-degree-rotate" color="white" />
<Maneuver speed="1" kind="right-flank" color="white" />
<Maneuver speed="0" kind="left-45-degree-rotate" color="green" />
<Maneuver speed="0" kind="left-90-degree-rotate" color="white" />
<Maneuver speed="0" kind="stop" color="green" />
<Maneuver speed="0" kind="45-degree-rotate" color="green" />
<Maneuver speed="0" kind="right-45-degree-rotate" color="green" />
<Maneuver speed="0" kind="right-90-degree-rotate" color="white" />
</Maneuvers>
<FrontArc>90</FrontArc>
<RearArc></RearArc>
Expand Down
1 change: 1 addition & 0 deletions src/DockManeuver+Addons.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
-(NSString*)asString;
-(NSComparisonResult)compareTo:(DockManeuver*)other;
-(BOOL)isSpin;
-(BOOL)isFlank;
@end
6 changes: 6 additions & 0 deletions src/DockManeuver+Addons.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ -(BOOL)isSpin
return [self.kind hasSuffix: @"spin"];
}

-(BOOL)isFlank
{
return [self.kind hasSuffix: @"flank"];
}


@end
1 change: 1 addition & 0 deletions src/DockShipClassDetails+Addons.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
-(NSString*)movesSummary;
-(NSSet*)speeds;
-(BOOL)hasSpins;
-(BOOL)hasFlanks;
@end
21 changes: 20 additions & 1 deletion src/DockShipClassDetails+Addons.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,20 @@ -(NSString*)movesSummary
NSMutableSet* specials = [NSMutableSet setWithCapacity: 0];

for (DockManeuver* m in self.maneuvers) {
if ([m.kind isEqualToString: @"about"]) {
if ([m.kind hasSuffix: @"spin"]) {
[specials addObject: @"spin"];
} else if ([m.kind isEqualToString: @"about"]) {
[specials addObject: @"come about"];
} else if ([m.speed intValue] < 0 && [m.kind isEqualToString: @"straight"]) {
[specials addObject: @"backup"];
} else if ([m.kind isEqualToString: @"stop"]) {
[specials addObject: @"all stop"];
} else if ([m.kind hasSuffix: @"rotate"]) {
[specials addObject: @"rotate"];
} else if ([m.speed intValue] >= 5 && ![m.color isEqualToString:@"red"]) {
[specials addObject: @"fast"];
}

}
return [[specials allObjects] componentsJoinedByString: @","];
}
Expand All @@ -151,4 +160,14 @@ -(BOOL)hasSpins
return index != NSNotFound;
}

-(BOOL)hasFlanks
{
id finder = ^(id obj, NSUInteger idx, BOOL *stop) {
DockManeuver* m = obj;
return m.isFlank;
};
NSInteger index = [self.maneuvers.allObjects indexOfObjectPassingTest: finder];
return index != NSNotFound;
}

@end

0 comments on commit 8611a97

Please sign in to comment.