public void opensqrs(sqrs s) { if (s.openin || s.flagin || s.surein) return; if (s.minein) { this.endall(); s.sqrsstyle("minebomb"); int num = (int)MessageBox.Show("爆炸拉!"); } else if (s.numis > 0) s.sqrsstyle("opennum"); else if (s.numis == 0) { s.sqrsstyle("openspace"); this.openspot(s.Y - 1, s.X - 1); this.openspot(s.Y - 1, s.X); this.openspot(s.Y - 1, s.X + 1); this.openspot(s.Y, s.X - 1); this.openspot(s.Y, s.X + 1); this.openspot(s.Y + 1, s.X - 1); this.openspot(s.Y + 1, s.X); this.openspot(s.Y + 1, s.X + 1); } }
private void viewsqrs() { sqrs sqrs1 = new sqrs(); this.sqrsarray = new sqrs[this.conty, this.contx]; if (this.contx < 20 || this.conty < 10) { this.Width = (double)(this.contx * 60); this.Height = (double)(this.conty * 60 + 22); } else { this.Width = (double)(this.contx * 40); this.Height = (double)(this.conty * 40 + 22); } this.ugbox01.Rows = this.conty; for (int index1 = 0; index1 < this.conty; ++index1) { for (int index2 = 0; index2 < this.contx; ++index2) { sqrs sqrs2 = new sqrs(); sqrs2.X = index2; sqrs2.Y = index1; sqrs2.sqrsstyle("unopen"); sqrs2.Focusable = false; this.sqrsarray[index1, index2] = sqrs2; this.ugbox01.Children.Add((UIElement)sqrs2); } } }