// Update is called once per frame void Update() { if (!XMenuBase.getInstance().getIsShowMenu()) { return; } if (XMenuBase.getInstance().getCurrentStatus() != XEnumMenuStatus.OBJECT) { CREATE.SetActive(false); DELETE.SetActive(false); COPY.SetActive(false); EXPORT.SetActive(false); ARRAY.SetActive(false); return; } else { CREATE.SetActive(true); DELETE.SetActive(true); COPY.SetActive(true); EXPORT.SetActive(true); ARRAY.SetActive(true); } //print selection_index CREATE.GetComponent <Image>().color = unselected_color; DELETE.GetComponent <Image>().color = unselected_color; COPY.GetComponent <Image>().color = unselected_color; EXPORT.GetComponent <Image>().color = unselected_color; ARRAY.GetComponent <Image>().color = unselected_color; switch (selection_index) { case 0: { CREATE.GetComponent <Image>().color = selected_color; break; } case 1: { DELETE.GetComponent <Image>().color = selected_color; break; } case 2: { COPY.GetComponent <Image>().color = selected_color; break; } case 3: { EXPORT.GetComponent <Image>().color = selected_color; break; } case 4: { ARRAY.GetComponent <Image>().color = selected_color; break; } default: { Debug.Log("Menu selection_index status error, index value : " + selection_index); break; } } //htcvive event handlers if (LeftControllerDriver.getInstance() != null) { //panel if (LeftControllerDriver.getInstance().PanelRightDown()) { addSelectionIndex(); } if (LeftControllerDriver.getInstance().PanelLeftDown()) { diminishSelectionIndex(); } if (LeftControllerDriver.getInstance().PanelDownDown()) { XMenuBase.getInstance().setCurrentStatus(XEnumMenuStatus.MAIN_MENU); return; } if (LeftControllerDriver.getInstance().TriggerDown()) { XEnumFunctionStatus current_function_status = XFunctionInfor.getInstance().getCurrentFunctionStatus(); if (current_function_status == XEnumFunctionStatus.CREATE || current_function_status == XEnumFunctionStatus.DELETE || current_function_status == XEnumFunctionStatus.COPY || current_function_status == XEnumFunctionStatus.EXPORT || current_function_status == XEnumFunctionStatus.ARRAY) { XFunctionInfor.getInstance().setCurrentFunctionStatus(XEnumFunctionStatus.NOTHING); } else { switch (selection_index) { case 0: { XFunctionInfor.getInstance().setCurrentFunctionStatus(XEnumFunctionStatus.CREATE); break; } case 1: { XFunctionInfor.getInstance().setCurrentFunctionStatus(XEnumFunctionStatus.DELETE); break; } case 2: { XFunctionInfor.getInstance().setCurrentFunctionStatus(XEnumFunctionStatus.COPY); break; } case 3: { XFunctionInfor.getInstance().setCurrentFunctionStatus(XEnumFunctionStatus.EXPORT); break; } case 4: { XFunctionInfor.getInstance().setCurrentFunctionStatus(XEnumFunctionStatus.ARRAY); break; } default: { Debug.Log("[FUNCTION SELECITON TRIGGERING] Menu selection_index status error, index value : " + selection_index); break; } } } } } }
private void Awake() { thisInstance = this; }
// Update is called once per frame void Update() { if (!XMenuBase.getInstance().getIsShowMenu()) { return; } if (XMenuBase.getInstance().getCurrentStatus() != XEnumMenuStatus.TRANSFORM) { MOVE.SetActive(false); ROTATE.SetActive(false); SCALE.SetActive(false); GROUP.SetActive(false); return; } else { MOVE.SetActive(true); ROTATE.SetActive(true); SCALE.SetActive(true); GROUP.SetActive(true); } //print selection_index MOVE.GetComponent <Image>().color = unselected_color; ROTATE.GetComponent <Image>().color = unselected_color; SCALE.GetComponent <Image>().color = unselected_color; GROUP.GetComponent <Image>().color = unselected_color; switch (selection_index) { case 0: { MOVE.GetComponent <Image>().color = selected_color; break; } case 1: { ROTATE.GetComponent <Image>().color = selected_color; break; } case 2: { SCALE.GetComponent <Image>().color = selected_color; break; } case 3: { GROUP.GetComponent <Image>().color = selected_color; break; } default: { Debug.Log("Menu selection_index status error, index value : " + selection_index); break; } } //htcvive event handlers if (LeftControllerDriver.getInstance() != null) { //panel if (LeftControllerDriver.getInstance().PanelRightDown()) { addSelectionIndex(); } if (LeftControllerDriver.getInstance().PanelLeftDown()) { diminishSelectionIndex(); } if (LeftControllerDriver.getInstance().PanelDownDown()) { XMenuBase.getInstance().setCurrentStatus(XEnumMenuStatus.MAIN_MENU); return; } if (LeftControllerDriver.getInstance().TriggerDown()) { XEnumFunctionStatus current_function_status = XFunctionInfor.getInstance().getCurrentFunctionStatus(); if (current_function_status == XEnumFunctionStatus.MOVE || current_function_status == XEnumFunctionStatus.ROTATE || current_function_status == XEnumFunctionStatus.SCALE || current_function_status == XEnumFunctionStatus.GROUP) { XFunctionInfor.getInstance().setCurrentFunctionStatus(XEnumFunctionStatus.NOTHING); } else { switch (selection_index) { case 0: { XFunctionInfor.getInstance().setCurrentFunctionStatus(XEnumFunctionStatus.MOVE); break; } case 1: { XFunctionInfor.getInstance().setCurrentFunctionStatus(XEnumFunctionStatus.ROTATE); break; } case 2: { XFunctionInfor.getInstance().setCurrentFunctionStatus(XEnumFunctionStatus.SCALE); break; } case 3: { XFunctionInfor.getInstance().setCurrentFunctionStatus(XEnumFunctionStatus.GROUP); break; } default: { Debug.Log("[FUNCTION SELECITON TRIGGERING] Menu selection_index status error, index value : " + selection_index); break; } } } } } }