

////////////////////////////////////////////////////////////////////////
// Performance snippet
////////////////////////////////////////////////////////////////////////
CFTimeInterval start = CACurrentMediaTime();

// DO STUFF

CFTimeInterval end = CACurrentMediaTime();
NSLog(@"Took:%f",(end - start));

////////////////////////////////////////////////////////////////////////
// File Download/import
////////////////////////////////////////////////////////////////////////
[self displayPopup:[GameViewFactory popupDownloadWithURL:@"http://lazyboydevelopments.com/gamedata/FootballTycoon2/Data/Formula1.zip"
                             destPath:[[FileHelper getDownloadFolder] stringByAppendingPathComponent:@"Data.zip"]
                       completedBlock:^{
    
    [[GameFactory sharedInstance].gameData importDataFile:@"Data.zip"];
}]];

////////////////////////////////////////////////////////////////////////
// smaz string compression test - working
////////////////////////////////////////////////////////////////////////
NSString* start = @"Scott Baillie";

NSData* sbCompressed = [SBSmallStringCompression compress:start];
NSString* sbDecompressed = [SBSmallStringCompression decompress:sbCompressed];

NSLog(@"--------------");
NSLog(@"start:      %@", start);
NSLog(@"encoded:    %@", sbCompressed);
NSLog(@"decoded:    %@", sbDecompressed);
NSLog(@"--------------");


////////////////////////////////////////////////////////////////////////
// Simulate & play match fixture
////////////////////////////////////////////////////////////////////////
SuperLeague* l = [[[GameFactory sharedInstance].gameData getAllLeagues:YES] objectAtIndex:0];
FixtureEntry* fe = [[l getAllFixtures] objectAtIndex:0];
MatchReport* report = [MatchSimulator playFixture:fe doPostProcess:YES];
[fe debug];

[self vcShow:[GameViewFactory matchView:report weeklyReports:@[]]];


////////////////////////////////////////////////////////////////////////
// play match fixtures only
////////////////////////////////////////////////////////////////////////
NSArray* fixtures = [[GameFactory sharedInstance].gameData getFixturesForWeekNo:0 ignorePlayed:NO];
[MatchSimulator playFixtures:fixtures doPostProcess:YES];

////////////////////////////////////////////////////////////////////////
// sb teat products for shop
////////////////////////////////////////////////////////////////////////
-(NSArray<SKProduct*>*) getTestProducts {
    
    return @[
        [[SBTestProduct alloc] init:ProductIdUnlockGame         title:@"Unlock"     description:@"Game"     price:@"2.99"],
        [[SBTestProduct alloc] init:ProductIdUnlockGameBonus    title:@"Unlock"     description:@"Bonus"    price:@"3.99"],
        
        [[SBTestProduct alloc] init:ProductIdCashSmall          title:@"Small"      description:@"Cash"     price:@"0.99"],
        [[SBTestProduct alloc] init:ProductIdCashMedium         title:@"Medium"     description:@"Cash"     price:@"1.99"],
        [[SBTestProduct alloc] init:ProductIdCashLarge          title:@"Large"      description:@"Cash"     price:@"2.99"],
        [[SBTestProduct alloc] init:ProductIdCashExtraLarge     title:@"x-Large"    description:@"Cash"     price:@"4.99"],
        [[SBTestProduct alloc] init:ProductIdCashHuge           title:@"Huge"       description:@"Cash"     price:@"7.99"],
        [[SBTestProduct alloc] init:ProductIdCashMega           title:@"Mega"       description:@"Cash"     price:@"12.99"]
    ];

}

////////////////////////////////////////////////////////////////////////
// Get row tapped from button in row
////////////////////////////////////////////////////////////////////////
CGPoint touchPoint          = [sender convertPoint:CGPointZero toView:_table];
NSIndexPath *indexPath      = [_table indexPathForRowAtPoint:touchPoint];
GambleFixture* gFixture     = [_sortedFixtures objectAtIndex:indexPath.row];


////////////////////////////////////////////////////////////////////////
// Add Season history
////////////////////////////////////////////////////////////////////////
-(void) debug {
    
    
    // add stats
    StatSeasonHistory* sh = [[StatSeasonHistory alloc] initLeagueNo:51
                                                             points:34
                                                                pos:0
                                                              goals:@"Scott Baillie (23)"
                                                            assists:@"Murdo Maclean (13)"
                                                               apps:@"Paul Armor (38)"];
    [[GameFactory sharedInstance].userStats addSeasonHistory:sh];
    
    sh = [[StatSeasonHistory alloc] initLeagueNo:50
                                                             points:12
                                                                pos:19
                                                              goals:@"Scott Baillie (23)"
                                                            assists:@"Murdo Maclean (13)"
                                                               apps:@"Paul Armor (38)"];
    [[GameFactory sharedInstance].userStats addSeasonHistory:sh];
    
    sh = [[StatSeasonHistory alloc] initLeagueNo:49
                                                             points:45
                                                                pos:12
                                                              goals:@"Scott Baillie (23)"
                                                            assists:@"Murdo Maclean (13)"
                                                               apps:@"Paul Armor (38)"];
    [[GameFactory sharedInstance].userStats addSeasonHistory:sh];
    
    NSLog(@"season Count:%d", (int)[[GameFactory sharedInstance].userStats.seasonHistory count]);
}
