public void Draw(float x, float y, float width, float height, int [] fieldTextures) { int index = (int)this.colour; int textureId = fieldTextures[index]; if (!this.selected) { // CLReDraw.Rect(x, y, width, height, Color.Argb(255, 127, 127, 127)); CLReDraw.Rect(x, y, width, height, fieldTextures[0]); } else { CLReDraw.Rect(x, y, width, height, fieldTextures[0], new float[] { 1, 0, 0, 0, 1, 1, 0, 1, }); } if (this.colour != CLColour.CLNone) { // CLReDraw.Circle(x+width/2, y-height/2, (height > width) ? (width * 0.35f) : (height * 0.35f), CLColourToColor(this.colour)); CLReDraw.Rect(x, y, width, height, textureId); } }
public void Draw(int textureId, float [] outBounds = null, bool grayscale = false) { CLReDraw.Rect(this.x, this.y, this.width, this.height, textureId, grayscale); if (!this.added) { if (outBounds != null) { float x = outBounds[0], y = outBounds[3], width = outBounds[1] - outBounds[0], height = outBounds[3] - outBounds[2]; CLReDraw.View(this.outTap, x, y, width, height); } else { this.outTap = null; } CLReDraw.View(this.label, this.x, this.y, this.width, this.height); this.added = true; } }
public void Draw(int textureId, float[] outBounds) { if (this.popping) { this.popping = false; this.Pop(); } if (!this.Show) { return; } CLReDraw.Rect(this.x, this.y, this.width, this.height, textureId); float dheight = this.height * 0.142857f; // / 7 if (!this.added) { if (outBounds != null) { float x = outBounds[0], y = outBounds[3], width = outBounds[1] - outBounds[0], height = outBounds[3] - outBounds[2]; CLReDraw.View(this.outTap, x, y, width, height); } else { this.outTap = null; } CLReDraw.View(this.inTap, this.x, this.y, this.width, this.height); CLReDraw.View(this.titleLabel, this.x, this.y - dheight * 0.5f, this.width, dheight); this.added = true; } if (!this.navigating) { this.drawContent?.Invoke(new float[] { this.x, this.y - dheight * 1.5f, this.width, this.height - dheight * 1.5f }, true); } }
public void Draw(int textureId, float xOffset, float yOffset) { CLReDraw.Rect(this.x, this.y, this.width, this.height, textureId); DrawText(xOffset, yOffset); }
public void MakeLabels(bool landscape, float left, float right, float bottom, float top, float scale) { this.left = left; this.right = right; this.bottom = bottom; this.top = top; float step; if (this.rows > this.columns) { step = 2.0f / this.rows; } else { step = 2.0f / this.columns; } float width = step * 3, height = step; float hor = right - left, ver = top - bottom; if (ver > hor) { this.textSize = height * 1.11125f * scale; } else { this.textSize = height * 1.11125f * scale; } if (!landscape) { this.bestScore = new CLLabel(this.scoresTable[0, 1], this.textSize, left, top, width, height, Paint.Align.Right, Color.Argb(255, 0, 170, 0)); this.userScore = new CLLabel(this.score.ToString(), this.textSize, left + step * 6, top, width, height, Paint.Align.Right, Color.Argb(255, 0, 170, 0)); this.results = new CLLabel(GetString(Resource.String.Results), this.textSize, left, bottom + step, width, height, Paint.Align.Center, Color.Argb(255, 0, 170, 0)); this.start = new CLLabel(GetString(Resource.String.Restart), this.textSize, left + step * 3, bottom + step, width, height, Paint.Align.Center, Color.Argb(255, 0, 170, 0)); this.exit = new CLLabel(GetString(Resource.String.Exit), this.textSize, left + step * 6, bottom + step, width, height, Paint.Align.Center, Color.Argb(255, 0, 170, 0)); } else { this.bestScore = new CLLabel(this.scoresTable[0, 1], this.textSize, right - step * 3, top, width, height, Paint.Align.Right, Color.Argb(255, 0, 170, 0)); this.userScore = new CLLabel(this.score.ToString(), this.textSize, right - step * 3, top - step, width, height, Paint.Align.Right, Color.Argb(255, 0, 170, 0)); this.results = new CLLabel(GetString(Resource.String.Results), this.textSize, left, bottom + step, width, height, Paint.Align.Center, Color.Argb(255, 0, 170, 0)); this.start = new CLLabel(GetString(Resource.String.Restart), this.textSize, left, bottom + step * 2, width, height, Paint.Align.Center, Color.Argb(255, 0, 170, 0)); this.exit = new CLLabel(GetString(Resource.String.Exit), this.textSize, right - step * 3, bottom + step, width, height, Paint.Align.Center, Color.Argb(255, 0, 170, 0)); } this.start.Action = delegate() { this.popUp = new CLLabel(GetString(Resource.String.RestartQ), this.textSize, -1.0f + step * 2, 1.0f - step * 4, step * 5, height, Paint.Align.Center, Color.Argb(255, 255, 0, 0)); this.popUp.ExtraDraw = delegate() { int textureId = (int)CLColour.CLMax + (int)CLLabelSize.CLMiddle; this.popUp.Draw(this.fieldTextures[textureId], 0.0f, 0.0f); }; this.popUp.Action = delegate() { if (!CheckNewScore()) { this.ClearField(); this.popUp = null; } else { RequestUserName(); } }; this.popUp.OutAction = delegate() { this.popUp = null; }; }; this.exit.Action = delegate() { this.popUp = new CLLabel(GetString(Resource.String.ExitQ), this.textSize, -1.0f + step * 2, 1.0f - step * 4, step * 5, height, Paint.Align.Center, Color.Argb(255, 255, 0, 0)); this.popUp.ExtraDraw = delegate() { int textureId = (int)CLColour.CLMax + (int)CLLabelSize.CLMiddle; this.popUp.Draw(this.fieldTextures[textureId], 0.0f, 0.0f); }; this.popUp.Action = delegate() { this.quit = true; this.popUp = null; }; this.popUp.OutAction = delegate() { this.popUp = null; }; }; this.results.Action = delegate() { this.popUp = new CLLabel(GetBestScoresList(), this.textSize * 1.337f, -1.0f + step, 1.0f - step, step * 7, step * 7, Paint.Align.Center, Color.Argb(255, 0, 170, 0), 1.95f); this.popUp.ExtraDraw = delegate() { int textureId = (int)CLColour.CLMax + (int)CLLabelSize.CLLarge; CLReDraw.Rect(-1.0f + step, 1.0f - step, step * 7, step * 7, this.fieldTextures[textureId]); this.popUp.DrawText(0.0f, -step * 3.5f); }; this.popUp.Action = delegate() { this.popUp = null; }; this.popUp.OutAction = delegate() { this.popUp = null; }; }; }
public void Draw(bool landscape, float left, float right, float bottom, float top) { float step; // CLReDraw.Rect(-1.0f, 1.0f, 2.0f, 2.0f, Color.Argb(255, 127, 127, 127)); if (this.rows > this.columns) { step = 2.0f / this.rows; } else { step = 2.0f / this.columns; } CLCell cell = this.cells; for (int i = 0; i < this.rows; i++, cell = cell.bottom) { for (int j = 0; j < this.columns; j++, cell = cell.right) { if (cell == null) { break; } cell.Draw(j * step - 1.0f, 1.0f - i * step, step, step, this.fieldTextures); } cell = this.cells; for (int k = 0; k < i; k++, cell = cell.bottom) { ; } if (cell == null) { break; } } float radius = step / 5.0f; if (!landscape) { CLReDraw.Rect(left + step * 3, top, step, step, this.fieldTextures[0]); if (this.nextColours[0] != CLColour.CLNone) { CLReDraw.Rect(left + step * 3.5f - radius, top - step * 0.5f + radius, radius * 2, radius * 2, this.fieldTextures[(int)this.nextColours[0]]); } CLReDraw.Rect(left + step * 4, top, step, step, this.fieldTextures[0]); if (this.nextColours[1] != CLColour.CLNone) { CLReDraw.Rect(left + step * 4.5f - radius, top - step * 0.5f + radius, radius * 2, radius * 2, this.fieldTextures[(int)this.nextColours[1]]); } CLReDraw.Rect(left + step * 5, top, step, step, this.fieldTextures[0]); if (this.nextColours[2] != CLColour.CLNone) { CLReDraw.Rect(left + step * 5.5f - radius, top - step * 0.5f + radius, radius * 2, radius * 2, this.fieldTextures[(int)this.nextColours[2]]); } } else { CLReDraw.Rect(left, top, step, step, this.fieldTextures[0]); if (this.nextColours[0] != CLColour.CLNone) { CLReDraw.Rect(left + step * 0.5f - radius, top - step * 0.5f + radius, radius * 2, radius * 2, this.fieldTextures[(int)this.nextColours[0]]); } CLReDraw.Rect(left + step, top, step, step, this.fieldTextures[0]); if (this.nextColours[1] != CLColour.CLNone) { CLReDraw.Rect(left + step * 1.5f - radius, top - step * 0.5f + radius, radius * 2, radius * 2, this.fieldTextures[(int)this.nextColours[1]]); } CLReDraw.Rect(left + step * 2, top, step, step, this.fieldTextures[0]); if (this.nextColours[2] != CLColour.CLNone) { CLReDraw.Rect(left + step * 2.5f - radius, top - step * 0.5f + radius, radius * 2, radius * 2, this.fieldTextures[(int)this.nextColours[2]]); } } int textureId = (int)CLColour.CLMax + (int)CLLabelSize.CLSmall; this.bestScore.Draw(this.fieldTextures[textureId], 0.0f, 0.0f); this.userScore.Draw(this.fieldTextures[textureId], 0.0f, 0.0f); this.results.Draw(this.fieldTextures[textureId], 0.0f, 0.0f); this.start.Draw(this.fieldTextures[textureId], 0.0f, 0.0f); this.exit.Draw(this.fieldTextures[textureId], 0.0f, 0.0f); if (this.popUp != null) { this.popUp.ExtraDraw(); } }
public void Draw(long time, float x, float y, float width, float height, int[] textures, bool ignoreTapView = false) { if (!this.Selected) { //#if DEBUG // CLReDraw.Rect(x, y, width, height, Color.FromRgba(127, 127, 127, 255)); //#endif CLReDraw.Rect(x, y, width, height, textures[0]); } else { CLReDraw.Rect(x, y, width, height, textures[0], 180.0f); } float dx = 0.0f, dy = 0.0f, dwidth = 0.0f, dheight = 0.0f; long delta = time - this.AnimTime; if (this.Highlight) { while (delta > CLCell.AnimHighlight) { delta -= CLCell.AnimHighlight; } float danim = 1.0f - CLAnim.Jump(delta, CLCell.AnimHighlight); danim *= 0.5f; Color highlightColour; if (!this.HighlightBlocked) { highlightColour = CLField.GreenColor.MultiplyAlpha(0.5f - danim); } else { highlightColour = CLField.RedColor.MultiplyAlpha(0.5f - danim); } CLReDraw.Rect(x, y, width, height, highlightColour); } bool tempNonBlowing = (this.Blowing && !this.BlowingStarted && !this.Moving && !this.Appearing); if ((this.Colour != CLColour.CLNone && !(this.Appearing || this.Moving)) || tempNonBlowing) { delta = time - this.AnimTime; if (this.Selected && this.AnimTime != 0) { dx = width * -0.1337f * 0.5f; dy = height * -0.1337f; dwidth = width * 0.1337f; dheight = height * -0.1337f; delta += CLCell.AnimJump; while (delta > CLCell.AnimJump) { delta -= CLCell.AnimJump; } float danim = CLAnim.Jump(delta, CLCell.AnimJump); dx *= danim; dy *= danim; dwidth *= danim; dheight *= danim; } /* else if (this.appearing && delta <= CLCell.AnimAppearing) { * dx = width * 0.7f * 0.5f; * dy = height * -0.7f * 0.5f; * dwidth = width * -0.7f; * dheight = height * -0.7f; * float danim = 1.0f-CLAnim.EaseOutCubic(delta, CLCell.AnimAppearing); * dx *= danim; * dy *= danim; * dwidth *= danim; * dheight *= danim; * } else if (this.appearing && delta > CLCell.AnimAppearing) { * this.appearing = false; * }*/ int textureId; if (!tempNonBlowing) { textureId = textures[1]; } else { textureId = textures[2]; } CLReDraw.Rect(x + dx, y + dy, width + dwidth, height + dheight, textureId); //#if DEBUG /* if (this.Colour != CLColour.CLNone) { * delta = time; * Color col = CLColourToColor(this.colour).WithSaturation(1.0).WithLuminosity(0.75); * for (int i = 0; i < 7; i++) { * switch (i) { * default: * case 0: * dx = width*0.33f; * dy = height*0.4f; * break; * case 1: * dx = width*0.5f; * dy = height*0.4f; * break; * case 2: * dx = width*0.3f; * dy = height*0.6f; * break; * case 3: * dx = width*0.69f; * dy = height*0.64f; * break; * case 4: * dx = width*0.4f; * dy = height*0.5f; * break; * case 5: * dx = width*0.5f; * dy = height*0.69f; * break; * case 6: * dx = width*0.69f; * dy = height*0.3f; * break; * } * delta += 123*i; * while (delta > 2000) { * delta -= 2000; * } * float danim = 1.0f-CLAnim.Jump(delta, 2000); * CLReDraw.Rect(x + dx, y - dy, width*0.03f, height*0.03f, col.MultiplyAlpha(1.0f-danim)); * danim *= 0.2f; * // CLReDraw.Circle(x+width/2, y-height/2, (height > width) ? (width * 0.4f) : (height * 0.4f), CLColourToColor(this.colour).MultiplyAlpha(0.2f-danim)); * } * }*/ //#endif } /* if (!this.added && !ignoreTapView) { * CLReDraw.View(this.tap, x, y, width, height); * this.added = true; * }*/ }