project_files/HedgewarsMobile/Classes/MainMenuViewController.m
changeset 11559 2b9e189df3d6
parent 11558 38996f467b23
child 12872 00215a7ec5f5
equal deleted inserted replaced
11558:38996f467b23 11559:2b9e189df3d6
    24 #import "SettingsBaseViewController.h"
    24 #import "SettingsBaseViewController.h"
    25 #import "AboutViewController.h"
    25 #import "AboutViewController.h"
    26 #import "SavedGamesViewController.h"
    26 #import "SavedGamesViewController.h"
    27 #import "RestoreViewController.h"
    27 #import "RestoreViewController.h"
    28 #import "MissionTrainingViewController.h"
    28 #import "MissionTrainingViewController.h"
       
    29 #import "CampaignsViewController.h"
    29 #import "Appirater.h"
    30 #import "Appirater.h"
    30 #import "ServerProtocolNetwork.h"
    31 #import "ServerProtocolNetwork.h"
    31 #import "GameInterfaceBridge.h"
    32 #import "GameInterfaceBridge.h"
    32 
    33 
    33 #import "SettingsBaseViewController.h"
    34 #import "SettingsBaseViewController.h"
    87     NSString *saveString = [userDefaults objectForKey:@"savedGamePath"];
    88     NSString *saveString = [userDefaults objectForKey:@"savedGamePath"];
    88     if (saveString != nil && [saveString isEqualToString:@""] == NO && [[userDefaults objectForKey:@"saveIsValid"] boolValue])
    89     if (saveString != nil && [saveString isEqualToString:@""] == NO && [[userDefaults objectForKey:@"saveIsValid"] boolValue])
    89     {
    90     {
    90         NSString *xibName = [@"RestoreViewController-" stringByAppendingString:(IS_IPAD() ? @"iPad" : @"iPhone")];
    91         NSString *xibName = [@"RestoreViewController-" stringByAppendingString:(IS_IPAD() ? @"iPad" : @"iPhone")];
    91         RestoreViewController *restored = [[RestoreViewController alloc] initWithNibName:xibName bundle:nil];
    92         RestoreViewController *restored = [[RestoreViewController alloc] initWithNibName:xibName bundle:nil];
    92         if ([restored respondsToSelector:@selector(setModalPresentationStyle:)])
    93         restored.modalPresentationStyle = UIModalPresentationFormSheet;
    93             restored.modalPresentationStyle = UIModalPresentationFormSheet;
       
    94 
    94 
    95         [self performSelector:@selector(presentViewController:) withObject:restored afterDelay:0.25];
    95         [self performSelector:@selector(presentViewController:) withObject:restored afterDelay:0.25];
    96     }
    96     }
    97     else
    97     else
    98     {
    98     {
   217             }
   217             }
   218 #else
   218 #else
   219             {
   219             {
   220                 AboutViewController *about = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
   220                 AboutViewController *about = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
   221                 about.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
   221                 about.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
   222                 if ([about respondsToSelector:@selector(setModalPresentationStyle:)])
   222                 about.modalPresentationStyle = UIModalPresentationFormSheet;
   223                      about.modalPresentationStyle = UIModalPresentationFormSheet;
       
   224                 
   223                 
   225                 [self presentViewController:about animated:YES completion:nil];
   224                 [self presentViewController:about animated:YES completion:nil];
   226                 [about release];
   225                 [about release];
   227             }
   226             }
   228 #endif
   227 #endif
   229             break;
   228             break;
   230         case 4:
   229         case 4:
   231             {
   230             {
   232                 SavedGamesViewController *savedgames = [[SavedGamesViewController alloc] initWithNibName:@"SavedGamesViewController" bundle:nil];
   231                 SavedGamesViewController *savedgames = [[SavedGamesViewController alloc] initWithNibName:@"SavedGamesViewController" bundle:nil];
   233                 savedgames.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
   232                 savedgames.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
   234                 if ([savedgames respondsToSelector:@selector(setModalPresentationStyle:)])
   233                 savedgames.modalPresentationStyle = UIModalPresentationPageSheet;
   235                     savedgames.modalPresentationStyle = UIModalPresentationPageSheet;
       
   236                 
   234                 
   237                 [self presentViewController:savedgames animated:YES completion:nil];
   235                 [self presentViewController:savedgames animated:YES completion:nil];
   238                 [savedgames release];
   236                 [savedgames release];
   239             }
   237             }
   240             break;
   238             break;
   241         case 5:
   239         case 5:
   242             {
   240             {
   243                 xib = IS_IPAD() ? @"MissionTrainingViewController-iPad" : @"MissionTrainingViewController-iPhone";
   241                 xib = IS_IPAD() ? @"MissionTrainingViewController-iPad" : @"MissionTrainingViewController-iPhone";
   244                 MissionTrainingViewController *missions = [[MissionTrainingViewController alloc] initWithNibName:xib bundle:nil];
   242                 MissionTrainingViewController *missions = [[MissionTrainingViewController alloc] initWithNibName:xib bundle:nil];
   245                 missions.modalTransitionStyle = IS_IPAD() ? UIModalTransitionStyleCoverVertical : UIModalTransitionStyleCrossDissolve;
   243                 missions.modalTransitionStyle = IS_IPAD() ? UIModalTransitionStyleCoverVertical : UIModalTransitionStyleCrossDissolve;
   246                 if ([missions respondsToSelector:@selector(setModalPresentationStyle:)])
   244                 missions.modalPresentationStyle = UIModalPresentationPageSheet;
   247                     missions.modalPresentationStyle = UIModalPresentationPageSheet;
       
   248                 
   245                 
   249                 [self presentViewController:missions animated:YES completion:nil];
   246                 [self presentViewController:missions animated:YES completion:nil];
   250                 [missions release];
   247                 [missions release];
   251             }
   248             }
   252             break;
   249             break;
   253         case 6:
   250         case 6:
   254             [GameInterfaceBridge registerCallingController:self];
   251             [GameInterfaceBridge registerCallingController:self];
   255             [GameInterfaceBridge startSimpleGame];
   252             [GameInterfaceBridge startSimpleGame];
       
   253             break;
       
   254         case 7:
       
   255             {
       
   256                 xib = IS_IPAD() ? @"CampaignsViewController-iPad" : @"CampaignsViewController-iPhone";
       
   257                 CampaignsViewController *campaigns = [[CampaignsViewController alloc] initWithNibName:xib bundle:nil];
       
   258                 UINavigationController *campaignNavigationController = [[UINavigationController alloc] initWithRootViewController:campaigns];
       
   259                 [campaigns release];
       
   260                 
       
   261                 campaignNavigationController.modalTransitionStyle = IS_IPAD() ? UIModalTransitionStyleCoverVertical : UIModalTransitionStyleCrossDissolve;
       
   262                 campaignNavigationController.modalPresentationStyle = UIModalPresentationPageSheet;
       
   263                 
       
   264                 [self presentViewController:campaignNavigationController animated:YES completion:nil];
       
   265                 [campaignNavigationController release];
       
   266             }
   256             break;
   267             break;
   257         default:
   268         default:
   258             alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented"
   269             alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented"
   259                                                message:@"Sorry, this feature is not yet implemented"
   270                                                message:@"Sorry, this feature is not yet implemented"
   260                                               delegate:nil
   271                                               delegate:nil