- Home /
Printing a GUI selection grid in order
I have a question regarding the use of lists. I have come up with a diagram that better describes what I have managed to accomplish for my school project and afterwards I will depict my issue.
The next step is where I am getting a mental block because I have to print that list in the order in which the random number generator selected them during gameplay.
I sort of have an idea on how to go about it but the MAIN issue I am having is that I have a GUI selection grid for the user to select which one of the messages he/she liked the most.
It was easy before when the list was in static order but now that the professor wants the list randomized I do not know how to randomize a selection grid.
This diagram will help illustrate where I am with this:
If anyone has any idea on how to go about this I will be much obliged. Hope I was clear enough and I await your responses. God bless and Happy New Year!!!
Answer by HappyMoo · Jan 02, 2014 at 05:44 PM
We meet again... Muahahahah ;)
well.. instead of just removing them from the list, also add them to another list, so you know in what order they were selected.
Is this what you want?
private List<string> selection = List<string>();
bool showNext()
{
if (messages.Count==0) return false;
int randomIndex = Random.Range(0, messages.Count);
currentString = messages[randomIndex];
selection.Add(currentString);
messages.RemoveAt(randomIndex);
return true;
}
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
my random task generator not working 1 Answer
Printing an ordered list 1 Answer
Making a camera list 1 Answer