本文共 3438 字,大约阅读时间需要 11 分钟。
-
-
-
using UnityEngine.
SocialPlatforms;
-
-
-
-
// we'll create some buttons in OnGui, allowing us to bump achievement and -
// score values for testing -
-
-
-
-
-
-
private long score1 =
1000;
-
private long score2 =
200;
-
-
private int buttonWidth =
120;
-
private int buttonHeight =
50;
-
private int buttonGap =
10;
-
-
-
-
. .
(HandleAuthenticated
);
-
-
-
-
-
private void HandleAuthenticated
( bool ) -
-
.
( "*** HandleAuthenticated: success = " +
);
-
-
. .
(HandleFriendsLoaded
);
-
.
(HandleAchievementsLoaded
);
-
.
(HandleAchievementDescriptionsLoaded
);
-
-
-
-
private void HandleFriendsLoaded
( bool ) -
-
.
( "*** HandleFriendsLoaded: success = " +
);
-
foreach ( friend
in . .
) { -
.
( "* friend = " + friend.
( ) );
-
-
-
-
private void HandleAchievementsLoaded
( [ ] achievements
) -
-
.
( "*** HandleAchievementsLoaded" );
-
foreach ( achievement
in achievements
) { -
.
( "* achievement = " + achievement.
( ) );
-
-
-
-
private void HandleAchievementDescriptionsLoaded
( [ ] achievementDescriptions
) -
-
.
( "*** HandleAchievementDescriptionsLoaded" );
-
foreach ( achievementDescription
in achievementDescriptions
) { -
.
( "* achievementDescription = " + achievementDescription.
( ) );
-
-
-
-
-
-
public void ( string achievementId,
double ) -
-
-
.
(achievementId, , HandleProgressReported
);
-
-
-
-
private void HandleProgressReported
( bool ) -
-
.
( "*** HandleProgressReported: success = " +
);
-
-
-
public void ShowAchievements
( ) -
-
-
-
-
-
-
-
-
public void ( string leaderboardId,
long score
) -
-
-
.
(score, leaderboardId, HandleScoreReported
);
-
-
-
-
public void HandleScoreReported
( bool ) -
-
.
( "*** HandleScoreReported: success = " +
);
-
-
-
public void ShowLeaderboard
( ) -
-
-
-
-
-
-
-
-
-
-
// four buttons, allowing us to bump and test setting achievements -
-
if ( .
( new (buttonGap, yDelta, buttonWidth, buttonHeight
),
"Ach 1" ) ) { -
-
ach1 =
(ach1 ==
100 ) ?
0 : ach1 +
10;
-
-
yDelta += buttonHeight + buttonGap;
-
if ( .
( new (buttonGap, yDelta, buttonWidth, buttonHeight
),
"Ach 2" ) ) { -
-
ach2 =
(ach2 ==
100 ) ?
0 : ach2 +
10;
-
-
yDelta += buttonHeight + buttonGap;
-
if ( .
( new (buttonGap, yDelta, buttonWidth, buttonHeight
),
"Ach 3" ) ) { -
-
ach3 =
(ach3 ==
100 ) ?
0 : ach3 +
10;
-
-
yDelta += buttonHeight + buttonGap;
-
if ( .
( new (buttonGap, yDelta, buttonWidth, buttonHeight
),
"Ach 4" ) ) { -
-
ach4 =
(ach4 ==
100 ) ?
0 : ach4 +
10;
-
-
-
yDelta += buttonHeight + buttonGap;
-
if ( .
( new (buttonGap, yDelta, buttonWidth, buttonHeight
),
"Show Achievements" ) ) { -
-
-
-
// two buttons, allowing us to bump and test setting high scores -
int xDelta = .
width - buttonWidth - buttonGap;
-
-
if ( .
( new (xDelta, yDelta, buttonWidth, buttonHeight
),
"Score 1" ) ) { -
-
-
-
yDelta += buttonHeight + buttonGap;
-
if ( .
( new (xDelta, yDelta, buttonWidth, buttonHeight
),
"Score 2" ) ) { -
-
-
-
-
yDelta += buttonHeight + buttonGap;
-
if ( .
( new (xDelta, yDelta, buttonWidth, buttonHeight
),
"Show Leaderboard" ) ) { -
-
-
-
转载于:https://www.cnblogs.com/U-tansuo/archive/2012/07/11/GameCenter.html