IMHOTEP Framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
AnnotationListEntry.cs
1 using UnityEngine;
2 using System.Collections;
3 using UnityEngine.UI;
4 
5 public class AnnotationListEntry : MonoBehaviour {
6 
7 
8  public Button editButton;
9  public Button deleteButton;
10  public Text listEntryLabel;
11 
12  private GameObject myAnnotation;
13 
14  public void setupListEntry (GameObject annotation) {
15  myAnnotation = annotation;
16  annotation.GetComponent<Annotation> ().myAnnotationListEntry = this.gameObject;
17  listEntryLabel.text = annotation.GetComponent<Annotation>().getLabelText();
18  }
19 
20  public void DestroyAnnotation() {
21  //Destroy Label
22  myAnnotation.GetComponent<Annotation>().destroyAnnotation();
23  Destroy(myAnnotation.gameObject);
24  myAnnotation = null;
25  }
26 
27  public GameObject getAnnotation() {
28  return myAnnotation;
29  }
30 
31  public Color getAnnotationColor() {
32  return myAnnotation.GetComponent<Annotation>().getColor();
33  }
34 
35  public void updateLabel(string newLabel) {
36  listEntryLabel.text = newLabel;
37  }
38 
39  //Called if the user pressed Edit Annotation Button (List Screen)
40  public void EditAnnotation() {
41  AnnotationControl.instance.EditAnnotation (this.gameObject);
42  }
43 
44  //Called if the user pressed Delete Annotation Button (List Screen)
45  public void DeleteAnnotation() {
46  AnnotationControl.instance.DeleteAnnotation (this.gameObject);
47  }
48 
49  public void changeAnnotationColor(Color newColor) {
50  myAnnotation.GetComponent<Annotation>().changeColor (newColor);
51  }
52 
53  public void updateAnnotationposition(Quaternion rotation, Vector3 position) {
54  myAnnotation.GetComponent<Annotation>().updatePosition (rotation, position);
55  }
56 
57  public Vector2 getListPos() {
58  return this.gameObject.GetComponent<RectTransform> ().anchoredPosition;
59  }
60 
61  public void replaceMyAnnotationMesh (GameObject newAnnotationGroup) {
62  newAnnotationGroup.GetComponent<Annotation> ().transferAnnotationSettings (myAnnotation);
63  DestroyAnnotation ();
64  setupListEntry (newAnnotationGroup);
65  AnnotationControl.instance.updateListInLabelPositioner ();
66  }
67 
68  public void setAnnotationMovementActive(bool active) {
69  myAnnotation.GetComponent<Annotation> ().setMovementMeshsActive (active);
70  }
71 
72  public AnnotationControl.AnnotationType getMyAnnotationType() {
73  return myAnnotation.GetComponent<Annotation> ().myType;
74  }
75 
76  public void makeAnnotationTransparent(float alpha) {
77  myAnnotation.GetComponent<Annotation> ().makeTransperent (alpha);
78  }
79 
80  public void resetAnnotationTransparency() {
81  myAnnotation.GetComponent<Annotation> ().setDefaultTransparency ();
82  }
83 
84  public void setAnnotationLayer(string layer) {
85  myAnnotation.GetComponent<Annotation> ().changeAnnotationMeshLayer (layer);
86  }
87 
88  public void setMyAnnotationActive(bool active) {
89  myAnnotation.SetActive (active);
90  }
91 
92  public void enableAllCollider (bool enable) {
93  myAnnotation.GetComponent<Annotation> ().enableAllCollider (enable);
94  }
95 }