Esempio n. 1
0
 private void UpdateReadTally()
 {
     readTally = int.Parse(DbCommands.GetFieldValueFromTable(
                               "DiscoveredVocab",
                               "ReadCorrectTallies",
                               "SaveIDs = 0 " +
                               "AND EnglishText = " + DbCommands.GetParameterNameFromValue(vocab[0]) + " " +
                               "AND WelshText = " + DbCommands.GetParameterNameFromValue(vocab[1]),
                               vocab[0],
                               vocab[1]
                               ));
     readTally       += tallyModifier;
     tallyShiftTotal += tallyModifier;
     if (readTally >= 0)
     {
         if (readTally <= highestTallyPossible)
         {
             DbCommands.UpdateTableField(
                 "DiscoveredVocab",
                 "ReadCorrectTallies",
                 readTally.ToString(),
                 "SaveIDs = 0 " +
                 "AND EnglishText = " + DbCommands.GetParameterNameFromValue(vocab[0]) + " " +
                 "AND WelshText = " + DbCommands.GetParameterNameFromValue(vocab[1]),
                 vocab[0],
                 vocab[1]
                 );
         }
     }
     else
     {
         readTally = 0;
     }
 }
Esempio n. 2
0
    /*player prefs is used to store the selected save id and then the database is accessed to load the saved scene from the
     * game, other details are loaded using the loadSave function from the Start method. */
    public void LoadFromGameID()
    {
        print(selectedSave);
        saveID = selectedSave.ID;
        print("ready to load game from id: " + saveID);
        PlayerPrefsManager.SetSaveGame(saveID);
        string sceneName = DbCommands.GetFieldValueFromTable("PlayerGames", "LocationName", "SaveIDs = " + saveID);

        sceneLoader.LoadSceneByName(sceneName);
    }
Esempio n. 3
0
        private bool IsDialogueComplete()
        {
            string dialogueComplete = DbCommands.GetFieldValueFromTable("ActivatedDialogues", "Completed", "DialogueIDs = " + currentDialogueID + " AND SaveIDs = 0");

            //no character dialogue so return true
            if (dialogueComplete == "")
            {
                return(true);
            }
            else
            {
                return(Convert.ToBoolean(int.Parse(dialogueComplete)));
            }
        }
Esempio n. 4
0
 public void StartNewDialogue(string dialogueID)
 {
     //print("ready for new dialogue = " + IsReadyForNewDialogue());
     if (IsReadyForNewDialogue())
     {
         currentCharID = DbCommands.GetFieldValueFromTable("CharacterDialogues", "CharacterNames", "DialogueIDs = " + dialogueID);
         //print("DIALOGUE ID = " + dialogueID);
         currentChar       = npcs.GetCharacterFromName(currentCharID);
         currentDialogueID = dialogueID;
         DisplayFirstDialogueNode();
     }
     else
     {
         QueueNewDialogue(dialogueID);
     }
 }
Esempio n. 5
0
        private string GetSpeakersName(string nodeID)
        {
            string overrideName = DbCommands.GetFieldValueFromTable("DialogueNodes", "CharacterSpeaking", "NodeIDs = " + nodeID);

            if (overrideName == "")
            {
                return(currentChar.CharacterName);
            }
            else if (overrideName == "!Player")
            {
                return(playerCharacter.GetMyName());
            }
            else
            {
                return(overrideName);
            }
        }
