cocoaTouch/GameConfigViewController.m
changeset 3369 c7289e42f0ee
parent 3365 37ac593e9027
child 3373 c1ff724a5c34
equal deleted inserted replaced
3368:791fa4664209 3369:c7289e42f0ee
    36     }
    36     }
    37 }
    37 }
    38 
    38 
    39 -(IBAction) segmentPressed:(id) sender {
    39 -(IBAction) segmentPressed:(id) sender {
    40     UISegmentedControl *theSegment = (UISegmentedControl *)sender;
    40     UISegmentedControl *theSegment = (UISegmentedControl *)sender;
    41     NSLog(@"%d", theSegment.selectedSegmentIndex);
    41 
    42     switch (theSegment.selectedSegmentIndex) {
    42     switch (theSegment.selectedSegmentIndex) {
    43         case 0:
    43         case 0:
    44             // this init here is just aestetic as this controller was already set up in viewDidLoad
    44             // this init here is just aestetic as this controller was already set up in viewDidLoad
    45             if (mapConfigViewController == nil) {
    45             if (mapConfigViewController == nil) {
    46                 mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil];
    46                 mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil];
    89                                               cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
    89                                               cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
    90                                               otherButtonTitles:nil];
    90                                               otherButtonTitles:nil];
    91         [alert show];
    91         [alert show];
    92         [alert release];
    92         [alert release];
    93         return;
    93         return;
    94     } 
    94     }
    95     NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:mapConfigViewController.seedCommand,@"seed_command",
    95     NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:mapConfigViewController.seedCommand,@"seed_command",
       
    96                                                                       mapConfigViewController.templateFilterCommand,@"templatefilter_command",
       
    97                                                                       mapConfigViewController.mapGenCommand,@"mapgen_command",
       
    98                                                                       mapConfigViewController.mazeSizeCommand,@"mazesize_command",
    96                                                                       teamConfigViewController.listOfSelectedTeams,@"teams_list",nil];
    99                                                                       teamConfigViewController.listOfSelectedTeams,@"teams_list",nil];
    97     [dict writeToFile:GAMECONFIG_FILE() atomically:YES];
   100     [dict writeToFile:GAMECONFIG_FILE() atomically:YES];
    98     [dict release];
   101     [dict release];
    99     [[self parentViewController] dismissModalViewControllerAnimated:YES];
   102     [[self parentViewController] dismissModalViewControllerAnimated:YES];
   100     [[SDLUIKitDelegate sharedAppDelegate] startSDLgame];
   103     [[SDLUIKitDelegate sharedAppDelegate] startSDLgame];
   102 
   105 
   103 -(void) viewDidLoad {
   106 -(void) viewDidLoad {
   104     mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil];
   107     mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil];
   105     activeController = mapConfigViewController;
   108     activeController = mapConfigViewController;
   106     
   109     
   107     [self.view insertSubview:mapConfigViewController.view atIndex:0];
   110     [self.view addSubview:mapConfigViewController.view];
   108     
   111     
   109     [super viewDidLoad];
   112     [super viewDidLoad];
   110 }
   113 }
   111 
   114 
   112 -(void) viewWillAppear:(BOOL)animated {
   115 -(void) viewWillAppear:(BOOL)animated {