UnityMol  0.9.6-875
UnityMol viewer / In developement
SecSGUI.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.View;
6 
7 public class SecSGUI : MonoBehaviour {
8 
9  public GameObject secStructMenu;
10 
11  public Toggle SecST;
12 
13  public Slider helixWidth;
14  public Slider sheetWidth;
15  public Slider coilWidth;
16  public Slider helixDiam;
17  public Slider thick;
18  public Slider arrowWidth;
19 
20  public Button apply;
21 
22  public Button helixColor;
23  public Button strandColor;
24  public Button coilColor;
25 
26  public HSVPicker picker;
27 
28  public void Start(){
29  //Adding all listeners to the UI Objects
30  SecST.onValueChanged.AddListener(EnableSecS);
31  apply.onClick.AddListener(UpdateRibbonsProp);
32  //When the button is clicked the ColorPicker is linked to it
33  helixColor.onClick.AddListener (()=>{
34  picker.gameObject.SetActive(true);
35  picker.onValueChanged.RemoveAllListeners();
36  picker.onValueChanged.AddListener(colorPick =>
37  {
38  helixColor.image.color = colorPick;
39  Ribbons.HELIX_COLOR.color = colorPick;
40  });
41  });
42  //When the button is clicked the ColorPicker is linked to it
43  strandColor.onClick.AddListener (()=>{
44  picker.gameObject.SetActive(true);
45  picker.onValueChanged.RemoveAllListeners();
46  picker.onValueChanged.AddListener(colorPick =>
47  {
48  strandColor.image.color = colorPick;
49  Ribbons.STRAND_COLOR.color = colorPick;
50  });
51  });
52  //When the button is clicked the ColorPicker is linked to it
53  coilColor.onClick.AddListener (()=>{
54  picker.gameObject.SetActive(true);
55  picker.onValueChanged.RemoveAllListeners();
56  picker.onValueChanged.AddListener(colorPick =>
57  {
58  coilColor.image.color = colorPick;
59  Ribbons.COIL_COLOR.color = colorPick;
60  });
61  });
62 
63  }
64 
65 
66  public void EnableSecS (bool isOn){
67 
68  if (isOn) {
70  //Keep until we switch to the new UI
71  UI.GUIMoleculeController.toggle_NA_HIDE = true;// hide atoms
72 
74  } else {
75  //Keep until we switch to the new UI
77 
80  }
81 
82  apply.interactable = true;
83 
84  }
85 
86  public void UpdateRibbonsProp(){
87 
88  Ribbons.ribbonWidth[0] = helixWidth.value;
89  Ribbons.ribbonWidth[1] = sheetWidth.value;
90  Ribbons.ribbonWidth[2] = coilWidth.value;
91  Ribbons.THICKNESS = thick.value;
92  Ribbons.HELIX_DIAM = helixDiam.value;
93  Ribbons.ARROW_WIDTH = arrowWidth.value;
94 
97  // Recreating them
100 
101 
102  }
103 
104 
105 }
static float[] ribbonWidth
Definition: Ribbons.cs:44
Toggle SecST
Definition: SecSGUI.cs:11
void EnableSecS(bool isOn)
Definition: SecSGUI.cs:66
static float HELIX_DIAM
Definition: Ribbons.cs:40
static ColorObject COIL_COLOR
Definition: Ribbons.cs:32
Slider coilWidth
Definition: SecSGUI.cs:15
void Start()
Definition: SecSGUI.cs:28
Color color
Definition: ColorObject.cs:72
Slider sheetWidth
Definition: SecSGUI.cs:14
GameObject secStructMenu
Definition: SecSGUI.cs:9
Slider helixWidth
Definition: SecSGUI.cs:13
static float ARROW_WIDTH
Definition: Ribbons.cs:42
Slider helixDiam
Definition: SecSGUI.cs:16
static SecondaryStructureManager getSecondaryStructureManager()
Definition: UnityMolMain.cs:34
static ColorObject STRAND_COLOR
Definition: Ribbons.cs:31
Slider arrowWidth
Definition: SecSGUI.cs:18
Button coilColor
Definition: SecSGUI.cs:24
Button helixColor
Definition: SecSGUI.cs:22
Slider thick
Definition: SecSGUI.cs:17
void UpdateRibbonsProp()
Definition: SecSGUI.cs:86
Button apply
Definition: SecSGUI.cs:20
Button strandColor
Definition: SecSGUI.cs:23
HSVPicker picker
Definition: SecSGUI.cs:26
static float THICKNESS
Definition: Ribbons.cs:41
static ColorObject HELIX_COLOR
Definition: Ribbons.cs:30
Definition: GUIDisplay.cs:66