using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; using UnityEngine.UI; using ChivaXR.Op; using ProcedureBYQ; using VRTK; public class EndExamPanel : MonoBehaviour { /// /// 结束考试按钮 /// public ButtonItem endExamBtn; /// /// 继续考试按钮 /// public ButtonItem continueExamBtn; public void OnEnable() { this.transform.parent.localScale = Vector3.zero; SetSelfPositionAndDisableCameraMove(); } public void SetSelfPositionAndDisableCameraMove() { Transform hander = VRTK_DeviceFinder.HeadsetTransform(); transform.parent.position = hander.transform.position + new Vector3(hander.transform.forward.x, 0, hander.transform.forward.z).normalized * 1.5f; transform.parent.eulerAngles = new Vector3(0, hander.transform.eulerAngles.y, 0); this.transform.parent.DOScale(new Vector3(0.001f, 0.001f, 0.001f), 0.5f); PlayMoveWayController cameraController = FindObjectOfType(); if (cameraController != null) cameraController.enabled = false; } void Start() { // 确定按钮 endExamBtn.BtnClickState.AddListener(() => { //GeneralMethod.AddDataToStatisticalTable(); ExamManagerForVR.instance.ExamFinish(); transform.parent.DOScale(Vector3.zero, 0.5f).OnComplete(() => Destroy(this.transform.parent.gameObject)); }); // 取消按钮 continueExamBtn.BtnClickState.AddListener(() => { PlayMoveWayController cameraController = FindObjectOfType(); if (cameraController != null) cameraController.enabled = true; transform.parent.DOScale(Vector3.zero, 0.5f).OnComplete(() => Destroy(this.transform.parent.gameObject)); }); } }