当前位置: 首页>>代码示例>>C#>>正文


C# Command.Add方法代码示例

本文整理汇总了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));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:Ball.cs

示例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));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:Paddle.cs

示例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;
 }
开发者ID:360studio,项目名称:OrangePineappleTechnical,代码行数:9,代码来源:CoverMove.cs

示例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);
     }
 }
开发者ID:360studio,项目名称:OrangePineappleTechnical,代码行数:9,代码来源:FPSHelper.cs

示例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);
     });
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:9,代码来源:CommandTests.cs

示例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;
 }
开发者ID:360studio,项目名称:OrangePineappleTechnical,代码行数:10,代码来源:FPSMove.cs

示例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);
     });
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:12,代码来源:CommandTests.cs

示例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);
         }
     });
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:17,代码来源:CommandTests.cs

示例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;
 }
开发者ID:360studio,项目名称:OrangePineappleTechnical,代码行数:6,代码来源:CoverMove.cs

示例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));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:22,代码来源:Game.cs

示例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;
 }
开发者ID:360studio,项目名称:OrangePineappleTechnical,代码行数:5,代码来源:FPSCrouch.cs

示例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;
 }
开发者ID:360studio,项目名称:OrangePineappleTechnical,代码行数:9,代码来源:FPSInterfacingHelper.cs

示例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);
         }
     });
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:17,代码来源:CommandTests.cs

示例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);
         }
     });
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:17,代码来源:CommandTests.cs


注:本文中的Command.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。