Exemple #1
0
        private void LoadAll()
        {
            if (CoreParams.LoadPolicy != DataLoadPolicy.OnStart)
            {
                return;
            }

            int dialoguesLoaded = 0, monologuesLoaded = 0;

            TextAsset[] tas = CoreUtils.LoadResources <TextAsset>("Data/Dialogue/");
            foreach (var ta in tas)
            {
                try
                {
                    LoadedDialogues.Add(ta.name, DialogueParser.LoadDialogueFromString(ta.name, ta.text));
                    CDebug.LogEx("Loaded dialogue " + ta.name, LogLevel.Verbose, this);
                    dialoguesLoaded++;
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }

            TextAsset[] tasm = CoreUtils.LoadResources <TextAsset>("Data/Monologue/");
            foreach (var ta in tasm)
            {
                try
                {
                    LoadedMonologues.Add(ta.name, MonologueParser.LoadMonologueFromString(ta.text));
                    CDebug.LogEx("Loaded monologue " + ta.name, LogLevel.Verbose, this);
                    monologuesLoaded++;
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }

            Log($"Loaded {dialoguesLoaded} dialogues, {monologuesLoaded} monologues");
        }
Exemple #2
0
        private void LoadFromTextAssets(IEnumerable <TextAsset> dialogueAssets, IEnumerable <TextAsset> monologueAssets)
        {
            int dialoguesLoaded = 0, monologuesLoaded = 0;

            foreach (var ta in dialogueAssets)
            {
                try
                {
                    LoadedDialogues[ta.name] = DialogueParser.LoadDialogueFromString(ta.name, ta.text);
                    if (ConfigState.Instance.UseVerboseLogging)
                    {
                        CDebug.LogEx("Loaded dialogue " + ta.name, LogLevel.Verbose, this);
                    }
                    dialoguesLoaded++;
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }

            foreach (var ta in monologueAssets)
            {
                try
                {
                    LoadedMonologues[ta.name] = MonologueParser.LoadMonologueFromString(ta.text);
                    if (ConfigState.Instance.UseVerboseLogging)
                    {
                        CDebug.LogEx("Loaded monologue " + ta.name, LogLevel.Verbose, this);
                    }
                    monologuesLoaded++;
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }

            Log($"Loaded {dialoguesLoaded} dialogues, {monologuesLoaded} monologues");
        }