project_files/HedgewarsMobile/Classes/GameConfigViewController.m
changeset 3625 9f1d79e01a60
parent 3623 f14db208f2fa
child 3626 19f78afa0188
equal deleted inserted replaced
3624:304c6d32383a 3625:9f1d79e01a60
    12 #import "MapConfigViewController.h"
    12 #import "MapConfigViewController.h"
    13 #import "TeamConfigViewController.h"
    13 #import "TeamConfigViewController.h"
    14 #import "SchemeWeaponConfigViewController.h"
    14 #import "SchemeWeaponConfigViewController.h"
    15 
    15 
    16 // draw background image in uitoolbar
    16 // draw background image in uitoolbar
    17 @implementation UIToolbar (CustomImage)
    17 /*@implementation UIToolbar (CustomImage)
    18 -(void) drawRect:(CGRect)rect {
    18 -(void) drawRect:(CGRect)rect {
    19     UIImage *image = [UIImage imageWithContentsOfFile:@"toolbarBackground.png"];
    19     UIImage *image = [UIImage imageWithContentsOfFile:@"toolbarBackground.png"];
    20     [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    20     [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    21 }
    21 }
    22 @end
    22 @end
    23 
    23 */
    24 @implementation GameConfigViewController
    24 @implementation GameConfigViewController
    25 
    25 
    26 
    26 
    27 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    27 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    28     return rotationManager(interfaceOrientation);
    28     return rotationManager(interfaceOrientation);
    31 -(IBAction) buttonPressed:(id) sender {
    31 -(IBAction) buttonPressed:(id) sender {
    32     // works even if it's not actually a button
    32     // works even if it's not actually a button
    33     UIButton *theButton = (UIButton *)sender;
    33     UIButton *theButton = (UIButton *)sender;
    34     switch (theButton.tag) {
    34     switch (theButton.tag) {
    35         case 0:
    35         case 0:
    36             [[self parentViewController] dismissModalViewControllerAnimated:YES];
    36             if ([mapConfigViewController busy]) {
       
    37                 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Wait for the Preview",@"")
       
    38                                                                 message:NSLocalizedString(@"Before returning the preview needs to be generated",@"")
       
    39                                                                delegate:nil
       
    40                                                       cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
       
    41                                                       otherButtonTitles:nil];
       
    42                 [alert show];
       
    43                 [alert release];
       
    44             } else {
       
    45                 [[self parentViewController] dismissModalViewControllerAnimated:YES];
       
    46                 
       
    47             }
    37             break;
    48             break;
    38         case 1:
    49         case 1:
    39             theButton.enabled = NO;
    50             theButton.enabled = NO;
    40             [self performSelector:@selector(startGame:)
    51             [self performSelector:@selector(startGame:)
    41                        withObject:theButton
    52                        withObject:theButton