Ejemplo n.º 1
0
        protected ButtonWidget(ButtonWidget other)
            : base(other)
        {
            Text = other.Text;
            Font = other.Font;
            TextColor = other.TextColor;
            TextColorDisabled = other.TextColorDisabled;
            Contrast = other.Contrast;
            ContrastColor = other.ContrastColor;
            Depressed = other.Depressed;
            VisualHeight = other.VisualHeight;
            GetText = other.GetText;
            GetColor = other.GetColor;
            GetColorDisabled = other.GetColorDisabled;
            GetContrastColor = other.GetContrastColor;
            OnMouseDown = other.OnMouseDown;
            Disabled = other.Disabled;
            IsDisabled = other.IsDisabled;
            Highlighted = other.Highlighted;
            IsHighlighted = other.IsHighlighted;

            OnMouseUp = mi => OnClick();
            OnKeyPress = _ => OnClick();

            TooltipTemplate = other.TooltipTemplate;
            TooltipText = other.TooltipText;
            TooltipContainer = other.TooltipContainer;
            tooltipContainer = Lazy.New(() =>
                Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
        }
Ejemplo n.º 2
0
        static bool ShowModsDropDown(ButtonWidget selector)
        {
            var dropDownOptions = new List<Pair<string, Action>>();

            foreach (var kv in Mod.AllMods)
            {
                var modList = new List<string>() { kv.Key };
                var m = kv.Key;
                while (!string.IsNullOrEmpty(Mod.AllMods[m].Requires))
                {
                    m = Mod.AllMods[m].Requires;
                    modList.Add(m);
                }

                dropDownOptions.Add(new Pair<string, Action>( kv.Value.Title,
                    () =>
                    {
                        if (Game.CurrentMods.Keys.ToArray().SymmetricDifference(modList.ToArray()).Any())
                            Game.RunAfterTick(() => Game.InitializeWithMods( modList.ToArray() ) );
                    }
                ));
            }

            DropDownButtonWidget.ShowDropDown( selector,
                dropDownOptions,
                (ac, w) => new LabelWidget
                {
                    Bounds = new Rectangle(0, 0, w, 24),
                    Text = "  {0}".F(ac.First),
                    OnMouseUp = mi => { ac.Second(); return true; },
                });
            return true;
        }
Ejemplo n.º 3
0
        public FactionTooltipLogic(Widget widget, ButtonWidget button)
        {
            var lines = button.GetTooltipText().Replace("\\n", "\n").Split('\n');

            var header = widget.Get<LabelWidget>("HEADER");
            var headerLine = lines[0];
            var headerFont = Game.Renderer.Fonts[header.Font];
            var headerSize = headerFont.Measure(headerLine);
            header.Bounds.Width += headerSize.X;
            header.Bounds.Height += headerSize.Y;
            header.GetText = () => headerLine;

            if (lines.Length > 1)
            {
                var description = widget.Get<LabelWidget>("DESCRIPTION");
                var descriptionLines = lines.Skip(1).ToArray();
                var descriptionFont = Game.Renderer.Fonts[description.Font];
                description.Bounds.Y += header.Bounds.Y + header.Bounds.Height;
                description.Bounds.Width += descriptionLines.Select(l => descriptionFont.Measure(l).X).Max();
                description.Bounds.Height += descriptionFont.Measure(descriptionLines.First()).Y * descriptionLines.Length;
                description.GetText = () => string.Join("\n", descriptionLines);

                widget.Bounds.Width = Math.Max(header.Bounds.X + header.Bounds.Width, description.Bounds.X + description.Bounds.Width);
                widget.Bounds.Height = description.Bounds.Y + description.Bounds.Height;
            }
            else
            {
                widget.Bounds.Width = header.Bounds.X + header.Bounds.Width;
                widget.Bounds.Height = header.Bounds.Y + header.Bounds.Height;
            }
        }
Ejemplo n.º 4
0
 protected ButtonWidget(ButtonWidget widget)
     : base(widget)
 {
     Text = widget.Text;
     Depressed = widget.Depressed;
     VisualHeight = widget.VisualHeight;
     GetText = widget.GetText;
 }
Ejemplo n.º 5
0
        void SetStance(ButtonWidget bw, Player p, Stance ss)
        {
            if (!p.World.LobbyInfo.GlobalSettings.FragileAlliances)
                return;	// stance changes are banned

            // HACK: Abuse of the type system here with `CPos`
            world.IssueOrder(new Order("SetStance", world.LocalPlayer.PlayerActor, false)
                { TargetLocation = new CPos((int)ss, 0), TargetString = p.InternalName });

            bw.Text = ss.ToString();
        }
Ejemplo n.º 6
0
		void SetStance(ButtonWidget bw, Player p, Stance ss)
		{
			if (!p.World.LobbyInfo.GlobalSettings.FragileAlliances)
				return;	// stance changes are banned

			world.IssueOrder(new Order("SetStance", world.LocalPlayer.PlayerActor, false)
			{
				ExtraData = (uint)ss,
				TargetString = p.InternalName,
			});

			bw.Text = ss.ToString();
		}
Ejemplo n.º 7
0
        protected ButtonWidget(ButtonWidget widget)
            : base(widget)
        {
            Text = widget.Text;
            Font = widget.Font;
            Depressed = widget.Depressed;
            VisualHeight = widget.VisualHeight;
            GetText = widget.GetText;
            OnMouseDown = widget.OnMouseDown;

            OnMouseUp = mi => OnClick();
            OnKeyPress = _ => OnClick();
        }
Ejemplo n.º 8
0
        public D2kInstallFromCDLogic(Widget widget)
        {
            panel = widget.Get("INSTALL_FROMCD_PANEL");
            progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
            statusLabel = panel.Get<LabelWidget>("STATUS_LABEL");

            backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
            backButton.OnClick = Ui.CloseWindow;

            retryButton = panel.Get<ButtonWidget>("RETRY_BUTTON");
            retryButton.OnClick = CheckForDisk;

            installingContainer = panel.Get("INSTALLING");
            insertDiskContainer = panel.Get("INSERT_DISK");
            CheckForDisk();
        }
Ejemplo n.º 9
0
        public D2kExtractGameFilesLogic(Widget widget)
        {
            panel = widget.Get("EXTRACT_GAMEFILES_PANEL");
            progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
            statusLabel = panel.Get<LabelWidget>("STATUS_LABEL");

            backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
            backButton.OnClick = Ui.CloseWindow;

            retryButton = panel.Get<ButtonWidget>("RETRY_BUTTON");
            retryButton.OnClick = Extract;

            extractingContainer = panel.Get("EXTRACTING");
            copyFilesContainer = panel.Get("COPY_FILES");
            Extract();
        }
Ejemplo n.º 10
0
		public ButtonTooltipLogic(Widget widget, ButtonWidget button)
		{
			var label = widget.Get<LabelWidget>("LABEL");
			var hotkey = widget.Get<LabelWidget>("HOTKEY");

			label.GetText = () => button.TooltipText;
			var labelWidth = Game.Renderer.Fonts[label.Font].Measure(button.TooltipText).X;
			label.Bounds.Width = labelWidth;

			var hotkeyLabel = "({0})".F(button.Key.DisplayString());
			hotkey.GetText = () => hotkeyLabel;
			hotkey.Bounds.X = labelWidth + 2 * label.Bounds.X;

			var panelWidth = hotkey.Bounds.X + label.Bounds.X
				+ Game.Renderer.Fonts[label.Font].Measure(hotkeyLabel).X;
			widget.Bounds.Width = panelWidth;
		}
Ejemplo n.º 11
0
        public InstallFromCDLogic(Widget widget, Action continueLoading)
        {
            installData = Game.ModData.Manifest.Get<ContentInstaller>();
            this.continueLoading = continueLoading;
            panel = widget.Get("INSTALL_FROMCD_PANEL");
            progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
            statusLabel = panel.Get<LabelWidget>("STATUS_LABEL");

            backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
            backButton.OnClick = Ui.CloseWindow;

            retryButton = panel.Get<ButtonWidget>("RETRY_BUTTON");
            retryButton.OnClick = CheckForDisk;

            installingContainer = panel.Get("INSTALLING");
            insertDiskContainer = panel.Get("INSERT_DISK");
            CheckForDisk();
        }
Ejemplo n.º 12
0
        public CncInstallFromCDLogic([ObjectCreator.Param] Widget widget,
		                       [ObjectCreator.Param] Action continueLoading)
        {
            this.continueLoading = continueLoading;
            panel = widget.GetWidget("INSTALL_FROMCD_PANEL");
            progressBar = panel.GetWidget<ProgressBarWidget>("PROGRESS_BAR");
            statusLabel = panel.GetWidget<LabelWidget>("STATUS_LABEL");

            backButton = panel.GetWidget<ButtonWidget>("BACK_BUTTON");
            backButton.OnClick = Widget.CloseWindow;

            retryButton = panel.GetWidget<ButtonWidget>("RETRY_BUTTON");
            retryButton.OnClick = CheckForDisk;

            installingContainer = panel.GetWidget("INSTALLING");
            insertDiskContainer = panel.GetWidget("INSERT_DISK");
            CheckForDisk();
        }
Ejemplo n.º 13
0
        public MissionObjectivesLogic(World world, Widget widget)
        {
            var gameRoot = Ui.Root.Get("INGAME_ROOT");
            primaryPanel = widget.Get("PRIMARY_OBJECTIVES");
            secondaryPanel = widget.Get("SECONDARY_OBJECTIVES");
            primaryTemplate = primaryPanel.Get("PRIMARY_OBJECTIVE_TEMPLATE");
            secondaryTemplate = secondaryPanel.Get("SECONDARY_OBJECTIVE_TEMPLATE");

            objectives = world.WorldActor.TraitsImplementing<IHasObjectives>().First();

            objectivesButton = gameRoot.Get<ButtonWidget>("OBJECTIVES_BUTTON");
            objectivesButton.IsHighlighted = () => Game.LocalTick % 50 < 25 && objectivesButton.Highlighted;
            objectivesButton.OnClick += () => objectivesButton.Highlighted = false;

            objectives.OnObjectivesUpdated += UpdateObjectives;
            UpdateObjectives(true);
            Game.ConnectionStateChanged += RemoveHandlers;
        }
Ejemplo n.º 14
0
		public InstallFromCDLogic(Widget widget, Action afterInstall, string modId)
		{
			this.modId = modId;
			installData = ModMetadata.AllMods[modId].Content;
			this.afterInstall = afterInstall;
			panel = widget.Get("INSTALL_FROMCD_PANEL");
			progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
			statusLabel = panel.Get<LabelWidget>("STATUS_LABEL");

			backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
			backButton.OnClick = Ui.CloseWindow;

			retryButton = panel.Get<ButtonWidget>("RETRY_BUTTON");
			retryButton.OnClick = CheckForDisk;

			installingContainer = panel.Get("INSTALLING");
			insertDiskContainer = panel.Get("INSERT_DISK");
			CheckForDisk();
		}
Ejemplo n.º 15
0
        public ConvertGameFilesLogic(Widget widget, string[][] ExtractGameFiles, string[][] ExportToPng, string[][] ImportFromPng)
        {
            panel = widget.Get("CONVERT_ASSETS_PANEL");
            progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
            statusLabel = panel.Get<LabelWidget>("STATUS_LABEL");

            backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
            backButton.OnClick = Ui.CloseWindow;

            retryButton = panel.Get<ButtonWidget>("RETRY_BUTTON");
            retryButton.OnClick = Extract;

            extractingContainer = panel.Get("EXTRACTING");

            this.ExtractGameFiles = ExtractGameFiles;
            this.ExportToPng = ExportToPng;
            this.ImportFromPng = ImportFromPng;

            Extract();
        }
        public CncInstallFromCDLogic(Widget widget, Action afterInstall, string[] filesToCopy, string[] filesToExtract)
        {
            this.afterInstall = afterInstall;
            this.filesToCopy = filesToCopy;
            this.filesToExtract = filesToExtract;

            panel = widget;
            progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
            statusLabel = panel.Get<LabelWidget>("STATUS_LABEL");

            backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
            backButton.OnClick = Ui.CloseWindow;

            retryButton = panel.Get<ButtonWidget>("RETRY_BUTTON");
            retryButton.OnClick = CheckForDisk;

            installingContainer = panel.Get("INSTALLING");
            insertDiskContainer = panel.Get("INSERT_DISK");

            CheckForDisk();
        }
Ejemplo n.º 17
0
        public InstallFromDiscLogic(Widget widget, ModContent content, Dictionary<string, ModContent.ModSource> sources, Action afterInstall)
        {
            this.content = content;
            this.sources = sources;

            Log.AddChannel("install", "install.log");

            // this.afterInstall = afterInstall;
            panel = widget.Get("DISC_INSTALL_PANEL");

            titleLabel = panel.Get<LabelWidget>("TITLE");

            primaryButton = panel.Get<ButtonWidget>("PRIMARY_BUTTON");
            secondaryButton = panel.Get<ButtonWidget>("SECONDARY_BUTTON");

            // Progress view
            progressContainer = panel.Get("PROGRESS");
            progressContainer.IsVisible = () => visible == Mode.Progress;
            progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
            progressLabel = panel.Get<LabelWidget>("PROGRESS_MESSAGE");
            progressLabel.IsVisible = () => visible == Mode.Progress;

            // Message view
            messageContainer = panel.Get("MESSAGE");
            messageContainer.IsVisible = () => visible == Mode.Message;
            messageLabel = messageContainer.Get<LabelWidget>("MESSAGE_MESSAGE");

            // List view
            listContainer = panel.Get("LIST");
            listContainer.IsVisible = () => visible == Mode.List;

            listPanel = listContainer.Get<ScrollPanelWidget>("LIST_PANEL");
            listHeaderTemplate = listPanel.Get("LIST_HEADER_TEMPLATE");
            listTemplate = listPanel.Get<LabelWidget>("LIST_TEMPLATE");
            listPanel.RemoveChildren();

            listLabel = listContainer.Get<LabelWidget>("LIST_MESSAGE");

            DetectContentDisks();
        }
Ejemplo n.º 18
0
        public ButtonTooltipLogic(Widget widget, ButtonWidget button)
        {
            var label = widget.Get<LabelWidget>("LABEL");
            var font = Game.Renderer.Fonts[label.Font];
            var labelWidth = font.Measure(button.TooltipText).X;

            label.GetText = () => button.TooltipText;
            label.Bounds.Width = labelWidth;
            widget.Bounds.Width = 2 * label.Bounds.X + labelWidth;

            if (button.Key.IsValid())
            {
                var hotkey = widget.Get<LabelWidget>("HOTKEY");
                hotkey.Visible = true;

                var hotkeyLabel = "({0})".F(button.Key.DisplayString());
                hotkey.GetText = () => hotkeyLabel;
                hotkey.Bounds.X = labelWidth + 2 * label.Bounds.X;

                widget.Bounds.Width = hotkey.Bounds.X + label.Bounds.X + font.Measure(hotkeyLabel).X;
            }
        }
Ejemplo n.º 19
0
		public MissionBrowserLogic(Widget widget, World world, Action onStart, Action onExit)
		{
			this.onStart = onStart;

			missionList = widget.Get<ScrollPanelWidget>("MISSION_LIST");

			headerTemplate = widget.Get<ScrollItemWidget>("HEADER");
			template = widget.Get<ScrollItemWidget>("TEMPLATE");

			var title = widget.GetOrNull<LabelWidget>("MISSIONBROWSER_TITLE");
			if (title != null)
				title.GetText = () => playingVideo != PlayingVideo.None ? selectedMapPreview.Title : title.Text;

			widget.Get("MISSION_INFO").IsVisible = () => selectedMapPreview != null;

			var previewWidget = widget.Get<MapPreviewWidget>("MISSION_PREVIEW");
			previewWidget.Preview = () => selectedMapPreview;
			previewWidget.IsVisible = () => playingVideo == PlayingVideo.None;

			videoPlayer = widget.Get<VqaPlayerWidget>("MISSION_VIDEO");
			widget.Get("MISSION_BIN").IsVisible = () => playingVideo != PlayingVideo.None;
			fullscreenVideoPlayer = Ui.LoadWidget<BackgroundWidget>("FULLSCREEN_PLAYER", Ui.Root, new WidgetArgs { { "world", world } });

			descriptionPanel = widget.Get<ScrollPanelWidget>("MISSION_DESCRIPTION_PANEL");

			description = descriptionPanel.Get<LabelWidget>("MISSION_DESCRIPTION");
			descriptionFont = Game.Renderer.Fonts[description.Font];

			difficultyButton = widget.Get<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
			gameSpeedButton = widget.GetOrNull<DropDownButtonWidget>("GAMESPEED_DROPDOWNBUTTON");

			startBriefingVideoButton = widget.Get<ButtonWidget>("START_BRIEFING_VIDEO_BUTTON");
			stopBriefingVideoButton = widget.Get<ButtonWidget>("STOP_BRIEFING_VIDEO_BUTTON");
			stopBriefingVideoButton.IsVisible = () => playingVideo == PlayingVideo.Briefing;
			stopBriefingVideoButton.OnClick = () => StopVideo(videoPlayer);

			startInfoVideoButton = widget.Get<ButtonWidget>("START_INFO_VIDEO_BUTTON");
			stopInfoVideoButton = widget.Get<ButtonWidget>("STOP_INFO_VIDEO_BUTTON");
			stopInfoVideoButton.IsVisible = () => playingVideo == PlayingVideo.Info;
			stopInfoVideoButton.OnClick = () => StopVideo(videoPlayer);

			var allMaps = new List<Map>();
			missionList.RemoveChildren();

			// Add a group for each campaign
			if (Game.ModData.Manifest.Missions.Any())
			{
				var yaml = Game.ModData.Manifest.Missions.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal);

				foreach (var kv in yaml)
				{
					var missionMapPaths = kv.Value.Nodes.Select(n => Path.GetFullPath(n.Key));

					var maps = Game.ModData.MapCache
						.Where(p => p.Status == MapStatus.Available && missionMapPaths.Contains(Path.GetFullPath(p.Map.Path)))
						.Select(p => p.Map);

					CreateMissionGroup(kv.Key, maps);
					allMaps.AddRange(maps);
				}
			}

			// Add an additional group for loose missions
			var looseMissions = Game.ModData.MapCache
				.Where(p => p.Status == MapStatus.Available && p.Map.Visibility.HasFlag(MapVisibility.MissionSelector) && !allMaps.Contains(p.Map))
				.Select(p => p.Map);

			if (looseMissions.Any())
			{
				CreateMissionGroup("Missions", looseMissions);
				allMaps.AddRange(looseMissions);
			}

			if (allMaps.Any())
				SelectMap(allMaps.First());

			var startButton = widget.Get<ButtonWidget>("STARTGAME_BUTTON");
			startButton.OnClick = StartMissionClicked;
			startButton.IsDisabled = () => selectedMapPreview == null || selectedMapPreview.RuleStatus != MapRuleStatus.Cached;

			widget.Get<ButtonWidget>("BACK_BUTTON").OnClick = () =>
			{
				StopVideo(videoPlayer);
				Game.Disconnect();
				Ui.CloseWindow();
				onExit();
			};
		}
Ejemplo n.º 20
0
        bool ShowSlotDropDown(Session.Slot slot, ButtonWidget name, bool showBotOptions)
        {
            var dropDownOptions = new List<Pair<string, Action>>
            {
                new Pair<string, Action>( "Open",
                    () => orderManager.IssueOrder( Order.Command( "slot_open " + slot.Index )  )),
                new Pair<string, Action>( "Closed",
                    () => orderManager.IssueOrder( Order.Command( "slot_close " + slot.Index ) )),
            };

            if (showBotOptions)
            {
                var bots = Rules.Info["player"].Traits.WithInterface<IBotInfo>().Select(t => t.Name);
                bots.Do(bot =>
                    dropDownOptions.Add(new Pair<string, Action>("Bot: {0}".F(bot),
                        () => orderManager.IssueOrder(Order.Command("slot_bot {0} {1}".F(slot.Index, bot))))));
            }

            DropDownButtonWidget.ShowDropDown( name,
                dropDownOptions,
                (ac, w) => new LabelWidget
                {
                    Bounds = new Rectangle(0, 0, w, 24),
                    Text = "  {0}".F(ac.First),
                    OnMouseUp = mi => { ac.Second(); return true; },
                });
            return true;
        }
Ejemplo n.º 21
0
        public ModBrowserLogic(Widget widget)
        {
            var panel = widget;
            var loadButton = panel.Get<ButtonWidget>("LOAD_BUTTON");
            loadButton.OnClick = () => LoadMod(selectedMod);
            loadButton.IsDisabled = () => selectedMod.Id == Game.modData.Manifest.Mod.Id;

            panel.Get<ButtonWidget>("QUIT_BUTTON").OnClick = Game.Exit;

            modList = panel.Get("MOD_LIST");
            modTemplate = modList.Get<ButtonWidget>("MOD_TEMPLATE");

            panel.Get<LabelWidget>("MOD_DESC").GetText = () => selectedDescription;
            panel.Get<LabelWidget>("MOD_TITLE").GetText = () => selectedMod.Title;
            panel.Get<LabelWidget>("MOD_AUTHOR").GetText = () => selectedAuthor;
            panel.Get<LabelWidget>("MOD_VERSION").GetText = () => selectedMod.Version;

            var prevMod = panel.Get<ButtonWidget>("PREV_MOD");
            prevMod.OnClick = () => { modOffset -= 1; RebuildModList(); };
            prevMod.IsVisible = () => modOffset > 0;

            var nextMod = panel.Get<ButtonWidget>("NEXT_MOD");
            nextMod.OnClick = () => { modOffset += 1; RebuildModList(); };
            nextMod.IsVisible = () => modOffset + 5 < allMods.Length;

            panel.Get<RGBASpriteWidget>("MOD_PREVIEW").GetSprite = () =>
            {
                Sprite ret = null;
                previews.TryGetValue(selectedMod.Id, out ret);
                return ret;
            };

            var sheetBuilder = new SheetBuilder(SheetType.BGRA);
            previews = new Dictionary<string, Sprite>();
            logos = new Dictionary<string, Sprite>();
            allMods = ModMetadata.AllMods.Values.Where(m => m.Id != "modchooser")
                .OrderBy(m => m.Title)
                .ToArray();

            // Load preview images, and eat any errors
            foreach (var mod in allMods)
            {
                try
                {
                    var preview = new Bitmap(new[] { "mods", mod.Id, "preview.png" }.Aggregate(Path.Combine));
                    if (preview.Width != 296 || preview.Height != 196)
                        continue;

                    previews.Add(mod.Id, sheetBuilder.Add(preview));
                }
                catch (Exception) { }

                try
                {
                    var logo = new Bitmap(new[] { "mods", mod.Id, "logo.png" }.Aggregate(Path.Combine));
                    if (logo.Width != 96 || logo.Height != 96)
                        continue;

                    logos.Add(mod.Id, sheetBuilder.Add(logo));
                }
                catch (Exception) { }
            }

            ModMetadata initialMod = null;
            ModMetadata.AllMods.TryGetValue(Game.Settings.Game.PreviousMod, out initialMod);
            SelectMod(initialMod ?? ModMetadata.AllMods["ra"]);

            RebuildModList();
        }
