Created
March 6, 2016 18:41
-
-
Save michael-martinez/3a9786b61edf5a654bd8 to your computer and use it in GitHub Desktop.
[Unity3D] Generic GUI test environment for debugging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region GUI | |
// Assign a valid Text object added to the test Scene | |
public Text logger = null; | |
// Field 1 : | |
private bool m_DISPLAY_11 = true; | |
private string m_TEXTFIELD_11A = "1"; | |
private string m_TEXTFIELD_11B = "2"; | |
// Field 2 : | |
private bool m_DISPLAY_12 = true; | |
private string m_TEXTFIELD_12A = "3"; | |
private string m_TEXTFIELD_12B = "4"; | |
void OnGUI() | |
{ | |
// Column 1 | |
if (m_DISPLAY_11) | |
{ | |
m_TEXTFIELD_11A = GUI.TextField(new Rect(10, 10, 100, 50), m_TEXTFIELD_11A, 1); | |
m_TEXTFIELD_11B = GUI.TextField(new Rect(110, 10, 100, 50), m_TEXTFIELD_11B, 4); | |
if (GUI.Button(new Rect(10, 70, 200, 50), "TEXTFIELD_11")) | |
{ | |
this.sampleControler(int.Parse(m_TEXTFIELD_11A), int.Parse(m_TEXTFIELD_11B)); | |
} | |
} | |
if (m_DISPLAY_12) | |
{ | |
m_TEXTFIELD_12A = GUI.TextField(new Rect(10, 130, 100, 50), m_TEXTFIELD_12A, 1); | |
m_TEXTFIELD_12B = GUI.TextField(new Rect(110, 130, 100, 50), m_TEXTFIELD_12B, 4); | |
if (GUI.Button(new Rect(10, 190, 200, 50), "TEXTFIELD_12")) | |
{ | |
this.sampleControler(int.Parse(m_TEXTFIELD_12A), int.Parse(m_TEXTFIELD_12B)); | |
} | |
} | |
} | |
public void LOG(string a_msg) | |
{ | |
Debug.Log(a_msg); | |
if(logger != null) logger.text = a_msg; | |
} | |
#endregion | |
#region interface | |
public void sampleControler(int a_data1, int a_data2) | |
{ | |
LOG("sampleControler called { " + a_data1 + " } { " + a_data2 + " }"); | |
} | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment