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
                }
            }
        }
Exemple #2
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);
                }
            }
        }