//破關回寫資料庫關卡資訊 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 void updateBefore() { //當系統更新後...要做哪些事情 DBHandler tDBHandler = new DBHandler(DBHandler.DBConnection); var tContacts = from Contacts in tDBHandler.Contacts where Contacts.ERI == "SYSTEM" select Contacts; Contacts tSpecContact = tContacts.First(); tSpecContact.SIZE = chked; tDBHandler.SubmitChanges(); }
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(); }
/// <summary> /// 允許遊戲先執行所需的初始化程序,再開始執行。 /// 這是遊戲可查詢必要服務和載入任何非圖形相關內容 /// 的地方。呼叫 base.Initialize 會列舉所有元件 /// 並予以初始化。 /// </summary> protected override void Initialize() { // TODO: 在此新增初始化邏輯 //建立遊戲資料庫************************** DBHandler tDBHandler = new DBHandler(DBHandler.DBConnection); if (tDBHandler.DatabaseExists() == false) { tDBHandler.CreateDatabase(); Contacts tNewContact1 = new Contacts(); tNewContact1.ERI = "SYSTEM"; tNewContact1.LVNO = 1; //可用關卡 預設為1 tNewContact1.SIZE = 0; //球體大小 tNewContact1.SORT = 0; //球體款式 List <Contacts> tAllConact = new List <Contacts>(); tAllConact.Add(tNewContact1); tDBHandler.Contacts.InsertAllOnSubmit(tAllConact); //----------------------------------------- tDBHandler.SubmitChanges(); } else { //刪除多餘的資料 //先刪除舊資料 var tContacts = from Contacts in tDBHandler.Contacts where Contacts.ERI == "SYSTEM" select Contacts; Contacts DATA = tContacts.First(); var deleteOrderDetails = from Contacts2 in tDBHandler.Contacts2 where Contacts2.T == 0 & Contacts2.LVNO < DATA.LVNO select Contacts2; foreach (var detail in deleteOrderDetails) { tDBHandler.Contacts2.DeleteOnSubmit(detail); } tDBHandler.SubmitChanges(); } picBG = Content.Load <Texture2D>("bg"); picINFO = Content.Load <Texture2D>("INFO"); picSize = Content.Load <Texture2D>("size"); picSort = Content.Load <Texture2D>("sort"); picA25 = Content.Load <Texture2D>("ballA1"); picA20 = Content.Load <Texture2D>("ballA2"); picA15 = Content.Load <Texture2D>("ballA3"); picB25 = Content.Load <Texture2D>("ballB1"); picB20 = Content.Load <Texture2D>("ballB2"); picB15 = Content.Load <Texture2D>("ballB3"); picC25 = Content.Load <Texture2D>("ballC1"); picC20 = Content.Load <Texture2D>("ballC2"); picC15 = Content.Load <Texture2D>("ballC3"); picZ1 = Content.Load <Texture2D>("t1"); picZ2 = Content.Load <Texture2D>("MONSTER1"); //T2 picZ3 = Content.Load <Texture2D>("t3"); //T3 picP1 = Content.Load <Texture2D>("pass"); picBar = Content.Load <Texture2D>("Bar"); picStart = Content.Load <Texture2D>("start"); picExit = Content.Load <Texture2D>("exit"); picBoard = Content.Load <Texture2D>("board"); picChangeBall = Content.Load <Texture2D>("ChangeBall"); picChangeBall2 = Content.Load <Texture2D>("ChangeBall2"); picTimerIcon2 = Content.Load <Texture2D>("num-1"); picTimerIcon = Content.Load <Texture2D>("num"); picS1 = Content.Load <Texture2D>("board1"); picS2 = Content.Load <Texture2D>("board2"); for (int i = 0; i < picTimer.Length; i++) { picTimer[i] = Content.Load <Texture2D>("num" + i.ToString()); } picballsort = Content.Load <Texture2D>("ballsort"); picballsortA1 = Content.Load <Texture2D>("ballsortA1"); picballsortA0 = Content.Load <Texture2D>("ballsortA0"); picballsortB1 = Content.Load <Texture2D>("ballsortB1"); picballsortB0 = Content.Load <Texture2D>("ballsortB0"); picballsortC0 = Content.Load <Texture2D>("ballsortC0"); picballsortC1 = Content.Load <Texture2D>("ballsortC1"); picballsort250 = Content.Load <Texture2D>("ballsort250"); picballsort251 = Content.Load <Texture2D>("ballsort251"); picballsort200 = Content.Load <Texture2D>("ballsort200"); picballsort201 = Content.Load <Texture2D>("ballsort201"); picballsort150 = Content.Load <Texture2D>("ballsort150"); picballsort151 = Content.Load <Texture2D>("ballsort151"); //破關畫面圖片 picL = Content.Load <Texture2D>("L"); picL1 = Content.Load <Texture2D>("L1"); picL2 = Content.Load <Texture2D>("L2"); picL3 = Content.Load <Texture2D>("L3"); setPicGameLv();//匯入關卡圖片初始化 menu = new menu(); base.Initialize(); }