コード例 #1
0
        public static void PrintDbQryResults(string qry, params string[] parameterVals)
        {
            List <string[]> strArray = new List <string[]>();

            DbCommands.GetDataStringsFromQry(qry, out strArray, parameterVals);
            PrintListOfStrArrays(strArray);
        }
コード例 #2
0
 public void DeleteChoice()
 {
     string[,] fields = { { "ChoiceIDs", myID } };
     DbCommands.DeleteTupleInTable("PlayerChoices",
                                   fields);
     Destroy(gameObject);
 }
コード例 #3
0
 private void InsertQuest()
 {
     DbCommands.InsertTupleToTable("Quests",
                                   inputQuestDetailsName.text,
                                   inputQuestDetailsDesc.text);
     FillDisplayFromDb(DbQueries.GetQuestsDisplayQry(), questsList.transform, BuildQuest);
 }
コード例 #4
0
ファイル: NPCs.cs プロジェクト: krothwell/WelshLearningRPG
    /// <summary>
    /// Check a list of npc names from the database against the npc names in the current scene so
    /// if the names are not there (meaning they have been removed from the scene) then the table
    /// of characters is updated to remove the scene from the character table scene field and in
    /// turn informs the user using the data dialogue UI.
    /// </summary>
    /// <param name="namesList">A list of character names</param>
    private void UpdateCharsInDbNoLongerInScene(List <string[]> namesList)
    {
        NPCs npcs = FindObjectOfType <NPCs>();

        foreach (string[] nameBox in namesList)
        {
            string npcName = nameBox[0];
            string npcParam;
            if (npcName == "")
            {
                npcParam = "''";
            }
            else
            {
                npcParam = DbCommands.GetParameterNameFromValue(npcName);
            }
            if (!npcs.IsNameInCharDict(npcName))
            {
                DbCommands.UpdateTableField(
                    "Characters",
                    "Scenes",
                    "null",
                    "CharacterNames = " + npcParam,
                    npcName
                    );
            }
        }
    }
コード例 #5
0
 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();
         }
     }
 }
コード例 #6
0
 public void ActivateNodeDetails()
 {
     GetPanel().SetActive(true);
     nodeTypeDropdown.value = 0;
     ToggleChoiceComponents();
     displayDialogueNodeDetailsBtn.GetComponent <Button>().interactable = false; //indicate to user that button no longer functions.
     if (editing)
     {
         print((dialogueNodesListUI.GetSelectedItemFromGroup(dialogueNodesListUI.SelectedNode) as DialogueNode));
         string[] nodeDesc = DbCommands.GetTupleFromTable("DialogueNodes",
                                                          "NodeIDs = " + (dialogueNodesListUI.GetSelectedItemFromGroup(dialogueNodesListUI.SelectedNode) as DialogueNode).GetComponent <DialogueNode>().MyID);
         inputNodeText.text = nodeDesc[1];
         bool endDialogueOptionBool = false;
         if (nodeDesc[5] != "")
         {
             endDialogueOptionBool = (int.Parse(nodeDesc[5]) == 1) ? true : false;
         }
         endDialogueOptionToggle.isOn = endDialogueOptionBool;
         SetOverrideBtnTxt(nodeDesc[3], nodeDesc[4]);
     }
     else
     {
         ClearEditNodeDetails();
     }
 }
コード例 #7
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);
                    }
                }
            }
        }
コード例 #8
0
    private void SaveWorldItems()
    {
        string saveIDstr = saveID.ToString();

        string[,] delFields = new string[, ] {
            { "SaveIDs", saveIDstr }
        };
        DbCommands.DeleteTupleInTable("SavedWorldItems", delFields);
        WorldItems worldItems = FindObjectOfType <WorldItems>();

        worldItems.SetWorldItemsList();
        List <string[]> worldItemsList = worldItems.WorldItemList;

        foreach (string[] worldItemData in worldItemsList)
        {
            DbCommands.InsertTupleToTable("SavedWorldItems",
                                          saveIDstr,
                                          worldItemData[0],
                                          worldItemData[1],
                                          worldItemData[2],
                                          worldItemData[3],
                                          sceneLoader.GetCurrentSceneName(),
                                          worldItemData[4],
                                          worldItemData[5]);
        }
    }
コード例 #9
0
        private void InsertWorldItemsNotInDbFromScene(string scene)
        {
            WorldItems worldItems = FindObjectOfType <WorldItems>();

            foreach (string[] worldItemDetailsArray in worldItems.WorldItemList)
            {
                bool itemExists = DbCommands.IsRecordInTable("PremadeWorldItems",
                                                             "StartingLocationX = " + DbCommands.GetParameterNameFromValue(worldItemDetailsArray[0]) + " AND " +
                                                             "StartingLocationY = " + DbCommands.GetParameterNameFromValue(worldItemDetailsArray[1]) + " AND " +
                                                             "StartingLocationZ = " + DbCommands.GetParameterNameFromValue(worldItemDetailsArray[2]) + " AND " +
                                                             "StartingParentPath = " + DbCommands.GetParameterNameFromValue(worldItemDetailsArray[3]) + " AND " +
                                                             "StartingSceneNames = " + DbCommands.GetParameterNameFromValue(scene),
                                                             worldItemDetailsArray[0],
                                                             worldItemDetailsArray[1],
                                                             worldItemDetailsArray[2],
                                                             worldItemDetailsArray[3],
                                                             scene
                                                             );
                if (!itemExists)
                {
                    DbCommands.InsertTupleToTable("PremadeWorldItems",
                                                  worldItemDetailsArray[0],   //x
                                                  worldItemDetailsArray[1],   //y
                                                  worldItemDetailsArray[2],   //z
                                                  worldItemDetailsArray[3],   //parent
                                                  scene,
                                                  worldItemDetailsArray[4]);  //item name
                }
            }
        }
