Commit Description:
Show tower on status bar.
Commit Description:
Show tower on status bar.
Show/Diff file:
Action:
isometric-park-fna/Options.cs
69 lines | 1.8 KiB | text/x-csharp | CSharpLexer
using System.IO;
using Newtonsoft.Json;
namespace isometricparkfna
{
public enum ProfanityLevel
{
Uncensored,
Minced,
Removed
}
public class Options
{
public string fontName;
public int fontSize;
public ProfanityLevel profanitySetting;
//Sound
public float SoundEffectVolume;
public bool SoundEffectMuted;
public Options(string fontName, int fontSize, ProfanityLevel profanitySetting,
float soundEffectVolume, bool soundEffectMuted)
{
this.fontName = fontName;
this.fontSize = fontSize;
this.profanitySetting = profanitySetting;
this.SoundEffectVolume = soundEffectVolume;
this.SoundEffectMuted = soundEffectMuted;
}
public static void writeOptions(string fontName, int fontSize, ProfanityLevel profanitySetting,
float soundEffectVolume, bool soundEffectMuted)
{
var options = new Options(fontName, fontSize, profanitySetting, soundEffectVolume,
soundEffectMuted);
string json = JsonConvert.SerializeObject(options,
Formatting.Indented);
File.WriteAllText(@"options.json", json);
Logging.Success("Writing options to file.");
}
public static Options readOptions()
{
var json = File.ReadAllText(@"options.json");
Logging.Spy(new {json=json});
Options options = JsonConvert.DeserializeObject<Options>(json);
Logging.Spy(new {name=options.fontName,
size=options.fontSize,
vol=options.SoundEffectVolume
});
Logging.Success("Read options.");
return options;
}
}
}