Exemple #1
0
        internal static Monologue GetMonologue(string name)
        {
            Monologue m;

            if (!Instance.LoadedMonologues.TryGetValue(name, out m))
            {
                m = MonologueParser.LoadMonologue(name);
                Instance.LoadedMonologues.Add(name, m);
                CDebug.LogEx("Loaded new monologue " + name, LogLevel.Verbose, Instance);
            }
            return(m);
        }
Exemple #2
0
        /// <summary>
        /// Gets a monologue by name
        /// </summary>
        public Monologue GetMonologue(string name)
        {
            Monologue m;

            if (!LoadedMonologues.TryGetValue(name, out m))
            {
                m = MonologueParser.LoadMonologue(name);
                LoadedMonologues.Add(name, m);
                CDebug.LogEx("Loaded new monologue " + name, LogLevel.Verbose, this);
            }
            return(m);
        }
Exemple #3
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 #4
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");
        }