123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- using UnityEngine;
- namespace Nxr.Internal
- {
- /// <summary>
- ///
- /// </summary>
- public class NibiruRemindBox : NibiruRemindBoxBase
- {
- public static NibiruRemindBox Instance { set; get; }
- // [SerializeField]
- private bool isAutoClose = true;
- private Vector2 VOLUMESIZE = new Vector2(60, 1.2f);
- private int VOLUMESTART = -20;
- // private int VOLUMEEND = 36;
- private string typeName = "";
- void Start()
- {
- Instance = this;
- // CloseBox();
- // Calibration();
- }
- /// <summary>
- /// The dialog of low battery。
- /// </summary>
- public void Electricity()
- {
- typeName = "electricity";
- if (this.Init(3))
- {
- Create("BGIcon", new Vector3(0, 0, 0), new Vector2(150, 20));
- Create("Context", LocalizationManager.GetInstance.GetValue("remindbox_lower_power"),
- new Vector3(0, 0, 0), new Vector2(500, 100));
- if (isAutoClose)
- Close();
- }
- }
- public void CalibrationDelay()
- {
- Loom.QueueOnMainThread((param) => { Calibration(); }, true);
- }
- /// <summary>
- /// The dialog of calibration.
- /// </summary>
- public void Calibration()
- {
- typeName = "calibration";
- if (this.Init(3))
- {
- Create("BGIcon", new Vector3(0, 0, 0), new Vector2(150, 20));
- Create("Context", LocalizationManager.GetInstance.GetValue("remindbox_nkey_tip"), new Vector3(0, 0, 0),
- new Vector2(600, 100));
- Create("HandleIcon", new Vector3(0, 48, 0), new Vector2(15, 65));
- if (isAutoClose)
- Close();
- }
- }
-
- // public void CloseBox()
- // {
- // typeName = "close";
- // if (this.Init(4))
- // {
- // Create("Close", LocalizationManager.GetInstance.GetValue("remindbox_shutdown"), new Vector3(0, 10, 0),
- // new Vector2(500, 100));
- // Create("ReStart", LocalizationManager.GetInstance.GetValue("remindbox_reboot"), new Vector3(0, -10, 0),
- // new Vector2(500, 100));
- // Create("CloseIcon", new Vector3(-40, 10, 0), new Vector2(10, 10));
- // Create("ReStartIcon", new Vector3(-40, -10, 0), new Vector2(10, 10));
- // #if NIBIRU_VR
- // Create("dialog_dismiss_normal", new Vector3(50, 16, 0), new Vector2(20, 20));
- // Create("CloseMeIcon", new Vector3(50, 16, 0), new Vector2(20, 20), OnLiftBack);
- // #else
- // Create("dialog_dismiss_normal", new Vector3(70, 16, 0), new Vector2(20, 20));
- // Create("CloseMeIcon", new Vector3(70, 16, 0), new Vector2(20, 20), OnLiftBack);
- // #endif
- // Create("CloseBGIcon", new Vector3(0, 9, 0), new Vector2(100, 18), TurnOff);
- // Create("ReStartBGIcon", new Vector3(0, -9, 0), new Vector2(100, 18), ReStart);
- // if (isAutoClose)
- // Close();
- // }
- // }
- /// <summary>
- /// The dialog of volume.
- /// </summary>
- /// <param name="param"></param>
- public void Volume(string param)
- {
- if (this.typeName.Equals("volume") && remindbox != null)
- {
- Create(new Vector3(VOLUMESTART + (56 * int.Parse(param)) / 15, 0, 0), new Vector2(4.8f, 4.8f));
- }
- else if (this.Init(2))
- {
- this.Create("BGIcon", new Vector3(0, 0, 0), new Vector2(100, 20));
- this.Create("VolumeIcon", new Vector3(-35.8f, 0, 0), new Vector2(7.6f, 7.6f));
- this.Create("VolumeWrite", new Vector3(8, 0, 0), VOLUMESIZE);
- //TODO:更改图标
- this.Create("VolumeTag", new Vector3(VOLUMESTART + (56 * int.Parse(param)) / 15, 0, 0),
- new Vector2(4.8f, 4.8f));
- if (isAutoClose) Close();
- }
- typeName = "volume";
- }
- public void TurnOff()
- {
- NxrViewer.Instance.TurnOff();
- ReleaseDestory();
- }
- public void ReStart()
- {
- NxrViewer.Instance.Reboot();
- ReleaseDestory();
- }
- public void OnLiftBack()
- {
- if (remindbox != null)
- {
- ReleaseDestory();
- }
- }
- #if UNITY_EDITOR
- private void Update()
- {
- if (Input.GetKeyDown(KeyCode.V))
- {
- Volume("1");
- // CloseBox();
- }
- }
- #endif
- }
- public enum RemindBoxParam
- {
- ELECTRICITY,
- CALIBRATION,
- CLOSE,
- VOLUME
- }
- }
|