private void Form1_Load(object sender, EventArgs e) { background = new PictureBox(); this.Focus(); background.Location = new System.Drawing.Point(0, 40); background.Size = new System.Drawing.Size(278, 278); background.Name = "bk"; background.TabIndex = 0; background.TabStop = false; background.BackgroundImage = global::_2048_Game.Properties.Resources.background; this.Controls.Add(background); scores.Text = "0"; UpDate.Start(); if (GameOwer.Visible) { Form1_Load(sender, e); } GameOwer.Visible = false; foreach (PictureBox i in picture_matrix) { this.Controls.Remove(i); } num_matrix = new int[4, 4]; picture_matrix = new List <PictureBox>(); SpawnNumbers(); SpawnNumbers(); }
public void IFGameOwer() { bool tr = false; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (num_matrix[i, j] == 0) { tr = true; } } } if (!tr) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { try { if (num_matrix[i, j] == num_matrix[i, j + 1] || num_matrix[i, j] == num_matrix[i + 1, j]) { tr = true; } } catch { } } } if (!tr) { foreach (PictureBox i in picture_matrix) { this.Controls.Remove(i); } UpDate.Stop(); this.Controls.Remove(background); GameOwer.BringToFront(); GameOwer.Visible = true; Lids ld = new Lids(scores.Text); ld.Show(); } } }
private void start_Click_1(object sender, EventArgs e) { scores.Text = "0"; UpDate.Start(); if (GameOwer.Visible) { Form1_Load(sender, e); } GameOwer.Visible = false; foreach (PictureBox i in picture_matrix) { this.Controls.Remove(i); } num_matrix = new int[4, 4]; picture_matrix = new List <PictureBox>(); SpawnNumbers(); SpawnNumbers(); }
public void IFGameOwer() // funcja zostaje wywolana kiedy liczba punktow jest 2048 lub kiedy nie ma miejsca no nowe klocki { bool tr = false; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (num_matrix[i, j] == 0) { tr = true; } } } if (!tr) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { try { if (num_matrix[i, j] == num_matrix[i, j + 1] || num_matrix[i, j] == num_matrix[i + 1, j]) { tr = true; } } catch { } } } if (!tr) { foreach (PictureBox i in picture_matrix) { this.Controls.Remove(i); } UpDate.Stop(); this.Controls.Remove(background); GameOwer.BringToFront(); GameOwer.Visible = true; } } }
/// <summary> /// 解压部署文件 /// </summary> public void Version_FileUpdate() { if (!EX_Admin.Power("version", "版本管理")) { AjaxNoPower(); return; } int id = RequestTool.RequestInt("id"); int IsUpdated = RequestTool.RequestInt("IsUpdated", 0); Lebi_Version model = B_Lebi_Version.GetModel(id); if (model == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (!Shop.LebiAPI.Service.Instanse.ISRightVersion(SYS, model)) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } //if (IsUpdated == 0) //{ if (model.Path_rar != "") { //文件解包+部署文件 string nistring = HtmlEngine.ReadTxt("/config/noupdate.txt"); UpDate.DecompressFile(model.Path_rar, "/", nistring); //执行更新程序 try { string url = "http://" + HttpContext.Current.Request.Url.Authority + "/update/update.aspx"; string res = HtmlEngine.CetHtml(url); if (res.Contains("OK")) { string ServerPath = System.Web.HttpContext.Current.Server.MapPath("~/"); string fileUrl = ServerPath + "/update/update.aspx"; if (File.Exists(fileUrl)) { File.Delete(fileUrl); } //fileUrl = ServerPath + "/update.aspx.cs"; //if (File.Exists(fileUrl)) //{ // File.Delete(fileUrl); //} } } catch { } //执行sql string sqlfile = WebPath + "/update/update.sql"; if (LB.DataAccess.DB.BaseUtilsInstance.DBType == "access") { sqlfile = WebPath + "/update/update_access.sql"; } //string sql = HtmlEngine.ReadTxt(sqlfile); //if (sql != null) //{ // if (sql != "") // Common.ExecuteSql(sql); //} string fileName = HttpContext.Current.Server.MapPath(@"~/" + sqlfile); if (File.Exists(fileName)) { using (FileStream fs = new FileStream(fileName, FileMode.Open)) { using (StreamReader reader = new StreamReader(fs, Encoding.UTF8)) { string text = string.Empty; while (!reader.EndOfStream) { try { text = reader.ReadLine(); if (text != "") { Common.ExecuteSql(text); } } catch { } } } } } } //} //if (model.IsTypeUpdate == 1) //{ // //更新type表 // Thread thread = new Thread(new ThreadStart(Shop.LebiAPI.Service.Instanse.UpdateType)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsDBStructUpdate == 1) //{ // //更新数据库结构 // Thread thread = new Thread(new ThreadStart(Shop.LebiAPI.Service.Instanse.UpdateDBBody)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsSystemMenuUpdate == 1) //{ // //更新系统菜单 // Thread thread = new Thread(new ThreadStart(Shop.LebiAPI.Service.Instanse.UpdateMenu)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsThemePageUpdate == 1) //{ // //更新系统页面 // Thread thread = new Thread(new ThreadStart(Shop.LebiAPI.Service.Instanse.UpdateThemePage)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsNodeUpdate == 1) //{ // //更新系统结点 // Thread thread = new Thread(new ThreadStart(Shop.LebiAPI.Service.Instanse.UpdateNode)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsSystemPageUpdate == 1) //{ // //更新系统页面 // Thread thread = new Thread(new ThreadStart(SystemTheme.CreateSystemPage)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsPageUpdate == 1) //{ // //更新所有前台页面 // Thread thread = new Thread(new ThreadStart(Shop.Bussiness.Theme.CreateThemeALL)); // thread.IsBackground = true; // thread.Start(); //} //更新版本号 BaseConfig cf = new BaseConfig(); cf.Version_Son = model.Version_Son.ToString(); cf.Version = model.Version.ToString(); B_BaseConfig bcf = new B_BaseConfig(); bcf.SaveConfig(cf); model.IsUpdate = 1; model.Time_Update = System.DateTime.Now; B_Lebi_Version.Update(model); //同步版本号 Shop.LebiAPI.Service.Instanse.UpdateVersionCode(); Response.Write("{\"msg\":\"OK\"}"); }