startcommand.cs

来自「嵌入式程序」· CS 代码 · 共 117 行

CS
117
字号
using System;

namespace DiamondPet.LogicLayer.GameStateStartLogic.StartCommand
{
	#region 向上命令
	/// <summary>
	/// UpCommand 的摘要说明。
	/// </summary>
	public class UpCommand : Command
	{
		private SelectState selectState;

		public UpCommand(SelectState s)
		{
			selectState = s;
		}

		public override void ExecuteCommand()
		{
			if(this.selectState.SelectIndex == 0)
			{
				this.selectState.SelectIndex = GameConstResource.btNumbers - 1;
			}
			else
			{
				this.selectState.SelectIndex = (this.selectState.SelectIndex - 1) % GameConstResource.btNumbers; 
			}
		}
	}

	#endregion

	#region 向左向右命令
	/// <summary>
	/// RightCommand 的摘要说明。
	/// </summary>
	public class RightCommand : Command
	{
		public RightCommand()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}

		public override void ExecuteCommand()
		{

		}
	}


	/// <summary>
	/// LeftCommand 的摘要说明。
	/// </summary>
	public class LeftCommand : Command
	{
		public LeftCommand()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}

		public override void ExecuteCommand()
		{

		}
	}
	#endregion

	#region 确定命令
	/// <summary>
	/// EnterCommand 的摘要说明。
	/// </summary>
	public class EnterCommand : Command
	{
		private SelectState selectState;

		public EnterCommand(SelectState s)
		{
			this.selectState = s;
		}

		public EnterCommand(UserLayerStateManager u) : base(u)
		{}

		public override void ExecuteCommand()
		{
			//进入选择模式  先设为一个人做测试

			this.selectState.userLayerStateManager.AnotherChangeState(this.selectState.SelectIndex);
		}
	}
	#endregion

	#region 向下命令
	/// <summary>
	/// DownCommand 的摘要说明。
	/// </summary>
	public class DownCommand : Command
	{
		private SelectState selectState;

		public DownCommand(SelectState s)
		{
			selectState = s;
		}

		public override void ExecuteCommand()
		{
			this.selectState.SelectIndex = (this.selectState.SelectIndex + 1) % GameConstResource.btNumbers; 
		}
	}
	#endregion
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?