Ejemplo n.º 1
0
        /// <summary>
        /// Loads all files from the source immediately.  For editor tooling.
        /// </summary>
        public void LoadFromSourceImmediately(ConfigSource source)
        {
            Config.Assert(Platform.Instance.CanDoImmediatePreload, "Trying to load immediately on a platform that doesn't support it");
            m_isPreloading = true;
            Config.Log(LogVerbosity.Info, "Immediate-loading " + source);

            source.Preload(() => {});  // assume that this is immediate
            var files = source.GetFiles();

            foreach (var finfo in files)
            {
                m_configFiles.Add(finfo.Name);
                m_loadedFiles.Add(finfo.Name, finfo);
            }

            m_isPreloading = false;
            m_isPreloaded  = true;
        }
Ejemplo n.º 2
0
        void HotloadIndex(ConfigSource source)
        {
            var files = source.GetFiles();

            foreach (var finfo in files)
            {
                if (!m_configFiles.Contains(finfo.Name))
                {
                    m_configFiles.Add(finfo.Name);
                }
                bool isNewFile = !m_loadedFiles.ContainsKey(finfo.Name);
                m_loadedFiles[finfo.Name] = finfo;
                if (isNewFile && OnHotloadFile != null)
                {
                    OnHotloadFile(finfo.Name);
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds a source of config files, to be consulted when loading or hotloading.
 /// </summary>
 public void AddSource(ConfigSource source)
 {
     m_sources.Add(source);
 }