27 #import "MissionTrainingViewController.h" |
27 #import "MissionTrainingViewController.h" |
28 #import "Appirater.h" |
28 #import "Appirater.h" |
29 #import "ServerProtocolNetwork.h" |
29 #import "ServerProtocolNetwork.h" |
30 #import "GameInterfaceBridge.h" |
30 #import "GameInterfaceBridge.h" |
31 |
31 |
|
32 #ifdef DEBUG |
|
33 #import "GameLogViewController.h" |
|
34 #endif |
|
35 |
32 @interface MainMenuViewController () |
36 @interface MainMenuViewController () |
33 @property (retain, nonatomic) IBOutlet UIButton *simpleGameButton; |
37 @property (retain, nonatomic) IBOutlet UIButton *simpleGameButton; |
34 @property (retain, nonatomic) IBOutlet UIButton *missionsButton; |
38 @property (retain, nonatomic) IBOutlet UIButton *missionsButton; |
35 @end |
39 @end |
36 |
40 |
102 #pragma mark - |
106 #pragma mark - |
103 -(IBAction) switchViews:(id) sender { |
107 -(IBAction) switchViews:(id) sender { |
104 UIButton *button = (UIButton *)sender; |
108 UIButton *button = (UIButton *)sender; |
105 UIAlertView *alert; |
109 UIAlertView *alert; |
106 NSString *xib = nil; |
110 NSString *xib = nil; |
107 NSString *debugStr = nil; |
|
108 |
111 |
109 [[AudioManagerController mainManager] playClickSound]; |
112 [[AudioManagerController mainManager] playClickSound]; |
110 switch (button.tag) { |
113 switch (button.tag) { |
111 case 0: |
114 case 0: |
112 if (nil == self.gameConfigViewController) { |
115 if (nil == self.gameConfigViewController) { |
128 } |
131 } |
129 [self presentViewController:self.settingsViewController animated:YES completion:nil]; |
132 [self presentViewController:self.settingsViewController animated:YES completion:nil]; |
130 break; |
133 break; |
131 case 3: |
134 case 3: |
132 #ifdef DEBUG |
135 #ifdef DEBUG |
133 if ([[NSFileManager defaultManager] fileExistsAtPath:DEBUG_FILE()]) |
136 { |
134 debugStr = [[NSString alloc] initWithContentsOfFile:DEBUG_FILE()]; |
137 GameLogViewController *gameLogVC = [[GameLogViewController alloc] init]; |
135 else |
138 UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:gameLogVC]; |
136 debugStr = [[NSString alloc] initWithString:@"Here be log"]; |
139 [gameLogVC release]; |
137 UITextView *scroll = [[UITextView alloc] initWithFrame:self.view.frame]; |
140 |
138 scroll.text = debugStr; |
141 [self presentViewController:navController animated:YES completion:nil]; |
139 [debugStr release]; |
142 [navController release]; |
140 scroll.editable = NO; |
143 } |
141 scroll.alpha = 0; |
|
142 |
|
143 UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; |
|
144 [btn addTarget:scroll action:@selector(removeFromSuperview) forControlEvents:UIControlEventTouchUpInside]; |
|
145 [btn addTarget:btn action:@selector(removeFromSuperview) forControlEvents:UIControlEventTouchUpInside]; |
|
146 btn.frame = CGRectMake(self.view.frame.size.width-58, -6, 64, 64); |
|
147 btn.backgroundColor = [UIColor blackColor]; |
|
148 btn.titleLabel.textColor = [UIColor whiteColor]; |
|
149 btn.titleLabel.textAlignment = UITextAlignmentCenter; |
|
150 btn.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]]; |
|
151 [btn setTitle:@"Close" forState:UIControlStateNormal]; |
|
152 btn.alpha = 0; |
|
153 [btn.layer setCornerRadius:10.0f]; |
|
154 [btn.layer setMasksToBounds:YES]; |
|
155 |
|
156 [self.view addSubview:scroll]; |
|
157 [self.view addSubview:btn]; |
|
158 |
|
159 [UIView beginAnimations:@"fadein" context:NULL]; |
|
160 [UIView setAnimationDuration:0.25f]; |
|
161 btn.alpha = 1; |
|
162 scroll.alpha = 1; |
|
163 [UIView commitAnimations]; |
|
164 [scroll release]; |
|
165 #else |
144 #else |
166 debugStr = debugStr; // prevent compiler warning |
|
167 if (nil == self.aboutViewController) { |
145 if (nil == self.aboutViewController) { |
168 AboutViewController *about = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil]; |
146 AboutViewController *about = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil]; |
169 about.modalTransitionStyle = UIModalTransitionStyleCoverVertical; |
147 about.modalTransitionStyle = UIModalTransitionStyleCoverVertical; |
170 if ([about respondsToSelector:@selector(setModalPresentationStyle:)]) |
148 if ([about respondsToSelector:@selector(setModalPresentationStyle:)]) |
171 about.modalPresentationStyle = UIModalPresentationFormSheet; |
149 about.modalPresentationStyle = UIModalPresentationFormSheet; |