Develop Smartphone software with C #: Push Box (iii)

Source: Internet
Author: User
Tags bool static class

This is the third of a series of articles "using C # to develop smartphone software: Push boxes". In this article, the Common/block.cs source program file is introduced.

The following is a reference fragment:

1 Namespace Skyiv.Ben.PushBox.Common


2 {


3///


4///Basic cell: geosyncline Wall brick box worker


5///


6 static class block


7 {


8 Public Const-byte land = 0; Ground


9 Public Const byte Slot = 1; Groove


Public Const BYTE Wall = 2; Wall


Public Const BYTE Brick = 3; Brick: Equivalent to the wall, usually on the periphery of the wall


Public Const BYTE Box0 = 4; The case is on the ground


Public Const BYTE Box1 = 5; The box is on the trough


Public Const BYTE Man0 = 6; The workmen stood on the ground


Public Const BYTE MAN1 = 7; The workmen stood on the trough


16


Const string mask = "-+#%xx ()"; (*.BXA) documents, which in turn represent the above


18


public static string Getpenname (Byte block)


20 {


"Geosyncline wall Brick box for Everyone" [Block & 0x07]. ToString ();


22}


23


public static Char GetChar (ushort block)


25 {


return Mask[block & 0x07];


27}


28


public static byte GetByte (char block)


30 {


return (byte) mask. INDEXOF (block);


32}


33


public static bool IsOk (UShort block)


35 {


return blocks <= Man1;


37}


38


-public static void Cleanallmark (ushort[,] bb)


40 {


for (int i = 0; i < BB.) GetLength (0); i++)


for (int j = 0; J < BB.) GetLength (1); J + +)


Bb[i, J] &= 0x07;


44}


45


public static void Mark (ref ushort block, int value)


47 {


Block |= (ushort) (Value << 3);


49}


50


Wuyi public static int Value (ushort block)


52 {


return blocks >> 3;


54}


55


public static void Update (ref ushort block, byte pen)


57 {


if (isslot (block) && pen = = block.man0) pen = block.man1;


if (isslot (block) && pen = = block.box0) pen = block.box1;


block = pen;


61}


62


the public static void Manin (ref ushort block)


64 {


block = = (Man0-land);


66}


67


public static void Manout (ref ushort block)


69 {


block-= (Man0-land);


71}


72


public static void Boxin (ref ushort block)


74 {


block = = (Box0-land);


76}


77


public static void Boxout (ref ushort block)


79 {


block-= (Box0-land);


81}


82


the public static bool Isslot (UShort block)


84 {


return block = = Slot | | Block = = Box1 | | block = = Man1;


86}


87


public static bool IsBlank (UShort block)


89 {


return block = = Land | | block = = Slot;


91}


92


public static bool Isbox (UShort block)


94 {


return block = = Box0 | | block = = Box1;


96}


97


public static bool Isman (UShort block)


99 {


return block = = Man0 | | block = = Man1;


101}


102}


103}

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.