Skip to content

Commit

Permalink
add google analytics and crittercism;
Browse files Browse the repository at this point in the history
  • Loading branch information
smj10j committed May 2, 2012
1 parent e46d52e commit 2e17525
Show file tree
Hide file tree
Showing 127 changed files with 9,163 additions and 14 deletions.
422 changes: 419 additions & 3 deletions Conquer.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Projectfiles-iOS/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<string>[email protected]</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<string>com.conquercorp.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
37 changes: 37 additions & 0 deletions Projectfiles/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Released under MIT License in Germany (LICENSE-Kobold2D.txt).
*/

#import "Constants.h"
#import "Crittercism.h"
#import "AppDelegate.h"

@implementation AppDelegate
Expand All @@ -16,6 +18,41 @@ -(void) initializationComplete
#else
CCLOG(@"ARC is either not available or not enabled");
#endif




[self initializeGoogleAnalytics];

[self initializeCrittercism];

}

-(void)initializeCrittercism {
NSLog(@"Initializing Crittercism");
//initialize Crittercism for crash reporting (https://www.crittercism.com/developers/docs)
if(!DEBUG_MODE) {
[Crittercism initWithAppID: @"4fa06fabb09315487d0000c9"
andKey:@"tcsqy9w16rpdl3achkorylf5hpxx"
andSecret:@"snouryb9xqm4lkn2mh0b8ua6lwoegqex"];

}
}

-(void)initializeGoogleAnalytics {
NSLog(@"Initializing Google Analytics");

const NSInteger kGANDispatchPeriodSec = 10;
[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-31019270-2"
dispatchPeriod:kGANDispatchPeriodSec
delegate:nil];



if(DEBUG_MODE) {
GASetVar(@"DebugMode", @"YES");
}

}

-(id) alternateRootViewController
Expand Down
2 changes: 1 addition & 1 deletion Projectfiles/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define DEBUG_MODE YES



#import "GAWrapper.h"



Expand Down
13 changes: 9 additions & 4 deletions Projectfiles/EasyComputerPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ -(void)place {

stateDescription = [NSString stringWithFormat:@"%d armies to place", armiesToPlace];

//TODO: this should NOT be done with sleeps as it screws up the game loop timing
usleep(500 * 1000);

}else {
[self endState];
}
Expand All @@ -68,10 +70,12 @@ -(void)attack {
}
}

short destinationSelectAttemptCount = 0;
while((destinationTerritory == nil || destinationTerritory.owner == self) && destinationSelectAttemptCount++ < 7) {
destinationTerritory = [originTerritory.neighboringTerritories objectAtIndex:(int)(arc4random()%[originTerritory.neighboringTerritories count])];
}
if(originTerritory != nil) {
short destinationSelectAttemptCount = 0;
while((destinationTerritory == nil || destinationTerritory.owner == self) && destinationSelectAttemptCount++ < 7) {
destinationTerritory = [originTerritory.neighboringTerritories objectAtIndex:(int)(arc4random()%[originTerritory.neighboringTerritories count])];
}
}

if(destinationTerritory.owner == self || originTerritory == nil || destinationTerritory == nil) {
return;
Expand All @@ -86,6 +90,7 @@ -(void)attack {
originTerritory = nil;
destinationTerritory = nil;

//TODO: this should NOT be done with sleeps as it screws up the game loop timing
usleep(500 * 1000);

}else {
Expand Down
3 changes: 3 additions & 0 deletions Projectfiles/GameLostScene.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright (c) 2012 Conquer, LLC. All rights reserved.
//

#import "Constants.h"
#import "GameLostScene.h"
#import "GameModeSelectionScene.h"

Expand Down Expand Up @@ -42,6 +43,8 @@ -(id) init {
gameLostLabel.position = ccp(winSize.width/2, winSize.height/2);
[self addChild: gameLostLabel];

GALogPageView(@"/GameLostScene")

NSLog(@"GameLostScene created");
}

Expand Down
5 changes: 3 additions & 2 deletions Projectfiles/GameModeSelectionScene.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// Copyright 2012 Conquer, LLC. All rights reserved.
//

#import "Constants.h"
#import "GameModeSelectionScene.h"

#import "SinglePlayerScene.h"


Expand Down Expand Up @@ -38,8 +38,9 @@ -(id) init {
// add the menu to your scene
[self addChild:myMenu];

GALogPageView(@"/GameModeSelectionScene")

NSLog(@"GameModeSelectionScene created");

}


Expand Down
3 changes: 3 additions & 0 deletions Projectfiles/GameWonScene.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright (c) 2012 Conquer, LLC. All rights reserved.
//

#import "Constants.h"
#import "GameWonScene.h"
#import "GameModeSelectionScene.h"

Expand Down Expand Up @@ -42,6 +43,8 @@ -(id) init {
gameWonLabel.position = ccp(winSize.width/2, winSize.height/2);
[self addChild: gameWonLabel];

GALogPageView(@"/GameWonScene")

NSLog(@"GameWonScene created");
}

Expand Down
8 changes: 6 additions & 2 deletions Projectfiles/Map.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ -(NSArray*)territoriesForPlayer:(Player*)player {
-(void)initializeMapData {

NSLog(@"Loading map properties");
double now = [[NSDate date] timeIntervalSince1970];

NSData *jsonData = [NSData dataWithContentsOfFile:[NSString stringWithFormat:@"Maps/%@/Properties.json", name]];
NSError *error = nil;
Expand All @@ -96,8 +97,9 @@ -(void)initializeMapData {
initialArmiesPerTerritory = [(NSString*)([properties objectForKey:@"InitialArmiesPerTerritory"]) intValue];
armiesPerTurn = [(NSString*)([properties objectForKey:@"ArmiesPerTurn"]) intValue];
territoriesForAdditionalArmyPerTurn = [(NSString*)([properties objectForKey:@"TerritoriesForAdditionalArmyPerTurn"]) intValue];
NSLog(@"Armies per turn: %d", armiesPerTurn);
NSLog(@"Territories required for each additional army per turn: %d", territoriesForAdditionalArmyPerTurn);
NSLog(@"InitialArmiesPerTerritory: %d", initialArmiesPerTerritory);
NSLog(@"ArmiesPerTurn: %d", armiesPerTurn);
NSLog(@"TerritoriesForAdditionalArmyPerTurn: %d", territoriesForAdditionalArmyPerTurn);

NSDictionary* territoryInfoMap = [properties objectForKey:@"Territories"];
NSDictionary* continentInfoMap = [properties objectForKey:@"Continents"];
Expand Down Expand Up @@ -244,6 +246,8 @@ -(void)initializeMapData {
NSLog(@"Hitmap created");


double elapsed = [[NSDate date] timeIntervalSince1970] - now;
GALogEvent(@"Map", @"Load Time", name, elapsed);
}

-(UInt32)colorAtLocation:(CGPoint)location {
Expand Down
3 changes: 2 additions & 1 deletion Projectfiles/SinglePlayerScene.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ -(id) init {
[self schedule:@selector(gameLoop:)];
});


GALogPageView(@"/SinglePlayerScene")

NSLog(@"SinglePlayerScene created");
}

Expand Down
Binary file modified Projectfiles/lib/.DS_Store
Binary file not shown.
Loading

0 comments on commit 2e17525

Please sign in to comment.