Example #1
0
 public ListMenuOption(Point icon, string text, Point position, Scene menu)
 {
     this.gotoMenu = (Menu) menu;
     base.Init(icon, text, "LIST", position, 0x2b);
 }
Example #2
0
 public void ChangeScene(Scene newScene)
 {
     if (newScene is GameMap)
     {
         if (this.enableMusic && (this.currentSong != null))
         {
             this.currentSong.SetPaused(false);
         }
         this.game.CurrentMap = (GameMap) newScene;
     }
     if (this.curScene != null)
     {
         this.transScene = newScene;
         this.transProg = 0f;
         this.transState = TransState.FadingOut;
     }
     else
     {
         this.curScene = newScene;
         this.curScene.InitScene();
     }
 }
Example #3
0
 private void InitEngine()
 {
     this.game = new GameData();
     Game = this.game;
     Framework = this;
     this.textureCollection = new SortedDictionary<string, Texture>();
     this.textureDisposePolicies = new SortedDictionary<string, TextureDisposePolicy>();
     this.timer = new Stopwatch();
     this.InitRendering();
     this.updateFrameTime = Stopwatch.Frequency / ((long) this.updateFPS);
     this.renderFrameTime = Stopwatch.Frequency / ((long) this.renderFPS);
     this.InitInput();
     this.LoadConfig();
     this.InitSounds();
     this.game.InitGame();
     this.quitDialog = new QuitDialog();
     this.drawColor = Color.White;
     this.transState = TransState.Showing;
     this.running = true;
     this.gameWindow.Location = new Point(200, 200);
     this.gameWindow.Show();
 }
Example #4
0
 private void OnFrameMove()
 {
     this.BeforeUpdate();
     if (this.devicePresent)
     {
         if (this.switchFullScreen)
         {
             this.switchFullScreen = false;
             this.fullScreen = !this.fullScreen;
             this.InitRendering();
         }
         if (this.lockTimer > 0)
         {
             this.lockTimer--;
             if (this.lockTimer == 0)
             {
                 this.PlaySound(SoundEffects.OpenDoor);
             }
         }
         else if (this.KeyPressed(1))
         {
             if (this.curScene.ShowDialogOnExit)
             {
                 if (this.transState == TransState.Showing)
                 {
                     this.transState = TransState.Dialog;
                 }
             }
             else
             {
                 this.Quit();
             }
         }
         else
         {
             if (this.KeyDown(0x1d) && this.KeyPressed(0x21))
             {
                 this.ToggleFullscreen();
             }
             this.game.UpdateStatsBar();
             if (this.transState == TransState.Showing)
             {
                 if (this.enableMusic && (this.currentSong != null))
                 {
                     this.currentSong.Update();
                 }
                 this.curScene.Update(false);
             }
             else if (this.transState == TransState.FadingOut)
             {
                 if (this.enableMusic && (this.currentSong != null))
                 {
                     this.currentSong.Update();
                 }
                 this.transProg += 0.05f;
                 if (this.transProg < 1f)
                 {
                     int red = 0xff - ((int) (255f * this.transProg));
                     this.drawColor = Color.FromArgb(0xff, red, red, red);
                     this.curScene.SetFade(red);
                 }
                 else
                 {
                     if ((this.transScene is GameMap) && (this.curScene is GameMap))
                     {
                         GameMap curScene = (GameMap) this.curScene;
                         GameMap transScene = (GameMap) this.transScene;
                         if (!curScene.TextureFilename.Equals(transScene.TextureFilename))
                         {
                             this.DisposeTextures(TextureDisposePolicy.DisposeOnTileChange);
                         }
                         else
                         {
                             this.DisposeTextures(TextureDisposePolicy.DisposeOnTileChange);
                         }
                     }
                     PointF playerEntry = Game.GetPlayerStats().PlayerEntry;
                     if (playerEntry.X > 0f)
                     {
                         Game.GetPlayer().Location = new PointF(playerEntry.X, playerEntry.Y);
                         Game.GetPlayerStats().PlayerEntry = new PointF(0f, 0f);
                     }
                     this.transScene.InitScene();
                     this.transScene.SetFade(0);
                     this.transState = TransState.FadingIn;
                     this.transProg = 0f;
                     this.curScene = this.transScene;
                     this.transScene = null;
                 }
             }
             else if (this.transState == TransState.FadingIn)
             {
                 if (this.enableMusic && (this.currentSong != null))
                 {
                     this.currentSong.Update();
                 }
                 this.transProg += 0.05f;
                 if (this.transProg < 1f)
                 {
                     int num2 = (int) (255f * this.transProg);
                     this.drawColor = Color.FromArgb(0xff, num2, num2, num2);
                     this.curScene.SetFade(num2);
                 }
                 else
                 {
                     this.transState = TransState.Showing;
                     this.transProg = 0f;
                     this.drawColor = Color.White;
                     this.curScene.SetFade(-1);
                 }
             }
             else if (this.transState == TransState.Dialog)
             {
                 if (this.currentSong != null)
                 {
                     this.currentSong.SetPaused(true);
                 }
                 this.quitDialog.Update(false);
             }
         }
     }
 }