Class PuzzleKeypad
Provides methods for generation, storing, and interpretation of user actions with a keypad of random layout.
This .ctor is supplied some code that user has to punch-in(touch/click) on a randomly laid-out keypad which is usually rendered as
an image. Use DecipherCoordinates() methods to convert user click/touch coordinates into characters
Inheritance
System.Object
PuzzleKeypad
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Azos.dll
Syntax
[Serializable]
public sealed class PuzzleKeypad
Constructors
PuzzleKeypad(String, String, Int32, Int32, Int32, Double, Int32, Int32)
Declaration
public PuzzleKeypad(string code, string extra = null, int puzzleBoxWidth = 5, int boxWidth = 35, int boxHeight = 50, double boxSizeVariance = 0.3, int minBoxWidth = 10, int minBoxHeight = 16)
Parameters
Type |
Name |
Description |
System.String |
code |
|
System.String |
extra |
|
System.Int32 |
puzzleBoxWidth |
|
System.Int32 |
boxWidth |
|
System.Int32 |
boxHeight |
|
System.Double |
boxSizeVariance |
|
System.Int32 |
minBoxWidth |
|
System.Int32 |
minBoxHeight |
|
Fields
DEFAULT_RENDER_OFFSET_X
Declaration
public const int DEFAULT_RENDER_OFFSET_X = 16
Field Value
Type |
Description |
System.Int32 |
|
DEFAULT_RENDER_OFFSET_Y
Declaration
public const int DEFAULT_RENDER_OFFSET_Y = 16
Field Value
Type |
Description |
System.Int32 |
|
Properties
Boxes
Declaration
public IEnumerable<PuzzleKeypad.CharBox> Boxes { get; }
Property Value
Code
Returns the original secret code that this keypad was created for
Declaration
public string Code { get; }
Property Value
Type |
Description |
System.String |
|
Size
Returns the size of rectangle that covers all boxes
Declaration
public Size Size { get; }
Property Value
Type |
Description |
System.Drawing.Size |
|
Methods
DecipherCoordinates(JSONDataArray, Nullable<Int32>, Nullable<Int32>)
Translates user action coordinates (i.e. screen touches or mouse clicks) into a string.
The coordinates must be supplied as a JSON array of json objects that have '{x: [int], y: [int]}' structure
Declaration
public string DecipherCoordinates(JSONDataArray coords, int? offsetX = default(int? ), int? offsetY = default(int? ))
Parameters
Type |
Name |
Description |
JSONDataArray |
coords |
|
System.Nullable<System.Int32> |
offsetX |
|
System.Nullable<System.Int32> |
offsetY |
|
Returns
Type |
Description |
System.String |
|
DecipherCoordinates(IEnumerable<Point>, Nullable<Int32>, Nullable<Int32>)
Translates user action coordinates (i.e. screen touches or mouse clicks) into a string.
The coordinates are supplied as IEnumerable(Point)
Declaration
public string DecipherCoordinates(IEnumerable<Point> coords, int? offsetX = default(int? ), int? offsetY = default(int? ))
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Drawing.Point> |
coords |
|
System.Nullable<System.Int32> |
offsetX |
|
System.Nullable<System.Int32> |
offsetY |
|
Returns
Type |
Description |
System.String |
|
DefaultRender(IApplication, Nullable<Color>, Boolean)
Renders default image of the keypad suitable for user entry (i.e. touch or mouse clicks).
This method requires IPuzzleKeypadRenderer module to be installed in application module root
Declaration
public Image DefaultRender(IApplication app, Color? bgColor = default(Color? ), bool showRects = false)
Parameters
Type |
Name |
Description |
IApplication |
app |
|
System.Nullable<System.Drawing.Color> |
bgColor |
|
System.Boolean |
showRects |
|
Returns
Extension Methods