public void SaveOptions(SM4OptionClass optionClass) { string path = Path.Combine(Application.streamingAssetsPath + "options.xml"); FileStream stream = new FileStream(@path, FileMode.Create); XmlSerializer xmlSerializer = new XmlSerializer(typeof(SM4OptionClass)); xmlSerializer.Serialize(stream, optionClass); stream.Close(); }
// this if for use form the pause menu in game public void OpenOptionMenu() { options = World.instance.options; options.LoadOptions(options, true); GetResolutions(); previousMenu = null; HideTabs(); ClassToMenu(); ShowGamePlayTab(); }
public void OpenOptionMenu(GameObject menuToReturnTo) { options = new SM4OptionClass(); options.LoadOptions(options, true); GetResolutions(); previousMenu = menuToReturnTo; HideTabs(); ClassToMenu(); ShowGamePlayTab(); }
public void LoadOptions(SM4OptionClass optionClass, bool firstAttemp) { string path = Path.Combine(Application.streamingAssetsPath + "options.xml"); try { FileStream stream = new FileStream(@path, FileMode.Open); XmlSerializer xmlSerializer = new XmlSerializer(typeof(SM4OptionClass)); optionClass = xmlSerializer.Deserialize(stream) as SM4OptionClass; stream.Close(); } catch { SM4OptionClass emptyOptions = new SM4OptionClass(); optionClass = emptyOptions; SaveOptions(optionClass); } }