Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using UnityEngine;
- using System.Collections;
- using ProgressBar;
- using UnityEngine.SceneManagement;
- public class PromptWindow : MonoBehaviour
- {
- public ProgressRadialBehaviour bar;
- public GameObject ProgressHolder;
- public AsyncOperation _async;
- public static PromptWindow Instance;
- void Start()
- {
- Instance = this;
- }
- public void OnYesClicked()
- {
- ProgressHolder.SetActive(true);
- if(!SaveController.Instance.data.isAccelerator)
- TractorController.Instance.SendDowngradeBT();
- TractorController.Instance.TryToConnectBt = false;
- if (!SaveController.Instance.data.isAccelerator)
- {
- #if UNITY_STANDALONE
- WinBluetoothController.Instance.RequestDisconnect();
- #endif
- TractorController.Instance.UnpairBt();
- }
- StartCoroutine(ShowProgressBar());
- }
- private IEnumerator ShowProgressBar()
- {
- Instance = this;
- yield return new WaitForSeconds(0.1f);
- _async = SceneManager.LoadSceneAsync("Menu");
- _async.allowSceneActivation = false;
- SaveController.Instance.SaveData();
- while (_async.progress < 0.85f)
- {
- yield return new WaitForEndOfFrame();
- }
- TractorController.Instance.GetScreenshot();
- _async.allowSceneActivation = true;
- yield return null;
- }
- void Update()
- {
- if (_async != null)
- {
- bar.Value = _async.progress * 100;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement