In the previous article "using C # to develop smartphone software: Push box (vi)", I introduced the Common/pub.cs source program files. In this article, Common/step.cs source program files are described.
The following is a reference fragment:
1namespace Skyiv.Ben.PushBox.Common
2{
3 enum Direction {None, East, South, West, North}/ /direction: No cardinal, No.
4 public enum Action {None, Create, edit, delete}//design: No create edit delete
5
6/**////
7/// Steps
8///
9 struct step
Ten {
one Direction direct;/forward direction
bool Isbox;/Whether push the box forward together
BOOL Isst Op If "undo", stay
Direction Direct {get {return direct;}}
public bool Isbox {get {return isbox;}}
Isstop-bool {get {return isstop;}}
Public Step (Direction Direct, BOOL Isbox, bool isstop)
{
This.direct = direct;
This.is Box = Isbox;
This.isstop = isstop;
24}
//Isbox isstop None East South West North
M/A B C D E
//x F G H I J
//x K L M N o< br>//x x P Q R S T
to
Implicit public static operator char (step Step)
% {
Char c = "ABCDE" [Ste P.direct-direction.none];
35 if (step.isbox) c = (char) (c + 5);
if (step.isstop) c = (char) (c + 10);
Panax Notoginseng return c;
38}
m
public static implicit operator step (char c)
' {
# int n = c-' A ';
Return to New step (Direc tion) (n% 5), (n% >= 5), (n >= 10));
44}
45}
}