Ejemplo n.º 22
0
        bool ShowTeamDropDown(ButtonWidget team)
        {
            var dropDownOptions = new List<Pair<string, Action>>();
            for (int i = 0; i <= Map.PlayerCount; i++)
            {
                var ii = i;
                dropDownOptions.Add(new Pair<string, Action>( ii == 0 ? "-" : ii.ToString(),
                    () => orderManager.IssueOrder( Order.Command("team "+ii) )) );
            };

            DropDownButtonWidget.ShowDropDown( team,
                dropDownOptions,
                (ac, w) => new LabelWidget
                {
                    Bounds = new Rectangle(0, 0, w, 24),
                    Text = "  {0}".F(ac.First),
                    OnMouseUp = mi => { ac.Second(); return true; },
                });
            return true;
        }
Ejemplo n.º 23
0
        bool ShowColorDropDown(Session.Slot s, ButtonWidget color)
        {
            if (Map.Players[s.MapPlayer].LockColor)
                return false;

            var colorChooser = Game.modData.WidgetLoader.LoadWidget( new Dictionary<string,object>(), null, "COLOR_CHOOSER" );
            var hueSlider = colorChooser.GetWidget<SliderWidget>("HUE_SLIDER");
            hueSlider.SetOffset(orderManager.LocalClient.ColorRamp.H / 255f);

            var satSlider = colorChooser.GetWidget<SliderWidget>("SAT_SLIDER");
            satSlider.SetOffset(orderManager.LocalClient.ColorRamp.S / 255f);

            var lumSlider = colorChooser.GetWidget<SliderWidget>("LUM_SLIDER");
            lumSlider.SetOffset(orderManager.LocalClient.ColorRamp.L / 255f);

            var rangeSlider = colorChooser.GetWidget<SliderWidget>("RANGE_SLIDER");
            rangeSlider.SetOffset(orderManager.LocalClient.ColorRamp.R / 255f);

            hueSlider.OnChange += _ => UpdateColorPreview(hueSlider.GetOffset(), satSlider.GetOffset(), lumSlider.GetOffset(), rangeSlider.GetOffset());
            satSlider.OnChange += _ => UpdateColorPreview(hueSlider.GetOffset(), satSlider.GetOffset(), lumSlider.GetOffset(), rangeSlider.GetOffset());
            lumSlider.OnChange += _ => UpdateColorPreview(hueSlider.GetOffset(), satSlider.GetOffset(), lumSlider.GetOffset(), rangeSlider.GetOffset());
            rangeSlider.OnChange += _ => UpdateColorPreview(hueSlider.GetOffset(), satSlider.GetOffset(), lumSlider.GetOffset(), rangeSlider.GetOffset());
            UpdateColorPreview(hueSlider.GetOffset(), satSlider.GetOffset(), lumSlider.GetOffset(), rangeSlider.GetOffset());

            DropDownButtonWidget.ShowDropPanel(color, colorChooser, new List<Widget>() {colorChooser.GetWidget("BUTTON_OK")}, () => {
                UpdateColorPreview(hueSlider.GetOffset(), satSlider.GetOffset(), lumSlider.GetOffset(), rangeSlider.GetOffset());
                UpdatePlayerColor(hueSlider.GetOffset(), satSlider.GetOffset(), lumSlider.GetOffset(), rangeSlider.GetOffset());
                return true;
            });
            return true;
        }
