project_files/HedgewarsMobile/Classes/GameConfigViewController.m
branchqmlfrontend
changeset 11408 b894922d58cc
parent 11232 e1bbd85a53b7
child 11554 893722a2a1f9
equal deleted inserted replaced
11076:fcbdee9cdd74 11408:b894922d58cc
    20 #import "GameConfigViewController.h"
    20 #import "GameConfigViewController.h"
    21 #import "MapConfigViewController.h"
    21 #import "MapConfigViewController.h"
    22 #import "TeamConfigViewController.h"
    22 #import "TeamConfigViewController.h"
    23 #import "SchemeWeaponConfigViewController.h"
    23 #import "SchemeWeaponConfigViewController.h"
    24 #import "GameInterfaceBridge.h"
    24 #import "GameInterfaceBridge.h"
    25 
    25 #import "HelpPageLobbyViewController.h"
       
    26 
       
    27 @interface GameConfigViewController ()
       
    28 @property (nonatomic, retain) IBOutlet UISegmentedControl *tabsSegmentedControl; //iPhone only
       
    29 
       
    30 @property (nonatomic, retain) IBOutlet UIBarButtonItem *backButton; //iPhone only
       
    31 @property (nonatomic, retain) IBOutlet UIBarButtonItem *startButton; //iPhone only
       
    32 @end
    26 
    33 
    27 @implementation GameConfigViewController
    34 @implementation GameConfigViewController
    28 @synthesize imgContainer, titleImage, sliderBackground, //helpPage,
    35 @synthesize imgContainer, titleImage, sliderBackground, helpPage,
    29             mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController;
    36             mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController;
    30 
    37 
    31 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    38 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    32     return rotationManager(interfaceOrientation);
    39     return rotationManager(interfaceOrientation);
    33 }
    40 }
       
    41 
       
    42 #pragma mark - Buttons
    34 
    43 
    35 -(IBAction) buttonPressed:(id) sender {
    44 -(IBAction) buttonPressed:(id) sender {
    36     UIButton *theButton = (UIButton *)sender;
    45     UIButton *theButton = (UIButton *)sender;
    37 
    46 
    38     switch (theButton.tag) {
    47     switch (theButton.tag) {
    45                                                       otherButtonTitles:nil];
    54                                                       otherButtonTitles:nil];
    46                 [alert show];
    55                 [alert show];
    47                 [alert release];
    56                 [alert release];
    48             } else {
    57             } else {
    49                 [[AudioManagerController mainManager] playBackSound];
    58                 [[AudioManagerController mainManager] playBackSound];
    50                 [[self parentViewController] dismissModalViewControllerAnimated:YES];
    59                 [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
    51             }
    60             }
    52             break;
    61             break;
    53         case 1:
    62         case 1:
    54             [[AudioManagerController mainManager] playClickSound];
    63             [[AudioManagerController mainManager] playClickSound];
    55             if ([self isEverythingSet] == NO)
    64             if ([self isEverythingSet] == NO)
    56                 return;
    65                 return;
    57             theButton.enabled = NO;
    66             theButton.enabled = NO;
    58             for (UIView *oneView in self.imgContainer.subviews) {
    67             [self clearImgContainer];
    59                 if ([oneView isMemberOfClass:[UIImageView class]]) {
       
    60                     UIImageView *anImageView = (UIImageView *)oneView;
       
    61                     [anImageView removeFromSuperview];
       
    62                 }
       
    63             }
       
    64             [self startGame:theButton];
    68             [self startGame:theButton];
    65 
    69 
    66             break;
    70             break;
    67         case 2:
    71         case 2:
    68             [[AudioManagerController mainManager] playClickSound];
    72             [[AudioManagerController mainManager] playClickSound];
    69             /*
       
    70             if (self.helpPage == nil)
    73             if (self.helpPage == nil)
    71                 self.helpPage = [[HelpPageLobbyViewController alloc] initWithNibName:@"HelpPageLobbyViewController-iPad" bundle:nil];
    74                 self.helpPage = [[HelpPageLobbyViewController alloc] initWithNibName:@"HelpPageLobbyViewController-iPad" bundle:nil];
    72             self.helpPage.view.alpha = 0;
    75             self.helpPage.view.alpha = 0;
       
    76             self.helpPage.view.frame = self.view.frame;
    73             [self.view addSubview:self.helpPage.view];
    77             [self.view addSubview:self.helpPage.view];
    74             [UIView beginAnimations:@"helplobby" context:NULL];
    78             [UIView animateWithDuration:0.5 animations:^{
    75             self.helpPage.view.alpha = 1;
    79                 self.helpPage.view.alpha = 1;
    76             [UIView commitAnimations];
    80             }];
    77             */
       
    78             break;
    81             break;
    79         default:
    82         default:
    80             DLog(@"Nope");
    83             DLog(@"Nope");
    81             break;
    84             break;
       
    85     }
       
    86 }
       
    87 
       
    88 #pragma mark - Tabs Segmented Control
       
    89 
       
    90 - (void)localizeTabsSegmentedControl
       
    91 {
       
    92     for (NSUInteger i = 0; i < self.tabsSegmentedControl.numberOfSegments; i++)
       
    93     {
       
    94         NSString *oldTitle = [self.tabsSegmentedControl titleForSegmentAtIndex:i];
       
    95         [self.tabsSegmentedControl setTitle:NSLocalizedString(oldTitle, nil) forSegmentAtIndex:i];
    82     }
    96     }
    83 }
    97 }
    84 
    98 
    85 -(IBAction) segmentPressed:(id) sender {
    99 -(IBAction) segmentPressed:(id) sender {
    86 
   100 
   102             // this message is compulsory otherwise the table won't be loaded at all
   116             // this message is compulsory otherwise the table won't be loaded at all
   103             [schemeWeaponConfigViewController viewWillAppear:NO];
   117             [schemeWeaponConfigViewController viewWillAppear:NO];
   104             [self.view bringSubviewToFront:schemeWeaponConfigViewController.view];
   118             [self.view bringSubviewToFront:schemeWeaponConfigViewController.view];
   105             break;
   119             break;
   106         case 3:
   120         case 3:
   107             /*
       
   108             if (helpPage == nil) {
   121             if (helpPage == nil) {
   109                 helpPage = [[HelpPageLobbyViewController alloc] initWithNibName:@"HelpPageLobbyViewController-iPhone" bundle:nil];
   122                 helpPage = [[HelpPageLobbyViewController alloc] initWithNibName:@"HelpPageLobbyViewController-iPhone" bundle:nil];
       
   123                 CGRect helpPageFrame = self.view.frame;
       
   124                 helpPageFrame.size.height -= 44; //toolbar height
       
   125                 self.helpPage.view.frame = helpPageFrame;
   110                 [self.view addSubview:helpPage.view];
   126                 [self.view addSubview:helpPage.view];
   111             }
   127             }
   112             // this message is compulsory otherwise the table won't be loaded at all
   128             // this message is compulsory otherwise the table won't be loaded at all
   113             [helpPage viewWillAppear:NO];
   129             [helpPage viewWillAppear:NO];
   114             [self.view bringSubviewToFront:helpPage.view];
   130             [self.view bringSubviewToFront:helpPage.view];
   115             */
       
   116             break;
   131             break;
   117         default:
   132         default:
   118             DLog(@"Nope");
   133             DLog(@"Nope");
   119             break;
   134             break;
   120     }
   135     }
   121 
   136 
   122 }
   137 }
       
   138 
       
   139 #pragma mark -
   123 
   140 
   124 -(BOOL) isEverythingSet {
   141 -(BOOL) isEverythingSet {
   125     // don't start playing if the preview is in progress
   142     // don't start playing if the preview is in progress
   126     if ([self.mapConfigViewController busy]) {
   143     if ([self.mapConfigViewController busy]) {
   127         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Wait for the Preview",@"")
   144         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Wait for the Preview",@"")
   227     [GameInterfaceBridge registerCallingController:self];
   244     [GameInterfaceBridge registerCallingController:self];
   228     [GameInterfaceBridge startLocalGame:gameDictionary];
   245     [GameInterfaceBridge startLocalGame:gameDictionary];
   229     [gameDictionary release];
   246     [gameDictionary release];
   230 }
   247 }
   231 
   248 
   232 -(void) loadNiceHogs {
   249 -(void) loadNiceHogs
   233     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   250 {
   234     srand(time(NULL));
   251     @autoreleasepool
   235     NSString *filePath = [[NSString alloc] initWithFormat:@"%@/Hedgehog/Idle.png",GRAPHICS_DIRECTORY()];
   252     {
   236     UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:filePath];
   253     
   237     [filePath release];
   254         NSString *filePath = [[NSString alloc] initWithFormat:@"%@/Hedgehog/Idle.png",GRAPHICS_DIRECTORY()];
   238 
   255         UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:filePath];
   239     NSArray *hatArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:HATS_DIRECTORY() error:NULL];
   256         [filePath release];
   240     int numberOfHats = [hatArray count];
   257 
   241     int animationFrames = IS_VERY_POWERFUL([HWUtils modelType]) ? 18 : 1;
   258         NSArray *hatArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:HATS_DIRECTORY() error:NULL];
   242 
   259         NSUInteger numberOfHats = [hatArray count];
   243     if (self.imgContainer != nil)
   260         int animationFrames = IS_VERY_POWERFUL([HWUtils modelType]) ? 16 : 1;
   244         [self.imgContainer removeFromSuperview];
   261         
   245 
   262         self.imgContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 40)];
   246     self.imgContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 40)];
   263         NSInteger numberOfHogs = 1 + arc4random_uniform(15);
   247     NSInteger numberOfHogs = 1 + random() % 20;
   264         DLog(@"Drawing %ld nice hedgehogs", (long)numberOfHogs);
   248     DLog(@"Drawing %d nice hedgehogs", numberOfHogs);
   265         for (int i = 0; i < numberOfHogs; i++) {
   249     for (int i = 0; i < numberOfHogs; i++) {
   266             NSString *hat = [hatArray objectAtIndex:arc4random_uniform((int)numberOfHats)];
   250         NSString *hat = [hatArray objectAtIndex:random()%numberOfHats];
   267 
   251 
   268             NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@", HATS_DIRECTORY(), hat];
   252         NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@", HATS_DIRECTORY(), hat];
   269             UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile:hatFile];
   253         UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile:hatFile];
   270             NSMutableArray *animation = [[NSMutableArray alloc] initWithCapacity:animationFrames];
   254         NSMutableArray *animation = [[NSMutableArray alloc] initWithCapacity:animationFrames];
   271             for (int j = 0; j < animationFrames; j++) {
   255         for (int j = 0; j < animationFrames; j++) {
   272                 int x = ((j*32)/(int)hatSprite.size.height)*32;
   256             int x = ((j*32)/(int)hatSprite.size.height)*32;
   273                 int y = (j*32)%(int)hatSprite.size.height;
   257             int y = (j*32)%(int)hatSprite.size.height;
   274                 UIImage *hatSpriteFrame = [hatSprite cutAt:CGRectMake(x, y, 32, 32)];
   258             UIImage *hatSpriteFrame = [hatSprite cutAt:CGRectMake(x, y, 32, 32)];
   275                 UIImage *hogSpriteFrame = [hogSprite cutAt:CGRectMake(x, y, 32, 32)];
   259             UIImage *hogSpriteFrame = [hogSprite cutAt:CGRectMake(x, y, 32, 32)];
   276                 UIImage *hogWithHat = [hogSpriteFrame mergeWith:hatSpriteFrame atPoint:CGPointMake(0, 5)];
   260             UIImage *hogWithHat = [hogSpriteFrame mergeWith:hatSpriteFrame atPoint:CGPointMake(0, 5)];
   277                 [animation addObject:hogWithHat];
   261             [animation addObject:hogWithHat];
   278             }
       
   279             [hatSprite release];
       
   280             [hatFile release];
       
   281 
       
   282             UIImageView *hog = [[UIImageView alloc] initWithImage:[animation objectAtIndex:0]];
       
   283             hog.animationImages = animation;
       
   284             hog.animationDuration = 3;
       
   285             [animation release];
       
   286 
       
   287             int x = 20*i+arc4random_uniform(128);
       
   288             while (x > 320 - 32)
       
   289                 x = i*arc4random_uniform(32);
       
   290             
       
   291             hog.frame = CGRectMake(x, 25, hog.frame.size.width, hog.frame.size.height);
       
   292             [self.imgContainer addSubview:hog];
       
   293             [hog startAnimating];
       
   294             [hog release];
   262         }
   295         }
   263         [hatSprite release];
   296         [hogSprite release];
   264         [hatFile release];
   297         
   265 
   298         dispatch_async(dispatch_get_main_queue(), ^{
   266         UIImageView *hog = [[UIImageView alloc] initWithImage:[animation objectAtIndex:0]];
   299             
   267         hog.animationImages = animation;
   300             [self.view addSubview:self.imgContainer];
   268         hog.animationDuration = 3;
   301             
   269         [animation release];
   302             // don't place the nice hogs if there is no space for them
   270 
   303             if ((self.interfaceOrientation == UIInterfaceOrientationPortrait ||
   271         int x = 20*i+random()%128;
   304                  self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown))
   272         if (x > 320 - 32)
   305                 self.imgContainer.alpha = 0;
   273             x = i*random()%32;
   306             
   274         hog.frame = CGRectMake(x, 25, hog.frame.size.width, hog.frame.size.height);
   307             self.isDrawingNiceHogs = NO;
   275         [self.imgContainer addSubview:hog];
   308         });
   276         [hog startAnimating];
   309     }
   277         [hog release];
   310 }
   278     }
   311 
   279 
   312 - (void)clearImgContainer
   280     // don't place the nice hogs if there is no space for them
   313 {
   281     if ((self.interfaceOrientation == UIInterfaceOrientationPortrait ||
   314     for (UIView *oneView in [self.imgContainer subviews])
   282          self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown))
   315     {
   283         self.imgContainer.alpha = 0;
   316         if ([oneView isMemberOfClass:[UIImageView class]])
   284 
   317         {
   285     [self.view addSubview:self.imgContainer];
   318             UIImageView *anImageView = (UIImageView *)oneView;
   286     [hogSprite release];
   319             [anImageView removeFromSuperview];
   287     [pool drain];
   320         }
   288 }
   321     }
   289 
   322     
   290 -(void) viewDidLoad {
   323     [self.imgContainer removeFromSuperview];
       
   324     self.imgContainer = nil;
       
   325 }
       
   326 
       
   327 -(void) viewDidLoad
       
   328 {
       
   329     [super viewDidLoad];
       
   330     
   291     self.view.backgroundColor = [UIColor blackColor];
   331     self.view.backgroundColor = [UIColor blackColor];
   292 
   332 
   293     CGRect screenRect = [[UIScreen mainScreen] safeBounds];
   333     CGRect screenRect = [[UIScreen mainScreen] safeBounds];
   294     self.view.frame = screenRect;
   334     self.view.frame = screenRect;
   295 
   335 
   296     if (IS_IPAD()) {
   336     if (IS_IPAD())
       
   337     {
   297         // the label for the filter slider
   338         // the label for the filter slider
   298         UILabel *backLabel = [[UILabel alloc] initWithFrame:CGRectMake(116, 714, 310, 40)
   339         UILabel *backLabel = [[UILabel alloc] initWithFrame:CGRectMake(116, 714, 310, 40)
   299                                                    andTitle:nil
   340                                                    andTitle:nil
   300                                             withBorderWidth:2.0f];
   341                                             withBorderWidth:2.0f];
   301         self.sliderBackground = backLabel;
   342         self.sliderBackground = backLabel;
   310         maxLabel.textColor = [UIColor whiteColor];
   351         maxLabel.textColor = [UIColor whiteColor];
   311         maxLabel.textAlignment = UITextAlignmentCenter;
   352         maxLabel.textAlignment = UITextAlignmentCenter;
   312         [self.view addSubview:maxLabel];
   353         [self.view addSubview:maxLabel];
   313         self.mapConfigViewController.maxLabel = maxLabel;
   354         self.mapConfigViewController.maxLabel = maxLabel;
   314         [maxLabel release];
   355         [maxLabel release];
   315     } else {
   356     }
       
   357     else
       
   358     {
       
   359         [self localizeTabsSegmentedControl];
       
   360         
       
   361         [self.backButton setTitle:NSLocalizedString(@"Back", nil)];
       
   362         [self.startButton setTitle:NSLocalizedString(@"Start", nil)];
       
   363         
   316         self.mapConfigViewController.view.frame = CGRectMake(0, 0, screenRect.size.width, screenRect.size.height-44);
   364         self.mapConfigViewController.view.frame = CGRectMake(0, 0, screenRect.size.width, screenRect.size.height-44);
   317     }
   365     }
       
   366     
   318     [self.view addSubview:self.mapConfigViewController.view];
   367     [self.view addSubview:self.mapConfigViewController.view];
   319     [self.view bringSubviewToFront:self.mapConfigViewController.slider];
   368     [self.view bringSubviewToFront:self.mapConfigViewController.slider];
   320 
       
   321     [super viewDidLoad];
       
   322 }
   369 }
   323 
   370 
   324 -(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval) duration {
   371 -(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval) duration {
   325     if (IS_IPAD() == NO)
   372     if (IS_IPAD() == NO)
   326         return;
   373         return;
   327 
   374 
   328     if ((toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
   375     [self updateiPadUIForInterfaceOrientation:toInterfaceOrientation];
   329          toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
   376 
       
   377     if (self.helpPage)
       
   378     {
       
   379         self.helpPage.view.frame = self.view.frame;
       
   380     }
       
   381 }
       
   382 
       
   383 - (void)updateiPadUIForInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
       
   384 {
       
   385     if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
       
   386          interfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
   330         self.imgContainer.alpha = 1;
   387         self.imgContainer.alpha = 1;
   331         self.titleImage.frame = CGRectMake(357, 17, 309, 165);
   388         self.titleImage.frame = CGRectMake(357, 17, 309, 165);
   332         self.schemeWeaponConfigViewController.view.frame = CGRectMake(0, 60, 320, 620);
   389         self.schemeWeaponConfigViewController.view.frame = CGRectMake(0, 60, 320, 620);
   333         self.mapConfigViewController.view.frame = CGRectMake(704, 0, 320, 680);
   390         self.mapConfigViewController.view.frame = CGRectMake(704, 0, 320, 680);
   334         self.teamConfigViewController.view.frame = CGRectMake(337, 187, 350, 505);
   391         self.teamConfigViewController.view.frame = CGRectMake(337, 187, 350, 505);
   343         self.teamConfigViewController.view.frame = CGRectMake(170, 590, 428, 366);
   400         self.teamConfigViewController.view.frame = CGRectMake(170, 590, 428, 366);
   344         self.mapConfigViewController.maxLabel.frame = CGRectMake(104, 975, 200, 40);
   401         self.mapConfigViewController.maxLabel.frame = CGRectMake(104, 975, 200, 40);
   345         self.sliderBackground.frame = CGRectMake(465, 975, 200, 40);
   402         self.sliderBackground.frame = CGRectMake(465, 975, 200, 40);
   346         self.mapConfigViewController.slider.frame = CGRectMake(475, 983, 180, 23);
   403         self.mapConfigViewController.slider.frame = CGRectMake(475, 983, 180, 23);
   347     }
   404     }
   348 
   405 }
   349     [self.schemeWeaponConfigViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation
   406 
   350                                                                             duration:duration];
   407 -(void) viewWillAppear:(BOOL)animated
   351 }
   408 {
   352 
   409     [super viewWillAppear:animated];
   353 -(void) viewWillAppear:(BOOL)animated {
   410     
       
   411     if (IS_IPAD() && !self.imgContainer && !self.isDrawingNiceHogs)
       
   412     {
       
   413         self.isDrawingNiceHogs = YES;
       
   414         [NSThread detachNewThreadSelector:@selector(loadNiceHogs) toTarget:self withObject:nil];
       
   415     }
       
   416     
   354     if (IS_IPAD())
   417     if (IS_IPAD())
   355         [NSThread detachNewThreadSelector:@selector(loadNiceHogs) toTarget:self withObject:nil];
   418     {
   356 
   419         // we assume here what 'statusBarOrientation' will never be changed manually!
   357     [self.mapConfigViewController viewWillAppear:animated];
   420         UIInterfaceOrientation currentOrientation = [[UIApplication sharedApplication] statusBarOrientation];
   358     [self.teamConfigViewController viewWillAppear:animated];
   421         [self updateiPadUIForInterfaceOrientation:currentOrientation];
   359     [self.schemeWeaponConfigViewController viewWillAppear:animated];
   422     }
   360     // add other controllers here and below
   423 }
   361 
   424 
   362     [super viewWillAppear:animated];
   425 - (void)viewDidAppear:(BOOL)animated
   363 }
   426 {
   364 
       
   365 -(void) viewDidAppear:(BOOL)animated {
       
   366     [self.mapConfigViewController viewDidAppear:animated];
       
   367     [self.teamConfigViewController viewDidAppear:animated];
       
   368     [self.schemeWeaponConfigViewController viewDidAppear:animated];
       
   369     [super viewDidAppear:animated];
   427     [super viewDidAppear:animated];
   370 }
   428 
   371 
   429     if (IS_IPAD())
   372 -(void) viewWillDisappear:(BOOL)animated {
   430     {
   373     [self.mapConfigViewController viewWillDisappear:animated];
   431         // need to call this again in order to fix layout on iOS 9 when going back from rotated stats page
   374     [self.teamConfigViewController viewWillDisappear:animated];
   432         UIInterfaceOrientation currentOrientation = [[UIApplication sharedApplication] statusBarOrientation];
   375     [self.schemeWeaponConfigViewController viewWillDisappear:animated];
   433         [self updateiPadUIForInterfaceOrientation:currentOrientation];
   376     [super viewWillDisappear:animated];
   434     }
   377 }
   435 }
   378 
   436 
   379 -(void) viewDidDisappear:(BOOL)animated {
   437 -(void) didReceiveMemoryWarning
   380     [self.mapConfigViewController viewDidDisappear:animated];
   438 {
   381     [self.teamConfigViewController viewDidDisappear:animated];
   439     [self clearImgContainer];
   382     [self.schemeWeaponConfigViewController viewDidDisappear:animated];
       
   383     [super viewDidDisappear:animated];
       
   384 }
       
   385 
       
   386 -(void) didReceiveMemoryWarning {
       
   387     self.imgContainer = nil;
       
   388 
   440 
   389     if (self.titleImage.superview == nil)
   441     if (self.titleImage.superview == nil)
   390         self.titleImage = nil;
   442         self.titleImage = nil;
   391     if (self.sliderBackground.superview == nil)
   443     if (self.sliderBackground.superview == nil)
   392         self.sliderBackground = nil;
   444         self.sliderBackground = nil;
   395         self.mapConfigViewController = nil;
   447         self.mapConfigViewController = nil;
   396     if (self.teamConfigViewController.view.superview == nil)
   448     if (self.teamConfigViewController.view.superview == nil)
   397         self.teamConfigViewController = nil;
   449         self.teamConfigViewController = nil;
   398     if (self.schemeWeaponConfigViewController.view.superview == nil)
   450     if (self.schemeWeaponConfigViewController.view.superview == nil)
   399         self.schemeWeaponConfigViewController = nil;
   451         self.schemeWeaponConfigViewController = nil;
   400     //if (self.helpPage.view.superview == nil)
   452     if (self.helpPage.view.superview == nil)
   401     //    self.helpPage = nil;
   453         self.helpPage = nil;
   402     MSG_MEMCLEAN();
   454     MSG_MEMCLEAN();
   403     [super didReceiveMemoryWarning];
   455     [super didReceiveMemoryWarning];
   404 }
   456 }
   405 
   457 
   406 -(void) viewDidUnload {
   458 -(void) viewDidUnload {
   408     self.titleImage = nil;
   460     self.titleImage = nil;
   409     self.sliderBackground = nil;
   461     self.sliderBackground = nil;
   410     self.schemeWeaponConfigViewController = nil;
   462     self.schemeWeaponConfigViewController = nil;
   411     self.teamConfigViewController = nil;
   463     self.teamConfigViewController = nil;
   412     self.mapConfigViewController = nil;
   464     self.mapConfigViewController = nil;
   413     //self.helpPage = nil;
   465     self.helpPage = nil;
   414     MSG_DIDUNLOAD();
   466     MSG_DIDUNLOAD();
   415     [super viewDidUnload];
   467     [super viewDidUnload];
   416 }
   468 }
   417 
   469 
   418 -(void) dealloc {
   470 -(void) dealloc {
       
   471     releaseAndNil(_tabsSegmentedControl);
       
   472     releaseAndNil(_backButton);
       
   473     releaseAndNil(_startButton);
   419     releaseAndNil(imgContainer);
   474     releaseAndNil(imgContainer);
   420     releaseAndNil(titleImage);
   475     releaseAndNil(titleImage);
   421     releaseAndNil(sliderBackground);
   476     releaseAndNil(sliderBackground);
   422     releaseAndNil(schemeWeaponConfigViewController);
   477     releaseAndNil(schemeWeaponConfigViewController);
   423     releaseAndNil(teamConfigViewController);
   478     releaseAndNil(teamConfigViewController);
   424     releaseAndNil(mapConfigViewController);
   479     releaseAndNil(mapConfigViewController);
   425     //releaseAndNil(helpPage);
   480     releaseAndNil(helpPage);
   426     [super dealloc];
   481     [super dealloc];
   427 }
   482 }
   428 
   483 
   429 @end
   484 @end