project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m
changeset 5224 6e8fbbfb0de5
parent 5220 76a2246f18f0
child 5370 a3f87be7b09a
equal deleted inserted replaced
5223:5730238e7ee6 5224:6e8fbbfb0de5
   152 
   152 
   153     // prepare options for overlay and add it to the future sdl uiwindow
   153     // prepare options for overlay and add it to the future sdl uiwindow
   154     [self performSelector:@selector(displayOverlayLater:) withObject:nil afterDelay:3];
   154     [self performSelector:@selector(displayOverlayLater:) withObject:nil afterDelay:3];
   155 
   155 
   156     // keep track of uncompleted games
   156     // keep track of uncompleted games
   157     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
   157     NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
   158     [defaults setObject:self.savePath forKey:@"savedGamePath"];
   158     [userDefaults setObject:self.savePath forKey:@"savedGamePath"];
   159     [defaults synchronize];
   159     [userDefaults synchronize];
       
   160 
       
   161     [HedgewarsAppDelegate pauseBackgroundMusic];
   160 
   162 
   161     // SYSTEMS ARE GO!!
   163     // SYSTEMS ARE GO!!
   162     [self startGameEngine];
   164     [self startGameEngine];
   163 
   165     
   164     // remove completed games notification
   166     // remove completed games notification
   165     [defaults setObject:@"" forKey:@"savedGamePath"];
   167     [userDefaults setObject:@"" forKey:@"savedGamePath"];
   166     [defaults synchronize];
   168     [userDefaults synchronize];
   167 
   169 
   168     // now we can remove the cover with a transition
   170     // now we can remove the cover with a transition
   169     [UIView beginAnimations:@"fade in" context:NULL];
   171     [UIView beginAnimations:@"fade in" context:NULL];
   170     [UIView setAnimationDuration:1];
   172     [UIView setAnimationDuration:1];
   171     blackView.alpha = 0;
   173     blackView.alpha = 0;
   178 
   180 
   179     // warn our host that it's going to be visible again
   181     // warn our host that it's going to be visible again
   180     [self.parentController viewWillAppear:YES];
   182     [self.parentController viewWillAppear:YES];
   181 
   183 
   182     // release the network manager and the savepath as they are not needed anymore
   184     // release the network manager and the savepath as they are not needed anymore
   183     [self.engineProtocol release];
   185     releaseAndNil(self.engineProtocol);
   184     [self.savePath release];
   186     if (self.gameType != gtSave)
       
   187         releaseAndNil(self.savePath);
       
   188 
       
   189     if ([[userDefaults objectForKey:@"music"] boolValue])
       
   190         [HedgewarsAppDelegate playBackgroundMusic];
   185 }
   191 }
   186 
   192 
   187 // set up variables for a local game
   193 // set up variables for a local game
   188 -(void) startLocalGame:(NSDictionary *)withDictionary {
   194 -(void) startLocalGame:(NSDictionary *)withDictionary {
   189     self.gameType = gtLocal;
   195     self.gameType = gtLocal;