コード例 #10
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;
     }
 }
コード例 #11
0
 public void DeleteCharacterDialogue()
 {
     string[,] fields = { { "CharacterNames", characterName }, { "DialogueIDs", dialogueID } };
     DbCommands.DeleteTupleInTable("CharacterDialogues",
                                   fields);
     Destroy(gameObject);
 }
コード例 #12
0
        public void DisplayDialogueNode(string[] nodeArray_)
        {
            currentNodeID = nodeArray_[0];
            string charName = GetSpeakersName(currentNodeID);

            InsertCharName(charName);
            //check if node character override is there and use the override name if so.
            GameObject speakerScrollObj = currentCharSpeaking.gameObject;

            SetCurrentPortraitFromName(charName);
            bool isDialogueNodeVocabTest = (DbCommands.GetCountFromTable("DialogueNodesVocabTests", "NodeIDs = " + currentNodeID) != 0);

            if (isDialogueNodeVocabTest)
            {
                string[] nodeVocabTestArray = DbCommands.GetTupleFromTable("DialogueNodesVocabTests", "NodeIDs = " + currentNodeID);
                string[] vocabArray         = new string[2];
                vocabArray[0] = nodeVocabTestArray[1];
                vocabArray[1] = nodeVocabTestArray[2];
                ProcessDialogueNodeTest(vocabArray);
            }
            else
            {
                InsertDialogueNode(nodeArray_);
                DisplayNodeChoices(currentNodeID);
            }
            ScrollToDialogueElement(speakerScrollObj);
        }
コード例 #13
0
 public override void InsertResult()
 {
     InsertNewPlayerChoiceResultID();
     DbCommands.InsertTupleToTable("WelshVocabActivatedByDialogueChoices", playerChoiceResultID, PlayerChoiceID, englishText, welshText);
     dialogueUI.DisplayResultsRelatedToChoices();
     dialogueUI.DeactivateNewChoiceResult();
 }
コード例 #14
0
 public void DeleteProficiency()
 {
     string[,] fields = { { "ProficiencyNames", CurrentProficiencyName } };
     DbCommands.DeleteTupleInTable("Proficiencies",
                                   fields);
     Destroy(gameObject);
 }
コード例 #15
0
 public void DeleteRule()
 {
     string[,] fields = { { "RuleIDs", RuleNumber } };
     DbCommands.DeleteTupleInTable("VocabGrammar",
                                   fields);
     Destroy(gameObject);
 }
コード例 #16
0
 public void SetQuestDetails(string questName)
 {
     string[] questData = DbCommands.GetTupleFromTable("Quests", "QuestNames = " + DbCommands.GetParameterNameFromValue(questName), "QuestNames", questName);
     selectedQuestTitleLbl.text       = questData[0];
     selectedQuestDescriptionLbl.text = questData[1];
     DisplayTasksRelatedToQuest(questName);
 }
コード例 #17
0
 public void DeleteTag()
 {
     string[,] fields = { { "Tags", tagText } };
     DbCommands.DeleteTupleInTable("TranslationTags",
                                   fields);
     Destroy(gameObject);
 }
コード例 #18
0
 public override void InsertResult()
 {
     InsertNewPlayerChoiceResultID();
     DbCommands.InsertTupleToTable("DialoguesActivatedByDialogueChoices", playerChoiceResultID, PlayerChoiceID, dialogueID);
     dialogueUI.DisplayResultsRelatedToChoices();
     dialogueUI.DeactivateNewChoiceResult();
 }
コード例 #19
0
        private void letsGoBtn_Click(object sender, RoutedEventArgs e)
        {
            if (boxOldPass.Password == UserSet.Password)
            {
                if (NewPasswordTexBox.Password == ConfirmPasswordTextBox.Password)
                {
                    UserSet.Password = NewPasswordTexBox.Password;
                    DbCommands cmd = new DbCommands();
                    UserSet.FuncName = "UserEdit";
                    cmd.SendUser(UserSet);

                    const string filePathUser = @"../../Data/User.bin";
                    if (File.Exists(filePathUser)) //Якщо юзер користувався функцією автологіна
                    {
                        File.Delete(filePathUser);
                    }

                    MessageBox.Show("Пароль змінено!");
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Нові паролі не співпадають");
                }
            }
            else
            {
                MessageBox.Show("Неправильний старий пароль");
            }
        }