Esempio n. 6
0
        public Transform BuildQuestTask(string[] taskData)
        {
            string taskID   = taskData[0];
            string taskDesc = taskData[1];

            print(DbCommands.GetFieldValueFromTable("QuestTasksActivated", "Completed", "TaskIDs = " + taskID + " AND SaveIDs = 0"));
            bool       completed = Convert.ToBoolean(int.Parse(DbCommands.GetFieldValueFromTable("QuestTasksActivated", "Completed", "TaskIDs = " + taskID + " AND SaveIDs = 0")));
            GameObject task      = Instantiate(taskPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject;

            //print(quest);
            if (completed)
            {
                task.GetComponent <QuestTask>().SetCompleted();
            }
            task.GetComponent <QuestTask>().SetDescription(taskDesc);
            task.GetComponent <QuestTask>().MyID = taskID;

            return(task.transform);
        }
Esempio n. 7
0
        private void DisplayNodeChoices(string nodeID)
        {
            InsertSpacer();
            //check if player is node character override, if not then the name can be inserted
            if (GetSpeakersName(nodeID) != playerCharacter.GetMyName())
            {
                InsertCharName(playerCharacter.GetMyName());
            }
            string nodeChoiceQry = "SELECT * FROM PlayerChoices WHERE NodeIDs = " + nodeID + ";";

            AppendDisplayFromDb(nodeChoiceQry, dialogueHolder.transform, BuildPlayerChoice);
            string displayEndDialogueIndicator = (DbCommands.GetFieldValueFromTable("DialogueNodes", "EndDialogueOption", "DialogueIDs = " + nodeID));
            int    choicesInt = DbCommands.GetCountFromTable("PlayerChoices", "NodeIDs = " + nodeID);

            if (displayEndDialogueIndicator == "1" || choicesInt == 0)
            {
                InsertEndDialogue();
            }
        }
Esempio n. 8
0
    private void UpdateGrammarTallies()
    {
        if (relatedGrammarList != null)
        {
            foreach (string[] grammarArray in relatedGrammarList)
            {
                int grammarID    = int.Parse(grammarArray[0]);
                int currentTally = int.Parse(DbCommands.GetFieldValueFromTable(
                                                 "DiscoveredVocabGrammar",
                                                 "CorrectTallies",
                                                 "SaveIDs = 0 " +
                                                 "AND RuleIDs = " + grammarID.ToString()
                                                 ));

                currentTally    += tallyModifier;
                tallyShiftTotal += tallyModifier;
                if (currentTally >= 0)
                {
                    if (currentTally <= highestTallyPossible)
                    {
                        DbCommands.UpdateTableField(
                            "DiscoveredVocabGrammar",
                            "CorrectTallies",
                            currentTally.ToString(),
                            "SaveIDs = 0 " +
                            "AND RuleIDs = " + grammarID.ToString()
                            );
                    }
                }
                else
                {
                    currentTally = 0;
                }
                if (!grammarDetailsDict.ContainsKey(grammarID))
                {
                    string[] details = new string[2];
                    details[0] = currentTally.ToString();
                    grammarDetailsDict.Add(grammarID, details);
                }
            }
        }
    }
Esempio n. 9
0
    private void UpdateWriteTally()
    {
        Debug.Log(vocab[0]);
        Debug.Log(vocab[1]);
        string tallyStr = (DbCommands.GetFieldValueFromTable(
                               "DiscoveredVocab",
                               "WriteCorrectTallies",
                               "SaveIDs = 0 " +
                               "AND EnglishText = " + DbCommands.GetParameterNameFromValue(vocab[0]) + " " +
                               "AND WelshText = " + DbCommands.GetParameterNameFromValue(vocab[1]),
                               vocab[0],
                               vocab[1]
                               ));

        Debug.Log(tallyStr);
        writeTally       = int.Parse(tallyStr);
        writeTally      += tallyModifier;
        tallyShiftTotal += tallyModifier;
        if (writeTally >= 0)
        {
            if (writeTally <= highestTallyPossible)
            {
                DbCommands.UpdateTableField(
                    "DiscoveredVocab",
                    "WriteCorrectTallies",
                    writeTally.ToString(),
                    "SaveIDs = 0 " +
                    "AND EnglishText = " + DbCommands.GetParameterNameFromValue(vocab[0]) + " " +
                    "AND WelshText = " + DbCommands.GetParameterNameFromValue(vocab[1]),
                    vocab[0],
                    vocab[1]
                    );
            }
        }
        else
        {
            writeTally = 0;
        }
    }
Esempio n. 10
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);
                }
            }
        }