コード例 #1
0
        /// <summary>
        /// Load input data and place it inside the database.
        /// </summary>
        /// <param name="DBInputData"></param>
        private void LoadDataFrom(DatabaseInputData DBInputData)
        {
            {
                Debug.Log("Loading Letters...");
                var parser = new LetterParser();
                parser.Parse(DBInputData.letterDataAsset.text, database, database.GetLetterTable());
            }

            {
                // @note: depends on Letter
                Debug.Log("Loading Words...");
                var parser = new WordParser();
                parser.Parse(DBInputData.wordDataAsset.text, database, database.GetWordTable());
            }

            {
                // @note: depends on Word
                Debug.Log("Loading Phrases...");
                var parser = new PhraseParser();
                parser.Parse(DBInputData.phraseDataAsset.text, database, database.GetPhraseTable());
            }

            {
                Debug.Log("Loading MiniGames...");
                var parser = new MiniGameParser();
                parser.Parse(DBInputData.minigameDataAsset.text, database, database.GetMiniGameTable());
            }

            {
                // @note: depends on Minigame
                Debug.Log("Loading PlaySessions...");
                var parser = new PlaySessionParser();
                parser.Parse(DBInputData.playSessionDataAsset.text, database, database.GetPlaySessionTable());
            }

            {
                // @note: depends on Letter, Word, Phrase, PlaySession
                Debug.Log("Loading LearningBlocks...");
                var parser = new LearningBlockParser();
                parser.Parse(DBInputData.playSessionDataAsset.text, database, database.GetLearningBlockTable());
            }

            {
                Debug.Log("Loading Localization...");
                var parser = new LocalizationParser();
                parser.Parse(DBInputData.localizationDataAsset.text, database, database.GetLocalizationTable());
            }

            {
                Debug.Log("Loading Stages...");
                var parser = new StageParser();
                parser.Parse(DBInputData.stageDataAsset.text, database, database.GetStageTable());
            }

            {
                Debug.Log("Loading Rewards...");
                var parser = new RewardParser();
                parser.Parse(DBInputData.rewardDataAsset.text, database, database.GetRewardTable());
            }

            // Save database modifications
            EditorUtility.SetDirty(database.stageDb);
            EditorUtility.SetDirty(database.minigameDb);
            EditorUtility.SetDirty(database.rewardDb);
            EditorUtility.SetDirty(database.letterDb);
            EditorUtility.SetDirty(database.wordDb);
            EditorUtility.SetDirty(database.phraseDb);
            EditorUtility.SetDirty(database.localizationDb);
            EditorUtility.SetDirty(database.learningblockDb);
            EditorUtility.SetDirty(database.playsessionDb);
            AssetDatabase.SaveAssets();
        }