本文整理汇总了C#中GuiWidget.Dragging方法的典型用法代码示例。如果您正苦于以下问题:C# GuiWidget.Dragging方法的具体用法?C# GuiWidget.Dragging怎么用?C# GuiWidget.Dragging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiWidget
的用法示例。
在下文中一共展示了GuiWidget.Dragging方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateWidgets
protected bool UpdateWidgets(GameTime gameTime, List<GuiWidget> widgets, Boolean update) {
bool cursorOnWidget = false;
for (int i = widgets.Count - 1; i >= 0; i--) {
GuiWidget widget = widgets[i];
widget.GuiHandler = this;
if (update) {
widget.PreUpdate();
widget.Update(gameTime);
}
if (widget == TooltipWidget) {
continue;
}
bool cursorOnChild = cursorOnWidget;
if (widget.ShowChildren) {
cursorOnChild = cursorOnWidget || UpdateWidgets(gameTime, widget.Widgets, false);
}
if (widget.InView && (widget.Position.X + widget.Offset.X <= MouseState.Position.X && MouseState.Position.X <= widget.Position.X + widget.Offset.X + widget.Size.X &&
widget.Position.Y + widget.Offset.Y <= MouseState.Position.Y && MouseState.Position.Y <= widget.Position.Y + widget.Offset.Y + widget.Size.Y)) {
cursorOnWidget = true;
widget.Hover(gameTime);
if (!cursorOnChild && MouseState.LeftButton.State == MouseButtonStates.Clicked) {
widget.Click(gameTime, 1);
if (FocusedWidget != null) {
FocusedWidget.Unfocus(gameTime);
}
FocusedWidget = widget;
}
if (!cursorOnChild && MouseState.RightButton.State == MouseButtonStates.Clicked) {
widget.Click(gameTime, 3);
}
if (!cursorOnChild && MouseState.LeftButton.State == MouseButtonStates.DragStarted) {
if (DraggingWidget != null) {
DraggingWidget.Dragging(gameTime, MouseButtonStates.DragEnded);
}
DraggingWidget = widget;
DraggingWidget.Dragging(gameTime, MouseButtonStates.DragStarted);
}
widget.Scroll(gameTime, MouseState.WheelTurns);
}
cursorOnWidget = cursorOnWidget || cursorOnChild;
}
return cursorOnWidget;
}