62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using TMPro;
|
|
|
|
public class optionClicked : MonoBehaviour
|
|
{
|
|
|
|
public GameObject debug;
|
|
|
|
private OptionLogic latestLevel;
|
|
|
|
public bool done;
|
|
public string choiseVal;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void ClickButton(string choise){
|
|
|
|
latestLevel.optionSelected(choise);
|
|
choiseVal = choise;
|
|
done = true;
|
|
}
|
|
|
|
public IEnumerator StartOptionChoise(Action<string> callback){
|
|
done = false;
|
|
bool tick = true;
|
|
while (!done){
|
|
//debug.GetComponent<TextMeshProUGUI>().text = "<font=\"Urbscape SDF\"><mark=#00000>" + "not done: " + tick + choiseVal + "</mark>";
|
|
tick = !tick;
|
|
yield return null;
|
|
}
|
|
debug.GetComponent<TextMeshProUGUI>().text = "<font=\"Urbscape SDF\"><mark=#00000>" + "done: " + choiseVal + "</mark>";
|
|
callback?.Invoke(choiseVal);
|
|
}
|
|
|
|
public void SetLevel(OptionLogic level)
|
|
{
|
|
debug.GetComponent<TextMeshProUGUI>().text = "<font=\"Urbscape SDF\"><mark=#00000>" + "set level: " + "</mark>";
|
|
|
|
Debug.Log("SetLevel!!!");
|
|
latestLevel = level;
|
|
}
|
|
|
|
|
|
public void timeOut(){
|
|
choiseVal = "timeout";
|
|
done = true;
|
|
}
|
|
}
|