private void SwitchSettings(FSSettingsPlatform platform)
 {
     GUI.FocusWindow(-1);
     FSSettings.CoreSettings = loadedFSCoreSettings;
     FSSettings.Save();
     FSSettings.Load(platform);
     loadedFSCoreSettings = FSSettings.CoreSettings;
     switchs = false;
 }
Example #2
0
    public static void Load(FSSettingsPlatform platform)
    {
        // path setup
        string path = Application.dataPath + "/FarseerUnity/Editor/SerializedSettings";

        //Debug.Log("PATH: " +path);
        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }

        //setup vars
        FileStream    fs;
        XmlSerializer xmls;

        //Debug.Log("PATH2: " +path + "/FSCoreSettings_" + platform.ToString() + ".cfg");
        //FSCoreSettings
        if (File.Exists(path + "/FSCoreSettings_" + platform.ToString() + ".cfg"))
        {
            //Debug.Log("EXISTS");
            xmls         = new XmlSerializer(typeof(FSCoreSettings));
            fs           = new FileStream(path + "/FSCoreSettings_" + platform.ToString() + ".cfg", FileMode.Open);
            coreSettings = xmls.Deserialize(fs) as FSCoreSettings;
            //Debug.Log(coreSettings);
            fs.Close();
        }
        else
        {
            coreSettings = new FSCoreSettings();
        }

        //FSCategorySettings
        if (File.Exists(path + "/FSCategorySettings.cfg"))
        {
            xmls             = new XmlSerializer(typeof(FSCategorySettings));
            fs               = new FileStream(path + "/FSCategorySettings.cfg", FileMode.Open);
            categorySettings = xmls.Deserialize(fs) as FSCategorySettings;
            fs.Close();
        }
        else
        {
            categorySettings = new FSCategorySettings();
        }

        lastPlatform = platform;
    }
Example #3
0
    public static void Save(FSSettingsPlatform platform)
    {
        // path setup
        string path = Application.dataPath + "/FarseerUnity/Editor/SerializedSettings";

        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }

        //setup vars
        FileStream    fs;
        XmlSerializer xmls;
        StreamWriter  sw;

        //FSCoreSettings
        xmls = new XmlSerializer(typeof(FSCoreSettings));
        if (File.Exists(path + "/FSCoreSettings_" + platform.ToString() + ".cfg"))
        {
            fs = File.Open(path + "/FSCoreSettings_" + platform.ToString() + ".cfg", FileMode.Truncate);
        }
        else
        {
            fs = File.Create(path + "/FSCoreSettings_" + platform.ToString() + ".cfg");
        }
        sw = new StreamWriter(fs);
        xmls.Serialize(sw, coreSettings);
        sw.Close();

        //FSCategorySettings
        xmls = new XmlSerializer(typeof(FSCategorySettings));
        if (File.Exists(path + "/FSCategorySettings.cfg"))
        {
            fs = File.Open(path + "/FSCategorySettings.cfg", FileMode.Truncate);
        }
        else
        {
            fs = File.Create(path + "/FSCategorySettings.cfg");
        }
        sw = new StreamWriter(fs);
        xmls.Serialize(sw, categorySettings);
        sw.Close();
    }
Example #4
0
    public static void Save(FSSettingsPlatform platform)
    {
        // path setup
        string path = Application.dataPath + "/FarseerUnity/Editor/SerializedSettings";
        if(!Directory.Exists(path))
            Directory.CreateDirectory(path);

        //setup vars
        FileStream fs;
        XmlSerializer xmls;
        StreamWriter sw;

        //FSCoreSettings
        xmls = new XmlSerializer(typeof(FSCoreSettings));
        if(File.Exists(path + "/FSCoreSettings_" + platform.ToString() + ".cfg"))
            fs = File.Open(path + "/FSCoreSettings_" + platform.ToString() + ".cfg", FileMode.Truncate);
        else
            fs = File.Create(path + "/FSCoreSettings_" + platform.ToString() + ".cfg");
        sw = new StreamWriter(fs);
        xmls.Serialize(sw, coreSettings);
        sw.Close();

        //FSCategorySettings
        xmls = new XmlSerializer(typeof(FSCategorySettings));
        if(File.Exists(path + "/FSCategorySettings.cfg"))
            fs = File.Open(path + "/FSCategorySettings.cfg", FileMode.Truncate);
        else
            fs = File.Create(path + "/FSCategorySettings.cfg");
        sw = new StreamWriter(fs);
        xmls.Serialize(sw, categorySettings);
        sw.Close();
    }
Example #5
0
    public static void Load(FSSettingsPlatform platform)
    {
        // path setup
        string path = Application.dataPath + "/FarseerUnity/Editor/SerializedSettings";
        if(!Directory.Exists(path))
            Directory.CreateDirectory(path);

        //setup vars
        FileStream fs;
        XmlSerializer xmls;

        //FSCoreSettings
        if(File.Exists(path + "/FSCoreSettings_" + platform.ToString() + ".cfg"))
        {
            xmls = new XmlSerializer(typeof(FSCoreSettings));
            fs = new FileStream(path + "/FSCoreSettings_" + platform.ToString() + ".cfg", FileMode.Open);
            coreSettings = xmls.Deserialize(fs) as FSCoreSettings;
            fs.Close();
        }
        else
        {
            coreSettings = new FSCoreSettings();
        }

        //FSCategorySettings
        if(File.Exists(path + "/FSCategorySettings.cfg"))
        {
            xmls = new XmlSerializer(typeof(FSCategorySettings));
            fs = new FileStream(path + "/FSCategorySettings.cfg", FileMode.Open);
            categorySettings = xmls.Deserialize(fs) as FSCategorySettings;
            fs.Close();
        }
        else
        {
            categorySettings = new FSCategorySettings();
        }

        lastPlatform = platform;
    }
	private void SwitchSettings(FSSettingsPlatform platform)
	{
		GUI.FocusWindow(-1);
		FSSettings.CoreSettings = loadedFSCoreSettings;
		FSSettings.Save();
		FSSettings.Load(platform);
		loadedFSCoreSettings = FSSettings.CoreSettings;
		switchs = false;
	}