# HG changeset patch # User antonc27 # Date 1456173503 -3600 # Node ID 32bbf1f6bb2b0839fc08b0294ca17108503d6a7b # Parent 254333210cc8a19bfcea899ed2de73c91f321eb3 - Campaign for iOS: Stub for CampaignViewController diff -r 254333210cc8 -r 32bbf1f6bb2b project_files/HedgewarsMobile/Classes/CampaignViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/CampaignViewController-iPad.xib Mon Feb 22 21:38:23 2016 +0100 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 254333210cc8 -r 32bbf1f6bb2b project_files/HedgewarsMobile/Classes/CampaignViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/CampaignViewController-iPhone.xib Mon Feb 22 21:38:23 2016 +0100 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 254333210cc8 -r 32bbf1f6bb2b project_files/HedgewarsMobile/Classes/CampaignViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/CampaignViewController.h Mon Feb 22 21:38:23 2016 +0100 @@ -0,0 +1,25 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2015-2016 Anton Malmygin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#import + +@interface CampaignViewController : UITableViewController + +@property (nonatomic, retain) NSString *campaignName; + +@end diff -r 254333210cc8 -r 32bbf1f6bb2b project_files/HedgewarsMobile/Classes/CampaignViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/CampaignViewController.m Mon Feb 22 21:38:23 2016 +0100 @@ -0,0 +1,134 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2015-2016 Anton Malmygin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#import "CampaignViewController.h" + +@interface CampaignViewController () + +@end + +@implementation CampaignViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismiss)]; + self.navigationItem.rightBarButtonItem = doneButton; + [doneButton release]; + + NSString *campaignIniPath = [CAMPAIGNS_DIRECTORY() stringByAppendingFormat:@"%@/campaign.ini", self.campaignName]; + NSLog(@"%@", campaignIniPath); +} + +- (void)dismiss { + [self.navigationController.presentingViewController dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { +#warning Incomplete implementation, return the number of sections + return 0; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { +#warning Incomplete implementation, return the number of rows + return 0; +} + +/* +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath]; + + // Configure the cell... + + return cell; +} +*/ + +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + +/* +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} +*/ + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +} +*/ + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + +/* +#pragma mark - Table view delegate + +// In a xib-based application, navigation from a table can be handled in -tableView:didSelectRowAtIndexPath: +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + // Navigation logic may go here, for example: + // Create the next view controller. + <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:<#@"Nib name"#> bundle:nil]; + + // Pass the selected object to the new view controller. + + // Push the view controller. + [self.navigationController pushViewController:detailViewController animated:YES]; +} +*/ + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +- (void)dealloc { + [_campaignName release]; + [super dealloc]; +} + +@end diff -r 254333210cc8 -r 32bbf1f6bb2b project_files/HedgewarsMobile/Classes/CampaignsViewController.m --- a/project_files/HedgewarsMobile/Classes/CampaignsViewController.m Mon Feb 22 10:24:00 2016 -0500 +++ b/project_files/HedgewarsMobile/Classes/CampaignsViewController.m Mon Feb 22 21:38:23 2016 +0100 @@ -17,6 +17,7 @@ */ #import "CampaignsViewController.h" +#import "CampaignViewController.h" @interface CampaignsViewController () @property (nonatomic, retain) NSArray *campaigns; @@ -57,7 +58,7 @@ [super viewDidLoad]; UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismiss)]; - self.navigationItem.leftBarButtonItem = doneButton; + self.navigationItem.rightBarButtonItem = doneButton; [doneButton release]; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"campaignCell"]; @@ -90,21 +91,17 @@ return cell; } -/* #pragma mark - Table view delegate -// In a xib-based application, navigation from a table can be handled in -tableView:didSelectRowAtIndexPath: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - // Navigation logic may go here, for example: - // Create the next view controller. - <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:<#@"Nib name"#> bundle:nil]; + NSString *xib = IS_IPAD() ? @"CampaignViewController-iPad" : @"CampaignViewController-iPhone"; + CampaignViewController *campaign = [[CampaignViewController alloc] initWithNibName:xib bundle:nil]; - // Pass the selected object to the new view controller. + campaign.campaignName = self.campaigns[indexPath.row]; - // Push the view controller. - [self.navigationController pushViewController:detailViewController animated:YES]; + [self.navigationController pushViewController:campaign animated:YES]; + [campaign release]; } -*/ #pragma mark - Dealloc diff -r 254333210cc8 -r 32bbf1f6bb2b project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Mon Feb 22 10:24:00 2016 -0500 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Mon Feb 22 21:38:23 2016 +0100 @@ -265,6 +265,9 @@ F6338CC81C7A53C100353945 /* CampaignsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F6338CC61C7A53C100353945 /* CampaignsViewController.m */; }; F6338CC91C7A53C100353945 /* CampaignsViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6338CC71C7A53C100353945 /* CampaignsViewController-iPhone.xib */; }; F6338CCC1C7A542C00353945 /* CampaignsViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6338CCB1C7A542C00353945 /* CampaignsViewController-iPad.xib */; }; + F6338CD81C7A702B00353945 /* CampaignViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F6338CD61C7A702B00353945 /* CampaignViewController.m */; }; + F6338CD91C7A702B00353945 /* CampaignViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6338CD71C7A702B00353945 /* CampaignViewController-iPhone.xib */; }; + F6338CDB1C7A709600353945 /* CampaignViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6338CDA1C7A709600353945 /* CampaignViewController-iPad.xib */; }; F6448CE31BD2E00500C31C8C /* TableViewControllerWithDoneButton.m in Sources */ = {isa = PBXBuildFile; fileRef = F6448CE21BD2E00500C31C8C /* TableViewControllerWithDoneButton.m */; }; F65724FD1B7E784700A86262 /* helpabove.png in Resources */ = {isa = PBXBuildFile; fileRef = F65724F81B7E784700A86262 /* helpabove.png */; }; F65724FE1B7E784700A86262 /* helpbottom.png in Resources */ = {isa = PBXBuildFile; fileRef = F65724F91B7E784700A86262 /* helpbottom.png */; }; @@ -758,6 +761,10 @@ F6338CC61C7A53C100353945 /* CampaignsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CampaignsViewController.m; sourceTree = ""; }; F6338CC71C7A53C100353945 /* CampaignsViewController-iPhone.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "CampaignsViewController-iPhone.xib"; sourceTree = ""; }; F6338CCB1C7A542C00353945 /* CampaignsViewController-iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "CampaignsViewController-iPad.xib"; sourceTree = ""; }; + F6338CD51C7A702B00353945 /* CampaignViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CampaignViewController.h; sourceTree = ""; }; + F6338CD61C7A702B00353945 /* CampaignViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CampaignViewController.m; sourceTree = ""; }; + F6338CD71C7A702B00353945 /* CampaignViewController-iPhone.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "CampaignViewController-iPhone.xib"; sourceTree = ""; }; + F6338CDA1C7A709600353945 /* CampaignViewController-iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "CampaignViewController-iPad.xib"; sourceTree = ""; }; F6448CE11BD2E00500C31C8C /* TableViewControllerWithDoneButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewControllerWithDoneButton.h; sourceTree = ""; }; F6448CE21BD2E00500C31C8C /* TableViewControllerWithDoneButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewControllerWithDoneButton.m; sourceTree = ""; }; F65724F81B7E784700A86262 /* helpabove.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = helpabove.png; sourceTree = ""; }; @@ -977,10 +984,7 @@ 61915D59143A4E2C00299991 /* MissionTrainingViewController.m */, 61915D5A143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib */, 61077E86143FB09800645B29 /* MissionTrainingViewController-iPad.xib */, - F6338CC51C7A53C100353945 /* CampaignsViewController.h */, - F6338CC61C7A53C100353945 /* CampaignsViewController.m */, - F6338CC71C7A53C100353945 /* CampaignsViewController-iPhone.xib */, - F6338CCB1C7A542C00353945 /* CampaignsViewController-iPad.xib */, + F6338CDC1C7A721B00353945 /* Campaigns */, ); name = "Satellite Controllers"; sourceTree = ""; @@ -1405,6 +1409,21 @@ name = Tabbar; sourceTree = ""; }; + F6338CDC1C7A721B00353945 /* Campaigns */ = { + isa = PBXGroup; + children = ( + F6338CC51C7A53C100353945 /* CampaignsViewController.h */, + F6338CC61C7A53C100353945 /* CampaignsViewController.m */, + F6338CC71C7A53C100353945 /* CampaignsViewController-iPhone.xib */, + F6338CCB1C7A542C00353945 /* CampaignsViewController-iPad.xib */, + F6338CD51C7A702B00353945 /* CampaignViewController.h */, + F6338CD61C7A702B00353945 /* CampaignViewController.m */, + F6338CD71C7A702B00353945 /* CampaignViewController-iPhone.xib */, + F6338CDA1C7A709600353945 /* CampaignViewController-iPad.xib */, + ); + name = Campaigns; + sourceTree = ""; + }; F65724F71B7E784700A86262 /* Help Bubbles */ = { isa = PBXGroup; children = ( @@ -1641,6 +1660,7 @@ 61F2E7EC12060E31005734F7 /* checkbox.png in Resources */, F60D04821BD137B5003ACB00 /* heart@2x.png in Resources */, 615AD96212073B4D00F2FF04 /* startGameButton.png in Resources */, + F6338CDB1C7A709600353945 /* CampaignViewController-iPad.xib in Resources */, F60D048A1BD137B5003ACB00 /* teams@2x.png in Resources */, F6D7E09F1B76884E004F3BCF /* Default-568h@2x.png in Resources */, F60D047E1BD137B5003ACB00 /* flower@2x.png in Resources */, @@ -1696,6 +1716,7 @@ F67FC8161BEC17AC00A9DC75 /* Appirater.bundle in Resources */, F65724FD1B7E784700A86262 /* helpabove.png in Resources */, F6F07BDE1B7E72D40010E48F /* HelpPageLobbyViewController-iPad.xib in Resources */, + F6338CD91C7A702B00353945 /* CampaignViewController-iPhone.xib in Resources */, 61188C0712A6FE960026C5DA /* settingsButton@2x.png in Resources */, 61188C0812A6FE9A0026C5DA /* title@2x~iphone.png in Resources */, F65724FF1B7E784700A86262 /* helpleft.png in Resources */, @@ -1859,6 +1880,7 @@ 61798838114AA34C00BA94A9 /* uStats.pas in Sources */, 61798839114AA34C00BA94A9 /* uStore.pas in Sources */, 6179883A114AA34C00BA94A9 /* uTeams.pas in Sources */, + F6338CD81C7A702B00353945 /* CampaignViewController.m in Sources */, 6179883C114AA34C00BA94A9 /* uVisualGears.pas in Sources */, 6179883D114AA34C00BA94A9 /* uWorld.pas in Sources */, 611F4D4B11B27A9900F9759A /* uScript.pas in Sources */,