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.SORT = chked; tDBHandler.SubmitChanges(); }
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 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(); }
Texture2D setBall() { DBHandler tDBHandler = new DBHandler(DBHandler.DBConnection); var tContacts = from Contacts in tDBHandler.Contacts where Contacts.ERI == "SYSTEM" select Contacts; Contacts DATA = tContacts.First(); SORT = DATA.SORT;//球的煞車及緩速功能 //普通---------------------------- if (DATA.SIZE == 0 && DATA.SORT == 0) { return(Game1.picA25); } if (DATA.SIZE == 1 && DATA.SORT == 0) { return(Game1.picA20); } if (DATA.SIZE == 2 && DATA.SORT == 0) { return(Game1.picA15); } //緩速---------------------------- if (DATA.SIZE == 0 && DATA.SORT == 1) { return(Game1.picB25); } if (DATA.SIZE == 1 && DATA.SORT == 1) { return(Game1.picB20); } if (DATA.SIZE == 2 && DATA.SORT == 1) { return(Game1.picB15); } //煞車---------------------------- if (DATA.SIZE == 0 && DATA.SORT == 2) { return(Game1.picC25); } if (DATA.SIZE == 1 && DATA.SORT == 2) { return(Game1.picC20); } if (DATA.SIZE == 2 && DATA.SORT == 2) { return(Game1.picC15); } return(Game1.picA25); }
/// <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(); }