Using C # to develop smartphone software: Push Box (vii)

Source: Internet
Author: User
Tags bool

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}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.