QUIZZ: Adding quizz
This commit is contained in:
11
Assets/Scripts/ChangeScene.cs.meta
Normal file
11
Assets/Scripts/ChangeScene.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa3c82db14b520041adae82955ebc07a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/Config.meta
Normal file
8
Assets/Scripts/Config.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 739dbd7194fb59c4bb3978970d6a341d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
11
Assets/Scripts/Config/GlobalConfig.cs.meta
Normal file
11
Assets/Scripts/Config/GlobalConfig.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b0498cde75e4aa4fb9b2fb9c71f1531
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
11
Assets/Scripts/MainMenuLoader.cs.meta
Normal file
11
Assets/Scripts/MainMenuLoader.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 343aa02fed4d2da45834acc2c81750b0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/Quizz.meta
Normal file
8
Assets/Scripts/Quizz.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3768333469ef3b43b0eb5679448a46b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
17
Assets/Scripts/Quizz/LoadingManager.cs
Normal file
17
Assets/Scripts/Quizz/LoadingManager.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LoadingManager : MonoBehaviour
|
||||
{
|
||||
public GameObject LoadingScreen;
|
||||
public GameObject TutorialScreen;
|
||||
|
||||
void Start() {
|
||||
LoadingScreen.GetComponent<Canvas>().enabled = false;
|
||||
TutorialScreen.GetComponent<Canvas>().enabled = false;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
}
|
||||
}
|
11
Assets/Scripts/Quizz/LoadingManager.cs.meta
Normal file
11
Assets/Scripts/Quizz/LoadingManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ce983d8b15e46d4491e43d7c8ed2568
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
90
Assets/Scripts/Quizz/OLD.cs
Normal file
90
Assets/Scripts/Quizz/OLD.cs
Normal file
@ -0,0 +1,90 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
[System.Serializable]
|
||||
public class aQuestion
|
||||
{
|
||||
public string aquestion;
|
||||
public string[] answers;
|
||||
public int good_answer;
|
||||
public int type;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class aQuestions
|
||||
{
|
||||
public aQuestion[] aquestions;
|
||||
}
|
||||
|
||||
public class QsuizzManager : MonoBehaviour
|
||||
{
|
||||
public GameObject LoadingCanvas;
|
||||
public GameObject TutorialCanvas;
|
||||
public GameObject aQuestions;
|
||||
public GameObject Home;
|
||||
public TextAsset jsonFile;
|
||||
private bool launched;
|
||||
private bool started;
|
||||
private int answer_button;
|
||||
|
||||
void Start() {
|
||||
LoadingCanvas.GetComponent<Canvas>().enabled = true;
|
||||
TutorialCanvas.GetComponent<Canvas>().enabled = false;
|
||||
aQuestions.GetComponent<Canvas>().enabled = false;
|
||||
Home.GetComponent<Canvas>().enabled = false;
|
||||
launched = false;
|
||||
started = false;
|
||||
}
|
||||
|
||||
public void ShowTutorial() {
|
||||
if (!launched) {
|
||||
LoadingCanvas.GetComponent<Canvas>().enabled = false;
|
||||
TutorialCanvas.GetComponent<Canvas>().enabled = true;
|
||||
launched = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void LaunchQuizz() {
|
||||
if (!started) {
|
||||
TutorialCanvas.GetComponent<Canvas>().enabled = false;
|
||||
Home.GetComponent<Canvas>().enabled = true;
|
||||
started = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void LeaveApp() {
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
private void YesNoaQuestion(aQuestion aquestion) {
|
||||
GameObject.Find("aQuestion").GetComponent<TMP_Text>().text = aquestion.aquestion;
|
||||
GameObject.Find("AnswerA").GetComponentInChildren<TMP_Text>().text = aquestion.answers[0];
|
||||
GameObject.Find("AnswerB").GetComponentInChildren<TMP_Text>().text = aquestion.answers[1];
|
||||
GameObject.Find("HidingCanva").GetComponent<Canvas>().enabled = false;
|
||||
}
|
||||
|
||||
private void ClassicaQuestion(aQuestion aquestion) {
|
||||
GameObject.Find("aQuestion").GetComponent<TMP_Text>().text = aquestion.aquestion;
|
||||
GameObject.Find("HidingCanva").GetComponent<Canvas>().enabled = true;
|
||||
GameObject.Find("AnswerA").GetComponentInChildren<TMP_Text>().text = aquestion.answers[0];
|
||||
GameObject.Find("AnswerB").GetComponentInChildren<TMP_Text>().text = aquestion.answers[1];
|
||||
GameObject.Find("AnswerC").GetComponentInChildren<TMP_Text>().text = aquestion.answers[2];
|
||||
GameObject.Find("AnswerD").GetComponentInChildren<TMP_Text>().text = aquestion.answers[3];
|
||||
}
|
||||
|
||||
public void StartQuizz() {
|
||||
Home.GetComponent<Canvas>().enabled = false;
|
||||
aQuestions.GetComponent<Canvas>().enabled = true;
|
||||
aQuestions aquestions = JsonUtility.FromJson<aQuestions>(jsonFile.text);
|
||||
for (int i = 0; i < aquestions.aquestions.Length; i++) {
|
||||
aQuestion aquestion = aquestions.aquestions[i];
|
||||
if (aquestion.type == 0) {
|
||||
ClassicaQuestion(aquestion);
|
||||
} else {
|
||||
YesNoaQuestion(aquestion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Quizz/OLD.cs.meta
Normal file
11
Assets/Scripts/Quizz/OLD.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4092beca5e50a24d9c6771c5e5eef64
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -20,71 +20,42 @@ public class Questions
|
||||
|
||||
public class QuizzManager : MonoBehaviour
|
||||
{
|
||||
public GameObject LoadingCanvas;
|
||||
public GameObject TutorialCanvas;
|
||||
public GameObject Questions;
|
||||
public GameObject Home;
|
||||
public TextAsset jsonFile;
|
||||
private bool launched;
|
||||
private bool started;
|
||||
private int answer_button;
|
||||
public GameObject LauncherScreen;
|
||||
public GameObject GameScreen;
|
||||
public GameObject Question1;
|
||||
public GameObject Question2;
|
||||
public GameObject Question3;
|
||||
|
||||
void Start() {
|
||||
LoadingCanvas.GetComponent<Canvas>().enabled = true;
|
||||
TutorialCanvas.GetComponent<Canvas>().enabled = false;
|
||||
Questions.GetComponent<Canvas>().enabled = false;
|
||||
Home.GetComponent<Canvas>().enabled = false;
|
||||
launched = false;
|
||||
started = false;
|
||||
void Start()
|
||||
{
|
||||
LauncherScreen.GetComponent<Canvas>().enabled = true;
|
||||
GameScreen.GetComponent<Canvas>().enabled = false;
|
||||
Question1.GetComponent<Canvas>().enabled = true;
|
||||
Question2.GetComponent<Canvas>().enabled = false;
|
||||
Question3.GetComponent<Canvas>().enabled = false;
|
||||
}
|
||||
|
||||
public void ShowTutorial() {
|
||||
if (!launched) {
|
||||
LoadingCanvas.GetComponent<Canvas>().enabled = false;
|
||||
TutorialCanvas.GetComponent<Canvas>().enabled = true;
|
||||
launched = true;
|
||||
}
|
||||
public void LaunchGame() {
|
||||
LauncherScreen.GetComponent<Canvas>().enabled = false;
|
||||
GameScreen.GetComponent<Canvas>().enabled = true;
|
||||
}
|
||||
|
||||
public void LaunchQuizz() {
|
||||
if (!started) {
|
||||
TutorialCanvas.GetComponent<Canvas>().enabled = false;
|
||||
Home.GetComponent<Canvas>().enabled = true;
|
||||
started = true;
|
||||
}
|
||||
public void LeaveQuizz() {
|
||||
|
||||
}
|
||||
|
||||
public void LeaveApp() {
|
||||
Application.Quit();
|
||||
public void ToQuestion2() {
|
||||
Question1.GetComponent<Canvas>().enabled = false;
|
||||
Question2.GetComponent<Canvas>().enabled = true;
|
||||
}
|
||||
|
||||
private void YesNoQuestion(Question question) {
|
||||
GameObject.Find("Question").GetComponent<TMP_Text>().text = question.question;
|
||||
GameObject.Find("AnswerA").GetComponentInChildren<TMP_Text>().text = question.answers[0];
|
||||
GameObject.Find("AnswerB").GetComponentInChildren<TMP_Text>().text = question.answers[1];
|
||||
GameObject.Find("HidingCanva").GetComponent<Canvas>().enabled = false;
|
||||
public void ToQuestion3() {
|
||||
Question2.GetComponent<Canvas>().enabled = false;
|
||||
Question3.GetComponent<Canvas>().enabled = true;
|
||||
}
|
||||
|
||||
private void ClassicQuestion(Question question) {
|
||||
GameObject.Find("Question").GetComponent<TMP_Text>().text = question.question;
|
||||
GameObject.Find("HidingCanva").GetComponent<Canvas>().enabled = true;
|
||||
GameObject.Find("AnswerA").GetComponentInChildren<TMP_Text>().text = question.answers[0];
|
||||
GameObject.Find("AnswerB").GetComponentInChildren<TMP_Text>().text = question.answers[1];
|
||||
GameObject.Find("AnswerC").GetComponentInChildren<TMP_Text>().text = question.answers[2];
|
||||
GameObject.Find("AnswerD").GetComponentInChildren<TMP_Text>().text = question.answers[3];
|
||||
}
|
||||
|
||||
public void StartQuizz() {
|
||||
Home.GetComponent<Canvas>().enabled = false;
|
||||
Questions.GetComponent<Canvas>().enabled = true;
|
||||
Questions questions = JsonUtility.FromJson<Questions>(jsonFile.text);
|
||||
for (int i = 0; i < questions.questions.Length; i++) {
|
||||
Question question = questions.questions[i];
|
||||
if (question.type == 0) {
|
||||
ClassicQuestion(question);
|
||||
} else {
|
||||
YesNoQuestion(question);
|
||||
}
|
||||
}
|
||||
public void ToHome() {
|
||||
LauncherScreen.GetComponent<Canvas>().enabled = true;
|
||||
GameScreen.GetComponent<Canvas>().enabled = false;
|
||||
}
|
||||
}
|
||||
|
11
Assets/Scripts/Quizz/QuizzManager.cs.meta
Normal file
11
Assets/Scripts/Quizz/QuizzManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a035461a9b3e2d49b6b023c2fe528e4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
7
Assets/Scripts/Scripts.asmdef.meta
Normal file
7
Assets/Scripts/Scripts.asmdef.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 943490d65c948264eb4d8287130d9238
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user