Ejemplo n.º 24
0
 public virtual void DrawBackground(Rectangle rect, bool disabled, bool pressed, bool hover, bool highlighted)
 {
     ButtonWidget.DrawBackground("button", rect, disabled, pressed, hover, highlighted);
 }
Ejemplo n.º 25
0
		public ModBrowserLogic(Widget widget)
		{
			modChooserPanel = widget;
			loadButton = modChooserPanel.Get<ButtonWidget>("LOAD_BUTTON");
			loadButton.OnClick = () => LoadMod(selectedMod);
			loadButton.IsDisabled = () => selectedMod.Id == Game.ModData.Manifest.Mod.Id;

			modChooserPanel.Get<ButtonWidget>("QUIT_BUTTON").OnClick = Game.Exit;

			modList = modChooserPanel.Get("MOD_LIST");
			modTemplate = modList.Get<ButtonWidget>("MOD_TEMPLATE");

			modChooserPanel.Get<LabelWidget>("MOD_DESC").GetText = () => selectedDescription;
			modChooserPanel.Get<LabelWidget>("MOD_TITLE").GetText = () => selectedMod.Title;
			modChooserPanel.Get<LabelWidget>("MOD_AUTHOR").GetText = () => selectedAuthor;
			modChooserPanel.Get<LabelWidget>("MOD_VERSION").GetText = () => selectedMod.Version;

			var prevMod = modChooserPanel.Get<ButtonWidget>("PREV_MOD");
			prevMod.OnClick = () => { modOffset -= 1; RebuildModList(); };
			prevMod.IsVisible = () => modOffset > 0;

			var nextMod = modChooserPanel.Get<ButtonWidget>("NEXT_MOD");
			nextMod.OnClick = () => { modOffset += 1; RebuildModList(); };
			nextMod.IsVisible = () => modOffset + 5 < allMods.Length;

			modChooserPanel.Get<RGBASpriteWidget>("MOD_PREVIEW").GetSprite = () =>
			{
				Sprite ret = null;
				previews.TryGetValue(selectedMod.Id, out ret);
				return ret;
			};

			sheetBuilder = new SheetBuilder(SheetType.BGRA);
			allMods = ModMetadata.AllMods.Values.Where(m => !m.Hidden)
				.OrderBy(m => m.Title)
				.ToArray();

			// Load preview images, and eat any errors
			foreach (var mod in allMods)
			{
				try
				{
					using (var preview = new Bitmap(Platform.ResolvePath(".", "mods", mod.Id, "preview.png")))
						if (preview.Width == 296 && preview.Height == 196)
							previews.Add(mod.Id, sheetBuilder.Add(preview));
				}
				catch (Exception) { }

				try
				{
					using (var logo = new Bitmap(Platform.ResolvePath(".", "mods", mod.Id, "logo.png")))
						if (logo.Width == 96 && logo.Height == 96)
							logos.Add(mod.Id, sheetBuilder.Add(logo));
				}
				catch (Exception) { }
			}

			modInstallStatus = new Cache<ModMetadata, bool>(IsModInstalled);

			ModMetadata initialMod;
			ModMetadata.AllMods.TryGetValue(Game.Settings.Game.PreviousMod, out initialMod);
			SelectMod(initialMod != null && initialMod.Id != "modchooser" ? initialMod : ModMetadata.AllMods["ra"]);

			RebuildModList();
		}
