UnityMol  0.9.6-875
UnityMol viewer / In developement
ArtemisClientLoop.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using System.Collections;
3 using System.Collections.Generic;
4 using UI;
5 
6 public class ArtemisClientLoop : MonoBehaviour {
7 
8  private static bool toggleTotalEnergyPlot = false;
9  private static bool toggleHBondsEnergyPlot = false;
10  private static bool toggleStackingEnergyPlot = false;
11 
12  public static Texture2D totalEnergyPlotTexture;
13  public static Texture2D hbondsEnergyPlotTexture;
14  public static Texture2D stackingEnergyPlotTexture;
15 
16  public static GameObject totalEnergyGameObject;
17  public static GameObject hbondsEnergyGameObject;
18  public static GameObject stackingEnergyGameObject;
19 
20  public static void instanciateTotalEnergyPlot()
21  {
23 
24  totalEnergyGameObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
25  totalEnergyGameObject.name = "TotalEnergyPlot";
26 
27  totalEnergyGameObject.transform.parent = Camera.main.transform;
28  totalEnergyGameObject.transform.LookAt(-Camera.main.transform.position);
29 
30  totalEnergyGameObject.GetComponent<MeshRenderer>().material = new Material(Shader.Find("Transparent/Zsorted"));
31  totalEnergyGameObject.GetComponent<MeshRenderer>().material.SetTexture("_MainTex", ArtemisClientLoop.totalEnergyPlotTexture);
32 
33  totalEnergyGameObject.AddComponent(typeof(DraggableBillboard));
34 
35  totalEnergyGameObject.transform.localPosition = new Vector3(0f, 0f, 3f);
36  totalEnergyGameObject.transform.rotation = Camera.main.transform.rotation;
37 
38  toggleTotalEnergyPlot = true;
39  }
40 
41  public static void activateTotalEnergyPlot()
42  {
43  toggleTotalEnergyPlot = true;
44  totalEnergyGameObject.SetActive(true);
45  }
46 
47  public static void deactivateTotalEnergyPlot()
48  {
49  totalEnergyGameObject.SetActive(false);
50 
51  toggleTotalEnergyPlot = false;
52  }
53 
54  public static void destroyTotalEnergyPlot()
55  {
56  PlotManager.Instance.PlotDestroy("Total Energy");
57 
58  GameObject.Destroy(totalEnergyGameObject);
59 
60  toggleTotalEnergyPlot = false;
62  }
63 
64  public static void instanciateHBondsEnergyPlot()
65  {
66  PlotManager.Instance.PlotCreate("Hydrogen Bonds Energy", -200, 200, GUIDisplay.artemisPlotGreenStyle.normal.textColor, ref ArtemisClientLoop.hbondsEnergyPlotTexture);
67 
68  hbondsEnergyGameObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
69  hbondsEnergyGameObject.name = "HBondsEnergyPlot";
70 
71  hbondsEnergyGameObject.transform.parent = Camera.main.transform;
72  hbondsEnergyGameObject.transform.LookAt(-Camera.main.transform.position);
73 
74  hbondsEnergyGameObject.GetComponent<MeshRenderer>().material = new Material(Shader.Find("Transparent/Zsorted"));
75  hbondsEnergyGameObject.GetComponent<MeshRenderer>().material.SetTexture("_MainTex", ArtemisClientLoop.hbondsEnergyPlotTexture);
76 
77  hbondsEnergyGameObject.AddComponent(typeof(DraggableBillboard));
78 
79  hbondsEnergyGameObject.transform.localPosition = new Vector3(0f, 0f, 3f);
80  hbondsEnergyGameObject.transform.rotation = Camera.main.transform.rotation;
81 
82  toggleHBondsEnergyPlot = true;
83  }
84 
85  public static void activateHBondsEnergyPlot()
86  {
87  toggleHBondsEnergyPlot = true;
88  hbondsEnergyGameObject.SetActive(true);
89  }
90 
91  public static void deactivateHBondsEnergyPlot()
92  {
93  hbondsEnergyGameObject.SetActive(false);
94 
95  toggleHBondsEnergyPlot = false;
96  }
97 
98  public static void destroyHBondsEnergyPlot()
99  {
100  PlotManager.Instance.PlotDestroy("Hydrogen Bonds Energy");
101 
102  GameObject.Destroy(hbondsEnergyGameObject);
103 
104  toggleHBondsEnergyPlot = false;
106  }
107 
108  public static void instantiateStackingEnergyPlot()
109  {
111 
112  stackingEnergyGameObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
113  stackingEnergyGameObject.name = "TotalEnergyPlot";
114 
115  stackingEnergyGameObject.transform.parent = Camera.main.transform;
116  stackingEnergyGameObject.transform.LookAt(-Camera.main.transform.position);
117 
118  stackingEnergyGameObject.GetComponent<MeshRenderer>().material = new Material(Shader.Find("Transparent/Zsorted"));
119  stackingEnergyGameObject.GetComponent<MeshRenderer>().material.SetTexture("_MainTex", ArtemisClientLoop.stackingEnergyPlotTexture);
120 
121  stackingEnergyGameObject.AddComponent(typeof(DraggableBillboard));
122 
123  stackingEnergyGameObject.transform.localPosition = new Vector3(0f, 0f, 3f);
124  stackingEnergyGameObject.transform.rotation = Camera.main.transform.rotation;
125 
126  toggleStackingEnergyPlot = true;
127  }
128 
129  public static void activateStackingEnergyPlot()
130  {
131  toggleStackingEnergyPlot = true;
132  stackingEnergyGameObject.SetActive(true);
133  }
134 
135  public static void deactivateStackingEnergyPlot()
136  {
137  stackingEnergyGameObject.SetActive(false);
138 
139  toggleStackingEnergyPlot = false;
140  }
141 
142  public static void destroyStackingEnergyPlot()
143  {
144  PlotManager.Instance.PlotDestroy("Stacking Energy");
145 
146  GameObject.Destroy(stackingEnergyGameObject);
147 
148  toggleStackingEnergyPlot = false;
150  }
151 
152  void OnDestroy() {
156  }
157 
158  void Start () {
162  }
163 
164  void Update () {
165  if (LoadTypeGUI.toggleIMDTotalEnergy && !toggleTotalEnergyPlot)
166  {
168  }
169  if (!LoadTypeGUI.toggleIMDTotalEnergy && toggleTotalEnergyPlot)
170  {
172  }
173 
174  if (LoadTypeGUI.toggleIMDHBondsEnergy && !toggleHBondsEnergyPlot)
175  {
177  }
178  if (!LoadTypeGUI.toggleIMDHBondsEnergy && toggleHBondsEnergyPlot)
179  {
181  }
182 
183  if (LoadTypeGUI.toggleIMDStackingEnergy && !toggleStackingEnergyPlot)
184  {
186  }
187  if (!LoadTypeGUI.toggleIMDStackingEnergy && toggleStackingEnergyPlot)
188  {
190  }
191 
193 
194  atomManager.ResetIMDSimulationPositions();
195 
197  bondManager.ResetIMDSimulationPositions();
198  }
199 }
static Texture2D totalEnergyPlotTexture
static bool toggleHBondsEnergyPlot
static GUIStyle artemisPlotWhiteStyle
Definition: GUIDisplay.cs:212
void PlotDestroy(String plotName)
Definition: PlotManager.cs:102
void PlotCreate(String plotName, float min, float max, Color plotColor, Vector2 pos)
Instantiate a new new plot graph
Definition: PlotManager.cs:64
static void deactivateTotalEnergyPlot()
static GameObject totalEnergyGameObject
abstract void ResetIMDSimulationPositions()
static PlotManager Instance
Instance of object
Definition: PlotManager.cs:18
static bool toggleTotalEnergyPlot
static bool toggleStackingEnergyPlot
static void destroyStackingEnergyPlot()
static GUIStyle artemisPlotRedStyle
Definition: GUIDisplay.cs:214
static void activateStackingEnergyPlot()
static GameObject hbondsEnergyGameObject
static void destroyHBondsEnergyPlot()
static void deactivateStackingEnergyPlot()
static void instantiateStackingEnergyPlot()
static void activateTotalEnergyPlot()
static GameObject stackingEnergyGameObject
!WiP manage GUI, and provide static strings for the GUI.
Definition: GUIDisplay.cs:94
static void deactivateHBondsEnergyPlot()
static Texture2D stackingEnergyPlotTexture
static Texture2D hbondsEnergyPlotTexture
static void instanciateHBondsEnergyPlot()
static void destroyTotalEnergyPlot()
static GenericManager getCurrentBondManager()
Definition: UnityMolMain.cs:54
static void instanciateTotalEnergyPlot()
static GUIStyle artemisPlotGreenStyle
Definition: GUIDisplay.cs:213
static void activateHBondsEnergyPlot()
Definition: GUIDisplay.cs:66
static GenericManager getCurrentAtomManager()
Definition: UnityMolMain.cs:50