コード例 #1
0
    public void Btn_ImportItemList()
    {
        string[] paths = StandaloneFileBrowser.OpenFilePanel("Import", LastPaths.instance.lastItemListPath, "json", false);

        if (paths.Length > 0)
        {
            LastPaths.instance.SetLastItemListPath(paths[0]);

            InventoryList importObj = JsonUtility.FromJson <InventoryList>(File.ReadAllText(paths[0]));
            if (!importObj.itemSlots.Any())
            {
                PopupWindow.Create(PopupWindow.importFailedErrorMsg);
                return;
            }
            inventory.MergeItemLists(importObj.itemSlots);
        }
    }
コード例 #2
0
    // -========== Export and Import ==========- //


    public void Btn_ExportItemList()
    {
        if (!inventory.items.Any())
        {
            PopupWindow.Create("Inventory is empty.");
            return;
        }

        string path = StandaloneFileBrowser.SaveFilePanel("Export To", LastPaths.instance.lastItemListPath, "ItemList", "json");

        if (!string.IsNullOrEmpty(path))
        {
            LastPaths.instance.SetLastItemListPath(path);

            InventoryList exportObj = new InventoryList(inventory.items);
            string        jsonObj   = JsonUtility.ToJson(exportObj);
            File.WriteAllText(path, jsonObj);
        }
    }
