using SC.XR.Unity.Module_InputSystem; using UnityEngine; using UnityEngine.UI; using static BoundingBox; public class Patch_VideoController : AbstractController { [SerializeField] private BoundingBox boundingBox; [SerializeField] private ManipulationHandler manipulationHandler; [SerializeField] private BoxCollider boxCollider; void Start() { boundingBox = GetComponent(); manipulationHandler = GetComponent(); boxCollider = GetComponent(); if (manipulationHandler != null) { manipulationHandler.enabled = false; } if (boundingBox != null) { boundingBox.enabled = false; } if (boxCollider != null) { boxCollider.enabled = false; } if (GameObject.Find("SetBtn/2.1/Canvas/Parent/EditorBtn/Toggle")) toggle = GameObject.Find("SetBtn/2.1/Canvas/Parent/EditorBtn/Toggle").GetComponent(); } private Toggle toggle; private void Update() { // Debug.Log("GameManager.m_IsStart20Editor Update"); if (toggle&&!UserInfo.Instance.is20) { // Debug.Log("GameManager.m_IsStart20Editor !is20"); if (!toggle.isOn) { if (manipulationHandler != null) manipulationHandler.enabled=false; if (boundingBox != null) { boundingBox.enabled = false; if (transform.Find("BoundingBox")&&transform.Find("BoundingBox").gameObject != null) transform.Find("BoundingBox").gameObject.SetActive(false); } if (boxCollider != null) boxCollider.enabled = false; } else { if (manipulationHandler == null) { manipulationHandler = gameObject.AddComponent(); } else { manipulationHandler.enabled = true; } if (boundingBox == null) { boundingBox = gameObject.AddComponent(); boundingBox.FlattenAxis = FlattenModeType.FlattenZ; boundingBox.ActiveHandle = HandleType.Rotation | HandleType.Scale; }else { boundingBox.enabled = true; if (transform.Find("BoundingBox") && transform.Find("BoundingBox").gameObject != null) transform.Find("BoundingBox").gameObject.SetActive(true); } if (boxCollider != null) boxCollider.enabled = true; else { boxCollider = gameObject.AddComponent(); } } }else if(UserInfo.Instance.is20) { Debug.Log("GameManager.m_IsStart20Editor !GameManager.m_IsStart20Editor"); if (!GameManager.m_IsStart20Editor) { Debug.Log("GameManager.m_IsStart20Editor"); if (manipulationHandler != null) manipulationHandler.enabled = false; if (boundingBox != null) { boundingBox.enabled = false; if (transform.Find("BoundingBox") && transform.Find("BoundingBox").gameObject != null) transform.Find("BoundingBox").gameObject.SetActive(false); } if (boxCollider != null) boxCollider.enabled = false; } else { if (manipulationHandler == null) { manipulationHandler = gameObject.AddComponent(); } else { manipulationHandler.enabled = true; } if (boundingBox == null) { boundingBox = gameObject.AddComponent(); boundingBox.FlattenAxis = FlattenModeType.FlattenZ; boundingBox.ActiveHandle = HandleType.Rotation | HandleType.Scale; } else { boundingBox.enabled = true; if (transform.Find("BoundingBox") && transform.Find("BoundingBox").gameObject != null) transform.Find("BoundingBox").gameObject.SetActive(true); } if (boxCollider != null) boxCollider.enabled = true; else { boxCollider = gameObject.AddComponent(); } } isBox = boxCollider.enabled; isMan = manipulationHandler.enabled; isboud = boundingBox.enabled; } } public bool isBox; public bool isMan; public bool isboud; }