private void InitialiseProjectsCombobox() { var items = new DbQueries().QueryProjects().Rows.Cast <DataRow>().Select(r => r[0]).ToArray(); if (items.Length == 0) { var noProjectsFound = "No projects found"; projectsDropdown.Items.Clear(); projectsDropdown.Items.Add(noProjectsFound); projectsDropdown.Text = noProjectsFound; projectsDropdownOnHistoryTab.Items.Clear(); projectsDropdownOnHistoryTab.Items.Add(noProjectsFound); projectsDropdownOnHistoryTab.Text = noProjectsFound; return; } projectsDropdown.Items.Clear(); projectsDropdown.Items.AddRange(items); projectsDropdown.Text = items[0].ToString(); projectsDropdownOnHistoryTab.Items.Clear(); projectsDropdownOnHistoryTab.Items.AddRange(items); projectsDropdownOnHistoryTab.Text = items[0].ToString(); }
private void InsertQuest() { DbCommands.InsertTupleToTable("Quests", inputQuestDetailsName.text, inputQuestDetailsDesc.text); FillDisplayFromDb(DbQueries.GetQuestsDisplayQry(), questsList.transform, BuildQuest); }
private void DisplayTestHistory(string project, string testId) { try { Cursor.Current = Cursors.WaitCursor; var testHistoryDataSet = new DbQueries().QueryTestHistoryFromDb(project, testId); var testHistoryTable = testHistoryDataSet.Tables[0]; testHistoryGrid.DataSource = testHistoryTable; testHistoryGrid.Columns["TestSummary"].Width = 300; if (testHistoryTable.Rows.Count == 0) { testHistoryGrid.DataSource = null; } } catch (Exception e) { Console.WriteLine(e); throw; } finally { Cursor.Current = Cursors.Default; testHistoryGrid.Refresh(); } }
public void ActivateQuestTasks(string choiceID) { QuestsController questsController = FindObjectOfType <QuestsController>(); int countTaskActivateResults = DbCommands.GetCountFromQry(DbQueries.GetTaskActivateCountFromChoiceIDqry(choiceID)); if (countTaskActivateResults > 0) { print("Task ACTIVATING!!!!"); List <string[]> tasksActivatedList; DbCommands.GetDataStringsFromQry(DbQueries.GetCurrentActivateTasksPlayerChoiceResultQry(choiceID), out tasksActivatedList); foreach (string[] activatedTask in tasksActivatedList) { questsUI.InsertActivatedTask(activatedTask[1], activatedTask[3], activatedTask[2]); //a list of task parts in task that are prefab types are iterated over (if any) and instantiated. List <string[]> prefabParts = new List <string[]>(); DbCommands.GetDataStringsFromQry(DbQueries.GetPrefabTaskPartsFromTaskIDqry(activatedTask[1]), out prefabParts); foreach (string[] prefabPart in prefabParts) { string prefabPath = prefabPart[0]; string partID = prefabPart[1]; UnityEngine.Object prefabTaskPartObj = Resources.Load(prefabPath); print(prefabPath); GameObject prefabTaskPart = Instantiate(prefabTaskPartObj, new Vector2(0f, 0f), Quaternion.identity) as GameObject; prefabTaskPart.GetComponent <QuestTaskPart>().InitialiseMe(partID, activatedTask[1], activatedTask[3]); prefabTaskPart.transform.SetParent(questsController.transform, false); } } } }
public void ToggleSideMenuToTagsList() { if (!GetPanel().activeSelf) { translationUI.ToggleMenuTo(GetComponent <UIController>(), translationUI.SideMenuGroup); translationUI.ToggleSelectedSideMenuButton(tagsListBtn); } Translation translation = (Translation)(vocabTranslationListUI.GetSelectedItemFromGroup(vocabTranslationListUI.VocabTranslationSelected)); string eng, cym; if (translation == null) { eng = cym = null; } else { eng = translation.CurrentEnglish; cym = translation.CurrentWelsh; } FillDisplayFromDb(DbQueries.GetTaggedVocabDisplayQry(eng, cym), tagsList.transform, BuildTag, eng, cym ); }
private void LoadWorldItems() { string saveIDstr = PlayerPrefsManager.GetSaveGame().ToString(); WorldItems worldItems = FindObjectOfType <WorldItems>(); worldItems.DestroyWorldItems(); List <string[]> newWorldItemsList = new List <string[]>(); //Debugging.PrintDbQryResults(DbQueries.GetSavedWorldItemsQry(saveIDstr, sceneLoader.GetCurrentSceneName()), saveIDstr, sceneLoader.GetCurrentSceneName()); DbCommands.GetDataStringsFromQry(DbQueries.GetSavedWorldItemsQry(saveIDstr, sceneLoader.GetCurrentSceneName()), out newWorldItemsList, saveIDstr, sceneLoader.GetCurrentSceneName()); foreach (string[] worldItemData in newWorldItemsList) { string prefabPath = worldItemData[5]; UnityEngine.Object worldItemPrefab = Resources.Load(prefabPath); GameObject worldItem = Instantiate(worldItemPrefab, new Vector2(0f, 0f), Quaternion.identity) as GameObject; string[] parentPath = worldItemData[3].Split('/'); Transform parentTransform = GameObject.Find(parentPath[1]).transform; for (int i = 2; i < parentPath.Length - 1; i++) { parentTransform = parentTransform.Find(parentPath[i]); } worldItem.transform.SetParent(parentTransform, false); worldItem.transform.position = new Vector3(float.Parse(worldItemData[0]), float.Parse(worldItemData[1]), float.Parse(worldItemData[2])); worldItem.name = worldItemData[4]; } }
public void ToggleSideMenuToGrammarList() { if (!GetPanel().activeSelf) { print("panelactive"); translationUI.ToggleMenuTo(GetComponent <UIController>(), translationUI.SideMenuGroup); proficienciesListUI.ProficienciesBtn.colors.normalColor.Equals(Colours.colorDataUIbtn); grammarRulesBtn.colors.normalColor.Equals(Colours.colorDataUItxt); } Translation translation = (Translation)(vocabTranslationListUI.GetSelectedItemFromGroup(vocabTranslationListUI.VocabTranslationSelected)); string eng, cym; if (translation == null) { eng = cym = null; } else { eng = translation.CurrentEnglish; cym = translation.CurrentWelsh; } FillDisplayFromDb(DbQueries.GetGrammarRuleDisplayQry(eng, cym), grammarList.transform, BuildRule, eng, cym ); }
public void DisplayChoicesRelatedToNode() { GetPanel().SetActive(true); DialogueNode currentDialogueNode = (dialogueNodesListUI.GetSelectedItemFromGroup(dialogueNodesListUI.SelectedNode) as DialogueNode); FillDisplayFromDb(DbQueries.GetPlayerChoiceDisplayQry(currentDialogueNode.MyID), playerChoicesList.transform, BuildPlayerChoiceTextOnly); AppendDisplayFromDb(DbQueries.GetPlayerChoiceVocabDisplayQry(currentDialogueNode.MyID), playerChoicesList.transform, BuildPlayerChoiceVocab); }
public void Checksum_When_empty_query_Returns_Null() { var q = DbQueries.Empty(); var c = _checksumGenerator.Generate(q); Assert.That(c, Is.EqualTo(null)); }
public void Checksum_When_query_has_sql_but_no_params_Returns_checksum() { var q = DbQueries.Sql(); var c = _checksumGenerator.Generate(q); Assert.That(c, Is.EqualTo(ChecksumsFor.Sql)); }
public void Checksum_When_query_has_sql_and_both_simple_and_array_params_Returns_checksum_for_both_sql_and_params() { var q = DbQueries.SqlAndSimpleAndArrayDacParams(); var c = _checksumGenerator.Generate(q); Assert.That(c, Is.EqualTo(ChecksumsFor.SqlAndSimpleAndArrayDacParams)); }
public void ToggleSideMenuToProficienciesList() { if (!GetPanel().activeSelf) { translationUI.ToggleMenuTo(GetComponent <UIController>(), translationUI.SideMenuGroup); translationUI.ToggleSelectedSideMenuButton(proficienciesBtn); } FillDisplayFromDb(DbQueries.GetProficienciesDisplayQry(), ProficienciesList.transform, BuildProficiency); }
public void InsertProficiency() { if ((inputProficiencyTxt.text != null) && (inputProficiencyTxt.text != "")) { DbCommands.InsertTupleToTable("Proficiencies", inputProficiencyTxt.text, inputThresholdTxt.text); FillDisplayFromDb(DbQueries.GetProficienciesDisplayQry(), proficienciesList.transform, BuildProficiency); inputProficiencyTxt.text = ""; inputThresholdTxt.text = ""; } }
public void DisplayNodesRelatedToDialogue() { DisplayComponents(); Dialogue currentDialogue = (dialogueUI.GetSelectedItemFromGroup(dialogueUI.selectedDialogue) as Dialogue); FillDisplayFromDb(DbQueries.GetDialogueNodeDisplayQry(currentDialogue.MyID), dialogueNodesList, BuildDialogueNodeTextOnly); AppendDisplayFromDb(DbQueries.GetDialogueNodeVocabDisplayQry(currentDialogue.MyID), dialogueNodesList, BuildDialogueNodeVocabTest); Debugging.PrintDbQryResults(DbQueries.GetDialogueNodeVocabDisplayQry(currentDialogue.MyID)); Debugging.PrintDbTable("DialogueNodesVocabTests"); Debugging.PrintDbTable("DialogueNodes"); }
/// <summary> /// The characters from the game are updated so that you know which ones still exist in the scene and are given the option /// to delete them (from the Data UI -> Dialogues UI -> Character lists(s?)) when the list is built. New characters in the scene are also added. /// </summary> public void UpdateCharactersTableFromGame() { SceneLoader sceneLoader = new SceneLoader(); string currentScene = sceneLoader.GetCurrentSceneName(); InsertCharsNotInDbFromScene(currentScene); List <string[]> characterNamesList = new List <string[]>(); DbCommands.GetDataStringsFromQry(DbQueries.GetCharacterNamesWithScene(currentScene), out characterNamesList, currentScene); UpdateCharsInDbNoLongerInScene(characterNamesList); }
public void DisplayTaskParts() { partsList = (Instantiate(partsListPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject).GetComponent <VerticalLayoutGroup>(); partsList.transform.SetParent(transform.parent, false); partsList.transform.SetSiblingIndex(transform.GetSiblingIndex() + 1); FillDisplayFromDb(DbQueries.GetEquipItemPartsRelatedToTask(myID), partsList.transform, BuildEquipItemPart, myID); AppendDisplayFromDb(DbQueries.GetPrefabPartsRelatedToTask(myID), partsList.transform, BuildPrefabPart, myID); AppendDisplayFromDb(DbQueries.GetActivateDialoguePartsRelatedToGameTaskQry(myID), partsList.transform, BuildActivateDialogueNodePart, myID); AppendDisplayFromDb(DbQueries.GetCompleteQuestPartsRelatedToTaskQry(myID), partsList.transform, BuildCompleteQuest, myID); AppendDisplayFromDb(DbQueries.GetDefeatCharTagPartsRelatedToTaskQry(myID), partsList.transform, BuildDefeatCharTagPart, myID); arrowTransform.Rotate(0, 0, -90); }
public void DisplayNewWelsh(string choiceID) { newWelshList = GetPanel().transform.Find("ScrollWindow").Find("NewWelshList").gameObject; EmptyDisplay(newWelshList.transform); AppendDisplayFromDb(DbQueries.GetCurrentActivateGrammarPlayerChoiceResultQry(choiceID), newWelshList.transform, BuildNewGrammar); AppendDisplayFromDb(DbQueries.GetCurrentActivateVocabPlayerChoiceResultQry(choiceID), newWelshList.transform, BuildNewVocab); Canvas.ForceUpdateCanvases(); if (newWelshList.transform.childCount > 0) { DisplayComponents(); Canvas.ForceUpdateCanvases(); } }
public static void Create(SqlCommand command) { Console.Clear(); Console.WriteLine(""); //Show students DbQueries.PrintData(1); Console.WriteLine(""); //Show assignments per course DbQueries.PrintData(7); Console.WriteLine("\r\nPlease, match students to assignments by entering the student's ID and the assignment's ID."); command.Parameters.Add(Helpers.GetIntParamFromKeyboard("studentID")); command.Parameters.Add(Helpers.GetIntParamFromKeyboard("assignmentID")); }
public static void Create(SqlCommand command) { Console.Clear(); Console.WriteLine(""); //Show courses DbQueries.PrintData(3); Console.WriteLine(""); //Show trainers DbQueries.PrintData(2); Console.WriteLine("\r\nPlease, match trainers to courses by entering the course's ID and the trainer's ID."); command.Parameters.Add(Helpers.GetIntParamFromKeyboard("courseID")); command.Parameters.Add(Helpers.GetIntParamFromKeyboard("trainerID")); }
public void CompleteQuestTaskPart(string questName) { List <string[]> partsToComplete = new List <string[]>(); DbCommands.GetDataStringsFromQry(DbQueries.GetCompleteQuestTasksData(questName, "0"), out partsToComplete, questName); if (partsToComplete.Count > 0) { foreach (string[] tuple in partsToComplete) { CompleteTaskPart(tuple[0], tuple[1], questName); } } }
public void InsertNewDialogue() { if ((inputShortDescriptionText.text != null) && (inputShortDescriptionText.text != "")) { string dialogueID = DbCommands.GenerateUniqueID("Dialogues", "DialogueIDs", "DialogueID"); DbCommands.InsertTupleToTable("Dialogues", dialogueID, inputShortDescriptionText.text); if (dialogueActive.isOn) { DbCommands.InsertTupleToTable("ActivatedDialogues", dialogueID, "0", "0"); //Puts the dialgoue in activated dialogues under the "New game" save ref as uncompleted. } FillDisplayFromDb(DbQueries.GetDialogueDisplayQry(), dialogueList.transform, BuildDialogue); HideCharsRelatedToDialogue(); HideNodesRelatedToDialogue(); } }
public void ActivateNewGrammar(string choiceID) { int countGrammarActivateResults = DbCommands.GetCountFromQry(DbQueries.GetGrammarActivateCountFromChoiceIDqry(choiceID)); if (countGrammarActivateResults > 0) { print("Grammar ACTIVATING!!!!"); List <string[]> grammarActivatedList; DbCommands.GetDataStringsFromQry(DbQueries.GetCurrentActivateGrammarPlayerChoiceResultQry(choiceID), out grammarActivatedList); foreach (string[] activatedGrammar in grammarActivatedList) { newWelshLearnedUI.InsertDiscoveredGrammar(activatedGrammar[1]); } } }
public void ActivateNewVocab(string choiceID) { int countVocabActivateResults = DbCommands.GetCountFromQry(DbQueries.GetVocabActivateCountFromChoiceIDqry(choiceID)); if (countVocabActivateResults > 0) { print("Vocab ACTIVATING!!!!"); List <string[]> vocabActivatedList; DbCommands.GetDataStringsFromQry(DbQueries.GetCurrentActivateVocabPlayerChoiceResultQry(choiceID), out vocabActivatedList); foreach (string[] activatedVocab in vocabActivatedList) { newWelshLearnedUI.InsertDiscoveredVocab(activatedVocab[2], activatedVocab[3]); } } }
private void projectsDropdown_TextChanged(object sender, EventArgs e) { var project = ((ComboBox)sender).Text; var items = new DbQueries().QueryTestEnvironments(project).Rows.Cast <DataRow>().Select(r => r[0]).ToArray(); if (items.Length == 0) { return; } environmentsDropdown.Items.Clear(); environmentsDropdown.Items.AddRange(items); environmentsDropdown.Text = items[0].ToString(); }
private void LoadPrefabQuests() { List <string[]> prefabQuestsPathList = new List <string[]>(); string saveIDstr = PlayerPrefsManager.GetSaveGame().ToString(); DbCommands.GetDataStringsFromQry(DbQueries.GetPathsForActivePrefabQuestParts(saveIDstr), out prefabQuestsPathList); foreach (string[] questPrefabArray in prefabQuestsPathList) { string prefabPath = questPrefabArray[0]; UnityEngine.Object prefabObj = Resources.Load(prefabPath); GameObject questPrefab = Instantiate(prefabObj, new Vector2(0f, 0f), Quaternion.identity) as GameObject; QuestsController questsController = FindObjectOfType <QuestsController>(); questPrefab.GetComponent <QuestTaskPart>().InitialiseMe(questPrefabArray[1], questPrefabArray[2], questPrefabArray[3]); questPrefab.transform.SetParent(questsController.transform, false); } }
public void CompleteDefeatEnemyTagTaskPart(string tagName) { Debugging.PrintDbQryResults(DbQueries.GetDefeatEnemyTagTasksData(tagName, "0"), tagName); List <string[]> partsToComplete = new List <string[]>(); DbCommands.GetDataStringsFromQry(DbQueries.GetDefeatEnemyTagTasksData(tagName, "0"), out partsToComplete, tagName); if (partsToComplete.Count > 0) { foreach (string[] tuple in partsToComplete) { print("completing task part " + tagName); CompleteTaskPart(tuple[0], tuple[1], tuple[2]); print("task part completed"); } } }
private void countryInfoOutputButton_Click(object sender, EventArgs e) { countryInfoDataGridView.Rows.Clear(); var query = new DbQueries(); var countriesInDb = query.GetCountriesFromDb(); foreach (var country in countriesInDb) { countryInfoDataGridView.Rows.Add(country.Name, country.Code, country.Capital.Name, country.Area, country.Population, country.Region.Name); } }
public void ActivateQuests(string choiceID) { int countQuestActivateResults = DbCommands.GetCountFromQry(DbQueries.GetQuestActivateCountFromChoiceIDqry(choiceID)); print(countQuestActivateResults); if (countQuestActivateResults > 0) { List <string[]> questsActivatedList; DbCommands.GetDataStringsFromQry(DbQueries.GetCurrentActivateQuestsPlayerChoiceResultQry(choiceID), out questsActivatedList); print(questsActivatedList.Count); foreach (string[] activatedQuest in questsActivatedList) { questsUI.InsertActivatedQuest(activatedQuest[1]); } } }
public void CompleteEquipItemTaskPart(string itemName) { print("Complete equip item task part"); Debugging.PrintDbQryResults(DbQueries.GetEquipItemTasksData(itemName, "0"), itemName); List <string[]> partsToComplete = new List <string[]>(); DbCommands.GetDataStringsFromQry(DbQueries.GetEquipItemTasksData(itemName, "0"), out partsToComplete, itemName); if (partsToComplete.Count > 0) { foreach (string[] tuple in partsToComplete) { print("completing task part " + itemName); CompleteTaskPart(tuple[0], tuple[1], tuple[2]); print("task part completed"); } } }
public JsonResult Post([FromBody] JsonElement requestJson) { try { string requestJsonString = JsonSerializer.Serialize(requestJson); DbQueries db = new DbQueries(); return(new JsonResult(db.GetClientInfo(requestJsonString))); } catch (Exception E) { return(new JsonResult(new ClientInfo { errorMessage = E.ToString() }) { StatusCode = StatusCodes.Status500InternalServerError }); } }