Ejemplo n.º 26
0
        public AssetBrowserLogic(Widget widget, Action onExit, World world)
        {
            panel = widget;

            var sourceDropdown = panel.Get<DropDownButtonWidget>("SOURCE_SELECTOR");
            sourceDropdown.OnMouseDown = _ => ShowSourceDropdown(sourceDropdown);
            sourceDropdown.GetText = () =>
            {
                var name = AssetSource != null ? AssetSource.Name : "All Packages";
                if (name.Length > 15)
                    name = "..."+name.Substring(name.Length - 15);

                return name;
            };

            AssetSource = FileSystem.MountedFolders.First();

            spriteImage = panel.Get<ShpImageWidget>("SPRITE");

            filenameInput = panel.Get<TextFieldWidget>("FILENAME_INPUT");
            filenameInput.Text = spriteImage.Image+".shp";
            filenameInput.OnEnterKey = () => LoadAsset(filenameInput.Text);

            frameSlider = panel.Get<SliderWidget>("FRAME_SLIDER");
            frameSlider.MaximumValue = (float)spriteImage.FrameCount;
            frameSlider.Ticks = spriteImage.FrameCount+1;
            frameSlider.OnChange += x => { spriteImage.Frame = (int)Math.Round(x); };
            frameSlider.GetValue = () => spriteImage.Frame;

            panel.Get<LabelWidget>("FRAME_COUNT").GetText = () => "{0}/{1}".F(spriteImage.Frame, spriteImage.FrameCount);

            playButton = panel.Get<ButtonWidget>("BUTTON_PLAY");
            playButton.OnClick = () =>
            {
                spriteImage.LoopAnimation = true;
                playButton.Visible = false;
                pauseButton.Visible = true;
            };
            pauseButton = panel.Get<ButtonWidget>("BUTTON_PAUSE");
            pauseButton.OnClick = () =>
            {
                spriteImage.LoopAnimation = false;
                playButton.Visible = true;
                pauseButton.Visible = false;
            };

            panel.Get<ButtonWidget>("BUTTON_STOP").OnClick = () =>
            {
                spriteImage.LoopAnimation = false;
                frameSlider.Value = 0;
                spriteImage.Frame = 0;
                playButton.Visible = true;
                pauseButton.Visible = false;
            };

            panel.Get<ButtonWidget>("BUTTON_NEXT").OnClick = () => { spriteImage.RenderNextFrame(); };
            panel.Get<ButtonWidget>("BUTTON_PREV").OnClick = () => { spriteImage.RenderPreviousFrame(); };

            panel.Get<ButtonWidget>("LOAD_BUTTON").OnClick = () =>
            {
                LoadAsset(filenameInput.Text);
            };

            assetList = panel.Get<ScrollPanelWidget>("ASSET_LIST");
            template = panel.Get<ScrollItemWidget>("ASSET_TEMPLATE");
            PopulateAssetList();

            var palette = (WidgetUtils.ActiveModId() == "d2k") ? "d2k.pal" : "egopal.pal";

            panel.Get<ButtonWidget>("EXPORT_BUTTON").OnClick = () =>
            {
                var ExtractGameFiles = new string[][]
                {
                    new string[] {"--extract", WidgetUtils.ActiveModId(), palette, "--userdir"},
                    new string[] {"--extract", WidgetUtils.ActiveModId(), "{0}.shp".F(spriteImage.Image), "--userdir"},
                };

                var ExportToPng = new string[][]
                {
                    new string[] {"--png", Platform.SupportDir+"{0}.shp".F(spriteImage.Image), Platform.SupportDir+palette},
                };

                var ImportFromPng = new string[][] { };

                var args = new WidgetArgs()
                {
                    { "ExtractGameFiles", ExtractGameFiles },
                    { "ExportToPng", ExportToPng },
                    { "ImportFromPng", ImportFromPng}
                };

                Ui.OpenWindow("CONVERT_ASSETS_PANEL", args);
            };

            panel.Get<ButtonWidget>("EXTRACT_BUTTON").OnClick = () =>
            {
                var ExtractGameFilesList = new List<string[]>();
                var ExportToPngList = new List<string[]>();

                ExtractGameFilesList.Add(new string[] { "--extract", WidgetUtils.ActiveModId(), palette, "--userdir"} );

                foreach (var shp in AvailableShps)
                {
                    ExtractGameFilesList.Add(new string[] { "--extract", WidgetUtils.ActiveModId(), shp, "--userdir" } );
                    ExportToPngList.Add(new string[] { "--png", Platform.SupportDir+shp, Platform.SupportDir+palette } );
                    Console.WriteLine(Platform.SupportDir+shp);
                }

                var ExtractGameFiles = ExtractGameFilesList.ToArray();
                var ExportToPng = ExportToPngList.ToArray();
                var ImportFromPng = new string[][] { };

                var args = new WidgetArgs()
                {
                    { "ExtractGameFiles", ExtractGameFiles },
                    { "ExportToPng", ExportToPng },
                    { "ImportFromPng", ImportFromPng}
                };

                Ui.OpenWindow("CONVERT_ASSETS_PANEL", args);
            };

            panel.Get<ButtonWidget>("IMPORT_BUTTON").OnClick = () =>
            {
                var imageSizeInput = panel.Get<TextFieldWidget>("IMAGE_SIZE_INPUT");
                var imageFilename = panel.Get<TextFieldWidget>("IMAGE_FILENAME_INPUT");

                var ExtractGameFiles = new string[][] { };
                var ExportToPng = new string[][] { };
                var ImportFromPng = new string[][]
                {
                    new string[] {"--shp", Platform.SupportDir+imageFilename.Text, imageSizeInput.Text},
                };

                var args = new WidgetArgs()
                {
                    { "ExtractGameFiles", ExtractGameFiles },
                    { "ExportToPng", ExportToPng },
                    { "ImportFromPng", ImportFromPng}
                };

                Ui.OpenWindow("CONVERT_ASSETS_PANEL", args);
            };

            panel.Get<ButtonWidget>("CLOSE_BUTTON").OnClick = () => { Ui.CloseWindow(); onExit(); };
        }
