Esempio n. 1
0
    void Start()
    {
        //if (!SystemParams.Instance().enableStereo) return;

#if !UNITY_EDITOR
        screenType = (BlendType)Enum.Parse(typeof(BlendType), SystemParams.Instance().stereoType, true);
#endif

        switch (screenType)
        {
        case BlendType.Blend1X2:
            this.gameObject.AddComponent <Blend1X2>();
            break;

        case BlendType.Blend1X3:
            this.gameObject.AddComponent <Blend1X3>();
            break;

        case BlendType.Stereo1X2:
            break;

        case BlendType.Stereo1X3:
            break;

        case BlendType.Stereo2X2:
            break;
        }
    }
Esempio n. 2
0
    //如果文件存在则读取文件
    private static void ReadConfig()
    {
        StreamReader sr    = new StreamReader(configPath);
        var          sjson = sr.ReadToEnd();
        SystemParams tps;

        try
        {
            tps = JsonUtility.FromJson <SystemParams>(sjson);
            SystemParams.Instance().CopyFrom(tps);
            sr.Close();
        }
        catch (Exception)
        {
            sr.Close();
            UpdateConfig();
        }
    }
Esempio n. 3
0
    //@brief 此处可重新创建config文件并将这些预设写入
    public static void UpdateConfig()
    {
        try
        {
            configPath = "/../config/config.txt";
            //获取文件路径
            configPath = string.Format("{0}{1}", Application.dataPath, configPath);

            if (File.Exists(configPath))
            {
                File.Delete(configPath);
            }

            FileStream   fs = new FileStream(configPath, FileMode.Create);
            StreamWriter sw = new StreamWriter(fs);

            var sjson = JsonUtility.ToJson(SystemParams.Instance());

            //将Json逐行写入配置文件
            var jsontowrite = sjson.Split(',');

            for (int i = 0; i < jsontowrite.Length; i++)
            {
                if (i != jsontowrite.Length - 1)
                {
                    sw.WriteLine(jsontowrite[i] + ",");
                }
                else
                {
                    sw.WriteLine(jsontowrite[i]);
                }
            }

            sw.Flush();
            sw.Close();
            fs.Close();
        }
        catch (IOException e)
        {
            Debug.Log(e);
        }
    }