/// <summary> /// This method takes the list of words from the current selected word list, /// creates a Counting Game data object from it and sends it off to the model /// via the controller. /// <seealso cref="CON_PlayList.AddOrEditEntry(string, int, object)"/> /// <seealso cref="MOD_PlayList.AddOrEditEntryData(int, int, string, string)"/> /// <seealso cref="DO_CountingGame"/> /// </summary> public void Save() { // Set the duration value to 1. int duration = 1; if (sceneName == countingScene) { // Create bools for the toggle options bool hints = optionsPanel.transform.Find("HintsToggle").gameObject.GetComponent <Toggle>().isOn; bool countAudio = optionsPanel.transform.Find("CountAudioToggle").gameObject.GetComponent <Toggle>().isOn; bool defaultImg = optionsPanel.transform.Find("DefaultImageToggle").gameObject.GetComponent <Toggle>().isOn; bool startAudio = false; // Create the collect and Item Max numbers int collectNum = Convert.ToInt32(collectNumField.text); int itemMax = Convert.ToInt32(itemMaxField.text); DO_CountingGame tempCounting = new DO_CountingGame(CreateWordIdList(), collectNum, itemMax, hints, countAudio, startAudio, defaultImg); if (controller.AddOrEditEntry(countingStr, duration, tempCounting)) { saveSuccessModal.SetActive(true); } else { saveErrorModal.SetActive(true); // TODO: Log an error } } }
/// <summary> /// This method takes the list of words from the current selected word list, /// creates a Memory Cards Game data object from it and sends it off to the model /// via the controller. /// <seealso cref="CON_PlayList.AddOrEditEntry(string, int, object)"/> /// <seealso cref="MOD_PlayList.AddOrEditEntryData(int, int, string, string)"/> /// <seealso cref="DO_MemoryCards"/> /// </summary> public void Save() { // Get the new duration value from the number of children in the current words list scroll view // Duration is set to 1 to fix a bug that would not allow progress past reward nor past end of playlist. int duration = 1; // Create bools for the toggle options bool wordText = optionsPanel.transform.Find("IncludeWordTextToggle").gameObject.GetComponent <Toggle>().isOn; bool alts = optionsPanel.transform.Find("AltImagesToggle").gameObject.GetComponent <Toggle>().isOn; bool wordSound = optionsPanel.transform.Find("WordSoundToggle").gameObject.GetComponent <Toggle>().isOn; DO_MemoryCards tempMemory = new DO_MemoryCards(CreateWordIdList(), wordText, alts, wordSound); Debug.Log("************ created tempMemory data object********"); if (controller.AddOrEditEntry(memoryStr, duration, tempMemory)) { saveSuccessModal.SetActive(true); } else { saveErrorModal.SetActive(true); } }
/// <summary> /// This method takes the list of words from the current selected word list, /// creates a Keyboard Game data object from it and sends it off to the model /// via the controller. /// <seealso cref="CON_PlayList.AddOrEditEntry(string, int, object)"/> /// <seealso cref="MOD_PlayList.AddOrEditEntryData(int, int, string, string)"/> /// <seealso cref="DO_KeyboardGame"/> /// </summary> public void Save() { // Create the word ids list for the playlist dataobject List <int> wordIdsToSave = new List <int>(); foreach (var pair in controller.GetIdToWordsDict()) { foreach (Transform child in currentWordsContent.transform) { if (child.name == pair.Value) { Debug.Log("found word in currentWordsContentList to add to wordsToSave list."); wordIdsToSave.Add(pair.Key); } } } Debug.Log("wordIdsToSave list count = " + wordIdsToSave.Count); // Get the new duration value from the number of children in the current words list scroll view int duration = currentWordsContent.transform.childCount; // Create bools for the toggle options bool letterName = optionsPanel.transform.Find("LetterNameToggle").gameObject.GetComponent <Toggle>().isOn; bool wordSound = optionsPanel.transform.Find("WordSoundToggle").gameObject.GetComponent <Toggle>().isOn; bool letterSound = optionsPanel.transform.Find("LetterSoundToggle").gameObject.GetComponent <Toggle>().isOn; bool keyboardColor = optionsPanel.transform.Find("KeyboardColorToggle").gameObject.GetComponent <Toggle>().isOn; bool provided = optionsPanel.transform.Find("ProvidedToggle").gameObject.GetComponent <Toggle>().isOn; // Create the playlist entry dataobject DO_KeyboardGame tempKeyboard = new DO_KeyboardGame(/* CreateWordIdList() */ wordIdsToSave, wordSound, letterName, letterSound, keyboardColor, provided); if (controller.AddOrEditEntry(keyboardStr, duration, tempKeyboard)) { saveSuccessModal.SetActive(true); } else { saveErrorModal.SetActive(true); // TODO: Log an error } }
/// <summary> /// Saves the playlist entry. /// </summary> public void Save() { // Create the word ids list for the playlist dataobject List <int> wordIdsToSave = new List <int>(); foreach (var pair in controller.GetIdToWordsDict()) { foreach (Transform child in currentWordsContent.transform) { if (child.name == pair.Value) { Debug.Log("found word in currentWordsContentList to add to wordsToSave list."); wordIdsToSave.Add(pair.Key); } } } Debug.Log("wordIdsToSave list count = " + wordIdsToSave.Count); // Get the new duration value from the number of children in the current words list scroll view int duration = currentWordsContent.transform.childCount; // TODO: Create bools for the toggle options // Create the playlist entry dataobject DO_FlashCard tempFlash = new DO_FlashCard(wordIdsToSave); if (controller.AddOrEditEntry(flashStr, duration, tempFlash)) { saveSuccessModal.SetActive(true); } else { saveErrorModal.SetActive(true); // TODO: Log an error } }
public void SaveRewardToPlayList() { // Get the duration from the timer input field int duration = Convert.ToInt32(durationInput.text); Debug.Log("Current Duration: " + duration.ToString()); // Save this choose reward to the playlist through the controller Debug.Log(CLASSNAME + "Sending request to Controller to save reward to playlist..."); DO_ChooseReward tempReward = new DO_ChooseReward(CreateRewardIdsList(), duration); // Success feedback if (controller.AddOrEditEntry(TYPESTR, duration, tempReward)) { successModal.SetActive(true); } else { errorModal.SetActive(true); // TODO: Log an error } }
/// <summary> /// This method takes the list of words from the current selected word list, /// creates a Word Scramble data object from it and sends it off to the model /// via the controller. /// <seealso cref="CON_PlayList.AddOrEditEntry(string, int, object)"/> /// <seealso cref="MOD_PlayList.AddOrEditEntryData(int, int, string, string)"/> /// <seealso cref="DO_WordScramble"/> /// </summary> public void Save() { // Create the word ids list for the playlist dataobject List <int> wordIdsToSave = new List <int>(); foreach (var pair in controller.GetIdToWordsDict()) { foreach (Transform child in currentWordsContent.transform) { if (child.name == pair.Value) { Debug.Log("found word in currentWordsContentList to add to wordsToSave list."); wordIdsToSave.Add(pair.Key); } } } Debug.Log("wordIdsToSave list count = " + wordIdsToSave.Count); // Get the new duration value from the number of children in the current words list scroll view int duration = currentWordsContent.transform.childCount; // Create bools for the toggle options bool snapOn = optionsPanel.transform.Find("LetterSnapToggle").gameObject.GetComponent <Toggle>().isOn; DO_WordScramble tempScramble = new DO_WordScramble(wordIdsToSave, snapOn); if (controller.AddOrEditEntry(scrambleStr, duration, tempScramble)) { saveSuccessModal.SetActive(true); } else { saveErrorModal.SetActive(true); // TODO: Log an error } }
/// <summary> /// This method takes the list of words from the current selected word list, /// creates a Counting Game data object from it and sends it off to the model /// via the controller. /// <seealso cref="CON_PlayList.AddOrEditEntry(string, int, object)"/> /// <seealso cref="MOD_PlayList.AddOrEditEntryData(int, int, string, string)"/> /// <seealso cref="DO_CountingGame"/> /// </summary> public void Save() { // Set the duration value to 1. int duration = 1; // Create bools for the toggle options bool hints = optionsPanel.transform.Find("HintsToggle").gameObject.GetComponent <Toggle>().isOn; bool wordSound = optionsPanel.transform.Find("WordSoundToggle").gameObject.GetComponent <Toggle>().isOn; DO_MatchingGame tempMatching = new DO_MatchingGame(CreateWordIdList(), hints, wordSound); if (controller.AddOrEditEntry("Matching Game", duration, tempMatching)) { saveSuccessModal.SetActive(true); } else { saveErrorModal.SetActive(true); Debug.Log("Error attempting controller.AddOrEditEntry"); } }
private void CreateAutoPlaylistEntries(int part) { // Create a choose reward playlist entry, with pre-set reward time (rewardTime) and types (rewardInts) List <int> rewardInts = new List <int>(); rewardInts.Add(1); DO_ChooseReward tempChooseReward = new DO_ChooseReward(CreateRewardIdsList(), rewardTime); Dictionary <int, int> OrderedFilteredWordIdsDict = CreateOrderedWordIDList(); if (part == maxParts) { int tempint = 0; for (int i = ((wordsPerReward * part)); i <= filteredWordIDListCount; i++) { foreach (var entry in OrderedFilteredWordIdsDict) { if (entry.Key == i) { Debug.Log("sending " + i + " to CreateWordLists"); CreateWordLists(entry.Value); } } tempint++; } int remainderInt = wordsPerReward - tempint; for (int i = 1; i <= remainderInt; i++) { foreach (var entry in OrderedFilteredWordIdsDict) { if (entry.Key == i) { Debug.Log("sending " + i + " to CreateWordLists"); CreateWordLists(entry.Value); } } tempint++; } } else if (part == 0 && part != maxParts) { //////////////////////////////////////////////////////// TESTING NEW CODE HERE for (int i = 1; i <= (wordsPerReward); i++) //TEST CODE { foreach (var entry in OrderedFilteredWordIdsDict) { if (entry.Key == i) { Debug.Log("sending " + i + " to CreateWordLists"); CreateWordLists(entry.Value); } } } } else { for (int i = ((wordsPerReward * part) + 1); i <= (wordsPerReward * (part + 1)); i++) { foreach (var entry in OrderedFilteredWordIdsDict) { if (entry.Key == i) { Debug.Log("sending " + i + " to CreateWordLists"); CreateWordLists(entry.Value); } } } } controller.CreatingNew(); controller.AddOrEditEntry("Choose Reward", rewardTime, tempChooseReward); }