Guest User

Untitled

a guest
Jul 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. #import "AppDelegate.h"
  2. #import "Game.h"
  3. #import "Main.h"
  4. #import "Beacon.h"
  5.  
  6. #import "SKSProduct.h"
  7. #import "SKServe.h"
  8.  
  9.  
  10.  
  11. @implementation AppDelegate
  12.  
  13.  
  14. - (void)applicationDidFinishLaunching:(UIApplication *)application {
  15.  
  16. window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  17.  
  18. //[window setUserInteractionEnabled:YES];
  19. //[window setMultipleTouchEnabled:YES];
  20.  
  21. [[Director sharedDirector] setPixelFormat:kRGBA8];
  22. [[Director sharedDirector] attachInWindow:window];
  23. // [[Director sharedDirector] setDisplayFPS:YES];
  24. [[Director sharedDirector] setAnimationInterval:1.0/kFPS];
  25.  
  26. [Texture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];
  27.  
  28. [window makeKeyAndVisible];
  29.  
  30. Scene *scene = [[Scene node] addChild:[Game node] z:0];
  31. [[Director sharedDirector] runWithScene: scene];
  32.  
  33.  
  34. NSString *applicationCode = @"4b122d6021c24d8029ff13bf4a63fd5b";
  35. [Beacon initAndStartBeaconWithApplicationCode:applicationCode
  36. useCoreLocation:NO useOnlyWiFi:NO];
  37.  
  38.  
  39. if (![[NSUserDefaults standardUserDefaults] boolForKey:@"hideAds"]) {
  40. // Open Ad Integration Start
  41. am = [[OAIAdManager alloc] initWithDelegate:self];
  42. am.view.frame = CGRectMake(0, 0, 320, 48);
  43. //am.view.backgroundColor = [UIColor redColor];
  44. [window addSubview:am.view];
  45. [am release];
  46. }
  47.  
  48. [SKServe initializeWithDelegate:self];
  49.  
  50.  
  51.  
  52. }
  53.  
  54. - (void)dealloc {
  55.  
  56. [window release];
  57. [super dealloc];
  58. }
  59.  
  60. - (void)applicationWillResignActive:(UIApplication*)application {
  61. [[Director sharedDirector] pause];
  62. }
  63.  
  64. - (void)applicationDidBecomeActive:(UIApplication*)application {
  65. [[Director sharedDirector] resume];
  66.  
  67. }
  68.  
  69. - (void)applicationDidReceiveMemoryWarning:(UIApplication*)application {
  70. [[TextureMgr sharedTextureMgr] removeAllTextures];
  71. }
  72.  
  73. - (void)applicationSignificantTimeChange:(UIApplication*)application {
  74. [[Director sharedDirector] setNextDeltaTimeZero:YES];
  75. }
  76.  
  77.  
  78.  
  79. // OpenAdIntegration Delegate REQUIRED
  80. - (NSString*)publisherId {
  81. return @"9RqeV5E6gkiBf8myiSKFLQ";
  82. }
  83.  
  84. - (NSString*)getZone {
  85. return @"0153949879008214632";
  86. }
  87.  
  88. - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
  89. if ([SKServe handleUrl:url]) {
  90. return YES;
  91. }
  92. else {
  93. NSLog(@"Failed to recognize inapp URL");
  94. // Do custom openURL code here
  95. return YES;
  96. }
  97. }
  98.  
  99.  
  100. - (void)applicationWillTerminate:(UIApplication *)application {
  101. [[Beacon shared] endBeacon];
  102.  
  103. }
  104.  
  105. - (void)productPurchased:(SKSProduct *)product {
  106. NSLog(@"Product purchased: %@", product.productId);
  107. [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"hideAds"];
  108.  
  109. }
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116. @end
Add Comment
Please, Sign In to add comment