コード例 #20
0
ファイル: Commands.cs プロジェクト: drualcman/BlasorIndexedDb
 /// <summary>
 /// Execute a command directly sending a json string
 /// </summary>
 /// <param name="command"></param>
 /// <param name="storeName"></param>
 /// <param name="data"></param>
 /// <exception cref="ResponseException"></exception>
 /// <returns></returns>
 public async ValueTask <List <ResponseJsDb> > DbCommand(DbCommands command, string storeName, string data)
 {
     if (Settings.EnableDebug)
     {
         Console.WriteLine($"{command} store = {storeName}, data = {data}");
     }
     if (string.IsNullOrEmpty(storeName))
     {
         throw new ResponseException(command.ToString(), "StoreName can't be null", data);
     }
     else if (string.IsNullOrEmpty(data))
     {
         throw new ResponseException(command.ToString(), storeName, "Data can't be null");
     }
     else
     {
         try
         {
             return(await jsRuntime.InvokeAsync <List <ResponseJsDb> >($"MyDb.{command}", storeName, data, Setup.DBName, Setup.Version, Setup.ModelsAsJson));
         }
         catch (Exception ex)
         {
             if (Settings.EnableDebug)
             {
                 Console.WriteLine($"Exception: {ex.Message}");
             }
             throw new ResponseException(command.ToString(), storeName, data, ex);
         }
     }
 }
コード例 #21
0
ファイル: Lobby.xaml.cs プロジェクト: Uglus/isbd
        private void BtnStartGame_Click(object sender, RoutedEventArgs e)
        {
            UserToSession userSession = new UserToSession();
            Session       session     = new Session();

            userSession.Session      = session;
            userSession.User         = UserSet;
            userSession.Session.Quiz = QuizSet;
            int cnt = QuizSet.Question.Count;

            for (int i = 0; i < cnt; i++)
            {
                Play_Quiz play = new Play_Quiz(userSession, i);
                if (play.ShowDialog() == true)
                {
                    userSession = play.UserSessionSet;
                }
            }

            DbCommands cmd = new DbCommands();

            cmd.SendUserSession(userSession);

            Quiz_Final final = new Quiz_Final();

            final.ShowDialog();
        }
コード例 #22
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];
        }
    }
コード例 #23
0
 public void InsertNewCharLink()
 {
     DbCommands.InsertTupleToTable("CharacterDialogues",
                                   selectedCharLink.GetComponent <AddCharDialogueBtn>().CharacterName,
                                   selectedCharLink.GetComponent <AddCharDialogueBtn>().SceneName,
                                   (GetSelectedItemFromGroup(selectedDialogue) as Dialogue).MyID);
 }
コード例 #24
0
        public static void PrintDbTable(string tblName)
        {
            List <string[]> strArray = new List <string[]>();

            DbCommands.GetDbTableListToPrint(tblName, out strArray);
            PrintListOfStrArrays(strArray);
        }
コード例 #25
0
        //protected void OnMouseUpAsButton() {
        //    InsertChoice();
        //}

        protected void InsertNewDialogueNodeVocabTest(string nodeID)
        {
            DbCommands.InsertTupleToTable("DialogueNodesVocabTests",
                                          nodeID,
                                          english,
                                          welsh);
            dialogueNodeDetailsUI.DeactivateNodeDetails();
        }
コード例 #26
0
 private void SetDefaultValues()
 {
     tallyShiftTotal      = skillPointsGainedTotal = 0;
     answerCorrectPercent = -1; //-1 when not set
     grammarDetailsDict   = new Dictionary <int, string[]>();
     highestTallyPossible = DbCommands.GetMaxFromTable("Proficiencies", "Thresholds");
     SetGrammar();
 }
コード例 #27
0
        //protected void OnMouseUpAsButton() {
        //    InsertChoice();
        //}

        protected void InsertNewPlayerChoiceVocabTest(string choiceID)
        {
            DbCommands.InsertTupleToTable("PlayerChoicesVocabTests",
                                          choiceID,
                                          english,
                                          welsh);
            playerChoiceDetailsUI.DeactivateChoiceDetails();
        }
コード例 #28
0
 public void DeleteNode()
 {
     string[,] fields = { { "NodeIDs", myID } };
     DbCommands.DeleteTupleInTable("DialogueNodes",
                                   fields);
     playerChoicesListUI.HidePlayerChoices();
     Destroy(gameObject);
 }
コード例 #29
0
 public void DeleteCompleteDialogueResult(string choiceID)
 {
     DbCommands.UpdateTableField(
         "PlayerChoices",
         "MarkDialogueCompleted",
         "0",
         "ChoiceIDs = " + choiceID);
 }
コード例 #30
0
        public void InsertChoice()
        {
            string choiceID = DbCommands.GenerateUniqueID("PlayerChoices", "ChoiceIDs", "ChoiceID");

            playerChoiceDetailsUI.InsertPlayerChoice(english, choiceID);
            InsertNewPlayerChoiceVocabTest(choiceID);
            playerChoiceListUI.DisplayChoicesRelatedToNode();
        }