Exemplo n.º 1
0
        public static void  DelRecord()
        {
            DBHandler tDBHandler = new DBHandler(DBHandler.DBConnection);

            var tContacts = from Contacts in tDBHandler.Contacts
                            where Contacts.CNAME == "HERO"
                            select Contacts;

            Contacts A = tContacts.First();

            A.XML = null;
            tDBHandler.SubmitChanges();
        }
Exemplo n.º 2
0
        public void AddSCORE()
        {
            //腳色死亡 將分數寫回資料庫

            DBHandler tDBHandler = new DBHandler(DBHandler.DBConnection);

            Contacts_Score DATA = new Contacts_Score();

            DATA.Lv       = GamePage.HERO_LV;
            DATA.Score    = GamePage.HERO_SCORE2;
            DATA.Datetime = DateTime.Now;

            tDBHandler.Contacts_Score.InsertOnSubmit(DATA);
            tDBHandler.SubmitChanges();
        }
Exemplo n.º 3
0
        public MainPage()
        {
            TARY_Library_Silverlight.ProdKey.Register(101);//產品序號


            InitializeComponent();
            tDBHandler = new DBHandler(DBHandler.DBConnection);
            if (tDBHandler.DatabaseExists() == false)
            {
                tDBHandler.CreateDatabase();

                Contacts A = new Contacts();
                A.CNAME = "HERO";
                A.XML   = null;
                tDBHandler.Contacts.InsertOnSubmit(A);
                tDBHandler.SubmitChanges();
            }

            isload();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 允許頁面執行邏輯,例如更新環境、
        /// 檢查衝突、收集輸入和播放音訊。
        /// </summary>
        private void OnUpdate(object sender, GameTimerEventArgs e)
        {
            touchState = TouchPanel.GetState();

            // TODO: 在此處加入更新邏輯

            if (LOCAL == "遊戲")
            {
                if (PANEL_STOP.Visibility == System.Windows.Visibility.Visible)
                {
                    PANEL_STOP.Visibility = System.Windows.Visibility.Collapsed;
                }


                if (PANEL_MENU.Visibility == System.Windows.Visibility.Visible)
                {
                    PANEL_MENU.Visibility = System.Windows.Visibility.Collapsed;
                }

                if (R_LV == null)
                {
                    R_LV = new LV(HERO_LV);
                }


                R_LV.update();         //關卡怪物
                R_HERO.update();       //畫英雄
                R_MFired.update();     //怪物攻擊球
                R_BAR.update();
                R_MonsterThg.update(); //寶物
                R_BG.update();         //背景
            }
            else if (LOCAL == "遊戲暫停")
            {
                if (PANEL_MENU.Visibility == System.Windows.Visibility.Visible)
                {
                    PANEL_MENU.Visibility = System.Windows.Visibility.Collapsed;
                }

                if (PANEL_STOP.Visibility == System.Windows.Visibility.Collapsed)
                {
                    PANEL_STOP.Visibility = System.Windows.Visibility.Visible;
                }
            }
            else if (LOCAL == "選單")
            {
                if (PANEL_STOP.Visibility == System.Windows.Visibility.Visible)
                {
                    PANEL_STOP.Visibility = System.Windows.Visibility.Collapsed;
                }


                if (PANEL_MENU.Visibility == System.Windows.Visibility.Collapsed)
                {
                    PANEL_MENU.Visibility = System.Windows.Visibility.Visible;
                }

                if (tR_MENU)
                {
                    R_MENU.Update();//重新撈取 英雄資料
                    tR_MENU = false;
                }

                MENU_UPDATE();//不斷一直抓取資料
            }
            else if (LOCAL == "死亡")
            {
                R_MENU_DEAD.update();
            }
            else if (LOCAL == "離開遊戲")
            {
                myHERO SaveGame = new myHERO();
                SaveGame.Save();    //將所有要存檔的資料彙整
                MemoryStream ms = new MemoryStream();
                Serialize(ms, SaveGame);
                ms.Position = 0;
                ms.Close();


                byte[] by = ms.ToArray();


                //-------------------------------
                DBHandler tDBHandler = new DBHandler(DBHandler.DBConnection);


                var tContacts = from Contacts in tDBHandler.Contacts
                                where Contacts.CNAME == "HERO"
                                select Contacts;

                Contacts A = tContacts.First();
                A.XML = by;
                tDBHandler.SubmitChanges();

                GamePage.R_BAR.PowerLv = 0;//將英雄能源清除


                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            }
            else if (LOCAL == "死亡離開遊戲")
            {
                GamePage.R_BAR.PowerLv = 0;//將英雄能源清除
                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            }
            else if (LOCAL == "破關")
            {
                R_GAME_END.update();
            }
            else if (LOCAL == "新遊戲")
            {
                if (PANEL_NEWGAME.Visibility == System.Windows.Visibility.Collapsed)
                {
                    PANEL_NEWGAME.Visibility = System.Windows.Visibility.Visible;
                }



                if (PANEL_STOP.Visibility == System.Windows.Visibility.Visible)
                {
                    PANEL_STOP.Visibility = System.Windows.Visibility.Collapsed;
                }


                if (PANEL_MENU.Visibility == System.Windows.Visibility.Visible)
                {
                    PANEL_MENU.Visibility = System.Windows.Visibility.Collapsed;
                }
            }
        }