Ejemplo n.º 27
0
        public MissionBrowserLogic(Widget widget, Action onStart, Action onExit)
        {
            this.onStart = onStart;

            missionList = widget.Get<ScrollPanelWidget>("MISSION_LIST");

            headerTemplate = widget.Get<ScrollItemWidget>("HEADER");
            template = widget.Get<ScrollItemWidget>("TEMPLATE");

            var title = widget.GetOrNull<LabelWidget>("MISSIONBROWSER_TITLE");
            if (title != null)
                title.GetText = () => showVideoPlayer ? selectedMapPreview.Title : title.Text;

            widget.Get("MISSION_INFO").IsVisible = () => selectedMapPreview != null;

            var previewWidget = widget.Get<MapPreviewWidget>("MISSION_PREVIEW");
            previewWidget.Preview = () => selectedMapPreview;
            previewWidget.IsVisible = () => !showVideoPlayer;

            videoPlayer = widget.Get<VqaPlayerWidget>("MISSION_VIDEO");
            widget.Get("MISSION_BIN").IsVisible = () => showVideoPlayer;

            descriptionPanel = widget.Get<ScrollPanelWidget>("MISSION_DESCRIPTION_PANEL");

            description = descriptionPanel.Get<LabelWidget>("MISSION_DESCRIPTION");
            descriptionFont = Game.Renderer.Fonts[description.Font];

            startVideoButton = widget.Get<ButtonWidget>("START_VIDEO_BUTTON");
            stopVideoButton = widget.Get<ButtonWidget>("STOP_VIDEO_BUTTON");
            stopVideoButton.IsVisible = () => showVideoPlayer;
            stopVideoButton.OnClick = StopVideo;

            var allMaps = new List<Map>();
            missionList.RemoveChildren();

            // Add a group for each campaign
            if (Game.modData.Manifest.Missions.Any())
            {
                var yaml = Game.modData.Manifest.Missions.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal);

                foreach (var kv in yaml)
                {
                    var missionMapPaths = kv.Value.Nodes.Select(n => Path.GetFullPath(n.Key));

                    var maps = Game.modData.MapCache
                        .Where(p => p.Status == MapStatus.Available && missionMapPaths.Contains(Path.GetFullPath(p.Map.Path)))
                        .Select(p => p.Map);

                    CreateMissionGroup(kv.Key, maps);
                    allMaps.AddRange(maps);
                }
            }

            // Add an additional group for loose missions
            // Loose missions must define Type: Mission and Selectable: false.
            var looseMissions = Game.modData.MapCache
                .Where(p => p.Status == MapStatus.Available && p.Map.Type == "Mission" && !p.Map.Selectable && !allMaps.Contains(p.Map))
                .Select(p => p.Map);

            if (looseMissions.Any())
            {
                CreateMissionGroup("Missions", looseMissions);
                allMaps.AddRange(looseMissions);
            }

            if (allMaps.Any())
                SelectMap(allMaps.First());

            var startButton = widget.Get<ButtonWidget>("STARTGAME_BUTTON");
            startButton.OnClick = StartMission;
            startButton.IsDisabled = () => selectedMapPreview.RuleStatus != MapRuleStatus.Cached;

            widget.Get<ButtonWidget>("BACK_BUTTON").OnClick = () =>
            {
                StopVideo();
                Game.Disconnect();
                Ui.CloseWindow();
                onExit();
            };
        }
