public static void Save(string file) { try { FileUtils.SaveBasicJson(Default, file); } catch (Exception exception) { Console.Error.WriteLine("Failed to save settings: {0}", exception.ToString()); if (exception.InnerException != null) { Console.Error.WriteLine("Inner exception: {0}", exception.InnerException.ToString()); } } }
public static void Save(string file) { FileUtils.SaveBasicJson(Default, file); }
public static void Save(string file) { FileUtils.SaveBasicJson(Mappings, file); }
public override void Construct() { var bottomBar = AddChild(new Widget() { AutoLayout = AutoLayout.DockBottom, MinimumSize = new Point(Rect.Width - 128, 24) }) ; bottomBar.AddChild(new Button() { Text = "Back", OnClick = (sender, args) => this.Close(), AutoLayout = AutoLayout.DockLeft, MinimumSize = new Point(64, 24) }); if (SoundManager.Mixer == null) { Text = "Error. Failed to load audio mixer :("; return; } bottomBar.AddChild(new Button() { Text = "Save", OnClick = (sender, args) => { try { FileUtils.SaveBasicJson(SoundManager.Mixer, AssetManager.ResolveContentPath(ContentPaths.mixer)); } catch (Exception exception) { Console.Out.WriteLine(exception.ToString()); Root.ShowModalPopup(new Popup() { Text = "Failed to save audio mixer. This is a debug tool. Are you a dev?", }); } }, AutoLayout = AutoLayout.DockRight, MinimumSize = new Point(64, 24) }); var listView = AddChild(new WidgetListView() { AutoLayout = AutoLayout.DockBottom, MinimumSize = new Point(Rect.Width - 128, 512), ItemHeight = 24 }); foreach (var level in SoundManager.Mixer.Gains) { var row = listView.AddChild(new Widget() { AutoLayout = AutoLayout.DockTop, MinimumSize = new Point(512, 24) }); row.AddChild(new Widget() { Text = level.Key, TextColor = Color.Black.ToVector4(), AutoLayout = AutoLayout.DockLeft, TextVerticalAlign = VerticalAlign.Center, TextHorizontalAlign = HorizontalAlign.Right, MinimumSize = new Point(256, 24) }); KeyValuePair <string, SFXMixer.Levels> level1 = level; row.AddChild(new HorizontalFloatSlider() { ScrollArea = 1.0f, ScrollPosition = level.Value.Volume, MinimumSize = new Point(256, 24), AutoLayout = AutoLayout.DockLeft, OnSliderChanged = (sender) => { SFXMixer.Levels levels = SoundManager.Mixer.GetOrCreateLevels(level1.Key); SoundManager.Mixer.SetLevels(level1.Key, new SFXMixer.Levels() { RandomPitch = level1.Value.RandomPitch, Volume = (sender as HorizontalFloatSlider).ScrollPosition }); if (MathFunctions.RandEvent(0.15f)) { SoundManager.PlaySound(level1.Key); } } }); } Layout(); base.Construct(); }
public void Save() { var metaDataPath = Directory + ProgramData.DirChar + "meta.json"; FileUtils.SaveBasicJson(this, metaDataPath); }
public void Save() { var metaDataPath = Directory + System.IO.Path.DirectorySeparatorChar + "meta.json"; FileUtils.SaveBasicJson(this, metaDataPath); }