288 [[NSNotificationCenter defaultCenter] addObserver:self |
288 [[NSNotificationCenter defaultCenter] addObserver:self |
289 selector:@selector(buttonPressed:) |
289 selector:@selector(buttonPressed:) |
290 name:@"buttonPressed" |
290 name:@"buttonPressed" |
291 object:nil]; |
291 object:nil]; |
292 srandom(time(NULL)); |
292 srandom(time(NULL)); |
293 |
293 |
294 // load other controllers |
294 // load other controllers |
295 if (self.mapConfigViewController == nil) |
295 if (self.mapConfigViewController == nil) |
296 self.mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPad" bundle:nil]; |
296 self.mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPad" bundle:nil]; |
|
297 |
|
298 UILabel *leftBackground = createLabelWithParams(nil, CGRectMake(0, 60, 320, 620), 2.7f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); |
|
299 [self.mapConfigViewController.view addSubview:leftBackground]; |
|
300 [leftBackground release]; |
|
301 UILabel *middleBackground = createLabelWithParams(nil, CGRectMake(337, 187, 350, 505), 2.7f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); |
|
302 [self.mapConfigViewController.view addSubview:middleBackground]; |
|
303 [middleBackground release]; |
|
304 UILabel *rightBackground = createLabelWithParams(nil, CGRectMake(704, 214, 320, 464), 2.7f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); |
|
305 [self.mapConfigViewController.view addSubview:rightBackground]; |
|
306 [rightBackground release]; |
|
307 UILabel *topBackground = createLabelWithParams(nil, CGRectMake(714, 14, 300, 190), 2.3f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); |
|
308 [self.mapConfigViewController.view addSubview:topBackground]; |
|
309 [topBackground release]; |
|
310 UILabel *bottomLeftBackground = createLabelWithParams(nil, CGRectMake(106, 714, 320, 40), 2.0f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); |
|
311 [self.mapConfigViewController.view addSubview:bottomLeftBackground]; |
|
312 [bottomLeftBackground release]; |
|
313 UILabel *bottomRightBackground = createLabelWithParams(NSLocalizedString(@"Max Hogs: ",@""), CGRectMake(594, 714, 320, 40), 2.0f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); |
|
314 bottomRightBackground.font = [UIFont italicSystemFontOfSize:[UIFont labelFontSize]]; |
|
315 [self.mapConfigViewController.view addSubview:bottomRightBackground]; |
|
316 [bottomRightBackground release]; |
|
317 [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.maxLabel]; |
|
318 [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.sizeLabel]; |
|
319 [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.segmentedControl]; |
|
320 [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.previewButton]; |
|
321 [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.slider]; |
|
322 [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.tableView]; |
|
323 |
297 if (self.teamConfigViewController == nil) |
324 if (self.teamConfigViewController == nil) |
298 self.teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
325 self.teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
299 [self.mapConfigViewController.view addSubview:self.teamConfigViewController.view]; |
326 [self.mapConfigViewController.view addSubview:self.teamConfigViewController.view]; |
300 if (self.schemeWeaponConfigViewController == nil) |
327 if (self.schemeWeaponConfigViewController == nil) |
301 self.schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
328 self.schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
302 [self.mapConfigViewController.view addSubview:schemeWeaponConfigViewController.view]; |
329 [self.mapConfigViewController.view addSubview:schemeWeaponConfigViewController.view]; |
303 self.mapConfigViewController.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width); |
330 self.mapConfigViewController.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width); |
304 self.teamConfigViewController.view.frame = CGRectMake(348, 200, 328, 480); |
331 self.teamConfigViewController.view.frame = CGRectMake(348, 200, 328, 480); |
305 self.schemeWeaponConfigViewController.view.frame = CGRectMake(10, 70, 300, 600); |
332 self.schemeWeaponConfigViewController.view.frame = CGRectMake(10, 70, 300, 600); |
306 |
333 |
307 } else { |
334 } else { |
308 // this is the visible controller |
335 // this is the visible controller |
309 if (self.mapConfigViewController == nil) |
336 if (self.mapConfigViewController == nil) |
310 self.mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil]; |
337 self.mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil]; |
311 // this must be loaded & added in order to auto set default scheme and ammo |
338 // this must be loaded & added in order to auto set default scheme and ammo |
349 [self.schemeWeaponConfigViewController viewDidDisappear:animated]; |
376 [self.schemeWeaponConfigViewController viewDidDisappear:animated]; |
350 [super viewDidDisappear:animated]; |
377 [super viewDidDisappear:animated]; |
351 } |
378 } |
352 |
379 |
353 -(void) didReceiveMemoryWarning { |
380 -(void) didReceiveMemoryWarning { |
354 if (self.mapConfigViewController.view.superview == nil) |
|
355 self.mapConfigViewController = nil; |
|
356 if (self.teamConfigViewController.view.superview == nil) |
381 if (self.teamConfigViewController.view.superview == nil) |
357 self.teamConfigViewController = nil; |
382 self.teamConfigViewController = nil; |
358 if (self.schemeWeaponConfigViewController.view.superview == nil) |
383 if (self.schemeWeaponConfigViewController.view.superview == nil) |
359 self.schemeWeaponConfigViewController = nil; |
384 self.schemeWeaponConfigViewController = nil; |
360 if (self.helpPage.view.superview == nil) |
385 if (self.helpPage.view.superview == nil) |
361 self.helpPage = nil; |
386 self.helpPage = nil; |
362 |
387 if (self.mapConfigViewController.view.superview == nil) |
363 // Release any cached data, images, etc that aren't in use. |
388 self.mapConfigViewController = nil; |
|
389 |
364 self.imgContainer = nil; |
390 self.imgContainer = nil; |
365 MSG_MEMCLEAN(); |
391 MSG_MEMCLEAN(); |
366 [super didReceiveMemoryWarning]; |
392 [super didReceiveMemoryWarning]; |
367 } |
393 } |
368 |
394 |