コード例 #1
0
 /// <summary>
 /// Deletes an annotation from the list
 /// </summary>
 /// <param name="annotation">The annotation to delete</param>
 public virtual void Delete(AnnotationContainer annotationContainer)
 {
     DeleteAudioAnnotation(annotationContainer);
     annotations.Remove(annotationContainer.Annotation);
     annotationContainers.Remove(annotationContainer);
     Save();
 }
コード例 #2
0
    /// <summary>
    /// shows all annotations
    /// at first it clears all annotationContainers if some still existed
    /// </summary>
    public void ShowAllAnnotations()
    {
        if (annotationContainers.Count != 0)
        {
            HideAllAnnotations();
        }

        foreach (Annotation annotation in annotations)
        {
            GameObject annotationObject = (GameObject)Instantiate(Resources.Load("AnnotationSphere"));
            annotationObject.transform.parent        = gameObject.transform;
            annotationObject.transform.localPosition = annotation.Position;
            annotationObject.transform.localScale    = new Vector3(annotationSize, annotationSize, annotationSize);


            AnnotationContainer container = annotationObject.AddComponent <AnnotationContainer>();
            container.annotationManager = this;
            container.loaded            = true;
            container.Annotation        = annotation;
            annotationContainers.Add(container);
        }

        if (annotationContainers.Count > 0)
        {
            LoadAudioAnnotations(0);
        }
    }
コード例 #3
0
    /// <summary>
    /// called if the annotation-object is tapped
    /// shows an annotation box with the corresponding annotation's content
    /// </summary>
    public void TapOnModel()
    {
        if (editMode)
        {
            GameObject annotationObject = (GameObject)Instantiate(Resources.Load("AnnotationSphere"));
            annotationObject.transform.position   = GazeManager.Instance.HitPosition;
            annotationObject.transform.parent     = gameObject.transform;
            annotationObject.transform.localScale = new Vector3(annotationSize, annotationSize, annotationSize);

            // close currently opened annotation box
            if (AnnotationBox.currentlyOpenAnnotationBox != null)
            {
                AnnotationBox.currentlyOpenAnnotationBox.Close();
            }
            // close keyboard if opened
            if (Keyboard.currentlyOpenedKeyboard != null)
            {
                Keyboard.currentlyOpenedKeyboard.Cancel();
            }

            AnnotationContainer container = annotationObject.AddComponent <AnnotationContainer>();
            container.loaded            = false;
            container.annotationManager = this;
        }
    }
コード例 #4
0
    /// <summary>
    /// Creates an annotation box and shows it
    /// </summary>
    /// <param name="container"></param>
    public static void Show(AnnotationContainer container)
    {
        GameObject    instance      = (GameObject)GameObject.Instantiate(Resources.Load("AnnotationBox"));
        AnnotationBox annotationBox = instance.GetComponent <AnnotationBox>();

        annotationBox.container = container;
        container.Select();
        currentlyOpenAnnotationBox = annotationBox;
    }
コード例 #5
0
 /// <summary>
 /// saves an audio annotation
 /// should be called immediately after an audio annotation was changed
 /// </summary>
 /// <param name="container">The container which stores the audio annotation</param>
 public void SaveAudioAnnotation(AnnotationContainer container)
 {
     if (!initializingAudio)
     {
         if (container.AnnotationClip != null)
         {
             Debug.Log("Saving clip for " + container.Annotation.PositionToStringWithoutDots + " (" + container.Annotation.Text + ")");
             RestManager.Instance.SendAudioClip(InformationManager.Instance.FullBackendAddress + "/resources/annotation/audio/" + objectInfo.ModelName + "/" + container.Annotation.PositionToStringWithoutDots, container.AnnotationClip, null);
         }
     }
 }
コード例 #6
0
    public override void Delete(AnnotationContainer annotationContainer)
    {
        base.Delete(annotationContainer);

        // handle gamification: delete action which is related to the question
        GamificationFramework.Instance.DeleteAction(gamificationManager.gameId, GameAction.CreateActionId(annotationContainer.Annotation, QuizName),
                                                    resCode =>
        {
            if (resCode != 200)
            {
                Debug.Log("Could not delete gamified question (Code " + resCode + ")");
                gamificationManager.Quest.RemoveAction(annotationContainer.Annotation.Position.ToString() + "_" + QuizName);
            }
        }
                                                    );

        // also decrease target for achievement
        UpdateAchievementPoints();
    }
コード例 #7
0
    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();
    }
コード例 #8
0
 /// <summary>
 /// Deletes an audio annotation on the backend's storage and destroys the refernce to it in the annotation container
 /// </summary>
 /// <param name="container">The container which holds the audio annotation</param>
 public void DeleteAudioAnnotation(AnnotationContainer container)
 {
     container.AnnotationClip = null;
     RestManager.Instance.DELETE(InformationManager.Instance.FullBackendAddress + "/resources/annotation/audio/" + objectInfo.ModelName + "/" + container.Annotation.PositionToStringWithoutDots, null);
 }
コード例 #9
0
 /// <summary>
 /// adds a new annotation to the list
 /// </summary>
 /// <param name="annotation">The annotation to add</param>
 public virtual void Add(AnnotationContainer annotationContainer)
 {
     annotations.Add(annotationContainer.Annotation);
     annotationContainers.Add(annotationContainer);
     Save();
 }