1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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
- {
- /// <summary>
- /// 结束考试按钮
- /// </summary>
- public ButtonItem endExamBtn;
- /// <summary>
- /// 继续考试按钮
- /// </summary>
- 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<PlayMoveWayController>();
- 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<PlayMoveWayController>();
- if (cameraController != null) cameraController.enabled = true;
- transform.parent.DOScale(Vector3.zero, 0.5f).OnComplete(() => Destroy(this.transform.parent.gameObject));
- });
- }
- }
|