forked from spacedockapp/spacedock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for DNA Encoded Messages (iOS/Mac)
Added better handling of Front-Line Retrofit and Captain's Chair (iOS) Added new Resource Upgrade type (iOS/Mac) Added Ship cost to ship selection list (iOS)
- Loading branch information
Showing
25 changed files
with
813 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// DockResourceUpgradeRowHandler.h | ||
// Space Dock iOS | ||
// | ||
// Created by Robert George on 11/29/17. | ||
// Copyright © 2017 Robert George. All rights reserved. | ||
// | ||
|
||
#import "DockRowHandler.h" | ||
|
||
@class DockEquippedShip; | ||
|
||
@interface DockResourceUpgradeRowHandler : DockRowHandler | ||
@property (strong, nonatomic) DockEquippedShip* equippedShip; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// | ||
// DockResourceUpgradeRowHandler.m | ||
// Space Dock iOS | ||
// | ||
// Created by Robert George on 11/29/17. | ||
// Copyright © 2017 Robert George. All rights reserved. | ||
// | ||
|
||
#import "DockResourceUpgradeRowHandler.h" | ||
|
||
#import "DockResourceUpgrade+Addons.h" | ||
#import "DockConstants.h" | ||
#import "DockEquippedShip+Addons.h" | ||
#import "DockEquippedUpgrade+Addons.h" | ||
#import "DockExtrasTableViewCell.h" | ||
#import "DockUpgrade+Addons.h" | ||
|
||
@implementation DockResourceUpgradeRowHandler | ||
|
||
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath row:(NSInteger)row | ||
{ | ||
DockEquippedUpgrade* eqr = _equippedShip.equippedResource; | ||
|
||
NSString* upType = @"Resource"; | ||
|
||
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier: @"upgrade" forIndexPath: indexPath]; | ||
|
||
if (eqr != nil) { | ||
DockResourceUpgrade* resUp = (DockResourceUpgrade*)eqr.upgrade; | ||
cell.textLabel.text = eqr.title; | ||
cell.detailTextLabel.text = [[resUp cost] stringValue]; | ||
cell.textLabel.textColor = [UIColor blackColor]; | ||
} else { | ||
cell.textLabel.text = upType; | ||
cell.textLabel.textColor = [UIColor grayColor]; | ||
cell.detailTextLabel.text = @" "; | ||
} | ||
|
||
return cell; | ||
} | ||
|
||
-(void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath row:(NSInteger)row; | ||
{ | ||
[_equippedShip removeUpgrade: [_equippedShip equippedAdmiral]]; | ||
} | ||
|
||
-(void)tableView:(UITableView*)tableView didHighlightRowAtIndexPath:(NSIndexPath*)indexPath row:(NSInteger)row; | ||
{ | ||
DockEquippedUpgrade* eqr = _equippedShip.equippedResource; | ||
if (eqr == nil) { | ||
NSManagedObjectContext* ctx = _equippedShip.managedObjectContext; | ||
NSEntityDescription* entity = [NSEntityDescription entityForName: @"EquippedUpgrade" inManagedObjectContext: ctx]; | ||
eqr = [[DockEquippedUpgrade alloc] initWithEntity: entity insertIntoManagedObjectContext: ctx]; | ||
eqr.upgrade = [DockUpgrade placeholder:@"Resource" inContext:ctx]; | ||
} | ||
[self.controller performSegueWithIdentifier: @"PickUpgrade" sender:eqr]; | ||
} | ||
|
||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath row:(NSInteger)row | ||
{ | ||
DockEquippedUpgrade* eqr = _equippedShip.equippedResource; | ||
if (eqr != nil) { | ||
return EXTRA_ROW_HEIGHT; | ||
} | ||
return tableView.rowHeight; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.