123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- using Blue;
- using UnityEngine;
- using UnityEngine.Events;
- using UnityEngine.UI;
- namespace GHZLangChao
- {
- public class StartXunJian : AbstractController
- {
- public bool Test = true;
- [SerializeField] private RawImage ShowRawImage; // 显示的视频画面
- [SerializeField] private GameObject ShowRaw_go; // 显示的视频画面父物体
- [SerializeField] private Image[] arrayImage; // 截图显示的画面
- //[SerializeField] private Image ScreenshotImage; // 截图的画面
- private int arrayImageIndex = 0; // 截图显示时要显示在哪个Image上的下标
- [SerializeField] private Button[] ScreenshotBtnList;
- [SerializeField] private Button CancelBtn;
- [SerializeField] private Button SaveBtn;
- [SerializeField] private bool[] toggleBoolList;
- [SerializeField] private GameObject DefaultUI_go;
- [SerializeField] private GameObject EndUI_go;
- [SerializeField] private Button Titile_Btn;
- public UnityEvent OnReset = new UnityEvent();
- public UnityEvent OnRetract = new UnityEvent();
- public UnityEvent OnExpand = new UnityEvent();
- void Start()
- {
- foreach (Button btn in ScreenshotBtnList)
- {
- btn.onClick.AddListener(ClickScreenshot);
- }
- SaveBtn.onClick.AddListener(ClickSave);
- Titile_Btn.onClick.AddListener(ClickTitle);
- //CancelBtn.onClick.AddListener(ClickCancel);
- }
- private void Update()
- {
- #if UNITY_EDITOR
- if (Test) return;
- #endif
- OnReset?.Invoke();
- }
- public void Next()
- {
- ShowXunJian.Instance.gotoWindow(ScenesManager.SceneType.ShowDH);
- }
- public void back()
- {
- ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose);
- }
- public void ShowDeviceInfo()
- {
- ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowDevice);
- }
- #region 按钮点击
- [SerializeField] private Sprite mScreenshotSprite;
- private void ClickScreenshot()
- {
- if (!ShowRaw_go.activeSelf)
- {
- ShowRaw_go.SetActive(true);
- XRRGBCamera.Instance.playCamera(1280, 720);
- ShowRawImage.texture = XRRGBCamera.Instance.CaptureImage;
- }
- }
- private void ClickSave()
- {
- var sprite = this.GetUtility<IRawImageForSpriteUtility>().SwitchSprite(ShowRawImage);
- //ScreenshotImage.gameObject.SetActive(true);
- //ScreenshotImage.sprite = sprite;
- arrayImage[arrayImageIndex].sprite = sprite;
- arrayImageIndex++;
- if (arrayImageIndex % 3 == 0)
- {
- arrayImageIndex -= 3;
- }
- }
- public void SetIndex(int index)
- {
- this.arrayImageIndex = index;
- }
- private void ClickCancel()
- {
- /*
- arrayImageIndex--;
- if (arrayImageIndex < 0)
- arrayImageIndex = arrayImage.Length - 1;
- arrayImage[arrayImageIndex].sprite = mScreenshotSprite;
- */
- }
- public void End()
- {
- foreach (bool isOn in toggleBoolList)
- {
- if (!isOn)
- {
- DefaultUI_go.SetActive(true);
- return;
- }
- }
- EndUI_go.SetActive(true);
- //ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose);
- }
- public void SetToogleBool(int index)
- {
- toggleBoolList[index] = true;
- }
- private bool isRetract = false;
- private void ClickTitle()
- {
- isRetract = !isRetract;
- if(isRetract)
- OnRetract?.Invoke();
- else
- OnExpand?.Invoke();
- }
- #endregion
- }
- }
|