|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UDE_HAND_INTERACTION;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
public class ReCalibration : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
public BleManager bleManager;
|
|
|
|
|
|
public GameObject[] Panels;
|
|
|
|
|
|
private int PanelIndex = 0;
|
|
|
|
|
|
|
|
|
|
|
|
public FingerPressController ContinueBtns;
|
|
|
|
|
|
|
|
|
|
|
|
public Image[] LoadBar;
|
|
|
|
|
|
public Text[] Msg;
|
|
|
|
|
|
private float TimeCnt = 3;
|
|
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
ContinueBtns.OnSelect.AddListener(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
Panels[PanelIndex++].SetActive(false);
|
|
|
|
|
|
Panels[PanelIndex].SetActive(true);
|
|
|
|
|
|
TimeCnt = 3;
|
|
|
|
|
|
bleManager.Calibration(0);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Init()
|
|
|
|
|
|
{
|
|
|
|
|
|
PanelIndex = 0;
|
|
|
|
|
|
foreach (var panel in Panels)
|
|
|
|
|
|
{
|
|
|
|
|
|
panel.SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
Panels[PanelIndex].SetActive(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
Init();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
|
void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (PanelIndex > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(TimeCnt == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
Panels[PanelIndex].GetComponentInChildren<UniGifImage>().Play();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TimeCnt -= Time.deltaTime;
|
|
|
|
|
|
if (TimeCnt >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
LoadBar[PanelIndex - 1].fillAmount = 1 - (TimeCnt / 3);
|
|
|
|
|
|
Msg[PanelIndex - 1].text = "Preparation phase " + (int)(TimeCnt + 1) + "s";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (TimeCnt > -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
LoadBar[PanelIndex - 1].fillAmount = -TimeCnt;
|
|
|
|
|
|
Msg[PanelIndex - 1].text = "Calibrating<EFBFBD><EFBFBD>Hold your pose";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
LoadBar[PanelIndex - 1].fillAmount = 1;
|
|
|
|
|
|
bleManager.Calibration(PanelIndex);
|
|
|
|
|
|
if (PanelIndex == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
transform.parent.Find("MainPanel").gameObject.SetActive(true);
|
|
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
|
for(int i = 1; i <= 3; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
Panels[i].GetComponentInChildren<UniGifImage>().ResetGif();
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
Panels[PanelIndex++].SetActive(false);
|
|
|
|
|
|
Panels[PanelIndex].SetActive(true);
|
|
|
|
|
|
TimeCnt = 3;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|