Exemple #1
0
 void Events_Quit(object sender, QuitEventArgs e)
 {
     MeleeMusic.Close();
     MeleeSound.Close();
     Events.QuitApplication();
     Application.Exit();
 }
        void DelayedAddShip(object oship)
        {
            IShip oldShip = (IShip)oship;

            Thread.Sleep(VictorySongWait);
            ShipSounds Victor = null;

            if (Array.IndexOf <string>(SuicideShipNames, oldShip.GetType().Name) != -1)
            {
                Victor = oldShip.ShipSounds;
            }
            foreach (IShip ship in GetShips())
            {
                if (!ship.IsExpired)
                {
                    if ((ship.FactionInfo.FactionCollection.GetDiplomacy(ship.FactionInfo, oldShip.FactionInfo) & FactionDiplomacy.Enemy) == FactionDiplomacy.Enemy)
                    {
                        Victor = ship.ShipSounds;
                        break;
                    }
                }
            }
            if (Victor != null)
            {
                Victor.Victory.Play();
            }
            Thread.Sleep(DeathWait - VictorySongWait);
            lock (world)
            {
                ReMasterSDL.physicsTimer.Enabled = false;

                lock (syncroot)
                {
                    GameResult gameResult = new GameResult();
                    IShip      newShip    = GetNewShip(oldShip.FactionInfo);
                    //IShip newShip2 = (IShip)newShip.Clone();
                    newShip.AddControler(null, oldShip.Controlers[0]);
                    if (oldShip.Controlers.Length > 1)
                    {
                        newShip.AddControler(null, oldShip.Controlers[1]);
                    }
                    AddShip(gameResult, newShip, oldShip.FactionInfo);
                    world.HandleActionEvents(gameResult);
                }
            }
            BindWorld(CamerasLastPosition);

            MeleeMusic.PlayDefault();
            Thread.Sleep(AfterChoiceWait);
            ReMasterSDL.physicsTimer.Enabled = true;
        }
Exemple #3
0
        /// <summary>
        /// Initializes methods common to all NeHe lessons
        /// </summary>
        protected void Initialize(BaseDisplayDemo demo)
        {
#if Release
            try
            {
#endif
            //Mixer.Open(22050, AudioFormat.Default, 2, 2048);



            // Sets keyboard events
            // Sets the ticker to update OpenGL Context
            Events.Tick += new TickEventHandler(this.Tick);
            // Sets the resize window event
            Events.VideoResize += new VideoResizeEventHandler(Events_VideoResize);
            Events.Quit        += new QuitEventHandler(Events_Quit);
            // Set the Frames per second.
            Events.Fps = 60;
            targetDT   = (float)1 / (float)Events.Fps;
            // Creates SDL.NET Surface to hold an OpenGL scene
            //screen = Video.SetVideoModeWindowOpenGL(width, height, true);
            //Environment.
            //screen = Video.SetVideoModeOpenGL(width, height, 16);
            screen = Video.SetVideoModeWindowOpenGL(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / 2, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height / 2, true);

            //Video.WindowIcon();
            // Video.
            //Video.SetVideoModeWindowOpenGL(Video.Screen.Width,Video.Screen.Height,true);
            //Tao.Sdl.Sdl.SDL_WM_IconifyWindow();


            // Sets Window icon and title
            this.WindowAttributes();

            MeleeMusic.PlayDefault();
            this.demo    = demo;
            physicsTimer = new PhysicsTimer(Update2, 1 / (float)Events.Fps, 3);
            physicsTimer.Start(false);

#if Release
        }
        catch (Exception ex)
        {
            ErrorBox.DisplayError(ex);
            throw;
        }
#endif
        }
 public ShipSounds(string VictoryName)
 {
     this.Victory = new MeleeMusic(VictoryName);
 }
 public ShipSounds()
 {
     this.Victory = new MeleeMusic();
 }