69 using System.Collections.Generic;
79 private Rect
m_r_area =
new Rect(60, 20, 50, 20);
80 private Rect
m_g_area =
new Rect(115, 20, 50, 20);
81 private Rect
m_b_area =
new Rect(170, 20, 50, 20);
92 private List<string>
m_atoms =
new List<string>();
124 ColorObject colorObj, List<string> atoms,
string residue =
"All",
string chain =
"All",
125 string title=
"Color Picker",
int caller=-1)
127 m_colorObj = colorObj;
131 m_r_value = (int)(colorObj.
color.r * 255f);
132 m_g_value = (int)(colorObj.
color.g * 255f);
133 m_b_value = (int)(colorObj.
color.b * 255f);
134 m_rect =
new Rect(xstart,ystart,width,height);
135 m_aTexture = (Texture2D)Resources.Load(
"ImprovedColorPicker");
138 m_activeArea =
new Rect(m_rect.x + m_text_area.x, m_rect.y + m_text_area.y, m_text_area.width, m_text_area.height);
143 ColorObject colorObj, List<string> atoms,
string residue =
"All",
string chain =
"All",
144 string title=
"Color Picker",
int caller=-1)
146 m_colorObj = colorObj;
150 m_r_value = (int)(colorObj.
color.r * 255f);
151 m_g_value = (int)(colorObj.
color.g * 255f);
152 m_b_value = (int)(colorObj.
color.b * 255f);
154 m_aTexture = (Texture2D)Resources.Load(
"ImprovedColorPicker");
157 m_activeArea =
new Rect(m_rect.x + m_text_area.x, m_rect.y + m_text_area.y, m_text_area.width, m_text_area.height);
172 if(mainCamera == null)
173 mainCamera = Camera.main;
174 GUI.Window(60, m_rect,
loadColor, m_title);
176 Vector3 mousePos = Input.mousePosition;
177 mousePos.y = Screen.height - mousePos.y;
178 if(m_activeArea.Contains(mousePos) && Input.GetMouseButton(0) && GUIUtility.hotControl == 0)
180 int X = (int)((mousePos.x - m_activeArea.x) / m_activeArea.width * m_aTexture.width);
181 int Y = (int)((mousePos.y - m_activeArea.y) / m_activeArea.height * m_aTexture.height);
183 m_r_value = (int)(m_aTexture.GetPixel(X,-Y).r * 255);
184 m_g_value = (int)(m_aTexture.GetPixel(X,-Y).g * 255);
185 m_b_value = (int)(m_aTexture.GetPixel(X,-Y).b * 255);
203 m_colorObj.
color =
new Color((
float)m_r_value/255f, (
float)m_g_value/255f, (
float)m_b_value/255f, 1f);
208 manager.
SetColor(m_colorObj.
color, m_atoms, m_residue, m_chain);
215 string toparse = obj.name.Split(
new string[] {
"Collider_Atom_"}, StringSplitOptions.None)[1];
216 int atomnumber =
int.Parse(toparse);
235 if(GUI.Button(m_close_area,
"Close"))
238 temp = GUI.TextField(m_r_area, m_r_value.ToString());
239 int.TryParse(temp, out m_r_value);
240 temp = GUI.TextField(m_g_area, m_g_value.ToString());
241 int.TryParse(temp, out m_g_value);
242 temp = GUI.TextField(m_b_area, m_b_value.ToString());
243 int.TryParse(temp, out m_b_value);
244 GUI.DrawTexture(m_text_area, m_aTexture, ScaleMode.ScaleToFit,
true, 0F);
245 if (Event.current.type == EventType.Repaint)
ColorPicker(Rect r, ColorObject colorObj, List< string > atoms, string residue="All", string chain="All", string title="Color Picker", int caller=-1)
abstract void SetColor(Color col, List< string > atoms, string residue="All", string chain="All")
static ColorPicker m_colorPicker
ColorPicker(int xstart, int ystart, int width, int height, ColorObject colorObj, List< string > atoms, string residue="All", string chain="All", string title="Color Picker", int caller=-1)
!WiP Includes FLAGS of GUI.
static bool toggle_NA_CLICK
void SwitchEnable(int caller)
List< GameObject > objList
static GenericManager getCurrentAtomManager()