public override void NotifyAnnotationEdited(Annotation updatedAnnotation) { base.NotifyAnnotationEdited(updatedAnnotation); GameAction updatedAction = GameAction.FromAnnotation(updatedAnnotation, QuizName); GamificationFramework.Instance.UpdateAction(gamificationManager.gameId, updatedAction, null); }
public override void Add(AnnotationContainer annotationContainer) { base.Add(annotationContainer); // handle gamification: add question as action GameAction action = GameAction.FromAnnotation(annotationContainer.Annotation, QuizName); GamificationFramework.Instance.CreateAction(gamificationManager.gameId, action, resCode => { if (resCode != 200 && resCode != 201) { Debug.Log("Could not gamify question (Code " + resCode + ")"); gamificationManager.Quest.AddAction(action, 1); } } ); // also increase target for achievement UpdateAchievementPoints(); }
private void EnsureActionsForAnnotations(Quest quest) { for (int i = 0; i < annotations.Count; i++) { int indexForLambda = i; // the index i of the for loop is changing while the lambda function is executed => store the current value in another variable GameAction action = GameAction.FromAnnotation(annotations[i], QuizName); quest.AddAction(action, 1); GamificationFramework.Instance.CreateAction(gamificationManager.gameId, action, resCode => { if (resCode != 201) { Debug.Log("Could not create action for " + annotations[indexForLambda].Text + "\nCode: " + resCode); } } ); } // also adapt achievement target points UpdateAchievementPoints(); }