project_files/HedgewarsMobile/Classes/OverlayViewController.m
changeset 3924 2a9ace189288
parent 3922 44804043b691
child 3926 668b71f31e51
equal deleted inserted replaced
3923:694e6f6e0e30 3924:2a9ace189288
    21 
    21 
    22 #import "OverlayViewController.h"
    22 #import "OverlayViewController.h"
    23 #import "SDL_uikitappdelegate.h"
    23 #import "SDL_uikitappdelegate.h"
    24 #import "InGameMenuViewController.h"
    24 #import "InGameMenuViewController.h"
    25 #import "HelpPageViewController.h"
    25 #import "HelpPageViewController.h"
       
    26 #import "AmmoMenuViewController.h"
    26 #import "PascalImports.h"
    27 #import "PascalImports.h"
    27 #import "CommodityFunctions.h"
    28 #import "CommodityFunctions.h"
    28 #import "CGPointUtils.h"
    29 #import "CGPointUtils.h"
    29 #import "SDL_config_iphoneos.h"
    30 #import "SDL_config_iphoneos.h"
    30 #import "SDL_mouse.h"
    31 #import "SDL_mouse.h"
   159     
   160     
   160     [UIView beginAnimations:@"showing overlay" context:NULL];
   161     [UIView beginAnimations:@"showing overlay" context:NULL];
   161     [UIView setAnimationDuration:1];
   162     [UIView setAnimationDuration:1];
   162     self.view.alpha = 1;
   163     self.view.alpha = 1;
   163     [UIView commitAnimations];
   164     [UIView commitAnimations];
       
   165     
       
   166     AmmoMenuViewController *amvc = [[AmmoMenuViewController alloc] init];
       
   167     amvc.view.center = self.view.center;
       
   168     [self.view addSubview:amvc.view];
   164 }
   169 }
   165 
   170 
   166 -(void) showHelp:(id) sender {
   171 -(void) showHelp:(id) sender {
   167     if (self.helpPage == nil)
   172     if (self.helpPage == nil)
   168         self.helpPage = [[HelpPageViewController alloc] initWithNibName:@"HelpPageInGameViewController" bundle:nil];
   173         self.helpPage = [[HelpPageViewController alloc] initWithNibName:@"HelpPageInGameViewController" bundle:nil];
   199     [super dealloc];
   204     [super dealloc];
   200 }
   205 }
   201 
   206 
   202 -(void) cleanup {
   207 -(void) cleanup {
   203     [self dismissPopover];
   208     [self dismissPopover];
       
   209     HW_terminate(NO);
   204     [self.view removeFromSuperview];
   210     [self.view removeFromSuperview];
   205 }
   211 }
   206 
   212 
   207 #pragma mark -
   213 #pragma mark -
   208 #pragma mark Overlay actions and members
   214 #pragma mark Overlay actions and members
   315 }
   321 }
   316 
   322 
   317 // present a further check before closing game
   323 // present a further check before closing game
   318 -(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex {
   324 -(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex {
   319     if ([actionSheet cancelButtonIndex] != buttonIndex)
   325     if ([actionSheet cancelButtonIndex] != buttonIndex)
   320         HW_terminate(NO);
   326         [self cleanup];
   321     else
   327     else
   322         HW_pause();
   328         HW_pause();
   323 }
   329 }
   324 
   330 
   325 // show up a popover containing a popupMenuViewController; we hook it with setPopoverContentSize
   331 // show up a popover containing a popupMenuViewController; we hook it with setPopoverContentSize