Fixed a google play connection crash
This commit is contained in:
parent
4832ccd5ee
commit
d45a49f809
4 changed files with 10 additions and 7 deletions
|
@ -111,13 +111,16 @@ namespace Android {
|
||||||
this.activity.StartActivity(new Intent(Intent.ActionView, Uri.Parse("https://play.google.com/store/apps/details?id=de.ellpeck.touchytickets")));
|
this.activity.StartActivity(new Intent(Intent.ActionView, Uri.Parse("https://play.google.com/store/apps/details?id=de.ellpeck.touchytickets")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void GainAchievement(Achievement achievement) {
|
public override bool GainAchievement(Achievement achievement) {
|
||||||
if (this.GoogleApi != null)
|
if (this.GoogleApi != null && this.GoogleApi.IsConnected) {
|
||||||
GamesClass.Achievements.Unlock(this.GoogleApi, AchievementIds[achievement.Name]);
|
GamesClass.Achievements.Unlock(this.GoogleApi, AchievementIds[achievement.Name]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ShowAchievements() {
|
public override void ShowAchievements() {
|
||||||
if (this.GoogleApi == null)
|
if (this.GoogleApi == null || !this.GoogleApi.IsConnected)
|
||||||
return;
|
return;
|
||||||
var intent = GamesClass.Achievements.GetAchievementsIntent(this.GoogleApi);
|
var intent = GamesClass.Achievements.GetAchievementsIntent(this.GoogleApi);
|
||||||
this.activity.StartActivityForResult(intent, ShowAchievementsRequest);
|
this.activity.StartActivityForResult(intent, ShowAchievementsRequest);
|
||||||
|
|
|
@ -48,8 +48,8 @@ namespace TouchyTickets {
|
||||||
return;
|
return;
|
||||||
if (!this.condition.Invoke(GameImpl.Instance))
|
if (!this.condition.Invoke(GameImpl.Instance))
|
||||||
return;
|
return;
|
||||||
GameImpl.Instance.Platform.GainAchievement(this);
|
if (GameImpl.Instance.Platform.GainAchievement(this))
|
||||||
this.unlocked = true;
|
this.unlocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Register(Achievement achievement) {
|
public static void Register(Achievement achievement) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace TouchyTickets {
|
||||||
|
|
||||||
public abstract void OpenRateLink();
|
public abstract void OpenRateLink();
|
||||||
|
|
||||||
public abstract void GainAchievement(Achievement achievement);
|
public abstract bool GainAchievement(Achievement achievement);
|
||||||
|
|
||||||
public abstract void ShowAchievements();
|
public abstract void ShowAchievements();
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace iOS {
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void GainAchievement(Achievement achievement) {
|
public override bool GainAchievement(Achievement achievement) {
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue