public void UpdateInsertNewTextOnlyNode() { if (inputNodeText.text != null) { string endDialogueStr = endDialogueOptionToggle.isOn ? "1" : "0"; SetCharOverrideDetails(); if (editing) { string[,] fieldVals = new string[, ] { { "NodeText", inputNodeText.text }, { "EndDialogueOption", endDialogueStr }, { "CharacterSpeaking", overrideName }, { "Scenes", overrideScene } }; DbCommands.UpdateTableTuple("DialogueNodes", "NodeIDs = " + (dialogueNodesListUI.GetSelectedItemFromGroup(dialogueNodesListUI.SelectedNode) as DialogueNode).MyID, fieldVals); DialogueNodeTextOnly selectedNode = (dialogueNodesListUI.GetSelectedItemFromGroup(dialogueNodesListUI.SelectedNode) as DialogueNode).GetComponent <DialogueNodeTextOnly>(); print(selectedNode); selectedNode.UpdateNodeDisplay(inputNodeText.text); } else { string nodeID = DbCommands.GenerateUniqueID("DialogueNodes", "NodeIDs", "NodeID"); InsertDialogueNode(inputNodeText.text, nodeID, endDialogueStr); dialogueNodesListUI.DisplayNodesRelatedToDialogue(); playerChoicesListUI.HidePlayerChoices(); } } }
public void StartNewGame(string name, string portraitPath) { string[,] pgFields = new string[, ] { { "PlayerNames", name }, { "PortraitImages", portraitPath }, { "Dates", DateTime.Now.ToString() }, { "LocationName", "Start" }, { "LocationX", "-2" }, { "LocationY", "0" }, { "SkillPointsSpent", "0" } }; DbCommands.UpdateTableTuple("PlayerGames", "SaveIDs = 0", pgFields); //Dialogues activated string[,] delFields = new string[, ] { { "SaveIDs", "0" } }; DbCommands.DeleteTupleInTable("ActivatedDialogues", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("ActivatedDialogues", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { "-1" }); //Quests activated DbCommands.DeleteTupleInTable("QuestsActivated", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("QuestsActivated", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { "-1" }); //Quests tasks completed DbCommands.DeleteTupleInTable("QuestTasksActivated", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("QuestTasksActivated", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { "-1" }); //Task parts completed DbCommands.DeleteTupleInTable("CompletedQuestTaskParts", delFields); //discovered vocabulary DbCommands.DeleteTupleInTable("DiscoveredVocab", delFields); //discovered vocabulary DbCommands.DeleteTupleInTable("DiscoveredVocabGrammar", delFields); //acquired vocabulary read proficiencies DbCommands.DeleteTupleInTable("AcquiredVocabReadSkills", delFields); //acquired vocabulary write proficiencies DbCommands.DeleteTupleInTable("AcquiredVocabWriteSkills", delFields); //acquired grammar proficiencies DbCommands.DeleteTupleInTable("AcquiredGrammarSkills", delFields); PlayerPrefsManager.SetSaveGame(0); sceneLoader.LoadSceneByName("Demo"); }
public void InsertCompleteDialogueResult() { //(GetSelectedItemFromGroup(selectedChoice) as PlayerChoice).MarkDialogueComplete = "1"; string[,] fieldVals = new string[, ] { { "MarkDialogueCompleted", "1" } }; DbCommands.UpdateTableTuple("PlayerChoices", "ChoiceIDs = " + (playerChoicesListUI.GetSelectedItemFromGroup(playerChoicesListUI.SelectedChoice) as PlayerChoice).MyID, fieldVals); DisplayResultsRelatedToChoices(); DeactivateNewChoiceResult(); }
public void UpdateQuestInDb(string questName, string newName, string questDescription) { string[,] fields = new string[, ] { { "QuestNames", newName }, { "QuestDescriptions", questDescription } }; DbCommands.UpdateTableTuple("Quests", "QuestNames = " + DbCommands.GetParameterNameFromValue(questName), fields, questName); }
public void SaveSelected() { SetSaveID(selectedSave.ID.ToString()); SkillsMenuUI skillsMenuUI = FindObjectOfType <SkillsMenuUI>(); string[,] fieldVals = new string[, ] { { "PlayerNames", player.GetComponent <PlayerCharacter>().GetMyName() }, { "Dates", DateTime.Now.ToString() }, { "LocationName", sceneLoader.GetCurrentSceneName() }, { "LocationX", player.GetComponent <Transform>().position.x.ToString() }, { "LocationY", player.GetComponent <Transform>().position.y.ToString() }, { "SkillPointsSpent", skillsMenuUI.GetSkillPointsSpent().ToString() } }; DbCommands.UpdateTableTuple("PlayerGames", "SaveIDs = " + saveID, fieldVals); }
public void InsertDialogueNodeResult(GameObject selectedBtn) { NewNodeChoiceResultBtn dialogueNodeChoiceResultBtn = selectedBtn.GetComponent <NewNodeChoiceResultBtn>(); //(GetSelectedItemFromGroup(selectedChoice) as PlayerChoice).MyNextNode = dialogueNodeChoiceResultBtn.MyID; string[,] fieldVals = new string[, ] { { "NextNodes", dialogueNodeChoiceResultBtn.MyID } }; PlayerChoice selectedChoiceObj = playerChoicesListUI.GetSelectedItemFromGroup(playerChoicesListUI.SelectedChoice) as PlayerChoice; selectedChoiceObj.MyNextNode = dialogueNodeChoiceResultBtn.MyID; DbCommands.UpdateTableTuple("PlayerChoices", "ChoiceIDs = " + selectedChoiceObj.MyID, fieldVals); DisplayResultsRelatedToChoices(); DeactivateNewChoiceResult(); }
public void UpdateTaskInDb(string taskID, string taskDescription, bool activeAtStart) { string[,] fields = new string[, ] { { "TaskDescriptions", taskDescription } }; DbCommands.UpdateTableTuple("QuestTasks", "TaskIDs = " + taskID, fields); if (activeAtStart) { DbCommands.InsertTupleToTable("QuestTasksActivated", taskID, "-1", "0"); } else { string[,] activeTaskfields = { { "TaskIDs", taskID }, { "SaveIDs", "-1" } }; DbCommands.DeleteTupleInTable("QuestTasksActivated", activeTaskfields); //Removes the task in activated tasks if it is marked as inactive. } }
public void UpdateInsertNewTextOnlyPlayerChoice() { if (inputChoiceText.text != null) { if (editingChoice) { string[,] fieldVals = new string[, ] { { "ChoiceText", inputChoiceText.text }, }; DbCommands.UpdateTableTuple("PlayerChoices", "ChoiceIDs = " + (playerChoicesListUI.GetSelectedItemFromGroup(playerChoicesListUI.SelectedChoice) as PlayerChoice).MyID, fieldVals); PlayerChoiceTextOnly selectedPlayerChoice = (playerChoicesListUI.GetSelectedItemFromGroup(playerChoicesListUI.SelectedChoice) as PlayerChoice).GetComponent <PlayerChoiceTextOnly>(); selectedPlayerChoice.UpdateChoiceDisplay(inputChoiceText.text); } else { string choiceID = DbCommands.GenerateUniqueID("PlayerChoices", "ChoiceIDs", "ChoiceID"); InsertPlayerChoice(inputChoiceText.text, choiceID); playerChoicesListUI.DisplayChoicesRelatedToNode(); } } }
public void UpdateInsertTag() { if (tagDetailsInput.text != null) { if (editingTag) { string[,] fieldVals = new string[, ] { { "Tags", tagDetailsInput.text }, }; TranslationTag tt = GetSelectedItemFromGroup(SelectedTag) as TranslationTag; string tagTxt = tt.GetComponent <TranslationTag>().TagText; DbCommands.UpdateTableTuple("TranslationTags", "Tags = " + DbCommands.GetParameterNameFromValue(tagTxt), fieldVals, tagTxt); tt.GetComponent <TranslationTag>().UpdateTagDisplay(tagDetailsInput.text); } else { DbCommands.InsertTupleToTable("TranslationTags", tagDetailsInput.text); FillDisplayFromDb(DbQueries.GetTaggedVocabDisplayQry(), tagsList.transform, BuildTag); } } }
public void SaveEdits() { string[,] fields = new string[, ] { { "DialogueDescriptions", GetInputField().text }, }; DbCommands.UpdateTableTuple("Dialogues", "DialogueIDs = " + myID, fields); print("updated Dialogues tuple"); if (activeToggle.isOn) { DbCommands.InsertTupleToTable("ActivatedDialogues", myID, "-1", "0"); //Puts the dialgoue in activated dialogues under the "New game" save ref. } else { string[,] activeDialoguefields = { { "DialogueIDs", myID }, { "SaveIDs", "-1" } }; DbCommands.DeleteTupleInTable("ActivatedDialogues", activeDialoguefields); //Removes the dialgoue in activated dialogues if it is marked as inactive. } MyDescription = GetInputField().text; StopEditing(); dialogueUI.ToggleSelectionTo(GetComponent <Dialogue>(), dialogueUI.selectedDialogue); }
public void UpdateInsertRule() { if ((inputRuleSdescTxt.text != null) && (inputRuleSdescTxt.text != "")) { if (editingRule) { string[,] fieldVals = new string[, ] { { "ShortDescriptions", inputRuleSdescTxt.text }, { "LongDescriptions", inputRuleLdescTxt.text }, }; GrammarRule selectedRule = (GrammarRule)(GetSelectedItemFromGroup(selectedGrammarRule)); DbCommands.UpdateTableTuple("VocabGrammar", "RuleIDs = " + selectedRule.RuleNumber, fieldVals); selectedRule.UpdateRuleDisplay(inputRuleSdescTxt.text); } else { string ruleID = DbCommands.GenerateUniqueID("VocabGrammar", "RuleIDs", "RuleID"); DbCommands.InsertTupleToTable("VocabGrammar", ruleID, inputRuleSdescTxt.text, inputRuleLdescTxt.text); FillDisplayFromDb(DbQueries.GetGrammarRuleDisplayQry(), grammarList.transform, BuildRule); } } }
public void CopyPlayerSaveToCurrentGame(string[] playerGameData) { string saveID = playerGameData[0]; if (saveID != "0") { //PlayerGames tbl string[,] pgFields = new string[, ] { { "PlayerNames", playerGameData[2] }, { "PortraitImages", playerGameData[3] }, { "LocationName", playerGameData[5] } }; DbCommands.UpdateTableTuple("PlayerGames", "SaveIDs = 0", pgFields); string[,] delFields = new string[, ] { { "SaveIDs", "0" } }; //Dialogues activated DbCommands.DeleteTupleInTable("ActivatedDialogues", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("ActivatedDialogues", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { playerGameData[0] }); //Quests activated DbCommands.DeleteTupleInTable("QuestsActivated", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("QuestsActivated", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { playerGameData[0] }); //Quests tasks completed DbCommands.DeleteTupleInTable("QuestTasksActivated", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("QuestTasksActivated", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { playerGameData[0] }); //Task parts completed DbCommands.DeleteTupleInTable("CompletedQuestTaskParts", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("CompletedQuestTaskParts", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { playerGameData[0] }); //discovered vocab DbCommands.DeleteTupleInTable("DiscoveredVocab", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("DiscoveredVocab", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { playerGameData[0] }); //discovered grammar DbCommands.DeleteTupleInTable("DiscoveredVocabGrammar", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("DiscoveredVocabGrammar", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { playerGameData[0] }); //acquired vocabulary read proficiencies DbCommands.DeleteTupleInTable("AcquiredVocabReadSkills", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("AcquiredVocabReadSkills", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { playerGameData[0] }); //acquired vocabulary write proficiencies DbCommands.DeleteTupleInTable("AcquiredVocabWriteSkills", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("AcquiredVocabWriteSkills", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { playerGameData[0] }); //acquired grammar proficiencies DbCommands.DeleteTupleInTable("AcquiredGrammarSkills", delFields); DbCommands.InsertExistingValuesInSameTableWithNewPK("AcquiredGrammarSkills", new string[] { "SaveIDs" }, new string[] { "0" }, new string[] { playerGameData[0] }); } }