コード例 #3
0
        public ExportVideoWindow(Gwen.Controls.ControlBase parent, GLWindow game) : base(parent, "Export Video")
        {
            game.Track.Stop();
            var openwindows = game.Canvas.GetOpenWindows();

            foreach (var v in openwindows)
            {
                if (v is WindowControl)
                {
                    ((WindowControl)v).Close();
                }
            }
            MakeModal(true);
            Width  = 400;
            Height = 280;
            ControlBase bottom = new ControlBase(this);

            bottom.Height = 150;
            bottom.Width  = 400 - 13;
            Align.AlignBottom(bottom);

            var buttonok = new Button(bottom);

            buttonok.Name   = "Okay";
            buttonok.Text   = "Record";
            buttonok.Height = 20;
            buttonok.Y      = 80;
            buttonok.Width  = 100;
            if (!Drawing.SafeFrameBuffer.CanRecord)
            {
                buttonok.IsHidden = true;
            }
            buttonok.Clicked += (o, e) =>
            {
                var wnd = ((WindowControl)o.Parent.Parent);
                wnd.Close();
                if (game.Track.GetFlag() == null)
                {
                    var pop = PopupWindow.Create(parent, game,
                                                 "No flag detected, place one at the end of the track so the recorder knows where to stop.",
                                                 "Error", true, false);
                    pop.FindChildByName("Okay", true).Clicked +=
                        (o1, e1) => { pop.Close(); };
                }
                else
                {
                    var  radiogrp = (RadioButtonGroup)this.FindChildByName("qualityselector", true);
                    bool is1080p  = radiogrp.Selected.Text == "1080p";
                    TrackFiles.TrackRecorder.RecordTrack(game, is1080p);
                }
            };
            Align.AlignLeft(buttonok);
            var buttoncancel = new Button(bottom);

            buttoncancel.Name     = "Cancel";
            buttoncancel.Text     = "Cancel";
            buttoncancel.Height   = 20;
            buttoncancel.Y        = 80;
            buttoncancel.Width    = 100;
            buttoncancel.Clicked += (o, e) => { this.Close(); };
            Align.AlignRight(buttoncancel);
            var label = new RichLabel(this);

            label.Dock  = Pos.Top;
            label.Width = this.Width;
            if (Drawing.SafeFrameBuffer.CanRecord)
            {
                label.AddText("You are about to export your track as a video file. Make sure the end of the track is marked by a flag. It will be located in the same folder as linerider.exe. Please allow some minutes depending on your computer speed. The window will become unresponsive during this time." + Environment.NewLine + Environment.NewLine + "After recording, a console window will open to encode the video. Closing it will cancel the process and all progress will be lost.", parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            }
            else
            {
                label.AddText("Video export is not supported on this machine." + Environment.NewLine + "Sorry.", parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            }
            label.SizeToChildren(false, true);
            var radio = new RadioButtonGroup(bottom);

            radio.Name = "qualityselector";
            radio.AddOption("720p").Select();
            radio.AddOption("1080p");
            Align.AlignLeft(radio);
            radio.Y += 20;
            if (!Drawing.SafeFrameBuffer.CanRecord)
            {
                radio.IsHidden = true;
            }
            DisableResizing();
        }
コード例 #4
0
        public static void Create(MainWindow game)
        {
            string howto = "You are about to export your track as a video file. Make sure the end of the track is marked by a flag. " +
                           "It will be located in your line rider user directory (Documents/LRA).\r\n" +
                           "Please allow some minutes depending on your computer speed. " +
                           "The window will become unresponsive during this time.\n\n" +
                           "After recording, a console window will open to encode the video. " +
                           "Closing it will cancel the process and all progress will be lost.";

            if (!SafeFrameBuffer.CanRecord)
            {
                howto = "Video export is not supported on this machine.\n\nSorry.";
            }
            var popup = PopupWindow.Create(howto, "Export Video", true, true);

            popup.Width = 350;

            popup.Container.Height += 50;
            var btn = popup.Container.FindChildByName("Okay");

            btn.Margin = new Margin(btn.Margin.Left, btn.Margin.Top + (Settings.Local.EnableSong ? 70 : 50), btn.Margin.Right, btn.Margin.Bottom);
            btn        = popup.Container.FindChildByName("Cancel");
            btn.Margin = new Margin(btn.Margin.Left, btn.Margin.Top + (Settings.Local.EnableSong ? 70 : 50), btn.Margin.Right, btn.Margin.Bottom);
            popup.Layout();
            var radio = new RadioButtonGroup(popup.Container);

            radio.Name = "qualityselector";

            if (Settings.Record108p)
            {
                radio.AddOption("720p");
                radio.AddOption("1080p").Select();
            }
            else
            {
                radio.AddOption("720p").Select();
                radio.AddOption("1080p");
            }

            if (!SafeFrameBuffer.CanRecord)
            {
                radio.IsHidden = true;
            }
            LabeledCheckBox smooth = new LabeledCheckBox(popup.Container);

            smooth.Name      = "smooth";
            smooth.IsChecked = Settings.RecordSmooth;
            smooth.Text      = "Smooth Playback";
            Align.AlignBottom(smooth);

            LabeledCheckBox music = new LabeledCheckBox(popup.Container);

            music.Name      = "music";
            music.IsChecked = Settings.Local.EnableSong && Settings.RecordMusic;
            music.IsHidden  = !Settings.Local.EnableSong;
            music.Text      = "Include Music";
            if (Settings.Local.EnableSong)
            {
                popup.Container.Height += 20;
                Align.PlaceDownLeft(music, smooth);
            }
            popup.Layout();

            popup.SetPosition((game.RenderSize.Width / 2) - (popup.Width / 2), (game.RenderSize.Height / 2) - (popup.Height / 2));

            popup.Dismissed += (o, e) =>
            {
                if (popup.Result == System.Windows.Forms.DialogResult.OK)
                {
                    var  radiogrp = radio;
                    bool is1080p  = radiogrp.Selected.Text == "1080p";

                    Settings.Record108p   = is1080p;
                    Settings.RecordSmooth = smooth.IsChecked;
                    if (Settings.Local.EnableSong)
                    {
                        Settings.RecordMusic = music.IsChecked;
                    }
                    Settings.Save();

                    if (game.Track.GetFlag() == null)
                    {
                        var pop = PopupWindow.Create(
                            "No flag detected, place one at the end of the track so the recorder knows where to stop.",
                            "Error", true, false);
                    }
                    else if (game.Track.Name == Utils.Constants.DefaultTrackName)
                    {
                        var pop = PopupWindow.Create(
                            "Please name your track before recording.",
                            "Error", true, false);
                    }
                    else
                    {
                        IO.TrackRecorder.RecordTrack(game, is1080p, smooth.IsChecked, music.IsChecked);
                    }
                }
            };
        }