示例#1
0
    void LoadVideoSettings()
    {
        FileInfo fileInf = new FileInfo(videoSettingsFilePath);

        if (!fileInf.Exists)
        {
            GameVideo.SetDefaultSettings();
            return;
        }
        XmlDocument xDoc = new XmlDocument();

        AES.DecryptFile(videoSettingsFilePath, true);
        xDoc.Load(videoSettingsFilePath);
        AES.EncryptFile(videoSettingsFilePath, true);
        XmlElement xRoot = xDoc.DocumentElement;

        foreach (XmlNode xData in xRoot)
        {
            switch (xData.Name)
            {
            case "Resolution":
                int width  = int.Parse(xData.Attributes.GetNamedItem("Width").Value);
                int height = int.Parse(xData.Attributes.GetNamedItem("Height").Value);
                Screen.SetResolution(width, height, true);
                GameVideo.screenResolution = Screen.currentResolution;
                break;

            case "Anisotropic":
                bool filtering = bool.Parse(xData.Attributes.GetNamedItem("Value").Value);
                GameVideo.SetAnisotropicFiltering(filtering);
                break;

            case "AntiAliasing":
                int aliasing = int.Parse(xData.Attributes.GetNamedItem("Value").Value);
                GameVideo.SetAntiAliasing(aliasing);
                break;

            default:
                throw new ArgumentException("Wrong data in file");
            }
        }
    }
 public void ChangeAnisotropicFiltering()
 {
     GameVideo.SetAnisotropicFiltering(m_Anisotropic.isOn);
 }