test: debug

This commit is contained in:
Michel Roux 2024-01-28 16:19:30 +01:00
parent 8902795ecd
commit 44a0a3fb39

View File

@ -10,22 +10,26 @@ public class QuestionHandler : MonoBehaviour
public TextMeshProUGUI explainText; public TextMeshProUGUI explainText;
public PromptList promptList; public PromptList promptList;
private List<Question> player2questions; private List<Question> player2questions;
private int currentQuestion = 0; private int currentQuestion = 1;
void OnEnable() void OnEnable()
{ {
player2questions = gameManager.myRoom.GetQuestionsByPlayer(gameManager.currentPlayer); player2questions = gameManager.myRoom.GetQuestionsByPlayer(gameManager.currentPlayer);
Redraw(++currentQuestion); Debug.Log(currentQuestion);
Debug.Log(JsonUtility.ToJson(player2questions));
Redraw(currentQuestion);
} }
void OnDisable() void OnDisable()
{ {
player2questions = null; player2questions = null;
currentQuestion = 1;
} }
void Redraw(int currentQuestion) void Redraw(int currentQuestion)
{ {
Prompt prompt = promptList.prompts.Find(x => x.id == player2questions[currentQuestion - 1].promptId); Prompt prompt = promptList.prompts.Find(x => x.id == player2questions[currentQuestion - 1].promptId);
Debug.Log(JsonUtility.ToJson(prompt));
explainText.SetText(prompt.en); explainText.SetText(prompt.en);
CameraManager cameraManager = gameObject.GetComponent<CameraManager>(); CameraManager cameraManager = gameObject.GetComponent<CameraManager>();
@ -47,7 +51,8 @@ public void OnSubmitButton()
GetPropRef(gameManager.currentPlayer)); GetPropRef(gameManager.currentPlayer));
if (currentQuestion < 2) { if (currentQuestion < 2) {
Redraw(++currentQuestion); currentQuestion++;
Redraw(currentQuestion);
} else { } else {
gameManager.myRoom.currentState = (int) GameState.PropositionsSent; gameManager.myRoom.currentState = (int) GameState.PropositionsSent;
} }