예제 #1
0
        /// <summary>
        /// Ensure Configs load
        /// </summary>
        /// <param name="forceReload"></param>
        public static EngineConfigs PreloadConfigs(bool forceReload = false)
        {
            if (_engineConfigs != null && !forceReload)
            {
                return(_engineConfigs);
            }

            string configContent = null;
//            if (Application.isEditor && !Application.isPlaying)
//            {
//                // prevent Resources.Load fail on Batch Mode
//                var filePath = "Assets/Resources/AppConfigs.txt";
//                if (File.Exists(filePath))
//                    configContent = System.IO.File.ReadAllText(filePath);
//            }
//            else
//            {
            var textAsset = Resources.Load <TextAsset>("AppConfigs");

            if (textAsset != null)
            {
                configContent = textAsset.text;
            }
//            }

            _engineConfigs = new EngineConfigs(configContent);
            return(_engineConfigs);
        }
예제 #2
0
        /// <summary>
        /// Ensure Configs load
        /// </summary>
        /// <param name="forceReload"></param>
        public static EngineConfigs PreloadConfigs(bool forceReload = false)
        {
            if (_engineConfigs != null && !forceReload)
                return _engineConfigs;

            string configContent = null;
            if (Application.isEditor && !Application.isPlaying)
            {
                // prevent Resources.Load fail on Batch Mode
                var filePath = "Assets/Resources/AppConfigs.txt";
                if (File.Exists(filePath))
                    configContent = System.IO.File.ReadAllText(filePath);
            }
            else
            {
                var textAsset = Resources.Load<TextAsset>("AppConfigs");
                if (textAsset != null)
                    configContent = textAsset.text;
            }

            _engineConfigs = new EngineConfigs(configContent);
            return _engineConfigs;
        }