# HG changeset patch
# User koda
# Date 1318035450 -7200
# Node ID 16b12a6417d1b15495eaf5612ee0b38429d07302
# Parent 42c9ac75446089223429a7cb0cc7ad973b21ba27
added iphone interface for missions/trainings page, setters/getters unlocked
diff -r 42c9ac754460 -r 16b12a6417d1 project_files/HedgewarsMobile/Classes/HWUtils.m
--- a/project_files/HedgewarsMobile/Classes/HWUtils.m Sat Oct 08 00:04:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.m Sat Oct 08 02:57:30 2011 +0200
@@ -74,11 +74,11 @@
}
+(UIColor *)darkBlueColorTransparent {
- return [UIColor colorWithRed:(CGFloat)0x0F/255 green:0 blue:(CGFloat)0x42/255 alpha:0.58f];
+ return [UIColor colorWithRed:(CGFloat)0x0F/255 green:0 blue:(CGFloat)0x55/255 alpha:0.6f];
}
+(UIColor *)blackColorTransparent {
- return [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7f];
+ return [UIColor colorWithRed:0 green:0 blue:0 alpha:0.65f];
}
@end
diff -r 42c9ac754460 -r 16b12a6417d1 project_files/HedgewarsMobile/Classes/MainMenuViewController-iPhone.xib
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController-iPhone.xib Sat Oct 08 00:04:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController-iPhone.xib Sat Oct 08 02:57:30 2011 +0200
@@ -177,6 +177,25 @@
+
{480, 320}
@@ -237,6 +256,15 @@
44
+
+
+ switchViews:
+
+
+ 7
+
+ 47
+
@@ -258,6 +286,7 @@
+
@@ -302,6 +331,11 @@
+
+ 46
+
+
+
@@ -324,6 +358,8 @@
41.IBViewBoundsToFrameTransform
43.IBPluginDependency
43.IBViewBoundsToFrameTransform
+ 46.IBPluginDependency
+ 46.IBViewBoundsToFrameTransform
YES
@@ -355,6 +391,10 @@
P4AAAL+AAABBoAAAw5iAAA
+ com.apple.InterfaceBuilder.IBCocoaTouchPlugin
+
+ P4AAAL+AAABD0YAAwmgAAA
+
@@ -373,7 +413,7 @@
- 45
+ 47
diff -r 42c9ac754460 -r 16b12a6417d1 project_files/HedgewarsMobile/Classes/MainMenuViewController.m
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Sat Oct 08 00:04:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Sat Oct 08 02:57:30 2011 +0200
@@ -227,8 +227,9 @@
break;
case 5:
if (nil == self.missionsViewController) {
- MissionTrainingViewController *missions = [[MissionTrainingViewController alloc] initWithNibName:@"MissionTrainingViewController-iPad" bundle:nil];
- missions.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
+ xib = IS_IPAD() ? @"MissionTrainingViewController-iPad" : @"MissionTrainingViewController-iPhone";
+ MissionTrainingViewController *missions = [[MissionTrainingViewController alloc] initWithNibName:xib bundle:nil];
+ missions.modalTransitionStyle = IS_IPAD() ? UIModalTransitionStyleCoverVertical : UIModalTransitionStyleCrossDissolve;
if ([missions respondsToSelector:@selector(setModalPresentationStyle:)])
missions.modalPresentationStyle = UIModalPresentationPageSheet;
self.missionsViewController = missions;
diff -r 42c9ac754460 -r 16b12a6417d1 project_files/HedgewarsMobile/Classes/MissionTrainingViewController-iPad.xib
--- a/project_files/HedgewarsMobile/Classes/MissionTrainingViewController-iPad.xib Sat Oct 08 00:04:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController-iPad.xib Sat Oct 08 02:57:30 2011 +0200
@@ -1,5 +1,5 @@
-
+
1056
10K549
@@ -31,11 +31,11 @@
YES
IBFilesOwner
- IBCocoaTouchFramework
+ IBIPadFramework
IBFirstResponder
- IBCocoaTouchFramework
+ IBIPadFramework
@@ -48,40 +48,12 @@
{{91, 86}, {585, 391}}
- 10
-
- 549453824
- {84, 1}
-
- YES
-
- YES
-
-
-
- TU0AKgAAAVjFzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
-y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
-xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
-xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
-xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
-xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P8ADQEAAAMAAAABAFQAAAEB
-AAMAAAABAAEAAAECAAMAAAAEAAAB+gEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES
-AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABAAEAAAEXAAQAAAABAAABUAEcAAMAAAABAAEAAAFS
-AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA
-
-
-
-
-
- 3
- MCAwAA
-
-
- groupTableViewBackgroundColor
+ 1
+ MCAwIDAgMAA
NO
YES
- IBCocoaTouchFramework
+ IBIPadFramework
YES
2
1
@@ -97,8 +69,9 @@
292
{{227, 496}, {314, 260}}
+ YES
NO
- IBCocoaTouchFramework
+ IBIPadFramework
@@ -106,7 +79,7 @@
{{20, 684}, {64, 64}}
NO
- IBCocoaTouchFramework
+ IBIPadFramework
0
0
@@ -138,7 +111,7 @@
NO
1
- IBCocoaTouchFramework
+ IBIPadFramework
0
0
@@ -162,7 +135,7 @@
YES
7
NO
- IBCocoaTouchFramework
+ IBIPadFramework
Description here
Helvetica-BoldOblique
@@ -192,7 +165,7 @@
3
- IBCocoaTouchFramework
+ IBIPadFramework
@@ -282,8 +255,8 @@
+
-
@@ -351,7 +324,7 @@
YES
MissionTrainingViewController
UIResponder
- {{492, 303}, {768, 768}}
+ {{139, 166}, {768, 768}}
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
@@ -371,7 +344,7 @@
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- P4AAAL+AAABC2AAAw8yAAA
+ P4AAAL+AAABCtgAAw+2AAA
@@ -415,14 +388,12 @@
YES
descriptionLabel
- missionFile
previewImage
tableView
YES
UILabel
- NSString
UIImageView
UITableView
@@ -432,7 +403,6 @@
YES
descriptionLabel
- missionFile
previewImage
tableView
@@ -443,10 +413,6 @@
UILabel
- missionFile
- NSString
-
-
previewImage
UIImageView
@@ -462,16 +428,12 @@
- NSString
-
+ UILabel
+
IBProjectSource
Classes/HWUtils.h
-
- UILabel
-
-
YES
@@ -533,7 +495,7 @@
NSObject
-
+
IBFrameworkSource
Foundation.framework/Headers/NSURL.h
@@ -581,32 +543,6 @@
- NSString
-
- IBFrameworkSource
- Foundation.framework/Headers/NSPathUtilities.h
-
-
-
- NSString
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSString.h
-
-
-
- NSString
-
-
-
- NSString
-
- IBFrameworkSource
- UIKit.framework/Headers/UIStringDrawing.h
-
-
-
UIButton
UIControl
@@ -736,7 +672,7 @@
0
- IBCocoaTouchFramework
+ IBIPadFramework
com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS
diff -r 42c9ac754460 -r 16b12a6417d1 project_files/HedgewarsMobile/Classes/MissionTrainingViewController-iPhone.xib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController-iPhone.xib Sat Oct 08 02:57:30 2011 +0200
@@ -0,0 +1,652 @@
+
+
+
+ 1056
+ 10K549
+ 823
+ 1038.36
+ 461.00
+
+ com.apple.InterfaceBuilder.IBCocoaTouchPlugin
+ 132
+
+
+ YES
+
+
+
+ YES
+ com.apple.InterfaceBuilder.IBCocoaTouchPlugin
+
+
+ YES
+
+ YES
+
+
+ YES
+
+
+
+ YES
+
+ IBFilesOwner
+ IBCocoaTouchFramework
+
+
+ IBFirstResponder
+ IBCocoaTouchFramework
+
+
+
+ 274
+
+ YES
+
+
+ 274
+ {{180, 0}, {300, 320}}
+
+
+ 3
+ MQA
+
+ NO
+ YES
+ IBCocoaTouchFramework
+ YES
+ 2
+ 2
+ 0
+ YES
+ 44
+ 22
+ 22
+
+
+
+ 292
+ {{11, 19}, {157, 130}}
+
+ YES
+ NO
+ IBCocoaTouchFramework
+
+
+
+ 292
+ {{57, 245}, {64, 64}}
+
+ NO
+ IBCocoaTouchFramework
+ 0
+ 0
+
+ Helvetica-Bold
+ 15
+ 16
+
+
+
+ 1
+ MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA
+
+
+ 3
+ MC41AA
+
+
+ NSImage
+ backButton.png
+
+
+
+
+ 292
+ {{18, 164}, {142, 64}}
+
+ NO
+ 1
+ IBCocoaTouchFramework
+ 0
+ 0
+
+
+
+ 1
+ MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA
+
+
+
+ NSImage
+ startGameButton.png
+
+
+
+ {480, 320}
+
+
+ 3
+ MQA
+
+ 2
+
+
+
+ 3
+
+ IBCocoaTouchFramework
+
+
+
+
+ YES
+
+
+ view
+
+
+
+ 3
+
+
+
+ dataSource
+
+
+
+ 11
+
+
+
+ delegate
+
+
+
+ 12
+
+
+
+ previewImage
+
+
+
+ 13
+
+
+
+ tableView
+
+
+
+ 14
+
+
+
+ buttonPressed:
+
+
+ 7
+
+ 19
+
+
+
+ buttonPressed:
+
+
+ 7
+
+ 20
+
+
+
+
+ YES
+
+ 0
+
+
+
+
+
+ 1
+
+
+ YES
+
+
+
+
+
+
+
+
+ -1
+
+
+ File's Owner
+
+
+ -2
+
+
+
+
+ 9
+
+
+ YES
+
+
+
+
+ 10
+
+
+
+
+ 17
+
+
+
+
+ 18
+
+
+
+
+
+
+ YES
+
+ YES
+ -1.CustomClassName
+ -2.CustomClassName
+ 1.IBEditorWindowLastContentRect
+ 1.IBPluginDependency
+ 10.IBPluginDependency
+ 10.IBViewBoundsToFrameTransform
+ 17.IBPluginDependency
+ 17.IBViewBoundsToFrameTransform
+ 18.IBPluginDependency
+ 18.IBViewBoundsToFrameTransform
+ 9.IBPluginDependency
+ 9.IBViewBoundsToFrameTransform
+
+
+ YES
+ MissionTrainingViewController
+ UIResponder
+ {{492, 751}, {480, 320}}
+ com.apple.InterfaceBuilder.IBCocoaTouchPlugin
+ com.apple.InterfaceBuilder.IBCocoaTouchPlugin
+
+ P4AAAL+AAABAoAAAwwYAAA
+
+ com.apple.InterfaceBuilder.IBCocoaTouchPlugin
+
+ P4AAAL+AAABChAAAw5eAAA
+
+ com.apple.InterfaceBuilder.IBCocoaTouchPlugin
+
+ P4AAAL+AAABB2AAAw2cAAA
+
+ com.apple.InterfaceBuilder.IBCocoaTouchPlugin
+
+ P4AAAL+AAABDUAAAw5UAAA
+
+
+
+
+ YES
+
+
+ YES
+
+
+
+
+ YES
+
+
+ YES
+
+
+
+ 22
+
+
+
+ YES
+
+ MissionTrainingViewController
+ UIViewController
+
+ buttonPressed:
+ id
+
+
+ buttonPressed:
+
+ buttonPressed:
+ id
+
+
+
+ YES
+
+ YES
+ descriptionLabel
+ previewImage
+ tableView
+
+
+ YES
+ UILabel
+ UIImageView
+ UITableView
+
+
+
+ YES
+
+ YES
+ descriptionLabel
+ previewImage
+ tableView
+
+
+ YES
+
+ descriptionLabel
+ UILabel
+
+
+ previewImage
+ UIImageView
+
+
+ tableView
+ UITableView
+
+
+
+
+ IBProjectSource
+ Classes/MissionTrainingViewController.h
+
+
+
+ UILabel
+
+ IBProjectSource
+ Classes/HWUtils.h
+
+
+
+
+ YES
+
+ NSObject
+
+ IBFrameworkSource
+ Foundation.framework/Headers/NSError.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ Foundation.framework/Headers/NSFileManager.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ Foundation.framework/Headers/NSKeyValueCoding.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ Foundation.framework/Headers/NSKeyValueObserving.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ Foundation.framework/Headers/NSKeyedArchiver.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ Foundation.framework/Headers/NSObject.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ Foundation.framework/Headers/NSRunLoop.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ Foundation.framework/Headers/NSThread.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ Foundation.framework/Headers/NSURL.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ Foundation.framework/Headers/NSURLConnection.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ QuartzCore.framework/Headers/CAAnimation.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ QuartzCore.framework/Headers/CALayer.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UIAccessibility.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UINibLoading.h
+
+
+
+ NSObject
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UIResponder.h
+
+
+
+ UIButton
+ UIControl
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UIButton.h
+
+
+
+ UIControl
+ UIView
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UIControl.h
+
+
+
+ UIImageView
+ UIView
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UIImageView.h
+
+
+
+ UILabel
+ UIView
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UILabel.h
+
+
+
+ UIResponder
+ NSObject
+
+
+
+ UIScrollView
+ UIView
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UIScrollView.h
+
+
+
+ UISearchBar
+ UIView
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UISearchBar.h
+
+
+
+ UISearchDisplayController
+ NSObject
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UISearchDisplayController.h
+
+
+
+ UITableView
+ UIScrollView
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UITableView.h
+
+
+
+ UIView
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UIPrintFormatter.h
+
+
+
+ UIView
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UITextField.h
+
+
+
+ UIView
+ UIResponder
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UIView.h
+
+
+
+ UIViewController
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UINavigationController.h
+
+
+
+ UIViewController
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UIPopoverController.h
+
+
+
+ UIViewController
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UISplitViewController.h
+
+
+
+ UIViewController
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UITabBarController.h
+
+
+
+ UIViewController
+ UIResponder
+
+ IBFrameworkSource
+ UIKit.framework/Headers/UIViewController.h
+
+
+
+
+ 0
+ IBCocoaTouchFramework
+
+ com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS
+
+
+
+ com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3
+
+
+ YES
+ ../Hedgewars.xcodeproj
+ 3
+
+ YES
+
+ YES
+ backButton.png
+ startGameButton.png
+
+
+ YES
+ {64, 64}
+ {142, 64}
+
+
+ 132
+
+
diff -r 42c9ac754460 -r 16b12a6417d1 project_files/HedgewarsMobile/Classes/MissionTrainingViewController.h
--- a/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.h Sat Oct 08 00:04:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.h Sat Oct 08 02:57:30 2011 +0200
@@ -23,17 +23,19 @@
@interface MissionTrainingViewController : UIViewController {
NSArray *listOfMissions;
+ NSArray *listOfDescriptions;
+ NSString *missionName;
UIImageView *previewImage;
UITableView *tableView;
UILabel *descriptionLabel;
- NSString *missionName;
}
@property (nonatomic, retain) NSArray *listOfMissions;
+@property (nonatomic, retain) NSArray *listOfDescriptions;
+@property (nonatomic, retain) NSString *missionName;
@property (nonatomic, retain) IBOutlet UIImageView *previewImage;
@property (nonatomic, retain) IBOutlet UITableView *tableView;
@property (nonatomic, retain) IBOutlet UILabel *descriptionLabel;
-@property (nonatomic, retain) IBOutlet NSString *missionName;
-(IBAction) buttonPressed:(id) sender;
diff -r 42c9ac754460 -r 16b12a6417d1 project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m
--- a/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m Sat Oct 08 00:04:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m Sat Oct 08 02:57:30 2011 +0200
@@ -18,38 +18,41 @@
* File created on 03/10/2011.
*/
+
#import "MissionTrainingViewController.h"
#import
#import "GameInterfaceBridge.h"
+
@implementation MissionTrainingViewController
-@synthesize listOfMissions, previewImage, tableView, descriptionLabel, missionName;
+@synthesize listOfMissions, listOfDescriptions, previewImage, tableView, descriptionLabel, missionName;
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
return rotationManager(interfaceOrientation);
}
-// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
+#pragma mark -
+#pragma mark View management
-(void) viewDidLoad {
NSString *imgName = (IS_IPAD()) ? @"mediumBackground~ipad.png" : @"smallerBackground~iphone.png";
UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName];
self.view.backgroundColor = [UIColor colorWithPatternImage:img];
[img release];
- NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TRAININGS_DIRECTORY() error:NULL];
- self.listOfMissions = array;
self.previewImage.layer.borderColor = [[UIColor darkYellowColor] CGColor];
self.previewImage.layer.borderWidth = 3.8f;
self.previewImage.layer.cornerRadius = 14;
UIView *backView = [[UIView alloc] initWithFrame:self.tableView.frame];
- backView.backgroundColor = [UIColor darkBlueColorTransparent];
+ backView.backgroundColor = IS_IPAD() ? [UIColor darkBlueColorTransparent] : [UIColor blackColorTransparent];
[self.tableView setBackgroundView:backView];
[backView release];
self.tableView.backgroundColor = [UIColor clearColor];
- self.tableView.layer.borderColor = [[UIColor darkYellowColor] CGColor];
- self.tableView.layer.borderWidth = 2;
+ self.tableView.layer.borderColor = IS_IPAD() ? [[UIColor darkYellowColor] CGColor] : [[UIColor whiteColor] CGColor];
+ self.tableView.layer.borderWidth = 2.4f;
self.tableView.layer.cornerRadius = 8;
+ self.tableView.separatorColor = [UIColor whiteColor];
+ self.tableView.separatorStyle = IS_IPAD() ? UITableViewCellSeparatorStyleNone : UITableViewCellSeparatorStyleSingleLine;
self.descriptionLabel.textColor = [UIColor lightYellowColor];
[super viewDidLoad];
@@ -75,6 +78,39 @@
}
}
+#pragma mark -
+#pragma mark override setters/getters for better memory handling
+-(NSArray *)listOfMissions {
+ if (listOfMissions == nil)
+ self.listOfMissions = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TRAININGS_DIRECTORY() error:NULL];
+ return listOfMissions;
+}
+
+-(NSArray *)listOfDescriptions {
+ if (listOfDescriptions == nil) {
+ NSString *descLocation = [[NSString alloc] initWithFormat:@"%@/missions_en.txt",LOCALE_DIRECTORY()];
+ NSString *descComplete = [[NSString alloc] initWithContentsOfFile:descLocation encoding:NSUTF8StringEncoding error:NULL];
+ [descLocation release];
+ NSArray *descArray = [descComplete componentsSeparatedByString:@"\n"];
+ NSMutableArray *filteredArray = [[NSMutableArray alloc] initWithCapacity:[descArray count]];
+ [descComplete release];
+ // sanity check to avoid having missions and descriptions conflicts
+ for (int i = 0; i < [self.listOfMissions count]; i++) {
+ NSString *desc = [[self.listOfMissions objectAtIndex:i] stringByDeletingPathExtension];
+ for (NSString *str in descArray)
+ if ([str hasPrefix:desc]) {
+ NSArray *descriptionText = [str componentsSeparatedByString:@"\""];
+ [filteredArray insertObject:[descriptionText objectAtIndex:1] atIndex:i];
+ break;
+ }
+ }
+ self.listOfDescriptions = filteredArray;
+ [filteredArray release];
+ }
+ return listOfDescriptions;
+}
+
+#pragma mark -
#pragma mark Table view data source
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
@@ -84,18 +120,33 @@
return [self.listOfMissions count];
}
+-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+ return (IS_IPAD()) ? self.tableView.rowHeight : 80;
+}
+
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CellTr";
+ NSInteger row = [indexPath row];
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[[UITableViewCell alloc] initWithStyle:(IS_IPAD()) ? UITableViewCellStyleDefault : UITableViewCellStyleSubtitle
+ reuseIdentifier:CellIdentifier] autorelease];
- cell.textLabel.text = [[[self.listOfMissions objectAtIndex:[indexPath row]] stringByDeletingPathExtension] stringByReplacingOccurrencesOfString:@"_" withString:@" "];
+ cell.textLabel.text = [[[self.listOfMissions objectAtIndex:row] stringByDeletingPathExtension]
+ stringByReplacingOccurrencesOfString:@"_" withString:@" "];
cell.textLabel.textColor = [UIColor lightYellowColor];
//cell.textLabel.font = [UIFont fontWithName:@"Bradley Hand Bold" size:[UIFont labelFontSize]];
- cell.textLabel.textAlignment = UITextAlignmentCenter;
+ cell.textLabel.textAlignment = (IS_IPAD()) ? UITextAlignmentCenter : UITextAlignmentLeft;
cell.textLabel.backgroundColor = [UIColor clearColor];
+ cell.textLabel.adjustsFontSizeToFitWidth = YES;
+ cell.detailTextLabel.text = (IS_IPAD()) ? nil : [self.listOfDescriptions objectAtIndex:row];
+ cell.detailTextLabel.textColor = [UIColor whiteColor];
+ cell.detailTextLabel.backgroundColor = [UIColor clearColor];
+ cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
+ cell.detailTextLabel.numberOfLines = ([cell.detailTextLabel.text length] % 40);
+ cell.detailTextLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
+
cell.backgroundColor = [UIColor blackColorTransparent];
return cell;
}
@@ -103,37 +154,33 @@
#pragma mark -
#pragma mark Table view delegate
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- self.missionName = [[self.listOfMissions objectAtIndex:[indexPath row]] stringByDeletingPathExtension];
+ NSInteger row = [indexPath row];
+
+ self.missionName = [[self.listOfMissions objectAtIndex:row] stringByDeletingPathExtension];
NSString *filePath = [[NSString alloc] initWithFormat:@"%@/Missions/Training/%@@2x.png",GRAPHICS_DIRECTORY(),self.missionName];
UIImage *img = [[UIImage alloc] initWithContentsOfFile:filePath];
[filePath release];
[self.previewImage setImage:img];
[img release];
- self.descriptionLabel.text = nil;
- NSString *descLocation = [[NSString alloc] initWithFormat:@"%@/missions_en.txt",LOCALE_DIRECTORY()];
- NSString *descComplete = [[NSString alloc] initWithContentsOfFile:descLocation encoding:NSUTF8StringEncoding error:NULL];
- [descLocation release];
- NSArray *descArray = [descComplete componentsSeparatedByString:@"\n"];
- [descComplete release];
- for (NSString *str in descArray) {
- if ([str hasPrefix:missionName]) {
- NSArray *descriptionText = [str componentsSeparatedByString:@"\""];
- self.descriptionLabel.text = [descriptionText objectAtIndex:1];
- }
- }
+ self.descriptionLabel.text = [self.listOfDescriptions objectAtIndex:row];
}
#pragma mark -
#pragma mark Memory management
-(void) didReceiveMemoryWarning {
- previewImage = nil;
- missionName = nil;
+ self.previewImage = nil;
+ self.missionName = nil;
+ self.listOfMissions = nil;
+ self.listOfDescriptions = nil;
+ // if you nil this one it won't get updated anymore
+ //self.previewImage = nil;
[super didReceiveMemoryWarning];
}
-(void) viewDidUnload {
self.listOfMissions = nil;
+ self.listOfDescriptions = nil;
self.previewImage = nil;
self.tableView = nil;
self.descriptionLabel = nil;
@@ -145,6 +192,7 @@
-(void) dealloc {
releaseAndNil(listOfMissions);
+ releaseAndNil(listOfDescriptions);
releaseAndNil(previewImage);
releaseAndNil(tableView);
releaseAndNil(descriptionLabel);
diff -r 42c9ac754460 -r 16b12a6417d1 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sat Oct 08 00:04:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sat Oct 08 02:57:30 2011 +0200
@@ -26,6 +26,8 @@
28FD15000DC6FC520079059D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD14FF0DC6FC520079059D /* OpenGLES.framework */; };
28FD15080DC6FC5B0079059D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD15070DC6FC5B0079059D /* QuartzCore.framework */; settings = {ATTRIBUTES = (Required, ); }; };
61006F95128DE31F00EBA7F7 /* CreationChamber.m in Sources */ = {isa = PBXBuildFile; fileRef = 61006F94128DE31F00EBA7F7 /* CreationChamber.m */; };
+ 61077E87143FB09800645B29 /* MissionTrainingViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61077E86143FB09800645B29 /* MissionTrainingViewController-iPad.xib */; };
+ 6107802A143FCCC800645B29 /* startGameButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61078029143FCCC800645B29 /* startGameButton@2x.png */; };
610D5FB21270E2660033333A /* Icon-Small@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43411E290650040BA66 /* Icon-Small@2x.png */; };
610D5FB31270E26C0033333A /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43611E290650040BA66 /* Icon@2x.png */; };
61188BF212A6FE530026C5DA /* ammoButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D399129B350700911D8D /* ammoButton@2x.png */; };
@@ -180,7 +182,7 @@
6187AEBD120781B900B31A27 /* Settings in Resources */ = {isa = PBXBuildFile; fileRef = 6187AEA5120781B900B31A27 /* Settings */; };
61889985129995B500D55FD6 /* title~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 61889984129995B500D55FD6 /* title~ipad.png */; };
61915D5B143A4E2C00299991 /* MissionTrainingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61915D59143A4E2C00299991 /* MissionTrainingViewController.m */; };
- 61915D5C143A4E2C00299991 /* MissionTrainingViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61915D5A143A4E2C00299991 /* MissionTrainingViewController-iPad.xib */; };
+ 61915D5C143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61915D5A143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib */; };
6195981F1364BCEF00B429B6 /* libTremor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6195981D1364BCD200B429B6 /* libTremor.a */; };
619599451364C83D00B429B6 /* libLua.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 619599441364C82B00B429B6 /* libLua.a */; };
619599C01364E66B00B429B6 /* libFreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 619599BF1364E65900B429B6 /* libFreetype.a */; };
@@ -359,6 +361,8 @@
6103D39C129B350700911D8D /* arrowRight@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "arrowRight@2x.png"; path = "Resources/Overlay/arrowRight@2x.png"; sourceTree = ""; };
6103D39D129B350700911D8D /* arrowUp@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "arrowUp@2x.png"; path = "Resources/Overlay/arrowUp@2x.png"; sourceTree = ""; };
6103D39E129B350700911D8D /* cornerButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "cornerButton@2x.png"; path = "Resources/Overlay/cornerButton@2x.png"; sourceTree = ""; };
+ 61077E86143FB09800645B29 /* MissionTrainingViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MissionTrainingViewController-iPad.xib"; sourceTree = ""; };
+ 61078029143FCCC800645B29 /* startGameButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "startGameButton@2x.png"; path = "Resources/Frontend/startGameButton@2x.png"; sourceTree = ""; };
611D9BF812497E9800008271 /* SavedGamesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SavedGamesViewController.h; sourceTree = ""; };
611D9BF912497E9800008271 /* SavedGamesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SavedGamesViewController.m; sourceTree = ""; };
611D9BFA12497E9800008271 /* SavedGamesViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SavedGamesViewController.xib; sourceTree = ""; };
@@ -546,7 +550,7 @@
618E27B612A2C30700C20EF0 /* SDL_net.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL_net.xcodeproj; path = "../../../Library/SDL_net/Xcode-iPhoneOS/SDL_net.xcodeproj"; sourceTree = SOURCE_ROOT; };
61915D58143A4E2C00299991 /* MissionTrainingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MissionTrainingViewController.h; sourceTree = ""; };
61915D59143A4E2C00299991 /* MissionTrainingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MissionTrainingViewController.m; sourceTree = ""; };
- 61915D5A143A4E2C00299991 /* MissionTrainingViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MissionTrainingViewController-iPad.xib"; sourceTree = ""; };
+ 61915D5A143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MissionTrainingViewController-iPhone.xib"; sourceTree = ""; };
619598181364BCD200B429B6 /* Tremor.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Tremor.xcodeproj; path = ../../misc/libtremor/Xcode/Tremor.xcodeproj; sourceTree = SOURCE_ROOT; };
6195993F1364C82B00B429B6 /* Lua.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Lua.xcodeproj; path = ../../misc/liblua/Xcode/Lua.xcodeproj; sourceTree = SOURCE_ROOT; };
619599BA1364E65900B429B6 /* Freetype.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Freetype.xcodeproj; path = "../../misc/libfreetype/Xcode-iPhoneOS/Freetype.xcodeproj"; sourceTree = SOURCE_ROOT; };
@@ -795,7 +799,8 @@
61B7A33712CC21080086B604 /* StatsPageViewController.m */,
61915D58143A4E2C00299991 /* MissionTrainingViewController.h */,
61915D59143A4E2C00299991 /* MissionTrainingViewController.m */,
- 61915D5A143A4E2C00299991 /* MissionTrainingViewController-iPad.xib */,
+ 61915D5A143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib */,
+ 61077E86143FB09800645B29 /* MissionTrainingViewController-iPad.xib */,
);
name = "Other Controllers";
sourceTree = "";
@@ -1098,6 +1103,7 @@
615AD9E8120764CA00F2FF04 /* backButton.png */,
6172FED31298CE6600D73365 /* backButton@2x.png */,
615AD96112073B4D00F2FF04 /* startGameButton.png */,
+ 61078029143FCCC800645B29 /* startGameButton@2x.png */,
615FEADE12A2A6640098EE92 /* localplayButton@2x~iphone.png */,
615FEAE012A2A6640098EE92 /* localplayButton~iphone.png */,
615FEADF12A2A6640098EE92 /* localplayButton~ipad.png */,
@@ -1460,7 +1466,9 @@
6167CA42142A6ED7003DD50F /* bot5@2x.png in Resources */,
6167CB48142A8769003DD50F /* basehat-hedgehog.png in Resources */,
6167CB49142A8769003DD50F /* basehat-hedgehog@2x.png in Resources */,
- 61915D5C143A4E2C00299991 /* MissionTrainingViewController-iPad.xib in Resources */,
+ 61915D5C143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib in Resources */,
+ 61077E87143FB09800645B29 /* MissionTrainingViewController-iPad.xib in Resources */,
+ 6107802A143FCCC800645B29 /* startGameButton@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff -r 42c9ac754460 -r 16b12a6417d1 project_files/HedgewarsMobile/Resources/Frontend/startGameButton@2x.png
Binary file project_files/HedgewarsMobile/Resources/Frontend/startGameButton@2x.png has changed