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();
        }
예제 #2
0
 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();
            }
        }
예제 #4
0
        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);
                    }
                }
            }
        }
예제 #5
0
        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
                              );
        }
예제 #6
0
    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];
        }
    }
예제 #7
0
        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);
        }
예제 #9
0
        public void Checksum_When_empty_query_Returns_Null()
        {
            var q = DbQueries.Empty();

            var c = _checksumGenerator.Generate(q);

            Assert.That(c, Is.EqualTo(null));
        }
예제 #10
0
        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));
        }
예제 #11
0
        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));
        }
예제 #12
0
 public void ToggleSideMenuToProficienciesList()
 {
     if (!GetPanel().activeSelf)
     {
         translationUI.ToggleMenuTo(GetComponent <UIController>(), translationUI.SideMenuGroup);
         translationUI.ToggleSelectedSideMenuButton(proficienciesBtn);
     }
     FillDisplayFromDb(DbQueries.GetProficienciesDisplayQry(), ProficienciesList.transform, BuildProficiency);
 }
예제 #13
0
 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   = "";
     }
 }
예제 #14
0
        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");
        }
예제 #15
0
    /// <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);
    }
예제 #16
0
 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);
 }
예제 #17
0
 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"));
 }
예제 #19
0
 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"));
 }
예제 #20
0
        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);
                }
            }
        }
예제 #21
0
 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();
     }
 }
예제 #22
0
        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]);
                }
            }
        }
예제 #23
0
        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();
        }
예제 #25
0
    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);
        }
    }
예제 #26
0
        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);
            }
        }
예제 #28
0
        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]);
                }
            }
        }
예제 #29
0
        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
         });
     }
 }