Ejemplo n.º 28
0
        public MissionBrowserLogic(Widget widget, ModData modData, World world, Action onStart, Action onExit)
        {
            this.modData = modData;
            this.onStart = onStart;
            Game.BeforeGameStart += OnGameStart;

            missionList = widget.Get<ScrollPanelWidget>("MISSION_LIST");

            headerTemplate = widget.Get<ScrollItemWidget>("HEADER");
            template = widget.Get<ScrollItemWidget>("TEMPLATE");

            var title = widget.GetOrNull<LabelWidget>("MISSIONBROWSER_TITLE");
            if (title != null)
                title.GetText = () => playingVideo != PlayingVideo.None ? selectedMap.Title : title.Text;

            widget.Get("MISSION_INFO").IsVisible = () => selectedMap != null;

            var previewWidget = widget.Get<MapPreviewWidget>("MISSION_PREVIEW");
            previewWidget.Preview = () => selectedMap;
            previewWidget.IsVisible = () => playingVideo == PlayingVideo.None;

            videoPlayer = widget.Get<VqaPlayerWidget>("MISSION_VIDEO");
            widget.Get("MISSION_BIN").IsVisible = () => playingVideo != PlayingVideo.None;
            fullscreenVideoPlayer = Ui.LoadWidget<BackgroundWidget>("FULLSCREEN_PLAYER", Ui.Root, new WidgetArgs { { "world", world } });

            descriptionPanel = widget.Get<ScrollPanelWidget>("MISSION_DESCRIPTION_PANEL");

            description = descriptionPanel.Get<LabelWidget>("MISSION_DESCRIPTION");
            descriptionFont = Game.Renderer.Fonts[description.Font];

            difficultyButton = widget.Get<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
            gameSpeedButton = widget.GetOrNull<DropDownButtonWidget>("GAMESPEED_DROPDOWNBUTTON");

            startBriefingVideoButton = widget.Get<ButtonWidget>("START_BRIEFING_VIDEO_BUTTON");
            stopBriefingVideoButton = widget.Get<ButtonWidget>("STOP_BRIEFING_VIDEO_BUTTON");
            stopBriefingVideoButton.IsVisible = () => playingVideo == PlayingVideo.Briefing;
            stopBriefingVideoButton.OnClick = () => StopVideo(videoPlayer);

            startInfoVideoButton = widget.Get<ButtonWidget>("START_INFO_VIDEO_BUTTON");
            stopInfoVideoButton = widget.Get<ButtonWidget>("STOP_INFO_VIDEO_BUTTON");
            stopInfoVideoButton.IsVisible = () => playingVideo == PlayingVideo.Info;
            stopInfoVideoButton.OnClick = () => StopVideo(videoPlayer);

            var allPreviews = new List<MapPreview>();
            missionList.RemoveChildren();

            // Add a group for each campaign
            if (modData.Manifest.Missions.Any())
            {
                var yaml = MiniYaml.Merge(modData.Manifest.Missions.Select(
                    m => MiniYaml.FromStream(modData.DefaultFileSystem.Open(m), m)));

                foreach (var kv in yaml)
                {
                    var missionMapPaths = kv.Value.Nodes.Select(n => Path.GetFullPath(n.Key)).ToList();

                    var previews = modData.MapCache
                        .Where(p => p.Status == MapStatus.Available && missionMapPaths.Contains(p.Package.Name))
                        .OrderBy(p => missionMapPaths.IndexOf(p.Package.Name));

                    CreateMissionGroup(kv.Key, previews);
                    allPreviews.AddRange(previews);
                }
            }

            // Add an additional group for loose missions
            var loosePreviews = modData.MapCache
                .Where(p => p.Status == MapStatus.Available && p.Visibility.HasFlag(MapVisibility.MissionSelector) && !allPreviews.Any(a => a.Uid == p.Uid));

            if (loosePreviews.Any())
            {
                CreateMissionGroup("Missions", loosePreviews);
                allPreviews.AddRange(loosePreviews);
            }

            if (allPreviews.Any())
                SelectMap(allPreviews.First());

            // Preload map preview and rules to reduce jank
            new Thread(() =>
            {
                foreach (var p in allPreviews)
                {
                    p.GetMinimap();
                    p.PreloadRules();
                }
            }).Start();

            var startButton = widget.Get<ButtonWidget>("STARTGAME_BUTTON");
            startButton.OnClick = StartMissionClicked;
            startButton.IsDisabled = () => selectedMap == null || selectedMap.InvalidCustomRules;

            widget.Get<ButtonWidget>("BACK_BUTTON").OnClick = () =>
            {
                StopVideo(videoPlayer);
                Game.Disconnect();
                Ui.CloseWindow();
                onExit();
            };
        }
