本文整理汇总了C#中OpenRA.Widgets.ScrollPanelWidget.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# ScrollPanelWidget.AddChild方法的具体用法?C# ScrollPanelWidget.AddChild怎么用?C# ScrollPanelWidget.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRA.Widgets.ScrollPanelWidget
的用法示例。
在下文中一共展示了ScrollPanelWidget.AddChild方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddReplay
void AddReplay(ScrollPanelWidget list, string filename, ScrollItemWidget template)
{
var item = ScrollItemWidget.Setup(template,
() => currentReplay != null && currentReplay.Filename == filename,
() => SelectReplay(filename));
var f = Path.GetFileName(filename);
item.Get<LabelWidget>("TITLE").GetText = () => f;
list.AddChild(item);
}
示例2: PopulateObjectivesList
void PopulateObjectivesList(MissionObjectives mo, ScrollPanelWidget parent, ContainerWidget template)
{
parent.RemoveChildren();
foreach (var o in mo.Objectives.OrderBy(o => o.Type))
{
var objective = o; // Work around the loop closure issue in older versions of C#
var widget = template.Clone();
var label = widget.Get<LabelWidget>("OBJECTIVE_TYPE");
label.GetText = () => objective.Type == ObjectiveType.Primary ? "Primary" : "Secondary";
var checkbox = widget.Get<CheckboxWidget>("OBJECTIVE_STATUS");
checkbox.IsChecked = () => objective.State != ObjectiveState.Incomplete;
checkbox.GetCheckType = () => objective.State == ObjectiveState.Completed ? "checked" : "crossed";
checkbox.GetText = () => objective.Description;
parent.AddChild(widget);
}
}
示例3: AddAsset
void AddAsset(ScrollPanelWidget list, string filepath, ScrollItemWidget template)
{
var filename = Path.GetFileName(filepath);
var item = ScrollItemWidget.Setup(template,
() => currentFilename == filename,
() => { LoadAsset(filename); });
item.Get<LabelWidget>("TITLE").GetText = () => filepath;
item.IsVisible = () =>
{
bool visible;
if (assetVisByName.TryGetValue(filepath, out visible))
return visible;
visible = FilterAsset(filepath);
assetVisByName.Add(filepath, visible);
return visible;
};
list.AddChild(item);
}
示例4: AddAsset
void AddAsset(ScrollPanelWidget list, string filepath, ScrollItemWidget template)
{
var sprite = Path.GetFileNameWithoutExtension(filepath);
var item = ScrollItemWidget.Setup(template,
() => spriteImage.Image == sprite,
() => LoadAsset(sprite));
item.Get<LabelWidget>("TITLE").GetText = () => filepath;
list.AddChild(item);
}
示例5: AddReplay
void AddReplay(ScrollPanelWidget list, string filename, LabelWidget template)
{
var entry = template.Clone() as LabelWidget;
entry.Id = "REPLAY_";
entry.GetText = () => " {0}".F(Path.GetFileName(filename));
entry.GetBackground = () => (CurrentReplay == filename) ? "dialog2" : null;
entry.OnMouseDown = mi => { if (mi.Button != MouseButton.Left) return false; CurrentReplay = filename; return true; };
entry.IsVisible = () => true;
list.AddChild(entry);
}
示例6: AddAsset
void AddAsset(ScrollPanelWidget list, string filepath, ScrollItemWidget template)
{
var filename = Path.GetFileName(filepath);
var item = ScrollItemWidget.Setup(template,
() => spriteWidget.Image == filename,
() => { filenameInput.Text = filename; LoadAsset(filename); });
item.Get<LabelWidget>("TITLE").GetText = () => filepath;
list.AddChild(item);
}