public void changeMode() { mode = (displayMode)(((int)mode + 1) % 5); modeText.text = mode.ToString(); modeChange = true; }
public Form1() { InitializeComponent(); usb = new USBDriver(); SendBuffer = new byte[64]; RecvBuffer = new byte[64]; LastBuffer = new byte[64]; sbInfo = new StringBuilder(); dm = displayMode.append; bSend = new List <byte>(); l_recvbuffer = new List <byte>(); }
void OnGUI() { GUI.skin = skin; GUI.Box(new Rect(5, 5, 300, 80), "", "robo"); GUI.BeginGroup(new Rect(2 * Screen.width / 3, 0, Screen.width / 3, Screen.height)); switch (mode) { case displayMode.STRUCTURE: { XGUI.Header(0.0f, 0.0f, Screen.width / 3, 40.0f, "Structural Data"); GUI.Box(new Rect(0, 40, Screen.width / 3, Screen.height - 40), structText); if (GUI.Button(new Rect(Screen.width/6-40, Screen.height - 100, 80, 40), "Close")) mode = displayMode.NORMAL; break; } case displayMode.POWER: { XGUI.Header(0.0f, 0.0f, Screen.width / 3, 40.0f, "Power Data"); GUI.Box(new Rect(0, 40, Screen.width / 3, Screen.height - 40), powerText); if (GUI.Button(new Rect(Screen.width / 6 - 40, Screen.height - 100, 80, 40), "Close")) mode = displayMode.NORMAL; break; } case displayMode.CODE: { XGUI.Header(0.0f, 0.0f, Screen.width / 3, 40.0f, "Code Data"); GUI.Box(new Rect(0, 40, Screen.width / 3, Screen.height - 40), codeText); if (GUI.Button(new Rect(Screen.width / 6 - 40, Screen.height - 100, 80, 40), "Close")) mode = displayMode.NORMAL; break; } case displayMode.NORMAL: break; } GUI.EndGroup(); }
void Update() { rcRay = Camera.main.ScreenPointToRay(Input.mousePosition); if (Input.GetMouseButtonUp(0)) { if (Physics.Raycast(rcRay, out hit, 1000)) { subsysName = hit.collider.gameObject.tag; print(subsysName); switch (subsysName) { case "structure": mode = displayMode.STRUCTURE; break; case "power": mode = displayMode.POWER; break; case "code": mode = displayMode.CODE; break; default: mode = displayMode.NORMAL; break; } } else subsysName = "NONE"; } }
void Start() { subsysName = "NONE"; mode = displayMode.NORMAL; }
private void checkBox1_CheckedChanged(object sender, EventArgs e) { dm = checkBox1.Checked ? displayMode.refresh : displayMode.append; }