void createSwitch() { bool found_location = false; for (int i = 0; i < 12; i++) { server = GameObject.Find("/Racks").GetComponent <RackObjectData>().switches[i]; if (!server.obj.activeSelf) { found_location = true; server.obj.SetActive(true); break; } } if (!found_location) { switch_text.text = "No Switches"; } else { /* * Call Victor's Function (for ID) */ //server.id = ; // highlight object subMenuScript = GameObject.Find("/OVRPlayerController/OVRCameraRig/TrackingSpace/RightHandAnchor/Create SubMenu").GetComponent <CreateSubMenu>(); subMenuScript.created_server = server; gameObject.SetActive(false); subMenu.SetActive(true); } }
// Use this for initialization void Start() { // player player = GameObject.Find("/OVRPlayerController"); // ojbect data data = GameObject.Find("/Racks"); // Main Context Menu main = GameObject.Find("/OVRPlayerController/OVRCameraRig/TrackingSpace/RightHandAnchor/Main Menu"); menu = GameObject.Find("/OVRPlayerController/OVRCameraRig/TrackingSpace/RightHandAnchor/Create LinkMenu"); // Main Menu Choices title = GameObject.Find("/OVRPlayerController/OVRCameraRig/TrackingSpace/RightHandAnchor/Create LinkMenu/Title"); device_1 = GameObject.Find("/OVRPlayerController/OVRCameraRig/TrackingSpace/RightHandAnchor/Create LinkMenu/Device 1"); port_1 = GameObject.Find("/OVRPlayerController/OVRCameraRig/TrackingSpace/RightHandAnchor/Create LinkMenu/Port 1"); device_2 = GameObject.Find("/OVRPlayerController/OVRCameraRig/TrackingSpace/RightHandAnchor/Create LinkMenu/Device 2"); port_2 = GameObject.Find("/OVRPlayerController/OVRCameraRig/TrackingSpace/RightHandAnchor/Create LinkMenu/Port 2"); confirm = GameObject.Find("/OVRPlayerController/OVRCameraRig/TrackingSpace/RightHandAnchor/Create LinkMenu/Confirm"); cancel = GameObject.Find("/OVRPlayerController/OVRCameraRig/TrackingSpace/RightHandAnchor/Create LinkMenu/Cancel"); menu_options[0] = device_1; menu_options[1] = device_2; menu_options[2] = port_1; menu_options[3] = port_2; menu_options[4] = confirm; menu_options[5] = cancel; title.GetComponentInChildren <Text>().text = "Link Two Devices"; device_1.GetComponentInChildren <Text>().text = "Device 1"; port_1.GetComponentInChildren <Text>().text = "Port 1"; device_2.GetComponentInChildren <Text>().text = "Device 2"; port_2.GetComponentInChildren <Text>().text = "Port 2"; confirm.GetComponentInChildren <Text>().text = "Confirm"; cancel.GetComponentInChildren <Text>().text = "Cancel"; // Main Menu Panel Objects device_1.GetComponent <Image>().color = panel_highlight; device_2.GetComponent <Image>().color = panel_default; port_1.GetComponent <Image>().color = panel_default; port_2.GetComponent <Image>().color = panel_default; confirm.GetComponent <Image>().color = panel_default; cancel.GetComponent <Image>().color = panel_default; menu_option = 0; horiz_active = false; vert_active = false; device_one = null; device_two = null; // set menu inactive gameObject.SetActive(false); }
void chooseDeviceTwo() { if (collided_server != null && OVRInput.GetDown(OVRInput.Button.One)) { for (int i = 0; i < 12; i++) { if (data.GetComponent <RackObjectData>().routers[i].obj.name == collided_server.name) { device_two = data.GetComponent <RackObjectData>().routers[i]; for (int j = 0; j < 8; j++) { if (!device_two.ports[j]) { data.GetComponent <RackObjectData>().routers[i].ports[j] = true; port_two = j; break; } } break; } else if (data.GetComponent <RackObjectData>().switches[i].obj.name == collided_server.name) { device_two = data.GetComponent <RackObjectData>().switches[i]; for (int j = 0; j < 8; j++) { if (!device_two.ports[j]) { data.GetComponent <RackObjectData>().switches[i].ports[j] = true; port_two = j; break; } } break; } } if (device_two == null) { port_2.GetComponentInChildren <Text>().text = "No Ports"; } else { device_2.GetComponentInChildren <Text>().text = "ID: " + device_two.name; port_2.GetComponentInChildren <Text>().text = "Port " + port_one.ToString(); } } }
void confirmLink() { if (OVRInput.GetDown(OVRInput.Button.One)) { pressedYes = true; } if (device_one != null && device_two != null && OVRInput.GetDown(OVRInput.Button.One)) { pressedYes = true; /* * Call Victor's function */ int p1; int a1; int p2; int a2; if (device_one.is_router) { p1 = 0; a1 = port_one; } else { p1 = port_one; a1 = 0; } if (device_two.is_router) { p2 = 0; a2 = port_two; } else { p2 = port_two; a2 = 0; } StartCoroutine(main.GetComponent <MainMenu>().projectHandle.CreateLink(device_one.id, device_two.id, p1, p2, a1, a2)); // set up cable device_one = null; device_two = null; } }