--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Fri Dec 29 22:37:31 2017 +0100
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Sat Dec 30 01:22:11 2017 +0100
@@ -50,12 +50,12 @@
@implementation MainMenuViewController
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
--(void) viewDidLoad {
+- (void)viewDidLoad {
self.view.frame = [[UIScreen mainScreen] safeBounds];
[super viewDidLoad];
@@ -108,31 +108,30 @@
- (void) presentViewController:(UIViewController *)vc
{
[self presentViewController:vc animated:NO completion:nil];
- [vc release];
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[[AudioManagerController mainManager] playBackgroundMusic];
[super viewWillAppear:animated];
}
#pragma mark -
--(IBAction) switchViews:(id) sender {
+- (IBAction)switchViews:(id)sender {
UIButton *button = (UIButton *)sender;
UIAlertView *alert;
NSString *xib = nil;
[[AudioManagerController mainManager] playClickSound];
switch (button.tag) {
- case 0:
+ case 0: {
xib = IS_IPAD() ? @"GameConfigViewController-iPad" : @"GameConfigViewController-iPhone";
GameConfigViewController *gcvc = [[GameConfigViewController alloc] initWithNibName:xib bundle:nil];
gcvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:gcvc animated:YES completion:nil];
- [gcvc release];
break;
+ }
case 2:
if (IS_IPAD())
{
@@ -140,23 +139,18 @@
SettingsBaseViewController *rightController = [[SettingsBaseViewController alloc] init];
rightController.targetController = nil;
UINavigationController *rightNavController = [[UINavigationController alloc] initWithRootViewController:rightController];
- [rightController release];
// the contens on the left of the splitview, setting targetController that will receive push/pop actions
SettingsBaseViewController *leftController = [[SettingsBaseViewController alloc] init];
leftController.targetController = rightNavController.topViewController;
UINavigationController *leftNavController = [[UINavigationController alloc] initWithRootViewController:leftController];
- [leftController release];
MGSplitViewController *splitViewRootController = [[MGSplitViewController alloc] init];
splitViewRootController.delegate = nil;
splitViewRootController.showsMasterInPortrait = YES;
splitViewRootController.viewControllers = [NSArray arrayWithObjects:leftNavController, rightNavController, nil];
- [leftNavController release];
- [rightNavController release];
[self presentViewController:splitViewRootController animated:YES completion:nil];
- [splitViewRootController release];
}
else
{
@@ -165,44 +159,32 @@
UIViewController *generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
generalSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"General",@"") imageName:@"flower" selectedImageName:@"flower_filled"];
UINavigationController *generalNavController = [[UINavigationController alloc] initWithRootViewController:generalSettingsViewController];
- [generalSettingsViewController release];
[tabBarNavigationControllers addObject:generalNavController];
- [generalNavController release];
UIViewController *teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
teamSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Teams",@"") imageName:@"teams" selectedImageName:@"teams_filled"];
UINavigationController *teamNavController = [[UINavigationController alloc] initWithRootViewController:teamSettingsViewController];
- [teamSettingsViewController release];
[tabBarNavigationControllers addObject:teamNavController];
- [teamNavController release];
UIViewController *weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
weaponSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Weapons",@"") imageName:@"bullet" selectedImageName:@"bullet_filled"];
UINavigationController *weaponNavController = [[UINavigationController alloc] initWithRootViewController:weaponSettingsViewController];
- [weaponSettingsViewController release];
[tabBarNavigationControllers addObject:weaponNavController];
- [weaponNavController release];
UIViewController *schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
schemeSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Schemes",@"") imageName:@"target" selectedImageName:@"target_filled"];
UINavigationController *schemeNavController = [[UINavigationController alloc] initWithRootViewController:schemeSettingsViewController];
- [schemeSettingsViewController release];
[tabBarNavigationControllers addObject:schemeNavController];
- [schemeNavController release];
UIViewController *supportViewController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped];
supportViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Support",@"") imageName:@"heart" selectedImageName:@"heart_filled"];
UINavigationController *supportNavController = [[UINavigationController alloc] initWithRootViewController:supportViewController];
- [supportViewController release];
[tabBarNavigationControllers addObject:supportNavController];
- [supportNavController release];
UITabBarController *settingsTabController = [[UITabBarController alloc] init];
settingsTabController.viewControllers = tabBarNavigationControllers;
- [tabBarNavigationControllers release];
[self presentViewController:settingsTabController animated:YES completion:nil];
- [settingsTabController release];
}
break;
case 3:
@@ -210,10 +192,8 @@
{
GameLogViewController *gameLogVC = [[GameLogViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:gameLogVC];
- [gameLogVC release];
[self presentViewController:navController animated:YES completion:nil];
- [navController release];
}
#else
{
@@ -222,7 +202,6 @@
about.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:about animated:YES completion:nil];
- [about release];
}
#endif
break;
@@ -233,7 +212,6 @@
savedgames.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentViewController:savedgames animated:YES completion:nil];
- [savedgames release];
}
break;
case 5:
@@ -244,36 +222,34 @@
missions.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentViewController:missions animated:YES completion:nil];
- [missions release];
}
break;
- case 6:
+ case 6: {
[GameInterfaceBridge registerCallingController:self];
[GameInterfaceBridge startSimpleGame];
break;
+ }
case 7:
{
xib = IS_IPAD() ? @"CampaignsViewController-iPad" : @"CampaignsViewController-iPhone";
CampaignsViewController *campaigns = [[CampaignsViewController alloc] initWithNibName:xib bundle:nil];
UINavigationController *campaignNavigationController = [[UINavigationController alloc] initWithRootViewController:campaigns];
- [campaigns release];
campaignNavigationController.modalTransitionStyle = IS_IPAD() ? UIModalTransitionStyleCoverVertical : UIModalTransitionStyleCrossDissolve;
campaignNavigationController.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentViewController:campaignNavigationController animated:YES completion:nil];
- [campaignNavigationController release];
}
break;
- default:
+ default: {
alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented"
message:@"Sorry, this feature is not yet implemented"
delegate:nil
cancelButtonTitle:@"Well, don't worry"
otherButtonTitles:nil];
[alert show];
- [alert release];
break;
+ }
}
}
@@ -281,27 +257,16 @@
imageName: (NSString *)imageName
selectedImageName: (NSString *)selectedImageName
{
- return [[[UITabBarItem alloc] initWithTitle:title
+ return [[UITabBarItem alloc] initWithTitle:title
image:[UIImage imageNamed:imageName]
- selectedImage:[UIImage imageNamed:selectedImageName]] autorelease];
+ selectedImage:[UIImage imageNamed:selectedImageName]];
}
#pragma mark -
--(void) viewDidUnload {
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
--(void) didReceiveMemoryWarning {
+- (void)didReceiveMemoryWarning {
MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
--(void) dealloc {
- [_simpleGameButton release];
- [_missionsButton release];
- [_campaignButton release];
- [super dealloc];
-}
-
@end