Skip to content

Commit

Permalink
Fix: Wrong achievements are reported.
Browse files Browse the repository at this point in the history
  • Loading branch information
softdevstory committed May 4, 2016
1 parent 310cf40 commit ec52961
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
14 changes: 7 additions & 7 deletions AchivementHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ enum Achievement: String {
case CreditWatch

private func getPercentage(gameStatistic: GameStatistics, maxValue: Double) -> Double {
let percent: Double = Double(gameStatistic.getValue()) / maxValue
if percent > 1.0 {
return 1.0
let percent: Double = (Double(gameStatistic.getValue()) / maxValue) * 100.0
if percent > 100.0 {
return 100.0
}

return percent
Expand Down Expand Up @@ -206,9 +206,9 @@ class AchievementHelper {
case .Gold:
achievement = Achievement.YellowPlaneGoldMedal.gkAchievement
case .Silver:
achievement = Achievement.YellowPlaneGoldMedal.gkAchievement
achievement = Achievement.YellowPlaneSilverMedal.gkAchievement
case .Bronze:
achievement = Achievement.YellowPlaneGoldMedal.gkAchievement
achievement = Achievement.YellowPlaneBronzeMedal.gkAchievement
default: break
}
}
Expand Down Expand Up @@ -335,10 +335,10 @@ class AchievementHelper {
achievements.appendContentsOf(bluePlaneFlightAchievements())

case .Yellow:
achievements.appendContentsOf(redPlaneFlightAchievements())
achievements.appendContentsOf(yellowPlaneFlightAchievements())

case .Green:
achievements.appendContentsOf(redPlaneFlightAchievements())
achievements.appendContentsOf(greenPlaneFlightAchievements())
}

return achievements
Expand Down
1 change: 0 additions & 1 deletion GameStatistics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ enum GameStatistics: String {

private func setValue(value: Int) {
NSUserDefaults.standardUserDefaults().setInteger(value, forKey: self.rawValue)
print("\(self.rawValue) value: \(value)")
}

func increaseCountByOne() {
Expand Down
8 changes: 4 additions & 4 deletions OhMyPlane.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
A42DE6611CCDD8F80088AD76 /* GameKitHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = A42DE6601CCDD8F80088AD76 /* GameKitHelper.swift */; };
A42DE6621CCDD8F80088AD76 /* GameKitHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = A42DE6601CCDD8F80088AD76 /* GameKitHelper.swift */; };
A42DE6651CCE11970088AD76 /* AchivementHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = A42DE6641CCE11970088AD76 /* AchivementHelper.swift */; };
A42DE6671CCF51320088AD76 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A42DE6661CCF51320088AD76 /* GameKit.framework */; };
A435C0621CBF61DF002EFCCF /* TVControlsScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = A435C0611CBF61DF002EFCCF /* TVControlsScene.swift */; };
A435C0631CBF61DF002EFCCF /* TVControlsScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = A435C0611CBF61DF002EFCCF /* TVControlsScene.swift */; };
A435C0661CBF6248002EFCCF /* GameScene+TVControlsScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = A435C0651CBF6248002EFCCF /* GameScene+TVControlsScene.swift */; };
Expand All @@ -26,6 +25,7 @@
A43735E41CA43F15005F5BC1 /* obstacle.atlas in Resources */ = {isa = PBXBuildFile; fileRef = A43735E31CA43F15005F5BC1 /* obstacle.atlas */; };
A43735E61CA51BA3005F5BC1 /* PauseGame.swift in Sources */ = {isa = PBXBuildFile; fileRef = A43735E51CA51BA3005F5BC1 /* PauseGame.swift */; };
A43735EA1CA51BC8005F5BC1 /* FailGame.swift in Sources */ = {isa = PBXBuildFile; fileRef = A43735E91CA51BC8005F5BC1 /* FailGame.swift */; };
A44AC67B1CD9B8FC00756161 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A44AC67A1CD9B8FC00756161 /* GameKit.framework */; };
A46711BD1CC8BC3D005A0E6A /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A46711BC1CC8BC3D005A0E6A /* GameKit.framework */; };
A48DA0161CBE222B000DCCED /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A48DA0151CBE222B000DCCED /* AppDelegate.swift */; };
A48DA01C1CBE222B000DCCED /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A48DA01B1CBE222B000DCCED /* GameViewController.swift */; };
Expand Down Expand Up @@ -105,7 +105,6 @@
/* Begin PBXFileReference section */
A42DE6601CCDD8F80088AD76 /* GameKitHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameKitHelper.swift; sourceTree = "<group>"; };
A42DE6641CCE11970088AD76 /* AchivementHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AchivementHelper.swift; sourceTree = "<group>"; };
A42DE6661CCF51320088AD76 /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; };
A435C0611CBF61DF002EFCCF /* TVControlsScene.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TVControlsScene.swift; sourceTree = "<group>"; };
A435C0651CBF6248002EFCCF /* GameScene+TVControlsScene.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "GameScene+TVControlsScene.swift"; sourceTree = "<group>"; };
A435C0671CBF62AE002EFCCF /* MainScene+TVControlsScene.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MainScene+TVControlsScene.swift"; sourceTree = "<group>"; };
Expand All @@ -119,6 +118,7 @@
A43735E31CA43F15005F5BC1 /* obstacle.atlas */ = {isa = PBXFileReference; lastKnownFileType = folder.skatlas; name = obstacle.atlas; path = ../Shared/obstacle.atlas; sourceTree = "<group>"; };
A43735E51CA51BA3005F5BC1 /* PauseGame.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; name = PauseGame.swift; path = ../Shared/PauseGame.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
A43735E91CA51BC8005F5BC1 /* FailGame.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; name = FailGame.swift; path = ../Shared/FailGame.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
A44AC67A1CD9B8FC00756161 /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; };
A46711BC1CC8BC3D005A0E6A /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.2.sdk/System/Library/Frameworks/GameKit.framework; sourceTree = DEVELOPER_DIR; };
A48DA0131CBE222B000DCCED /* OhMyPlaneTv.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OhMyPlaneTv.app; sourceTree = BUILT_PRODUCTS_DIR; };
A48DA0151CBE222B000DCCED /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -179,7 +179,7 @@
buildActionMask = 2147483647;
files = (
A49008001CD4C9310046DAC8 /* SKTUtilsExtended.framework in Frameworks */,
A42DE6671CCF51320088AD76 /* GameKit.framework in Frameworks */,
A44AC67B1CD9B8FC00756161 /* GameKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -259,7 +259,6 @@
children = (
A49007FF1CD4C9310046DAC8 /* SKTUtilsExtended.framework */,
A49007FD1CD4C9230046DAC8 /* SKTUtilsExtended.framework */,
A42DE6661CCF51320088AD76 /* GameKit.framework */,
A46711BC1CC8BC3D005A0E6A /* GameKit.framework */,
);
name = framework;
Expand All @@ -268,6 +267,7 @@
A496E8D01CA228C800A448F5 = {
isa = PBXGroup;
children = (
A44AC67A1CD9B8FC00756161 /* GameKit.framework */,
A48DA0281CBE2261000DCCED /* Share */,
A496E8DB1CA228C800A448F5 /* OhMyPlane */,
A48DA0141CBE222B000DCCED /* OhMyPlaneTv */,
Expand Down
4 changes: 2 additions & 2 deletions OhMyPlane/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>4</string>
<string>2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
4 changes: 2 additions & 2 deletions OhMyPlaneTv/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>4</string>
<string>2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down

0 comments on commit ec52961

Please sign in to comment.