UnityMol  0.9.6-875
UnityMol viewer / In developement
ToolsGUI.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using System.Collections;
3 using UnityEngine.UI;
4 using UI;
5 using Molecule.Model;
6 
7 public class ToolsGUI : MonoBehaviour {
8  public Toggle select;
9  public Toggle inter;
10  private Camera mainCamera = null;
11 
12  // Use this for initialization
13  void Start () {
14  //Adding all listeners to the UI Objects
15  select.onValueChanged.AddListener (SelectAtoms);
16  inter.onValueChanged.AddListener (Interact);
17  mainCamera = Camera.main;
18  }
19 
20  public void SelectAtoms(bool isOn){
21  if(mainCamera == null)
22  mainCamera = Camera.main;
23  if (!isOn && mainCamera.GetComponent<ClickAtom> ())
24  mainCamera.GetComponent<ClickAtom> ().enabled = false;
25  else if (select && mainCamera.GetComponent<ClickAtom> ())
26  mainCamera.GetComponent<ClickAtom> ().enabled = true;
27  }
28 
29  public void Interact(bool isOn){
30  if (isOn && UIData.atomtype == UIData.AtomType.hyperball) {
31  UIData.interactive = true;
32  UIData.resetInteractive = true;
33  } else {
34  UIData.toggleGray = false;
35  UIData.toggleColor = true;
36  UIData.interactive = false;
37  UIData.resetInteractive = true;
39  LoadTypeGUI.showGrayColor = false;
42  }
43  }
44 }
void Interact(bool isOn)
Definition: ToolsGUI.cs:29
static bool toggleColor
Definition: UIData.cs:126
static bool interactive
Definition: UIData.cs:145
Camera mainCamera
Definition: ToolsGUI.cs:10
Toggle select
Definition: ToolsGUI.cs:8
void SelectAtoms(bool isOn)
Definition: ToolsGUI.cs:20
static bool resetInteractive
Definition: UIData.cs:147
!WiP Includes FLAGS of GUI.
Definition: UIData.cs:78
Toggle inter
Definition: ToolsGUI.cs:9
static bool toggleGray
Definition: UIData.cs:125
static AtomType atomtype
Definition: UIData.cs:139
void Start()
Definition: ToolsGUI.cs:13
Definition: GUIDisplay.cs:66