75 lines
1.7 KiB
C#
75 lines
1.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class StepSkipController : MonoBehaviour
|
|
{
|
|
public InputField inputPassword;
|
|
public Text txtNbr, txtNomeEtapa, txtTipo;
|
|
|
|
int actualStep = 0;
|
|
|
|
GeneralScript general;
|
|
|
|
void SetText()
|
|
{
|
|
txtNomeEtapa.text = general.etapa[actualStep].description;
|
|
txtTipo.text = StepsShow_Control.instance.SearchForType(general.etapa[actualStep].type).nameToShow;
|
|
txtNbr.text = (actualStep + 1).ToString();
|
|
}
|
|
|
|
public void AddValue(int add)
|
|
{
|
|
int nextStep = actualStep + add;
|
|
|
|
if (nextStep >= 0 && nextStep < general.etapa.Length)
|
|
{
|
|
actualStep = nextStep;
|
|
SetText();
|
|
}
|
|
}
|
|
|
|
public void EnterPassword()
|
|
{
|
|
string password = inputPassword.text;
|
|
|
|
if (password == "151613")
|
|
{
|
|
GetComponent<Animator>().SetTrigger("open");
|
|
general = GeneralScript.instance;
|
|
|
|
SetText();
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
|
|
public void CancelNQuit()
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
public void SkipProgress()
|
|
{
|
|
StartCoroutine(SkipProgressCor());
|
|
}
|
|
|
|
IEnumerator SkipProgressCor()
|
|
{
|
|
ApiClass api = ApiClass.instance;
|
|
int compareStep = actualStep + 1;
|
|
//if (compareStep > api.updateStep.actualexercise)
|
|
//{
|
|
Debug.Log("Updating");
|
|
api.updateStep.actualexercise = actualStep;
|
|
|
|
yield return StartCoroutine(api.updateStepClass());
|
|
//}
|
|
|
|
UnityEngine.SceneManagement.SceneManager.LoadSceneAsync("DoingClass", UnityEngine.SceneManagement.LoadSceneMode.Single);
|
|
}
|
|
}
|