嵌入式程序
源代码在线查看: startcommand.cs
using System;
namespace DiamondPet.LogicLayer.GameStateStartLogic.StartCommand
{
#region 向上命令
///
/// UpCommand 的摘要说明。
///
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 向左向右命令
///
/// RightCommand 的摘要说明。
///
public class RightCommand : Command
{
public RightCommand()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public override void ExecuteCommand()
{
}
}
///
/// LeftCommand 的摘要说明。
///
public class LeftCommand : Command
{
public LeftCommand()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public override void ExecuteCommand()
{
}
}
#endregion
#region 确定命令
///
/// EnterCommand 的摘要说明。
///
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 向下命令
///
/// DownCommand 的摘要说明。
///
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
}