本文整理汇总了C#中OpenRA.Widgets.ScrollPanelWidget.RemoveChild方法的典型用法代码示例。如果您正苦于以下问题:C# ScrollPanelWidget.RemoveChild方法的具体用法?C# ScrollPanelWidget.RemoveChild怎么用?C# ScrollPanelWidget.RemoveChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRA.Widgets.ScrollPanelWidget
的用法示例。
在下文中一共展示了ScrollPanelWidget.RemoveChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainMenuLogic
//.........这里部分代码省略.........
{ "onExit", () => SwitchMenu(MenuType.Extras) },
});
};
extrasMenu.Get<ButtonWidget>("CREDITS_BUTTON").OnClick = () =>
{
SwitchMenu(MenuType.None);
Ui.OpenWindow("CREDITS_PANEL", new WidgetArgs
{
{ "onExit", () => SwitchMenu(MenuType.Extras) },
});
};
extrasMenu.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => SwitchMenu(MenuType.Main);
// Map editor menu
var mapEditorMenu = widget.Get("MAP_EDITOR_MENU");
mapEditorMenu.IsVisible = () => menuType == MenuType.MapEditor;
// Loading into the map editor
Game.BeforeGameStart += RemoveShellmapUI;
var onSelect = new Action<string>(uid => LoadMapIntoEditor(modData.MapCache[uid].Uid));
var newMapButton = widget.Get<ButtonWidget>("NEW_MAP_BUTTON");
newMapButton.OnClick = () =>
{
SwitchMenu(MenuType.None);
Game.OpenWindow("NEW_MAP_BG", new WidgetArgs()
{
{ "onSelect", onSelect },
{ "onExit", () => SwitchMenu(MenuType.MapEditor) }
});
};
var loadMapButton = widget.Get<ButtonWidget>("LOAD_MAP_BUTTON");
loadMapButton.OnClick = () =>
{
SwitchMenu(MenuType.None);
Game.OpenWindow("MAPCHOOSER_PANEL", new WidgetArgs()
{
{ "initialMap", null },
{ "initialTab", MapClassification.User },
{ "onExit", () => SwitchMenu(MenuType.MapEditor) },
{ "onSelect", onSelect },
{ "filter", MapVisibility.Lobby | MapVisibility.Shellmap | MapVisibility.MissionSelector },
});
};
mapEditorMenu.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => SwitchMenu(MenuType.Extras);
var newsBG = widget.GetOrNull("NEWS_BG");
if (newsBG != null)
{
newsBG.IsVisible = () => Game.Settings.Game.FetchNews && menuType != MenuType.None && menuType != MenuType.SystemInfoPrompt;
newsPanel = Ui.LoadWidget<ScrollPanelWidget>("NEWS_PANEL", null, new WidgetArgs());
newsTemplate = newsPanel.Get("NEWS_ITEM_TEMPLATE");
newsPanel.RemoveChild(newsTemplate);
newsStatus = newsPanel.Get<LabelWidget>("NEWS_STATUS");
SetNewsStatus("Loading news");
}
Game.OnRemoteDirectConnect += OnRemoteDirectConnect;
// System information opt-out prompt
var sysInfoPrompt = widget.Get("SYSTEM_INFO_PROMPT");
sysInfoPrompt.IsVisible = () => menuType == MenuType.SystemInfoPrompt;
if (Game.Settings.Debug.SystemInformationVersionPrompt < SystemInformationVersion)
{
menuType = MenuType.SystemInfoPrompt;
var sysInfoCheckbox = sysInfoPrompt.Get<CheckboxWidget>("SYSINFO_CHECKBOX");
sysInfoCheckbox.IsChecked = () => Game.Settings.Debug.SendSystemInformation;
sysInfoCheckbox.OnClick = () => Game.Settings.Debug.SendSystemInformation ^= true;
var sysInfoData = sysInfoPrompt.Get<ScrollPanelWidget>("SYSINFO_DATA");
var template = sysInfoData.Get<LabelWidget>("DATA_TEMPLATE");
sysInfoData.RemoveChildren();
foreach (var info in GetSystemInformation().Values)
{
var label = template.Clone() as LabelWidget;
var text = info.First + ": " + info.Second;
label.GetText = () => text;
sysInfoData.AddChild(label);
}
sysInfoPrompt.Get<ButtonWidget>("BACK_BUTTON").OnClick = () =>
{
Game.Settings.Debug.SystemInformationVersionPrompt = SystemInformationVersion;
Game.Settings.Save();
SwitchMenu(MenuType.Main);
LoadAndDisplayNews(newsBG);
};
}
else
LoadAndDisplayNews(newsBG);
}
示例2: MainMenuLogic
//.........这里部分代码省略.........
{
menuType = MenuType.None;
Game.OpenWindow("ASSETBROWSER_PANEL", new WidgetArgs
{
{ "onExit", () => menuType = MenuType.Extras },
});
};
extrasMenu.Get<ButtonWidget>("CREDITS_BUTTON").OnClick = () =>
{
menuType = MenuType.None;
Ui.OpenWindow("CREDITS_PANEL", new WidgetArgs
{
{ "onExit", () => menuType = MenuType.Extras },
});
};
extrasMenu.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => menuType = MenuType.Main;
// Map editor menu
var mapEditorMenu = widget.Get("MAP_EDITOR_MENU");
mapEditorMenu.IsVisible = () => menuType == MenuType.MapEditor;
var onSelect = new Action<string>(uid =>
{
RemoveShellmapUI();
LoadMapIntoEditor(Game.ModData.MapCache[uid].Map);
});
var newMapButton = widget.Get<ButtonWidget>("NEW_MAP_BUTTON");
newMapButton.OnClick = () =>
{
menuType = MenuType.None;
Game.OpenWindow("NEW_MAP_BG", new WidgetArgs()
{
{ "onSelect", onSelect },
{ "onExit", () => menuType = MenuType.MapEditor }
});
};
var loadMapButton = widget.Get<ButtonWidget>("LOAD_MAP_BUTTON");
loadMapButton.OnClick = () =>
{
menuType = MenuType.None;
Game.OpenWindow("MAPCHOOSER_PANEL", new WidgetArgs()
{
{ "initialMap", null },
{ "initialTab", MapClassification.User },
{ "onExit", () => menuType = MenuType.MapEditor },
{ "onSelect", onSelect },
{ "filter", MapVisibility.Lobby | MapVisibility.Shellmap | MapVisibility.MissionSelector },
});
};
mapEditorMenu.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => menuType = MenuType.Extras;
var newsBG = widget.GetOrNull("NEWS_BG");
if (newsBG != null)
{
newsBG.IsVisible = () => Game.Settings.Game.FetchNews && menuType != MenuType.None;
newsPanel = Ui.LoadWidget<ScrollPanelWidget>("NEWS_PANEL", null, new WidgetArgs());
newsTemplate = newsPanel.Get("NEWS_ITEM_TEMPLATE");
newsPanel.RemoveChild(newsTemplate);
newsStatus = newsPanel.Get<LabelWidget>("NEWS_STATUS");
SetNewsStatus("Loading news");
var cacheFile = Platform.ResolvePath("^", "news.yaml");
var currentNews = ParseNews(cacheFile);
if (currentNews != null)
DisplayNews(currentNews);
// Only query for new stories once per day
var cacheValid = currentNews != null && DateTime.Today.ToUniversalTime() <= Game.Settings.Game.NewsFetchedDate;
if (!cacheValid)
new Download(Game.Settings.Game.NewsUrl, cacheFile, e => { }, (e, c) => NewsDownloadComplete(e, c, cacheFile, currentNews));
var newsButton = newsBG.GetOrNull<DropDownButtonWidget>("NEWS_BUTTON");
newsButton.OnClick = () =>
{
newsButton.AttachPanel(newsPanel);
newsHighlighted = false;
};
newsButton.IsHighlighted = () => newsHighlighted && Game.LocalTick % 50 < 25;
}
Game.OnRemoteDirectConnect += (host, port) =>
{
menuType = MenuType.None;
Ui.OpenWindow("SERVERBROWSER_PANEL", new WidgetArgs
{
{ "onStart", RemoveShellmapUI },
{ "onExit", () => menuType = MenuType.Main },
{ "directConnectHost", host },
{ "directConnectPort", port },
});
};
}
示例3: MainMenuLogic
//.........这里部分代码省略.........
mainMenu.Get<ButtonWidget>("QUIT_BUTTON").OnClick = Game.Exit;
// Singleplayer menu
var singleplayerMenu = widget.Get("SINGLEPLAYER_MENU");
singleplayerMenu.IsVisible = () => menuType == MenuType.Singleplayer;
var missionsButton = singleplayerMenu.Get<ButtonWidget>("MISSIONS_BUTTON");
missionsButton.OnClick = () =>
{
menuType = MenuType.None;
Ui.OpenWindow("MISSIONBROWSER_PANEL", new WidgetArgs
{
{ "onExit", () => menuType = MenuType.Singleplayer },
{ "onStart", RemoveShellmapUI }
});
};
missionsButton.Disabled = !Game.modData.Manifest.Missions.Any();
singleplayerMenu.Get<ButtonWidget>("SKIRMISH_BUTTON").OnClick = StartSkirmishGame;
singleplayerMenu.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => menuType = MenuType.Main;
// Extras menu
var extrasMenu = widget.Get("EXTRAS_MENU");
extrasMenu.IsVisible = () => menuType == MenuType.Extras;
extrasMenu.Get<ButtonWidget>("REPLAYS_BUTTON").OnClick = () =>
{
menuType = MenuType.None;
Ui.OpenWindow("REPLAYBROWSER_PANEL", new WidgetArgs
{
{ "onExit", () => menuType = MenuType.Extras },
{ "onStart", RemoveShellmapUI }
});
};
extrasMenu.Get<ButtonWidget>("MUSIC_BUTTON").OnClick = () =>
{
menuType = MenuType.None;
Ui.OpenWindow("MUSIC_PANEL", new WidgetArgs
{
{ "onExit", () => menuType = MenuType.Extras },
});
};
var assetBrowserButton = extrasMenu.GetOrNull<ButtonWidget>("ASSETBROWSER_BUTTON");
if (assetBrowserButton != null)
assetBrowserButton.OnClick = () =>
{
menuType = MenuType.None;
Game.OpenWindow("ASSETBROWSER_PANEL", new WidgetArgs
{
{ "onExit", () => menuType = MenuType.Extras },
});
};
extrasMenu.Get<ButtonWidget>("CREDITS_BUTTON").OnClick = () =>
{
menuType = MenuType.None;
Ui.OpenWindow("CREDITS_PANEL", new WidgetArgs
{
{ "onExit", () => menuType = MenuType.Extras },
});
};
extrasMenu.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => menuType = MenuType.Main;
var newsBG = widget.GetOrNull("NEWS_BG");
if (newsBG != null)
{
newsBG.IsVisible = () => Game.Settings.Game.FetchNews && menuType != MenuType.None;
newsPanel = Ui.LoadWidget<ScrollPanelWidget>("NEWS_PANEL", null, new WidgetArgs());
newsTemplate = newsPanel.Get("NEWS_ITEM_TEMPLATE");
newsPanel.RemoveChild(newsTemplate);
newsStatus = newsPanel.Get<LabelWidget>("NEWS_STATUS");
SetNewsStatus("Loading news");
var cacheFile = Path.Combine(Platform.SupportDir, "news.yaml");
var currentNews = ParseNews(cacheFile);
if (currentNews != null)
DisplayNews(currentNews);
// Only query for new stories once per day
var cacheValid = currentNews != null && DateTime.Today.ToUniversalTime() <= Game.Settings.Game.NewsFetchedDate;
if (!cacheValid)
new Download(Game.Settings.Game.NewsUrl, cacheFile, e => { }, (e, c) => NewsDownloadComplete(e, c, cacheFile, currentNews));
var newsButton = newsBG.GetOrNull<DropDownButtonWidget>("NEWS_BUTTON");
newsButton.OnClick = () =>
{
newsButton.AttachPanel(newsPanel);
newsHighlighted = false;
};
newsButton.IsHighlighted = () => newsHighlighted && Game.LocalTick % 50 < 25;
}
}