本文整理汇总了C#中Command.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Command.Add方法的具体用法?C# Command.Add怎么用?C# Command.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command
的用法示例。
在下文中一共展示了Command.Add方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterFireBallCommand
private void RegisterFireBallCommand()
{
var command = new Command(FireBallFromPaddle);
command.Add(new KeyTrigger(Key.Space));
command.Add(new MouseButtonTrigger());
command.Add(new GamePadButtonTrigger(GamePadButton.A));
}
示例2: RegisterButtonCommands
private void RegisterButtonCommands()
{
var left = new Command(() => xPosition -= PaddleMovementSpeed * Time.Delta);
left.Add(new KeyTrigger(Key.CursorLeft, State.Pressed));
left.Add(new GamePadButtonTrigger(GamePadButton.Left, State.Pressed));
var right = new Command(() => xPosition += PaddleMovementSpeed * Time.Delta);
right.Add(new KeyTrigger(Key.CursorRight, State.Pressed));
right.Add(new GamePadButtonTrigger(GamePadButton.Right, State.Pressed));
}
示例3: GenerateTransitionCommand
public Command GenerateTransitionCommand () {
Cover cover = CoverManager.FindCover(CachedTurn.GetBodiesInLine(FixedMath.One * 200),CurrentCover);
if (cover != null) {
Command com = new Command(this.Data.ListenInputID,this.Agent.Controller.ControllerID);
com.Add<DefaultData> (new DefaultData(DataType.UShort,cover.ID));
return com;
}
return null;
}
示例4: OnGameStart
protected override void OnGameStart()
{
Command registerCom = new Command(RegisterCode);
registerCom.Add<DefaultData> (new DefaultData(DataType.Int, ClientManager.ClientID));
for (int i = 0; i < 1; i++)
{
CommandManager.SendCommand(registerCom);
}
}
示例5: Run
public void Run(Type resolver)
{
Start(resolver, (InputCommands input) =>
{
var command = new Command();
command.Add(new KeyTrigger(Key.Y, State.Releasing));
command.Run(input);
});
}
示例6: GenerateMoveCommand
public Command GenerateMoveCommand(Vector2 input)
{
Command com = new Command(this.Data.ListenInputID, this.Agent.Controller.ControllerID);
Vector2d vec = (new Vector2d(input));
if (vec.FastMagnitude () > FixedMath.One * FixedMath.One) {
vec.Normalize();
}
com.Add<Vector2d>(vec);
return com;
}
示例7: AddAndRemoveTrigger
public void AddAndRemoveTrigger(Type resolver)
{
Start(resolver, (InputCommands input) =>
{
var command = new Command();
var trigger = new MouseButtonTrigger(MouseButton.Left, State.Releasing);
command.Add(trigger);
Assert.AreEqual(1, command.attachedTriggers.Count);
command.Remove(trigger);
Assert.AreEqual(0, command.attachedTriggers.Count);
});
}
示例8: SimulateKeyPress
public void SimulateKeyPress(Type resolver)
{
Start(resolver, (InputCommands input) =>
{
var command = new Command();
input.Add(command);
command.Add(new KeyTrigger(Key.A, State.Pressed));
bool triggered = false;
command.Attach(trigger => triggered = true);
if (testResolver != null)
{
testResolver.SetKeyboardState(Key.A, State.Pressed);
testResolver.AdvanceTimeAndExecuteRunners(0.1f);
Assert.IsTrue(triggered);
}
});
}
示例9: GenerateMovementCommand
public Command GenerateMovementCommand (float input) {
if (this.IsTransitioning) return null;
Command com = new Command(this.Data.ListenInputID,this.Agent.Controller.ControllerID);
com.Add<DefaultData> (new DefaultData(DataType.Long,FixedMath.Create(input)));
return com;
}
示例10: DisplayGameOverMessage
private void DisplayGameOverMessage()
{
Chunk.Dispose();
var fontGameOverText = ContentLoader.Load<Font>("Tahoma30");
var fontReplayText = ContentLoader.Load<Font>("Verdana12");
gameOverMsg = new FontText(fontGameOverText, "Game Over",
Rectangle.FromCenter(Vector2D.Half, new Size(0.6f, 0.3f)))
{
Color = menu.gameColors[1],
RenderLayer = 3
};
restartMsg = new FontText(fontReplayText, "Do you want to continue (Y/N)",
Rectangle.FromCenter(new Vector2D(0.5f, 0.7f), new Size(0.6f, 0.3f)))
{
Color = menu.gameColors[2],
RenderLayer = 3
};
yesCommand = new Command(RestartGame);
yesCommand.Add(new KeyTrigger(Key.Y));
noCommand = new Command(BackToMenu);
noCommand.Add(new KeyTrigger(Key.N));
}
示例11: GenerateCrouchCommand
public Command GenerateCrouchCommand (bool crouch) {
Command com = new Command(this.Data.ListenInputID,Agent.Controller.ControllerID);
com.Add<DefaultData> (new DefaultData(DataType.Bool,crouch));
return com;
}
示例12: SendCommand
public void SendCommand(Command com, bool immediate = false)
{
if (com == null)
return;
if (Agent.Controller.SelectionChanged)
com.Add(new Selection(Agent.Controller.SelectedAgents));
CommandManager.SendCommand(com, false);
if (immediate) sendOut = true;
}
示例13: SimulateMouseClick
public void SimulateMouseClick(Type resolver)
{
Start(resolver, (InputCommands input) =>
{
var command = new Command();
input.Add(command);
command.Add(new MouseButtonTrigger(MouseButton.Left, State.Releasing));
bool triggered = false;
command.Attach(trigger => triggered = true);
if (testResolver != null)
{
testResolver.SetMouseButtonState(MouseButton.Left, State.Releasing, Point.Zero);
testResolver.AdvanceTimeAndExecuteRunners(0.1f);
Assert.IsTrue(triggered);
}
});
}
示例14: SimulateMouseMovement
public void SimulateMouseMovement(Type resolver)
{
Start(resolver, (InputCommands input) =>
{
var command = new Command();
input.Add(command);
command.Add(new MouseMovementTrigger());
if (testResolver != null)
{
testResolver.SetMousePosition(Point.Half);
testResolver.AdvanceTimeAndExecuteRunners(0.1f);
testResolver.SetMousePosition(Point.One);
testResolver.AdvanceTimeAndExecuteRunners(0.1f);
Assert.IsTrue(command.TriggerFired);
}
});
}