本文整理汇总了C#中EventInfo.Consume方法的典型用法代码示例。如果您正苦于以下问题:C# EventInfo.Consume方法的具体用法?C# EventInfo.Consume怎么用?C# EventInfo.Consume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventInfo
的用法示例。
在下文中一共展示了EventInfo.Consume方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EventListener
protected void EventListener(EventInfo e)
{
e.Consume();
if ((e.Type == "Press") || (e.Type == "RepeatPress")) {
if (e.Source == Game.InputControls.Cancel) {
Cancel();
return;
} else if (e.Source == Game.InputControls.Up) {
SelectedIndex = SelectedIndex - 1;
if (SelectedIndex < 0)
SelectedIndex = Items.Count - 1;
Game.EventBus.Broadcast(this, "MenuCursorMoved", SelectedIndex);
return;
} else if (e.Source == Game.InputControls.Down) {
SelectedIndex = SelectedIndex + 1;
if (SelectedIndex >= Items.Count)
SelectedIndex = 0;
Game.EventBus.Broadcast(this, "MenuCursorMoved", SelectedIndex);
return;
}
}
var item = Items[SelectedIndex];
item.HandleInput(Game, e);
}
示例2: EventListener
protected void EventListener(EventInfo e)
{
if (HideWhenPaused && Game.Paused)
return;
e.Consume();
int scroll = 0;
if ((e.Source == Game.InputControls.Left) || (e.Source == Game.InputControls.Up))
scroll = -1;
else if ((e.Source == Game.InputControls.Right) || (e.Source == Game.InputControls.Down))
scroll = 1;
if (scroll != 0) {
if (
(Pages.Length > 1) && (
(e.Type == "Press") ||
(e.Type == "RepeatPress")
)
) {
ActivePage = Arithmetic.Wrap(ActivePage + scroll, 0, Pages.Length - 1);
}
} else if (e.Type == "Press") {
Close();
}
}