本文整理汇总了C#中Command.AddTag方法的典型用法代码示例。如果您正苦于以下问题:C# Command.AddTag方法的具体用法?C# Command.AddTag怎么用?C# Command.AddTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command
的用法示例。
在下文中一共展示了Command.AddTag方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Preview
public override void Preview(string contentName)
{
verdana = ContentLoader.Load<Font>("Verdana12");
new FontText(verdana, "Play", Rectangle.One);
sound = ContentLoader.Load<Sound>(contentName);
var trigger = new MouseButtonTrigger();
trigger.AddTag("temporary");
var soundCommand = new Command(() => sound.Play(1)).Add(trigger);
soundCommand.AddTag("temporary");
}
示例2: Preview
protected override void Preview(string contentName)
{
var verdana = ContentLoader.Load<Font>("Verdana12");
new FontText(verdana, "Play", Rectangle.One);
if (Sound != null)
DisposeData();
Sound = ContentLoader.Load<Sound>(contentName);
trigger = new MouseButtonTrigger();
trigger.AddTag("temporary");
soundCommand = new Command(() => Sound.Play(1)).Add(trigger);
soundCommand.AddTag("temporary");
}
示例3: SetMouseCommands
private void SetMouseCommands(string obj)
{
var leftClickTriggerReleasing = new MouseButtonTrigger(MouseButton.Left, State.Releasing);
leftClickTriggerReleasing.AddTag("temporary");
var findEntityCommand = new Command(FindEntity2DOnPosition).Add(leftClickTriggerReleasing);
findEntityCommand.AddTag("temporary");
var releaseMiddleMouse = new MouseButtonTrigger(MouseButton.Left, State.Releasing);
releaseMiddleMouse.AddTag("temporary");
var setReleasingCommand =
new Command(position => AddControlToScene(position)).Add(releaseMiddleMouse);
setReleasingCommand.AddTag("temporary");
UiEditorScene.SetMousePosition();
}
示例4: Preview
protected override void Preview(string contentName)
{
verdana = ContentLoader.Load<Font>("Verdana12");
new FontText(verdana, "Play/Stop", Rectangle.One);
music = ContentLoader.Load<Music>(contentName);
music.Play(1);
var trigger = new MouseButtonTrigger();
trigger.AddTag("temporary");
var musicCommand = new Command(() => //ncrunch: no coverage start
{
if (music.IsPlaying())
music.Stop();
else
music.Play(1);
}).Add(trigger);
musicCommand.AddTag("temporary");
//ncrunch: no coverage end
}
示例5: SetCommands
public void SetCommands()
{
var leftClickTrigger = new MouseButtonTrigger();
leftClickTrigger.AddTag("temporary");
var leftClickCommand = new Command(LeftMouseButton).Add(leftClickTrigger);
leftClickCommand.AddTag("temporary");
var middleDragTrigger = new MouseDragTrigger(MouseButton.Middle);
middleDragTrigger.AddTag("temporary");
var middleDragCommand = new Command(MiddleMouseDrag).Add(middleDragTrigger);
middleDragCommand.AddTag("temporary");
var dragLeftTrigger = new MouseDragTrigger();
dragLeftTrigger.AddTag("temporary");
var dragLeftCommand = new Command(LeftMouseDrag).Add(dragLeftTrigger);
dragLeftCommand.AddTag("temporary");
var zoomTrigger = new MouseZoomTrigger();
zoomTrigger.AddTag("temporary");
var zoomCommand = new Command(Zoom).Add(zoomTrigger);
zoomCommand.AddTag("temporary");
var leftReleaseTrigger = new MouseButtonTrigger(State.Releasing);
leftReleaseTrigger.AddTag("temporary");
var leftReleaseCommand = new Command(LeftMouseRelease).Add(leftReleaseTrigger);
leftReleaseCommand.AddTag("temporary");
}
示例6: SetMouseCommands
private void SetMouseCommands(string obj)
{
var leftClickTrigger = new MouseButtonTrigger();
leftClickTrigger.AddTag("temporary");
var findEntityCommand = new Command(FindEntity2DOnPosition).Add(leftClickTrigger);
findEntityCommand.AddTag("temporary");
var moveMouse = new MousePositionTrigger(MouseButton.Left, State.Pressed);
moveMouse.AddTag("temporary");
var moveImageCommand =
new Command(
position =>
uiEditorScene.ControlProcessor.MoveImage(position, SelectedEntity2D, Adder.IsDragging,
uiEditorScene.IsSnappingToGrid, uiEditorScene)).Add(moveMouse);
moveImageCommand.AddTag("temporary");
var middleMouseClick = new MouseButtonTrigger(MouseButton.Middle);
middleMouseClick.AddTag("temporary");
var setLastPositionCommand =
new Command(position => uiEditorScene.ControlProcessor.lastMousePosition = position).Add(
middleMouseClick);
setLastPositionCommand.AddTag("temporary");
var releaseMiddleMouse = new MouseButtonTrigger(MouseButton.Left, State.Releasing);
releaseMiddleMouse.AddTag("temporary");
var setReleasingCommand =
new Command(position => SetCommandsForReleasing(position)).Add(releaseMiddleMouse);
setReleasingCommand.AddTag("temporary");
}
示例7: CreateViewportCommands
private static void CreateViewportCommands(Service service)
{
var dragTrigger = new MouseDragTrigger(Input.MouseButton.Middle);
dragTrigger.AddTag("ViewControl");
var zoomTrigger = new MouseZoomTrigger();
zoomTrigger.AddTag("ViewControl");
var panningCommand = new Command(service.Viewport.OnViewportPanning).Add(dragTrigger);
var zoomCommand = new Command(service.Viewport.OnViewPortZooming).Add(zoomTrigger);
panningCommand.AddTag("ViewControl");
zoomCommand.AddTag("ViewControl");
}
示例8: SetMousePosition
public void SetMousePosition()
{
var middleClick = new MouseButtonTrigger();
middleClick.AddTag("temporary");
var setLastPositionCommand = new Command(position => SetPosition(position)).Add(middleClick);
setLastPositionCommand.AddTag("temporary");
var moveMouse = new MousePositionTrigger(MouseButton.Left, State.Released);
moveMouse.AddTag("temporary");
var checkTransformationCommand =
new Command(position => CheckIfCanTransformControl(position)).Add(moveMouse);
checkTransformationCommand.AddTag("temporary");
var pressAndMoveMouse = new MousePositionTrigger(MouseButton.Left, State.Pressed);
pressAndMoveMouse.AddTag("temporary");
var pressOnControlCommand =
new Command(position => TransformSelectedControl(position)).Add(pressAndMoveMouse);
pressOnControlCommand.AddTag("temporary");
var pressControl = new KeyTrigger(Key.LeftControl);
pressControl.AddTag("temporary");
var multiSelectControl = new Command(() => SetMultiSelection(true)).Add(pressControl);
multiSelectControl.AddTag("temporary");
var releaseControl = new KeyTrigger(Key.LeftControl, State.Releasing);
releaseControl.AddTag("temporary");
var disableMultiSelectControl =
new Command(() => SetMultiSelection(false)).Add(releaseControl);
disableMultiSelectControl.AddTag("temporary");
}