public Form1() { InitializeComponent(); Frame1.SendToBack(); Frame2.SendToBack(); Frame3.SendToBack(); Frame4.SendToBack(); Frame5.SendToBack(); Frame6.SendToBack(); Frame7.SendToBack(); Factions.SelectedItem = "Academy"; //DialogResult result; //string msg = (string)Factions.SelectedItem; //result = MessageBox.Show(msg); //Current_Haven(); Pop_Tier[0] = null; Pop_Tier[1] = this.Pop_Tier1; Pop_Tier[2] = this.Pop_Tier2; Pop_Tier[3] = this.Pop_Tier3; Pop_Tier[4] = this.Pop_Tier4; Pop_Tier[5] = this.Pop_Tier5; Pop_Tier[6] = this.Pop_Tier6; Pop_Tier[7] = this.Pop_Tier7; Gold_Tier[0] = null; Gold_Tier[1] = this.Gold_Tier1; Gold_Tier[2] = this.Gold_Tier2; Gold_Tier[3] = this.Gold_Tier3; Gold_Tier[4] = this.Gold_Tier4; Gold_Tier[5] = this.Gold_Tier5; Gold_Tier[6] = this.Gold_Tier6; Gold_Tier[7] = this.Gold_Tier7; }
private async void Frame3_Tapped(object sender, EventArgs e) { CheckCircle2.IsVisible = false; CheckCircle1.IsVisible = false; CheckCircle4.IsVisible = false; await Frame3.ScaleTo(0.85); CheckCircle3.IsVisible = true; await Frame3.ScaleTo(1); }
public async void Frame4Anim() { Frame4.TranslationY = Frame4.TranslationY + 200; Frame4.Opacity = 0.0; await Task.Delay(3700); Frame4.IsVisible = true; Frame4.FadeTo(1.0, 600); await Frame4.TranslateTo(Frame4.TranslationX, Frame4.TranslationY - 210, 180); Frame4.TranslateTo(Frame4.TranslationX, Frame4.TranslationY + 10, 300); Frame3.TranslateTo(Frame3.TranslationX, Frame3.TranslationY - 15, 150); Frame3.RotateXTo(12.0, 150); await Task.Delay(150); Frame3.RotateXTo(0.0, 150); Frame3.TranslateTo(Frame3.TranslationX, Frame3.TranslationY + 15, 100); Frame2.TranslateTo(Frame2.TranslationX, Frame2.TranslationY - 15, 200); Frame2.RotateXTo(-12.0, 200); await Task.Delay(200); Frame2.RotateXTo(0.0, 200); Frame2.TranslateTo(Frame2.TranslationX, Frame2.TranslationY + 15, 150); Frame1.TranslateTo(Frame1.TranslationX, Frame1.TranslationY - 15, 220); Frame1.RotateXTo(17.0, 220); await Task.Delay(220); Frame1.RotateXTo(0.0, 220); Frame1.TranslateTo(Frame1.TranslationX, Frame1.TranslationY + 15, 170); Frame5.IsVisible = true; Frame5.Opacity = 0.0; await Frame5.FadeTo(1.0, 1500); Frame6.IsVisible = true; Frame6.Opacity = 0.0; await Frame6.FadeTo(1.0, 500); ButAnim = true; while (ButAnim) { await Frame6.ScaleTo(0.93, 100); await Frame6.ScaleTo(1.0, 100); await Task.Delay(1000); } //await Frame4.TranslateTo(Frame4.TranslationX, Frame4.TranslationY - 100, 600); }
public async void Frame3Anim() { Frame3.TranslationY = -200; Frame3.Opacity = 0.0; await Task.Delay(2200); Frame3.IsVisible = true; Frame3.FadeTo(1.0, 600); await Frame3.TranslateTo(Frame3.TranslationX, Frame3.TranslationY + 550, 300); await Frame3.TranslateTo(Frame3.TranslationX, Frame3.TranslationY - 250, 400); await Frame3.TranslateTo(Frame3.TranslationX, Frame3.TranslationY - 100, 470); }
private void btn_save_Click(object sender, EventArgs e) { var dlgResult = saveFileDialog1.ShowDialog(); if (dlgResult != DialogResult.OK) { return; } UseWaitCursor = true; var map = panel1.GetSeedMap(); int width = map.Length; int height = map[0].Length; var colorCount = new Dictionary <int, int>(); var solution = new Frame3(width, height); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { int argb = map[i][j]; var c = Color.FromArgb(argb); solution.SetPixelAt(i, j, 0, c.B); solution.SetPixelAt(i, j, 1, c.G); solution.SetPixelAt(i, j, 2, c.R); if (colorCount.ContainsKey(argb)) { colorCount[argb]++; } else { colorCount.Add(argb, 1); } } } var bmpSol = solution.GetBitmap(); string noEnding = System.IO.Path.ChangeExtension(saveFileDialog1.FileName, null); bmpSol.Save(noEnding + "_loesung.jpg"); bmpSol.Dispose(); solution = null; int background = 0; if (this.Background != null) { background = this.Background.Value; } else { background = colorCount.OrderByDescending((i) => i.Value).First().Key; } var rowHeader = new List <long> [height]; Action <List <long>, int, int> add = (lst, clr, cnt) => { long toAdd = (long)clr << 32; toAdd += cnt; lst.Add(toAdd); }; int count = 0; int color = 0; for (int i = 0; i < height; i++) { count = 0; bool counting = false; rowHeader[i] = new List <long>(); for (int j = 0; j < width; j++) { if (map[j][i] == background && counting) { counting = false; add(rowHeader[i], color, count); count = 0; } else if (map[j][i] != color && counting) { add(rowHeader[i], color, count); count = 1; color = map[j][i]; } else if (map[j][i] != background) { counting = true; color = map[j][i]; count++; } } if (counting) { add(rowHeader[i], color, count); } } var colHeader = new List <long> [width]; for (int i = 0; i < width; i++) { count = 0; bool counting = false; colHeader[i] = new List <long>(); for (int j = 0; j < height; j++) { if (map[i][j] == background && counting) { counting = false; add(colHeader[i], color, count); count = 0; } else if (map[i][j] != color && counting) { add(colHeader[i], color, count); count = 1; color = map[i][j]; } else if (map[i][j] != background) { counting = true; color = map[i][j]; count++; } } if (counting) { add(colHeader[i], color, count); } } int maxItemsRow = rowHeader.Max((i) => i.Count); int maxItemsCol = colHeader.Max((i) => i.Count); float rowHeadSize = maxItemsRow * 0.7f + 0.5f; float colHeadSize = maxItemsCol * 0.7f + 0.5f; int ppcm = 80; var bmp = new Bitmap((int)(rowHeadSize + 2.0f + width * 0.5f) * ppcm, (int)(colHeadSize + 2.0f + height * 0.5f) * ppcm); var font = new Font("Verdana", ppcm / 10.0f * 3.0f, FontStyle.Regular, GraphicsUnit.Pixel); using (Graphics g = Graphics.FromImage(bmp)) { g.Clear(Color.White); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; using (Pen pThin = new Pen(Color.Black, 0.02f * ppcm)) using (Pen pBig = new Pen(Color.Black, 0.07f * ppcm)) { for (int i = 0; i < width; i++) { for (int j = 0; j < colHeader[i].Count; j++) { long val = colHeader[i][colHeader[i].Count - 1 - j]; string text = (val & int.MaxValue).ToString(); var clr = Color.FromArgb((int)(val >> 32)); float offset = text.Length * 0.135f; using (Brush b = new SolidBrush(clr)) g.DrawString(text, font, b, new PointF(ppcm * (rowHeadSize + 1.3f + i * 0.5f - offset), ppcm * (0.45f + colHeadSize - 0.7f * j))); } var pen = pThin; if (i % 5 == 0) { pen = pBig; } g.DrawLine(pen, new PointF(ppcm * (rowHeadSize + 1.0f + i * 0.5f), ppcm), new PointF(ppcm * (rowHeadSize + 1.0f + i * 0.5f), (1 + colHeadSize + height * 0.5f) * ppcm)); } g.DrawLine(pBig, new PointF(ppcm * (rowHeadSize + width * 0.5f + 1), ppcm), new PointF(ppcm * (rowHeadSize + width * 0.5f + 1), (1 + colHeadSize + height * 0.5f) * ppcm)); for (int i = 0; i < height; i++) { for (int j = 0; j < rowHeader[i].Count; j++) { long val = rowHeader[i][rowHeader[i].Count - 1 - j]; string text = (val & int.MaxValue).ToString(); var clr = Color.FromArgb((int)(val >> 32)); float offset = text.Length * 0.175f; using (Brush b = new SolidBrush(clr)) g.DrawString(text, font, b, new PointF(ppcm * (0.65f + rowHeadSize - offset - j * 0.7f), ppcm * (colHeadSize + 1.075f + i * 0.5f))); } var pen = pThin; if (i % 5 == 0) { pen = pBig; } g.DrawLine(pen, new PointF(ppcm, ppcm * (colHeadSize + 1.0f + i * 0.5f)), new PointF(ppcm * (rowHeadSize + 1.0f + width * 0.5f), ppcm * (colHeadSize + 1.0f + i * 0.5f))); } g.DrawLine(pBig, new PointF(ppcm, ppcm * (colHeadSize + 1.0f + height * 0.5f)), new PointF(ppcm * (rowHeadSize + 1.0f + width * 0.5f), ppcm * (colHeadSize + 1.0f + height * 0.5f))); } } bmp.Save(saveFileDialog1.FileName); bmp.Dispose(); UseWaitCursor = false; }