project_files/HedgewarsMobile/Classes/SavedGamesViewController.m
changeset 4763 c228a4841e3f
parent 4476 4bf74e158f44
child 4856 dbc256913b35
equal deleted inserted replaced
4760:224c31b3ce7d 4763:c228a4841e3f
    19  */
    19  */
    20 
    20 
    21 
    21 
    22 #import "SavedGamesViewController.h"
    22 #import "SavedGamesViewController.h"
    23 #import "SDL_uikitappdelegate.h"
    23 #import "SDL_uikitappdelegate.h"
       
    24 #import "StatsPageViewController.h"
    24 #import "CommodityFunctions.h"
    25 #import "CommodityFunctions.h"
    25 
    26 
    26 @implementation SavedGamesViewController
    27 @implementation SavedGamesViewController
    27 @synthesize tableView, listOfSavegames;
    28 @synthesize tableView, listOfSavegames;
    28 
    29 
   215     NSDictionary *allDataNecessary = [NSDictionary dictionaryWithObjectsAndKeys:
   216     NSDictionary *allDataNecessary = [NSDictionary dictionaryWithObjectsAndKeys:
   216                                       filePath,@"savefile",
   217                                       filePath,@"savefile",
   217                                       [NSNumber numberWithBool:NO],@"netgame",
   218                                       [NSNumber numberWithBool:NO],@"netgame",
   218                                       [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:self.interfaceOrientation] forKey:@"orientation"],@"game_dictionary",
   219                                       [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:self.interfaceOrientation] forKey:@"orientation"],@"game_dictionary",
   219                                       nil];
   220                                       nil];
   220     [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary];
   221 
   221     [self.parentViewController dismissModalViewControllerAnimated:NO];
   222     StatsPageViewController *statsPage = [[StatsPageViewController alloc] initWithStyle:UITableViewStyleGrouped];
       
   223     statsPage.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
       
   224     if ([statsPage respondsToSelector:@selector(setModalPresentationStyle:)])
       
   225         statsPage.modalPresentationStyle = UIModalPresentationPageSheet;
       
   226     [self presentModalViewController:statsPage animated:NO];
       
   227 
       
   228     NSArray *stats = [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary];
       
   229     if ([stats count] == 0) {
       
   230         [statsPage dismissModalViewControllerAnimated:NO];
       
   231     } else {
       
   232         statsPage.statsArray = stats;
       
   233         [statsPage.tableView reloadData];
       
   234         [statsPage viewWillAppear:YES];
       
   235     }
       
   236     // reload needed because when ending game the entry remains there
       
   237     [self.tableView reloadData];
   222 }
   238 }
   223 
   239 
   224 #pragma mark -
   240 #pragma mark -
   225 #pragma mark editableCellView delegate
   241 #pragma mark editableCellView delegate
   226 // rename old file if names differ
   242 // rename old file if names differ