Ejemplo n.º 29
0
        bool ShowRaceDropDown(Session.Slot s, ButtonWidget race)
        {
            if (Map.Players[s.MapPlayer].LockRace)
                return false;

            var dropDownOptions = new List<Pair<string, Action>>();
            foreach (var c in CountryNames)
            {
                var cc = c;
                dropDownOptions.Add(new Pair<string, Action>( cc.Key,
                    () => orderManager.IssueOrder( Order.Command("race "+cc.Key) )) );
            };

            DropDownButtonWidget.ShowDropDown( race,
                dropDownOptions,
                (ac, w) =>
                {
                    var ret = new LabelWidget
                    {
                        Bounds = new Rectangle(0, 0, w, 24),
                        Text = "          {0}".F(CountryNames[ac.First]),
                        OnMouseUp = mi => { ac.Second(); return true; },
                    };

                    ret.AddChild(new ImageWidget
                    {
                        Bounds = new Rectangle(5, 5, 40, 15),
                        GetImageName = () => ac.First,
                        GetImageCollection = () => "flags",
                    });
                    return ret;
                });
            return true;
        }
Ejemplo n.º 30
0
        void SetStance(ButtonWidget bw, Player p, Stance ss)
        {
            if (p.World.LobbyInfo.GlobalSettings.LockTeams)
                return;	// team changes are banned

            world.IssueOrder(new Order("SetStance", world.LocalPlayer.PlayerActor, false)
                { TargetLocation = new int2((int)ss, 0), TargetString = p.InternalName });

            bw.Text = ss.ToString();
        }
Ejemplo n.º 31
0
        public AssetBrowserLogic(Widget widget, Action onExit, World world)
        {
            panel = widget;

            var sourceDropdown = panel.Get<DropDownButtonWidget>("SOURCE_SELECTOR");
            sourceDropdown.OnMouseDown = _ => ShowSourceDropdown(sourceDropdown);
            sourceDropdown.GetText = () =>
            {
                var name = assetSource != null ? assetSource.Name.Replace(Platform.SupportDir, "^") : "All Packages";

                if (name.Length > 15)
                    name = "..." + name.Substring(name.Length - 15);

                return name;
            };

            assetSource = FileSystem.MountedFolders.First();

            spriteWidget = panel.Get<ShpImageWidget>("SPRITE");

            currentPalette = world.WorldActor.TraitsImplementing<PaletteFromFile>().First(p => p.Name == spriteWidget.Palette);

            var paletteDropDown = panel.Get<DropDownButtonWidget>("PALETTE_SELECTOR");
            paletteDropDown.OnMouseDown = _ => ShowPaletteDropdown(paletteDropDown, world);
            paletteDropDown.GetText = () => currentPalette.Name;

            var colorPreview = panel.Get<ColorPreviewManagerWidget>("COLOR_MANAGER");
            colorPreview.Color = Game.Settings.Player.Color;

            var color = panel.Get<DropDownButtonWidget>("COLOR");
            color.IsDisabled = () => currentPalette.Name != colorPreview.Palette;
            color.OnMouseDown = _ => ShowColorDropDown(color, colorPreview, world);
            var block = panel.Get<ColorBlockWidget>("COLORBLOCK");
            block.GetColor = () => Game.Settings.Player.Color.RGB;

            filenameInput = panel.Get<TextFieldWidget>("FILENAME_INPUT");
            filenameInput.OnEnterKey = () => LoadAsset(filenameInput.Text);

            frameSlider = panel.Get<SliderWidget>("FRAME_SLIDER");
            frameSlider.MaximumValue = (float)spriteWidget.FrameCount;
            frameSlider.Ticks = spriteWidget.FrameCount + 1;
            frameSlider.IsVisible = () => spriteWidget.FrameCount > 0;
            frameSlider.OnChange += x => { spriteWidget.Frame = (int)Math.Round(x); };
            frameSlider.GetValue = () => spriteWidget.Frame;

            panel.Get<LabelWidget>("FRAME_COUNT").GetText = () => "{0} / {1}".F(spriteWidget.Frame + 1, spriteWidget.FrameCount + 1);

            playButton = panel.Get<ButtonWidget>("BUTTON_PLAY");
            playButton.OnClick = () =>
            {
                spriteWidget.LoopAnimation = true;
                playButton.Visible = false;
                pauseButton.Visible = true;
            };
            pauseButton = panel.Get<ButtonWidget>("BUTTON_PAUSE");
            pauseButton.OnClick = () =>
            {
                spriteWidget.LoopAnimation = false;
                playButton.Visible = true;
                pauseButton.Visible = false;
            };

            panel.Get<ButtonWidget>("BUTTON_STOP").OnClick = () =>
            {
                spriteWidget.LoopAnimation = false;
                frameSlider.Value = 0;
                spriteWidget.Frame = 0;
                playButton.Visible = true;
                pauseButton.Visible = false;
            };

            panel.Get<ButtonWidget>("BUTTON_NEXT").OnClick = () => { spriteWidget.RenderNextFrame(); };
            panel.Get<ButtonWidget>("BUTTON_PREV").OnClick = () => { spriteWidget.RenderPreviousFrame(); };

            panel.Get<ButtonWidget>("LOAD_BUTTON").OnClick = () =>
            {
                LoadAsset(filenameInput.Text);
            };

            assetList = panel.Get<ScrollPanelWidget>("ASSET_LIST");
            template = panel.Get<ScrollItemWidget>("ASSET_TEMPLATE");
            PopulateAssetList();

            panel.Get<ButtonWidget>("CLOSE_BUTTON").OnClick = () => { Ui.CloseWindow(); onExit(); };
        }