project_files/HedgewarsMobile/Classes/GameConfigViewController.m
changeset 6219 c193881389c1
parent 6115 485cfecadc9a
child 6266 b02a1e92dba2
equal deleted inserted replaced
6218:999215ca87d7 6219:c193881389c1
    33 
    33 
    34 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    34 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    35     return rotationManager(interfaceOrientation);
    35     return rotationManager(interfaceOrientation);
    36 }
    36 }
    37 
    37 
    38 /*
       
    39 -(MapConfigViewController *)mapConfigViewController {
       
    40     if (mapConfigViewController == nil) {
       
    41         NSString *xib = IS_IPAD() ? @"MapConfigViewController-iPad" : @"MapConfigViewController-iPhone";
       
    42         MapConfigViewController *mcvc = [[MapConfigViewController alloc] initWithNibName:xib bundle:nil];
       
    43         [self.view addSubview:mcvc.view];
       
    44         self.mapConfigViewController = mcvc;
       
    45         [mcvc release];
       
    46     }
       
    47     return mapConfigViewController;
       
    48 }
       
    49 */
       
    50 
       
    51 -(IBAction) buttonPressed:(id) sender {
    38 -(IBAction) buttonPressed:(id) sender {
    52     UIButton *theButton = (UIButton *)sender;
    39     UIButton *theButton = (UIButton *)sender;
    53 
    40 
    54     switch (theButton.tag) {
    41     switch (theButton.tag) {
    55         case 0:
    42         case 0:
    95             break;
    82             break;
    96     }
    83     }
    97 }
    84 }
    98 
    85 
    99 -(IBAction) segmentPressed:(id) sender {
    86 -(IBAction) segmentPressed:(id) sender {
   100 /*
    87 
   101     UISegmentedControl *theSegment = (UISegmentedControl *)sender;
    88     UISegmentedControl *theSegment = (UISegmentedControl *)sender;
   102 
    89 
   103     [AudioManagerController playSelectSound];
    90     [AudioManagerController playSelectSound];
   104     switch (theSegment.selectedSegmentIndex) {
    91     switch (theSegment.selectedSegmentIndex) {
   105         case 0:
    92         case 0:
   111             // this message is compulsory otherwise the table won't be loaded at all
    98             // this message is compulsory otherwise the table won't be loaded at all
   112             [self.teamConfigViewController viewWillAppear:NO];
    99             [self.teamConfigViewController viewWillAppear:NO];
   113             [self.view bringSubviewToFront:self.teamConfigViewController.view];
   100             [self.view bringSubviewToFront:self.teamConfigViewController.view];
   114             break;
   101             break;
   115         case 2:
   102         case 2:
   116             if (schemeWeaponConfigViewController == nil) {
       
   117                 schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
       
   118                 [self.view addSubview:schemeWeaponConfigViewController.view];
       
   119             }
       
   120             // this message is compulsory otherwise the table won't be loaded at all
   103             // this message is compulsory otherwise the table won't be loaded at all
   121             [schemeWeaponConfigViewController viewWillAppear:NO];
   104             [schemeWeaponConfigViewController viewWillAppear:NO];
   122             [self.view bringSubviewToFront:schemeWeaponConfigViewController.view];
   105             [self.view bringSubviewToFront:schemeWeaponConfigViewController.view];
   123             break;
   106             break;
   124         case 3:
   107         case 3:
   132             break;
   115             break;
   133         default:
   116         default:
   134             DLog(@"Nope");
   117             DLog(@"Nope");
   135             break;
   118             break;
   136     }
   119     }
   137 */
   120 
   138 }
   121 }
   139 
   122 
   140 -(BOOL) isEverythingSet {
   123 -(BOOL) isEverythingSet {
   141     // don't start playing if the preview is in progress
   124     // don't start playing if the preview is in progress
   142     if ([self.mapConfigViewController busy]) {
   125     if ([self.mapConfigViewController busy]) {
   322         [maxLabel release];
   305         [maxLabel release];
   323 
   306 
   324         // as this is loaded from a NIB we need to set its size and position
   307         // as this is loaded from a NIB we need to set its size and position
   325         self.mapConfigViewController.view.frame = CGRectMake(704, 0, 320, 680);
   308         self.mapConfigViewController.view.frame = CGRectMake(704, 0, 320, 680);
   326     } else {
   309     } else {
   327         // this is the visible controller
   310         self.mapConfigViewController.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width-44);
   328         if (self.mapConfigViewController == nil)
       
   329             self.mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil];
       
   330         // this must be loaded & added in order to auto set default scheme and ammo
       
   331         self.schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
       
   332         [self.view addSubview:self.schemeWeaponConfigViewController.view];
       
   333     }
   311     }
   334     [self.view addSubview:self.mapConfigViewController.view];
   312     [self.view addSubview:self.mapConfigViewController.view];
   335 
   313 
   336     [super viewDidLoad];
   314     [super viewDidLoad];
   337 }
   315 }