-
Notifications
You must be signed in to change notification settings - Fork 33
/
index.html
executable file
·139 lines (133 loc) · 5.29 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<html>
<head>
<script type="text/javascript" src="cordova.js"></script>
</head>
<body>
<script>
//
var leaderboardId = "CgkI2O2VnNMUEAIQBg";
var achievementId1 = "CgkI2O2VnNMUEAIQAQ";
var achievementId2 = "CgkI2O2VnNMUEAIQBw";
var achievementId3 = "CgkI2O2VnNMUEAIQBA";
var achievementId4 = "CgkI2O2VnNMUEAIQAg";
var achievementId5 = "CgkI2O2VnNMUEAIQBQ";
/*
var leaderboardId;
var achievementId1;
var achievementId2;
var achievementId3;
var achievementId4;
var achievementId5;
//android
if (navigator.userAgent.match(/Android/i)) {
leaderboardId = "CgkI2O2VnNMUEAIQBg";
achievementId1 = "CgkI2O2VnNMUEAIQAQ";
achievementId2 = "CgkI2O2VnNMUEAIQBw";
achievementId3 = "CgkI2O2VnNMUEAIQBA";
achievementId4 = "CgkI2O2VnNMUEAIQAg";
achievementId5 = "CgkI2O2VnNMUEAIQBQ";
}
//ios
else if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) {
leaderboardId = "testapp_leaderboard";
achievementId1 = "testapp_achievement1";
achievementId2 = "testapp_achievement2";
achievementId3 = "testapp_achievement3";
achievementId4 = "testapp_achievement4";
achievementId5 = "testapp_achievement5";
}
*/
var tag = "tag1";
//var tag = "tag2";
//
document.addEventListener("deviceready", function(){
window.game.setUp();
//callback
window.game.onLoginSucceeded = function(result) {
var playerDetail = result;
alert('onLoginSucceeded: ' + playerDetail['playerId'] + ' ' + playerDetail['playerDisplayName']);
alert(window.game.tag);
};
window.game.onLoginFailed = function() {
alert('onLoginFailed');
alert(window.game.tag);
};
//
window.game.onSubmitScoreSucceeded = function() {
alert('onSubmitScoreSucceeded');
};
window.game.onSubmitScoreFailed = function() {
alert('onSubmitScoreFailed');
alert(window.game.tag);
};
window.game.onGetPlayerScoreSucceeded = function(result) {
var playerScore = result;
alert('onGetPlayerScoreSucceeded: ' + playerScore);
alert(window.game.tag);
};
window.game.onGetPlayerScoreFailed = function() {
alert('onGetPlayerScoreFailed');
alert(window.game.tag);
};
//
window.game.onUnlockAchievementSucceeded = function() {
alert('onUnlockAchievementSucceeded');
alert(window.game.tag);
};
window.game.onUnlockAchievementFailed = function() {
alert('onUnlockAchievementFailed');
alert(window.game.tag);
};
window.game.onIncrementAchievementSucceeded = function() {
alert('onIncrementAchievementSucceeded');
alert(window.game.tag);
};
window.game.onIncrementAchievementFailed = function() {
alert('onIncrementAchievementFailed');
alert(window.game.tag);
};
window.game.onResetAchievementsSucceeded = function() {
alert('onResetAchievementsSucceeded');
alert(window.game.tag);
};
window.game.onResetAchievementsFailed = function() {
alert('onResetAchievementsFailed');
alert(window.game.tag);
};
//
window.game.onGetPlayerImageSucceeded = function(result) {
var playerImageUrl = result;
alert('onGetPlayerImageSucceeded: ' + playerImageUrl);
alert(window.game.tag);
};
window.game.onGetPlayerImageFailed = function() {
alert('onGetPlayerImageFailed');
alert(window.game.tag);
};
}, false);
</script>
<p><button onclick="window.game.login(tag);">login</button></p>
<p><button onclick="window.game.logout();">logout</button></p>
<p><button onclick="alert(window.game.isLoggedIn());">isLoggedIn</button></p>
<br>
<p><button onclick="window.game.submitScore(leaderboardId, 5, tag);//leaderboardId, score">submitScore</button></p>
<p><button onclick="window.game.showLeaderboard(leaderboardId);">showLeaderboard</button></p>
<p><button onclick="window.game.showLeaderboards();">showLeaderboards</button></p>
<p><button onclick="window.game.getPlayerScore(leaderboardId, tag);">getPlayerScore</button></p>
<br>
<p><button onclick="window.game.unlockAchievement(achievementId1, tag);">unlockAchievement1</button></p>
<p><button onclick="window.game.unlockAchievement(achievementId2, tag);">unlockAchievement2</button></p>
<p><button onclick="window.game.unlockAchievement(achievementId3, tag);">unlockAchievement3</button></p>
<p><button onclick="window.game.unlockAchievement(achievementId4, tag);">unlockAchievement4</button></p>
<p><button onclick="window.game.unlockAchievement(achievementId5, tag);">unlockAchievement5</button></p>
<p><button onclick="window.game.incrementAchievement(achievementId1, 2, tag); //achievementId, incrementalStepOrCurrentPercent: Incremental step (android) or current percent (ios) for incremental achievement.">incrementAchievement1</button></p>
<p><button onclick="window.game.incrementAchievement(achievementId2, 2, tag);">incrementAchievement2</button></p>
<p><button onclick="window.game.incrementAchievement(achievementId3, 2, tag);">incrementAchievement3</button></p>
<p><button onclick="window.game.incrementAchievement(achievementId4, 2, tag);">incrementAchievement4</button></p>
<p><button onclick="window.game.incrementAchievement(achievementId5, 2, tag);">incrementAchievement5</button></p>
<p><button onclick="window.game.showAchievements();">showAchievements</button></p>
<p><button onclick="window.game.resetAchievements();">resetAchievements</button></p>
<br>
<p><button onclick="window.game.getPlayerImage();">getPlayerImage</button></p>
</body>
</html>