equal
deleted
inserted
replaced
20 |
20 |
21 |
21 |
22 #import "GeneralSettingsViewController.h" |
22 #import "GeneralSettingsViewController.h" |
23 #import "CommodityFunctions.h" |
23 #import "CommodityFunctions.h" |
24 |
24 |
|
25 |
25 @implementation GeneralSettingsViewController |
26 @implementation GeneralSettingsViewController |
26 |
27 |
27 |
28 |
28 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
29 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
29 return rotationManager(interfaceOrientation); |
30 return rotationManager(interfaceOrientation); |
42 |
43 |
43 -(void) viewWillDisappear:(BOOL)animated { |
44 -(void) viewWillDisappear:(BOOL)animated { |
44 NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; |
45 NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; |
45 [userDefaults synchronize]; |
46 [userDefaults synchronize]; |
46 if ([[userDefaults objectForKey:@"music"] boolValue] == NO) |
47 if ([[userDefaults objectForKey:@"music"] boolValue] == NO) |
47 [HedgewarsAppDelegate stopBackgroundMusic]; |
48 [AudioManagerController stopBackgroundMusic]; |
48 |
49 |
49 [super viewWillDisappear:animated]; |
50 [super viewWillDisappear:animated]; |
50 } |
51 } |
51 |
52 |
52 #pragma mark - |
53 #pragma mark - |
62 [settings setObject:[NSNumber numberWithBool:NO] forKey:@"music"]; |
63 [settings setObject:[NSNumber numberWithBool:NO] forKey:@"music"]; |
63 theOtherSwitch = (UISwitch *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:1]].accessoryView; |
64 theOtherSwitch = (UISwitch *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:1]].accessoryView; |
64 [theOtherSwitch setOn:NO animated:YES]; |
65 [theOtherSwitch setOn:NO animated:YES]; |
65 |
66 |
66 if (theOtherSwitch.on) |
67 if (theOtherSwitch.on) |
67 [HedgewarsAppDelegate pauseBackgroundMusic]; |
68 [AudioManagerController pauseBackgroundMusic]; |
68 break; |
69 break; |
69 case 20: //musicSwitch |
70 case 20: //musicSwitch |
70 // if switch above (sound) is off, never turn on |
71 // if switch above (sound) is off, never turn on |
71 if (NO == [[settings objectForKey:@"sound"] boolValue]) { |
72 if (NO == [[settings objectForKey:@"sound"] boolValue]) { |
72 [settings setObject:[NSNumber numberWithBool:NO] forKey:@"music"]; |
73 [settings setObject:[NSNumber numberWithBool:NO] forKey:@"music"]; |
74 [theOtherSwitch setOn:NO animated:YES]; |
75 [theOtherSwitch setOn:NO animated:YES]; |
75 } else |
76 } else |
76 [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"music"]; |
77 [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"music"]; |
77 |
78 |
78 if (theSwitch.on) |
79 if (theSwitch.on) |
79 [HedgewarsAppDelegate playBackgroundMusic]; |
80 [AudioManagerController playBackgroundMusic]; |
80 else |
81 else |
81 [HedgewarsAppDelegate pauseBackgroundMusic]; |
82 [AudioManagerController pauseBackgroundMusic]; |
82 |
83 |
83 break; |
84 break; |
84 case 30: //alternateSwitch |
85 case 30: //alternateSwitch |
85 [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"alternate"]; |
86 [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"alternate"]; |
86 break; |
87 break; |