|
@@ -1,8 +1,8 @@
|
|
|
using System.Collections;
|
|
|
-using System.Collections.Generic;
|
|
|
using Blue;
|
|
|
using SC.XR.Unity.Module_InputSystem;
|
|
|
using UnityEngine;
|
|
|
+using UnityEngine.UI;
|
|
|
|
|
|
public class Patch_VideoController : AbstractController
|
|
|
{
|
|
@@ -11,35 +11,57 @@ public class Patch_VideoController : AbstractController
|
|
|
[SerializeField] private GameObject obj_BoundingBox;
|
|
|
void Start()
|
|
|
{
|
|
|
+ if (GetComponent<ManipulationHandler>() != null)
|
|
|
+ {
|
|
|
+ Destroy(manipulationHandler);
|
|
|
+ }
|
|
|
+
|
|
|
this.RegisterEvent<Patch_VideoEvent>(e=>
|
|
|
{
|
|
|
if(e.set)
|
|
|
{
|
|
|
- if(obj_BoundingBox!=null)
|
|
|
- {
|
|
|
- obj_BoundingBox.SetActive(true);
|
|
|
- manipulationHandler.enabled = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- boundingBox.enabled = true;
|
|
|
- manipulationHandler.enabled = true;
|
|
|
- StartCoroutine(GetBoundingBox());
|
|
|
- }
|
|
|
+ manipulationHandler = gameObject.AddComponent<ManipulationHandler>();
|
|
|
+
|
|
|
+ boundingBox.enabled = true;
|
|
|
+ manipulationHandler.enabled = true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- obj_BoundingBox.SetActive(false);
|
|
|
+ if (transform.Find("BoundingBox").gameObject != null)
|
|
|
+ Destroy(transform.Find("BoundingBox").gameObject);
|
|
|
boundingBox.enabled = false;
|
|
|
- manipulationHandler.enabled = false;
|
|
|
+ Destroy(manipulationHandler);
|
|
|
}
|
|
|
});
|
|
|
+ */
|
|
|
+ toggle = GameObject.Find("SetBtn/Canvas/Parent/EditorBtn/Toggle").GetComponent<Toggle>();
|
|
|
}
|
|
|
|
|
|
- private IEnumerator GetBoundingBox()
|
|
|
+ private Toggle toggle;
|
|
|
+ private bool des;
|
|
|
+ private void Update()
|
|
|
{
|
|
|
- yield return null;
|
|
|
- if(transform.Find("BoundingBox").gameObject!=null)
|
|
|
- obj_BoundingBox = transform.Find("BoundingBox").gameObject;
|
|
|
+ if(!toggle.isOn)
|
|
|
+ {
|
|
|
+ if(des)
|
|
|
+ {
|
|
|
+ if (transform.Find("BoundingBox").gameObject != null)
|
|
|
+ Destroy(transform.Find("BoundingBox").gameObject);
|
|
|
+ boundingBox.enabled = false;
|
|
|
+ Destroy(manipulationHandler);
|
|
|
+ des = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(!des)
|
|
|
+ {
|
|
|
+ manipulationHandler = gameObject.AddComponent<ManipulationHandler>();
|
|
|
+
|
|
|
+ boundingBox.enabled = true;
|
|
|
+ manipulationHandler.enabled = true;
|
|
|
+ des = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|