Selecting between user-made levels
In my game, which is a variation of flashcards, the player can create their own flashcard sets and name them. To create the terms, I have an input field for the subject name and then two columns of input fields for the actual terms. I was thinking of creating different dictionaries for each subject the player makes (there can be up to 9 subjects/card sets), but how can I do this with the same input fields? Or I guess I should say...how can I save the terms and definitions with their respective subject name so that different subjects can be selected to play a new game? Here's what I have so far...sorry if this is really messy. BTW, the modal panel is a popup message that tells the user to delete a set since the maximum number of sets that can be stored is 9.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CreateSet : MonoBehaviour
{
public GameObject Subject1;
public GameObject Subject2;
public GameObject Subject3;
public GameObject Subject4;
public GameObject Subject5;
public GameObject Subject6;
public GameObject Subject7;
public GameObject Subject8;
public GameObject Subject9;
public Text subject1;
public Text subject2;
public Text subject3;
public Text subject4;
public Text subject5;
public Text subject6;
public Text subject7;
public Text subject8;
public Text subject9;
public InputField subjectName;
public static Button ContinueButton;
public GameObject modalPanel;
public InputField term1;
public InputField term2;
public InputField term3;
public InputField term4;
public InputField term5;
public InputField term6;
public InputField term7;
public InputField term8;
public InputField term9;
public InputField term10;
public InputField term11;
public InputField term12;
public InputField term13;
public InputField term14;
public InputField term15;
public InputField def1;
public InputField def2;
public InputField def3;
public InputField def4;
public InputField def5;
public InputField def6;
public InputField def7;
public InputField def8;
public InputField def9;
public InputField def10;
public InputField def11;
public InputField def12;
public InputField def13;
public InputField def14;
public InputField def15;
public void SetName()
{
subject1.text = "1. " + subjectName.text;
if (subject1.text != null)
{
subject2.text = "2. " + subjectName.text;
if (subject2.text != null)
{
subject3.text = "3. " + subjectName.text;
if (subject3.text != null)
{
subject4.text = "4. " + subjectName.text;
if (subject4.text != null)
{
subject5.text = "5. " + subjectName.text;
if (subject5.text != null)
{
subject6.text = "6. " + subjectName.text;
if (subject6.text != null)
{
subject7.text = "7. " + subjectName.text;
if (subject7.text != null)
{
subject8.text = "8. " + subjectName.text;
if (subject8.text != null)
{
subject9.text = "9. " + subjectName.text;
if (subject9.text != null)
{
modalPanel.SetActive(true);
}
}
}
}
}
}
}
}
}
}
public Dictionary<string, string> termsDefs;
private void Start ()
{
termsDefs = new Dictionary<string, string>();
termsDefs.Add(term1.text, def1.text);
termsDefs.Add(term2.text, def2.text);
termsDefs.Add(term3.text, def3.text);
termsDefs.Add(term4.text, def4.text);
termsDefs.Add(term5.text, def5.text);
termsDefs.Add(term6.text, def6.text);
termsDefs.Add(term7.text, def7.text);
termsDefs.Add(term8.text, def8.text);
termsDefs.Add(term9.text, def9.text);
termsDefs.Add(term10.text, def10.text);
termsDefs.Add(term11.text, def11.text);
termsDefs.Add(term12.text, def12.text);
termsDefs.Add(term13.text, def13.text);
termsDefs.Add(term14.text, def14.text);
termsDefs.Add(term15.text, def15.text);
}
}