project_files/HedgewarsMobile/Classes/MainMenuViewController.m
changeset 6083 72c882c0fd0f
parent 6075 0173cd44c3bc
child 6085 252e9a7d260f
equal deleted inserted replaced
6082:16ca7a7a6aa6 6083:72c882c0fd0f
    19  */
    19  */
    20 
    20 
    21 
    21 
    22 #import "MainMenuViewController.h"
    22 #import "MainMenuViewController.h"
    23 #import "CreationChamber.h"
    23 #import "CreationChamber.h"
    24 #import "PascalImports.h"
       
    25 #import "GameConfigViewController.h"
    24 #import "GameConfigViewController.h"
    26 #import "SettingsContainerViewController.h"
    25 #import "SettingsContainerViewController.h"
    27 #import "AboutViewController.h"
    26 #import "AboutViewController.h"
    28 #import "SavedGamesViewController.h"
    27 #import "SavedGamesViewController.h"
    29 #import "RestoreViewController.h"
    28 #import "RestoreViewController.h"
       
    29 #import "MissionTrainingViewController.h"
    30 #import "GameInterfaceBridge.h"
    30 #import "GameInterfaceBridge.h"
    31 #import "Appirater.h"
    31 #import "Appirater.h"
    32 #import "ServerSetup.h"
    32 #import "ServerSetup.h"
    33 
    33 
    34 
    34 
    35 @implementation MainMenuViewController
    35 @implementation MainMenuViewController
    36 @synthesize gameConfigViewController, settingsViewController, aboutViewController, savedGamesViewController, restoreViewController;
    36 @synthesize gameConfigViewController, settingsViewController, aboutViewController, savedGamesViewController,
       
    37             restoreViewController, missionsViewController;
    37 
    38 
    38 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    39 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    39     return rotationManager(interfaceOrientation);
    40     return rotationManager(interfaceOrientation);
    40 }
    41 }
    41 
    42 
   169                 GameConfigViewController *gcvc = [[GameConfigViewController alloc] initWithNibName:xib bundle:nil];
   170                 GameConfigViewController *gcvc = [[GameConfigViewController alloc] initWithNibName:xib bundle:nil];
   170                 gcvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
   171                 gcvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
   171                 self.gameConfigViewController = gcvc;
   172                 self.gameConfigViewController = gcvc;
   172                 [gcvc release];
   173                 [gcvc release];
   173             }
   174             }
   174 
       
   175             [self presentModalViewController:self.gameConfigViewController animated:YES];
   175             [self presentModalViewController:self.gameConfigViewController animated:YES];
   176             break;
   176             break;
   177         case 2:
   177         case 2:
   178             if (nil == self.settingsViewController) {
   178             if (nil == self.settingsViewController) {
   179                 SettingsContainerViewController *svrc = [[SettingsContainerViewController alloc] initWithNibName:nil bundle:nil];
   179                 SettingsContainerViewController *svrc = [[SettingsContainerViewController alloc] initWithNibName:nil bundle:nil];
   180                 svrc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
   180                 svrc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
   181                 self.settingsViewController = svrc;
   181                 self.settingsViewController = svrc;
   182                 [svrc release];
   182                 [svrc release];
   183             }
   183             }
   184 
       
   185             [self presentModalViewController:self.settingsViewController animated:YES];
   184             [self presentModalViewController:self.settingsViewController animated:YES];
   186             break;
   185             break;
   187         case 3:
   186         case 3:
   188 #ifdef DEBUG
   187 #ifdef DEBUG
   189             if ([[NSFileManager defaultManager] fileExistsAtPath:DEBUG_FILE()])
   188             if ([[NSFileManager defaultManager] fileExistsAtPath:DEBUG_FILE()])
   222                 if ([savedgames respondsToSelector:@selector(setModalPresentationStyle:)])
   221                 if ([savedgames respondsToSelector:@selector(setModalPresentationStyle:)])
   223                     savedgames.modalPresentationStyle = UIModalPresentationPageSheet;
   222                     savedgames.modalPresentationStyle = UIModalPresentationPageSheet;
   224                 self.savedGamesViewController = savedgames;
   223                 self.savedGamesViewController = savedgames;
   225                 [savedgames release];
   224                 [savedgames release];
   226             }
   225             }
   227             
       
   228             [self presentModalViewController:self.savedGamesViewController animated:YES];
   226             [self presentModalViewController:self.savedGamesViewController animated:YES];
       
   227             break;
       
   228         case 5:
       
   229             if (nil == self.missionsViewController) {
       
   230                 MissionTrainingViewController *missions = [[MissionTrainingViewController alloc] initWithNibName:@"MissionTrainingViewController~iPad" bundle:nil];
       
   231                 missions.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
       
   232                 if ([missions respondsToSelector:@selector(setModalPresentationStyle:)])
       
   233                     missions.modalPresentationStyle = UIModalPresentationPageSheet;
       
   234                 self.missionsViewController = missions;
       
   235                 [missions release];
       
   236             }
       
   237             [self presentModalViewController:self.missionsViewController animated:YES];
   229             break;
   238             break;
   230         default:
   239         default:
   231             alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented"
   240             alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented"
   232                                                message:@"Sorry, this feature is not yet implemented"
   241                                                message:@"Sorry, this feature is not yet implemented"
   233                                               delegate:nil
   242                                               delegate:nil