Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "AppDelegate.h"
- #import "Game.h"
- #import "Main.h"
- #import "Beacon.h"
- #import "SKSProduct.h"
- #import "SKServe.h"
- @implementation AppDelegate
- - (void)applicationDidFinishLaunching:(UIApplication *)application {
- window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- //[window setUserInteractionEnabled:YES];
- //[window setMultipleTouchEnabled:YES];
- [[Director sharedDirector] setPixelFormat:kRGBA8];
- [[Director sharedDirector] attachInWindow:window];
- // [[Director sharedDirector] setDisplayFPS:YES];
- [[Director sharedDirector] setAnimationInterval:1.0/kFPS];
- [Texture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];
- [window makeKeyAndVisible];
- Scene *scene = [[Scene node] addChild:[Game node] z:0];
- [[Director sharedDirector] runWithScene: scene];
- NSString *applicationCode = @"4b122d6021c24d8029ff13bf4a63fd5b";
- [Beacon initAndStartBeaconWithApplicationCode:applicationCode
- useCoreLocation:NO useOnlyWiFi:NO];
- if (![[NSUserDefaults standardUserDefaults] boolForKey:@"hideAds"]) {
- // Open Ad Integration Start
- am = [[OAIAdManager alloc] initWithDelegate:self];
- am.view.frame = CGRectMake(0, 0, 320, 48);
- //am.view.backgroundColor = [UIColor redColor];
- [window addSubview:am.view];
- [am release];
- }
- [SKServe initializeWithDelegate:self];
- }
- - (void)dealloc {
- [window release];
- [super dealloc];
- }
- - (void)applicationWillResignActive:(UIApplication*)application {
- [[Director sharedDirector] pause];
- }
- - (void)applicationDidBecomeActive:(UIApplication*)application {
- [[Director sharedDirector] resume];
- }
- - (void)applicationDidReceiveMemoryWarning:(UIApplication*)application {
- [[TextureMgr sharedTextureMgr] removeAllTextures];
- }
- - (void)applicationSignificantTimeChange:(UIApplication*)application {
- [[Director sharedDirector] setNextDeltaTimeZero:YES];
- }
- // OpenAdIntegration Delegate REQUIRED
- - (NSString*)publisherId {
- return @"9RqeV5E6gkiBf8myiSKFLQ";
- }
- - (NSString*)getZone {
- return @"0153949879008214632";
- }
- - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
- if ([SKServe handleUrl:url]) {
- return YES;
- }
- else {
- NSLog(@"Failed to recognize inapp URL");
- // Do custom openURL code here
- return YES;
- }
- }
- - (void)applicationWillTerminate:(UIApplication *)application {
- [[Beacon shared] endBeacon];
- }
- - (void)productPurchased:(SKSProduct *)product {
- NSLog(@"Product purchased: %@", product.productId);
- [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"hideAds"];
- }
- @end
Add Comment
Please, Sign In to add comment