- Home /
How to make review system in quiz game?
Hi all ,I want to make a review system in my quiz game.
The player can review the questions on every Level before playing.
I want to show 10 questions each round.
But it will show Round 1-1,Round 2-2, Round 3-3...to Round 10-10 , total ten questions.
This is not what I want. I want Round 1 , 1-10 questions.
Can someone check my code and give me a point.
Thank !
RoundData:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class RoundData
{
public string _name;
public float timeLimitInSeconds ;
public QueData[] questions;
}
QueData:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class QueData
{
public string queText;
public AnsData[] answers;
}
QueButton:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class QueButton : MonoBehaviour
{
public Text queText;
private QueData queData;
public void QueSetup(QueData data)
{
queData = data;
queText.text = queData.queText;
}
}
QuizCon:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using UnityEngine.Networking;
using System.Text;
public class QuizCon : MonoBehaviour
{
public RoundData[] allRoundData;
public Transform queButtonParent;
public SimpleObjectPool queButtonObjectPool;
private int index;
private string gameDataFileName = "quiz.json";
private void Start()
{
//index = PlayerPrefs.GetInt("NowLevelStage");
DontDestroyOnLoad(gameObject);
StartCoroutine(testload());
ShowQue();
}
public RoundData GetCurrectRoundData()
{
return allRoundData[index];
}
public void RoundAdd(int LevelNum)
{
index = LevelNum;
}
private void ShowQue()
{
for (int i = 0; i < allRoundData.Length; i++)
{
RoundData round = allRoundData[i];
GameObject queButtonObject = queButtonObjectPool.GetObject();
queButtonObject.transform.SetParent(queButtonParent);
QueButton queButton = queButtonObject.GetComponent<QueButton>();
queButton.QueSetup(round.questions[i]);
}
}
Like this
you need to tell us why is not working and whats happening
sorry , I didn't say it clearly. I will update my information ,and try my best to explain the situation.
Answer by xxmariofer · Sep 02, 2019 at 08:56 AM
private void ShowQue()
{
RoundData round = allRoundData[index];
for (int i = 0; i < round.Questions.Lenght; i++)
{
GameObject queButtonObject = queButtonObjectPool.GetObject();
queButtonObject.transform.SetParent(queButtonParent);
QueButton queButton = queButtonObject.GetComponent<QueButton>();
queButton.QueSetup(round.questions[i]);
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612211440im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Quiz game with images 0 Answers
Question about game setup 0 Answers
Creating a Multiple Choice Game 2 Answers
Code to integrate Json database? 2 Answers
Make quiz game Confused About PlayerPrefs and database 1 Answer