Пример #1
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);
                    }
                }
            }
        }
Пример #2
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]);
                }
            }
        }
Пример #3
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]);
                }
            }
        }
Пример #4
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]);
                }
            }
        }
Пример #5
0
        public void CompleteTaskPart(string partID, string taskID, string questName)
        {
            DbCommands.InsertTupleToTable("CompletedQuestTaskParts", partID, "0");
            //print("inserted tuple to completed task parts");
            int taskPartsCount = DbCommands.GetCountFromTable("QuestTaskParts", "TaskIDs = " + taskID);
            //print("task parts with id " + taskID + " = " + taskPartsCount);
            int taskPartsCompletedCount = DbCommands.GetCountFromQry(DbQueries.GetTaskPartsCompleteFromTaskID(taskID, "0"));

            //print("task parts completed with id " + taskID + " = " + taskPartsCompletedCount);
            //Debugging.PrintDbTable("CompletedQuestTaskParts");
            if (taskPartsCount == taskPartsCompletedCount)
            {
                DbCommands.UpdateTableField("QuestTasksActivated", "Completed", "1", "TaskIDs = " + taskID + " AND SaveIDs = 0");
                int tasksCount = DbCommands.GetCountFromTable(
                    "QuestTasks",
                    "QuestNames = " + DbCommands.GetParameterNameFromValue(questName),
                    questName);
                string[] taskResults = DbCommands.GetTupleFromQry(DbQueries.GetAllTaskResultsQry(taskID));
                //string startDialogueID = DbCommands.GetFieldValueFromTable("QuestTaskStartDialogueResults", "DialogueIDs", "TaskIDs = " + taskID);
                string endCombatWithCharName = taskResults[0];
                string startDialogueID       = taskResults[1];
                if (endCombatWithCharName != "")
                {
                    combatUI.EndCombatWithCharacter(endCombatWithCharName);
                }
                if (startDialogueID != "")
                {
                    print(startDialogueID);
                    DbCommands.InsertTupleToTable("ActivatedDialogues", startDialogueID, "0", "0");
                    dialogueUI.StartNewDialogue(startDialogueID);
                }
                int tasksCompletedCount = DbCommands.GetCountFromQry(
                    DbQueries.GetTasksCompleteFromQuestName(questName, "0"),
                    questName);
                if (tasksCount == tasksCompletedCount)
                {
                    DbCommands.UpdateTableField("QuestsActivated",
                                                "Completed", "1",
                                                "SaveIDs = 0 AND QuestNames = " + DbCommands.GetParameterNameFromValue(questName),
                                                questName);
                }
            }
            SetQuestDetails(questName);
        }
Пример #6
0
        public void ActivateNewDialogue(string choiceID)
        {
            Debugging.PrintDbTable("ActivatedDialogues");
            int countDialogueActivateResults = DbCommands.GetCountFromQry(DbQueries.GetDialogueActivateCountFromChoiceIDqry(choiceID));

            if (countDialogueActivateResults > 0)
            {
                print("Dialogue ACTIVATING!!!!");
                List <string[]> dialogueActivatedList;

                DbCommands.GetDataStringsFromQry(DbQueries.GetCurrentActivateDialoguePlayerChoiceResultQry(choiceID), out dialogueActivatedList);

                foreach (string[] activatedDialogue in dialogueActivatedList)
                {
                    //get characters related to activated dialogue. Set active dialogues related to each character to completed
                    List <string[]> charactersRelatedToDialogue;

                    DbCommands.GetDataStringsFromQry(DbQueries.GetCharsRelatedToDialogue(activatedDialogue[1]), out charactersRelatedToDialogue);

                    foreach (string[] characterName in charactersRelatedToDialogue)
                    {
                        List <string[]> activeDialoguesWithCharacter;
                        string          charname = characterName[0];
                        DbCommands.GetDataStringsFromQry(DbQueries.GetActiveDialoguesWithCharacter(charname), out activeDialoguesWithCharacter, characterName[0]);

                        foreach (string[] dialogueWithChar in activeDialoguesWithCharacter)
                        {
                            string dialogueID = dialogueWithChar[0];
                            print("printing active dialogues with " + charname);
                            Debugging.PrintDbQryResults(DbQueries.GetActiveDialoguesWithCharacter(charname), charname);
                            DbCommands.UpdateTableField("ActivatedDialogues", "Completed", "1", "DialogueIDs = " + dialogueID + " AND SaveIDs = 0");
                            Debugging.PrintDbTable("ActivatedDialogues");
                        }
                    }
                    DbCommands.InsertTupleToTable("ActivatedDialogues", activatedDialogue[1], "0", "0");
                    //activate dialogues in dialogue activated list
                }
            }
        }
