3356
|
1 |
//
|
|
2 |
// GameConfigViewController.m
|
|
3 |
// HedgewarsMobile
|
|
4 |
//
|
|
5 |
// Created by Vittorio on 18/04/10.
|
|
6 |
// Copyright 2010 __MyCompanyName__. All rights reserved.
|
|
7 |
//
|
|
8 |
|
|
9 |
#import "GameConfigViewController.h"
|
|
10 |
#import "SDL_uikitappdelegate.h"
|
|
11 |
#import "CommodityFunctions.h"
|
3361
|
12 |
#import "TeamConfigViewController.h"
|
3356
|
13 |
|
|
14 |
@implementation GameConfigViewController
|
3361
|
15 |
@synthesize availableTeamsTableView, weaponsButton, schemesButton, mapButton, randomButton, startButton;
|
3356
|
16 |
|
|
17 |
|
|
18 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
|
19 |
return rotationManager(interfaceOrientation);
|
|
20 |
}
|
|
21 |
|
|
22 |
-(IBAction) buttonPressed:(id) sender {
|
3361
|
23 |
// works even if it's not actually a button
|
3356
|
24 |
UIButton *theButton = (UIButton *)sender;
|
|
25 |
switch (theButton.tag) {
|
|
26 |
case 0:
|
|
27 |
[[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil];
|
|
28 |
break;
|
|
29 |
case 1:
|
|
30 |
[[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil];
|
|
31 |
[self performSelector:@selector(startSDLgame)
|
|
32 |
withObject:nil
|
|
33 |
afterDelay:0.4];
|
|
34 |
break;
|
|
35 |
}
|
|
36 |
}
|
|
37 |
|
|
38 |
-(void) startSDLgame {
|
|
39 |
[[SDLUIKitDelegate sharedAppDelegate] startSDLgame];
|
|
40 |
}
|
|
41 |
|
|
42 |
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
|
3361
|
43 |
-(void) viewDidLoad {
|
|
44 |
teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
|
|
45 |
activeController = teamConfigViewController;
|
|
46 |
|
|
47 |
[self.view insertSubview:teamConfigViewController.view atIndex:0];
|
|
48 |
|
3356
|
49 |
[super viewDidLoad];
|
|
50 |
}
|
|
51 |
|
|
52 |
-(void) didReceiveMemoryWarning {
|
|
53 |
// Releases the view if it doesn't have a superview.
|
|
54 |
[super didReceiveMemoryWarning];
|
|
55 |
// Release any cached data, images, etc that aren't in use.
|
|
56 |
}
|
|
57 |
|
|
58 |
|
|
59 |
-(void) viewDidUnload {
|
3361
|
60 |
activeController = nil;
|
|
61 |
teamConfigViewController = nil;
|
3356
|
62 |
self.availableTeamsTableView = nil;
|
|
63 |
self.weaponsButton = nil;
|
|
64 |
self.schemesButton = nil;
|
|
65 |
self.mapButton = nil;
|
|
66 |
self.randomButton = nil;
|
|
67 |
self.startButton = nil;
|
|
68 |
[super viewDidUnload];
|
|
69 |
}
|
|
70 |
|
|
71 |
|
|
72 |
-(void) dealloc {
|
3361
|
73 |
[activeController release];
|
|
74 |
[teamConfigViewController release];
|
3356
|
75 |
[availableTeamsTableView release];
|
|
76 |
[weaponsButton release];
|
|
77 |
[schemesButton release];
|
|
78 |
[mapButton release];
|
|
79 |
[randomButton release];
|
|
80 |
[startButton release];
|
|
81 |
[super dealloc];
|
|
82 |
}
|
|
83 |
|
3361
|
84 |
-(void) viewWillAppear:(BOOL)animated {
|
|
85 |
[super viewWillAppear:animated];
|
|
86 |
[activeController viewWillAppear:animated];
|
|
87 |
}
|
|
88 |
|
|
89 |
-(void) viewWillDisappear:(BOOL)animated {
|
|
90 |
[super viewWillDisappear:animated];
|
|
91 |
[activeController viewWillDisappear:animated];
|
|
92 |
}
|
|
93 |
|
|
94 |
-(void) viewDidAppear:(BOOL)animated {
|
|
95 |
[super viewDidLoad];
|
|
96 |
[activeController viewDidAppear:animated];
|
|
97 |
}
|
|
98 |
|
|
99 |
-(void) viewDidDisappear:(BOOL)animated {
|
|
100 |
[super viewDidUnload];
|
|
101 |
[activeController viewDidDisappear:animated];
|
|
102 |
}
|
3356
|
103 |
|
|
104 |
@end
|