Beispiel #1
0
 private void CompositionTarget_Rendering2(object sender, EventArgs e)
 {
     if (PGstart.isStartGame)
     {
         if (frameConuts++ < 1)
         {
         }
         else
         {
             PGstart.ResetSizeStartButton();
             PageGameContent PGgamelogic = new PageGameContent();//这是进入游戏界面的前一帧,在这帧中实例化游戏逻辑,以至于进入游戏可以看到小人落下,假如在23行实例化,还没点进入游戏,小人就已经落下了
             PGgamelogic.gameoverpanel += PGgamelogic_gameoverpanel;
             frameConuts         = 0;
             PGstart.isStartGame = false;
             PGgamelogic.Focus();
             this.Content = PGgamelogic;
             CompositionTarget.Rendering -= CompositionTarget_Rendering2;
         }
     }
 }
Beispiel #2
0
 private void PGgamelogic_gameoverpanel(int seclectionIndex)
 {
     if (seclectionIndex == 1)//回到主页 PageStart
     {
         //MessageBox.Show("1");
         RunPageStart();
         CompositionTarget.Rendering += CompositionTarget_Rendering2;
     }
     if (seclectionIndex == 2)//重开游戏 PageGameContent
     {
         //MessageBox.Show("2");
         PGstart.ResetSizeStartButton();
         PageGameContent PGgamelogic = new PageGameContent();//这是进入游戏界面的前一帧,在这帧中实例化游戏逻辑,以至于进入游戏可以看到小人落下,假如在23行实例化,还没点进入游戏,小人就已经落下了
         PGgamelogic.gameoverpanel += PGgamelogic_gameoverpanel;
         frameConuts         = 0;
         PGstart.isStartGame = false;
         PGgamelogic.Focus();
         this.Content = PGgamelogic;
         CompositionTarget.Rendering -= CompositionTarget_Rendering2;
     }
 }