Exemple #1
0
        private void Awake()
        {
            Debug.unityLogger.logEnabled = enableLog;

            instance = this;

            var path = dataPath;

#if UNITY_EDITOR
            if (!_bypassINIConfig)
            {
                path = GameSettings.CheckSettings(this);
            }
#else
            var path = GameSettings.CheckSettings(this);
#endif

            if (!GameSettings.IsValidPath(path))
            {
                GameSettings.SetDataPath(string.Empty);
                UnityEngine.SceneManagement.SceneManager.LoadScene("AskPathScene");
            }
            else
            {
                dataPath = path;
            }
        }
Exemple #2
0
        /// <summary>
        /// Checks if a file named Config.ini is located left to the main executable.
        /// Open/Parse it and configure default values.
        /// </summary>
        public static string CheckSettings(TESUnity tes)
        {
            var path  = string.Empty;
            var lines = File.ReadAllLines(ConfigFile);
            var temp  = new string[2];
            var value = string.Empty;

            foreach (var line in lines)
            {
                temp = line.Split('=');

                if (temp.Length == 2)
                {
                    value = temp[1].Trim();

                    switch (temp[0].Trim())
                    {
                    case "AntiAliasing":
                    {
                        int result;
                        if (int.TryParse(value, out result))
                        {
                            if (result >= 0 && result < 4)
                            {
                                tes.antiAliasing = (PostProcessLayer.Antialiasing)result;
                            }
                        }
                    }
                    break;

                    case "PostProcessQuality":
                    {
                        int result;
                        if (int.TryParse(value, out result))
                        {
                            if (result >= 0 && result < 4)
                            {
                                tes.postProcessingQuality = (TESUnity.PostProcessingQuality)result;
                            }
                        }
                    }
                    break;

                    case "AnimateLights": tes.animateLights = ParseBool(value, tes.animateLights); break;

                    case "MorrowindDataPath": path = value; break;

                    case "FollowHeadDirection": tes.followHeadDirection = ParseBool(value, tes.followHeadDirection); break;

                    case "DirectModePreview": tes.directModePreview = ParseBool(value, tes.directModePreview); break;

                    case "SunShadows": tes.renderSunShadows = ParseBool(value, tes.renderSunShadows); break;

                    case "LightShadows": tes.renderLightShadows = ParseBool(value, tes.renderLightShadows); break;

                    case "PlayMusic": tes.playMusic = ParseBool(value, tes.playMusic); break;

                    case "RenderExteriorCellLights": tes.renderExteriorCellLights = ParseBool(value, tes.renderExteriorCellLights); break;

                    case "WaterBackSideTransparent": tes.waterBackSideTransparent = ParseBool(value, tes.waterBackSideTransparent); break;

                    case "RenderPath":
                        var renderPathID = ParseInt(value, 0);
                        if (renderPathID == 1 || renderPathID == 3)
                        {
                            tes.renderPath = (RenderingPath)renderPathID;
                        }

                        break;

                    case "Shader":
                        switch (value)
                        {
                        case "Default": tes.materialType = TESUnity.MWMaterialType.Default; break;

                        case "Standard": tes.materialType = TESUnity.MWMaterialType.Standard; break;

                        case "Unlit": tes.materialType = TESUnity.MWMaterialType.Unlit; break;

                        default: tes.materialType = TESUnity.MWMaterialType.BumpedDiffuse; break;
                        }
                        break;
                    }
                }
            }

            return(path);
        }