Пример #7
0
        public void DisplayResultsRelatedToChoices()
        {
            playerChoiceResultsPanel.SetActive(true);
            EmptyDisplay(playerChoicesResultsList.transform);
            print(playerChoicesListUI);
            playerChoicesListUI = FindObjectOfType <PlayerChoicesListUI>();
            string selectedChoiceID = (playerChoicesListUI.GetSelectedItemFromGroup(playerChoicesListUI.SelectedChoice) as PlayerChoice).MyID;

            if (DbCommands.GetFieldValueFromTable("PlayerChoices", "MarkDialogueCompleted", " ChoiceIDs = " + selectedChoiceID) != "0")
            {
                AppendDisplayFromDb((DbQueries.GetChoiceCompleteDialogueQry(selectedChoiceID)), playerChoicesResultsList.transform, BuildExistingResultCompleteDialogue);
            }
            if (DbCommands.GetFieldValueFromTable("PlayerChoices", "NextNodes", " ChoiceIDs = " + selectedChoiceID) != "")
            {
                GameObject pChoiceResultsTitle = Instantiate(existingResultTitlePrefab, new Vector2(0f, 0f), Quaternion.identity) as GameObject;
                AppendDisplayWithTitle(playerChoicesResultsList.transform, pChoiceResultsTitle.transform, "Goes to dialogue node... ");
                PlayerChoice currentPlayerChoice = playerChoicesListUI.GetSelectedItemFromGroup(playerChoicesListUI.SelectedChoice) as PlayerChoice;
                AppendDisplayFromDb(DbQueries.GetNextNodeResultQry(currentPlayerChoice.MyNextNode), playerChoicesResultsList.transform, BuildExistingResultNode);
            }
            int resultsCount = DbCommands.GetCountFromTable("PlayerChoiceResults", "ChoiceIDs = " + selectedChoiceID);

            if (resultsCount > 0)
            {
                int questActivateCount = DbCommands.GetCountFromQry(DbQueries.GetQuestActivateCountFromChoiceIDqry(selectedChoiceID));
                if (questActivateCount > 0)
                {
                    GameObject existingResultsTitle = Instantiate(existingResultTitlePrefab, new Vector2(0f, 0f), Quaternion.identity) as GameObject;
                    AppendDisplayWithTitle(playerChoicesResultsList.transform, existingResultsTitle.transform, "Activates quest... ");
                    AppendDisplayFromDb(DbQueries.GetCurrentActivateQuestsPlayerChoiceResultQry(selectedChoiceID),
                                        playerChoicesResultsList.transform,
                                        BuildExistingResultActivateQuest);
                }

                int taskActivateCount = DbCommands.GetCountFromQry(DbQueries.GetTaskActivateCountFromChoiceIDqry(selectedChoiceID));
                if (taskActivateCount > 0)
                {
                    GameObject existingResultsTitle = Instantiate(existingResultTitlePrefab, new Vector2(0f, 0f), Quaternion.identity) as GameObject;
                    AppendDisplayWithTitle(playerChoicesResultsList.transform, existingResultsTitle.transform, "Activates tasks... ");
                    AppendDisplayFromDb(DbQueries.GetCurrentActivateTasksPlayerChoiceResultQry(selectedChoiceID),
                                        playerChoicesResultsList.transform,
                                        BuildExistingResultActivateTask);
                }

                int taskCompleteCount = DbCommands.GetCountFromQry(DbQueries.GetTaskCompleteCountFromChoiceIDqry(selectedChoiceID));
                if (taskCompleteCount > 0)
                {
                    GameObject existingResultsTitle = Instantiate(existingResultTitlePrefab, new Vector2(0f, 0f), Quaternion.identity) as GameObject;
                    AppendDisplayWithTitle(playerChoicesResultsList.transform, existingResultsTitle.transform, "Completes tasks... ");
                    AppendDisplayFromDb(DbQueries.GetCurrentCompleteTasksPlayerChoiceResultQry(selectedChoiceID),
                                        playerChoicesResultsList.transform,
                                        BuildExistingResultCompleteTask);
                }

                int grammarActivateCount = DbCommands.GetCountFromQry(DbQueries.GetGrammarActivateCountFromChoiceIDqry(selectedChoiceID));
                if (grammarActivateCount > 0)
                {
                    GameObject existingResultsTitle = Instantiate(existingResultTitlePrefab, new Vector2(0f, 0f), Quaternion.identity) as GameObject;
                    AppendDisplayWithTitle(playerChoicesResultsList.transform, existingResultsTitle.transform, "Activates new grammar... ");
                    AppendDisplayFromDb(DbQueries.GetCurrentActivateGrammarPlayerChoiceResultQry(selectedChoiceID),
                                        playerChoicesResultsList.transform,
                                        BuildExistingResultActivateGrammar);
                }

                int vocabActivateCount = DbCommands.GetCountFromQry(DbQueries.GetVocabActivateCountFromChoiceIDqry(selectedChoiceID));
                if (vocabActivateCount > 0)
                {
                    GameObject existingResultsTitle = Instantiate(existingResultTitlePrefab, new Vector2(0f, 0f), Quaternion.identity) as GameObject;
                    AppendDisplayWithTitle(playerChoicesResultsList.transform, existingResultsTitle.transform, "Activates new vocab... ");
                    AppendDisplayFromDb(DbQueries.GetCurrentActivateVocabPlayerChoiceResultQry(selectedChoiceID),
                                        playerChoicesResultsList.transform,
                                        BuildExistingResultActivateVocab);
                }

                int dialogueActivateCount = DbCommands.GetCountFromQry(DbQueries.GetDialogueActivateCountFromChoiceIDqry(selectedChoiceID));
                if (dialogueActivateCount > 0)
                {
                    GameObject existingResultsTitle = Instantiate(existingResultTitlePrefab, new Vector2(0f, 0f), Quaternion.identity) as GameObject;
                    AppendDisplayWithTitle(playerChoicesResultsList.transform, existingResultsTitle.transform, "Activates new dialogue(s)... ");
                    AppendDisplayFromDb(DbQueries.GetCurrentActivateDialoguePlayerChoiceResultQry(selectedChoiceID),
                                        playerChoicesResultsList.transform,
                                        BuildExistingResultActivateDialogue);
                }
            }
        }