//破關回寫資料庫關卡資訊 public void setP(int p, int timer) { DBHandler tDBHandler = new DBHandler(DBHandler.DBConnection); if (getP() == p) { var tContacts = from Contacts in tDBHandler.Contacts where Contacts.ERI == "SYSTEM" select Contacts; Contacts tSpecContact = tContacts.First(); tSpecContact.LVNO = p + 1; }//判斷資料庫關卡是否要+1 //將此場關卡及秒數存進資料庫 Contacts2 AAA = new Contacts2(); AAA.LVNO = p; AAA.Timer = timer; AAA.T = 1; tDBHandler.Contacts2.InsertOnSubmit(AAA); tDBHandler.SubmitChanges(); }
public int fast(int LVNO) { DBHandler tDBHandler = new DBHandler(DBHandler.DBConnection); var tContacts2 = from Contacts2 in tDBHandler.Contacts2 where Contacts2.LVNO == LVNO && Contacts2.T == 1 orderby Contacts2.Timer ascending select Contacts2; Contacts2 AAA = tContacts2.First(); return(AAA.Timer); }
public mytimer(int Lv) { DBHandler tDBHandler = new DBHandler(DBHandler.DBConnection); var tContacts = from Contacts in tDBHandler.Contacts where Contacts.ERI == "SYSTEM" select Contacts; Contacts AAA = tContacts.First(); if (AAA.LVNO == Lv) { var tContacts2 = from Contacts2 in tDBHandler.Contacts2 where Contacts2.LVNO == Lv && Contacts2.T == 0 orderby Contacts2.Timer descending select Contacts2; int i = 0; foreach (Contacts2 t in tContacts2) { i++; } if (i > 0) { Contacts2 BBB = tContacts2.First(); setN(BBB.Timer); } else { setN(0); } } else { setN(0); } }
public bool getLVsum(int S, int E, int total) { int t = 0; for (int i = S; i <= E; i++) { var tContacts2 = from Contacts2 in tDBHandler.Contacts2 where Contacts2.LVNO == i && Contacts2.T == 1 orderby Contacts2.Timer ascending select Contacts2; int j = 0; foreach (Contacts2 V in tContacts2) { j++; } if (j != 0) { Contacts2 temp = tContacts2.First(); t += temp.Timer; } else { return(false); } } //------------------------------------------- if (t <= total) { return(true); } return(false); }
public void saveTimer(int LVNO) { //當此關卡未被破時,任何離開遊戲的形為 就將該saveTimer存起來 DBHandler tDBHandler = new DBHandler(DBHandler.DBConnection); var tContacts = from Contacts in tDBHandler.Contacts where Contacts.ERI == "SYSTEM" select Contacts; Contacts AAA = tContacts.First(); if (AAA.LVNO == LVNO) { Contacts2 BBB = new Contacts2(); BBB.LVNO = LVNO; BBB.Timer = N; BBB.T = 0; tDBHandler.Contacts2.InsertOnSubmit(BBB); } tDBHandler.SubmitChanges(); }