Esempio n. 1
0
        public override void Update(GameTime gameTime)
        {
            if (this.shutdownBgSlider != null)
            {
                this.position.Y = this.shutdownBgSlider.Position;
                this.closeOk.SetPosition((int)this.closeOk.GetPosition().X, (int)this.shutdownBgSlider.Position + 45);
                this.closeNo.SetPosition((int)this.closeNo.GetPosition().X, (int)this.shutdownBgSlider.Position + 45);
                this.shutdownBgSlider.Update(gameTime);
                this.darkenAlpha.Update(gameTime);
            }

            ////slides the shutdown window in if the user hits escape
            if (Keyboard.GetState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape) && !this.IsBlocking())
            {
                this.shutdownBgSlider = new Slide(this.position.Y, 455, 0.5f);
                this.darkenAlpha = new Slide(0, 255, 0.5f);
                this.SetBlocking(true);
            }

            if (this.CheckMouseClick())
            {
                ////checks all available buttons
                foreach (Button button in this.shutdownControlButtons) 
                { 
                    button.CheckForCollision(); 
                }
            }

            base.Update(gameTime);
        }
Esempio n. 2
0
 public override void Hide()
 {
     this.shutdownBgSlider = new Slide(this.position.Y, -200, 0.5f);
     this.darkenAlpha = new Slide(255, 0, 0.5f);
     this.SetBlocking(false);
 }
Esempio n. 3
0
 public override void Show()
 {
     this.shutdownBgSlider = new Slide(this.position.Y, 455, 0.5f);
     this.darkenAlpha = new Slide(0, 255, 0.5f);
     this.SetBlocking(true);
 }
Esempio n. 4
0
 public override void Hide()
 {
     this.setupBgSlider = new Slide(this.position.Y, -700, 0.5f);
     this.SetBlocking(false);
     Settings.Write();
 } 
Esempio n. 5
0
 public override void Show()
 {
     this.setupBgSlider = new Slide(this.position.Y, 258, 0.5f);
     this.SetBlocking(true);
 }
Esempio n. 6
0
        protected override void Update(GameTime gameTime)
        {
            //// update the mouse position
            this.mousePosition = this.UpdateMouse();

            this.blocked = this.CheckBlocking();
           
            ////slide down the button on the top left
            if (this.mousePosition.X <= 247 && this.mousePosition.Y <= 50 && this.CheckMouseClick() && !this.blocked)
            {
                this.additionalBgSlider = new Slide(this.additionalBgPos.Y, 0, 0.5f);
                this.slided = true;
            }
            ////slide them up if the mouse is no longer over them
            if (this.slided == true && (this.mousePosition.X > 201 || this.mousePosition.Y > 540))
            {
                this.additionalBgSlider = new Slide(this.additionalBgPos.Y, -492, 0.5f);
                this.slided = false;
            }
            ////slide the menu
            if (this.additionalBgSlider != null)
            {
                this.additionalBgPos.Y = this.additionalBgSlider.Position;
                this.close.SetPosition((int)this.close.GetPosition().X, (int)this.additionalBgSlider.Position - 20);
                this.file.SetPosition((int)this.file.GetPosition().X, (int)this.additionalBgSlider.Position + 150);
                this.setup.SetPosition((int)this.file.GetPosition().X, (int)this.additionalBgSlider.Position + 320);
                this.additionalBgSlider.Update(gameTime);
            }

            if (this.jmpToZeroSlider != null)
            {
                this.tempoSlider.SetPosition((int)this.tempoSlider.GetPosition().X, (int)this.jmpToZeroSlider.Position);
                this.jmpToZeroSlider.Update(gameTime);
                if (this.jmpToZeroSlider.Position == 450)
                {
                    this.jmpToZeroSlider = null;
                }
            }

            ////check if mouse was clicked
            if (this.CheckMouseClick())
            {
                if (!this.blocked)
                {
                    ////checks all available buttons
                    foreach (Button button in this.guiButtons) 
                    { 
                        button.CheckForCollision(); 
                    }

                    //// Check if mouse is inside texture area
                    if (this.OnMouseOver() && !this.state.Scratch && !this.slided)
                    {
                        ////pause the stream
                        this.state.Paused = true;
                        ////get and set the new position
                        long pos = this.wf.GetBytePositionFromX(this.realCurrentX[this.currentFrame], this.framePos, -1, -1);
                        Bass.BASS_ChannelSetPosition(this.streamTempo, pos);
                        if (this.currentFrame > this.loopOutFrame || this.currentFrame < this.loopInFrame && this.loopOut != -1)
                        {
                            this.ResetLoopOut();
                        }
                    }
                    else if (this.FrameOnMouseOver() && !this.state.Scratch && !this.slided)
                    {
                        ////normally I would also use a collision detection for alpha values but sometimes a waveform 
                        ////is too small specially when there is no sound at a certain point
                        ////so we skip that alpha check
                        this.state.Paused = true;

                        ////set the new frame
                        this.currentFrame = this.selectedFrame;
                        long pos = this.wf.GetBytePositionFromX(this.realCurrentX[this.selectedFrame], this.framePos, -1, -1);
                        Bass.BASS_ChannelSetPosition(this.streamTempo, pos);
                        if (this.currentFrame > this.loopOutFrame || this.currentFrame < this.loopInFrame && this.loopOut != -1)
                        {
                            this.ResetLoopOut();
                        } 
                    }
                }
            }
            else
            {
                ////set back the frequency
                if (this.info != null)
                {
                    this.currentFreq = this.info.freq;
                }

                this.state.Paused = false;
                ////set back the button is clicked var
                this.isAllreadyClicked = false;
                this.plateAngleHelper = 0;
                this.firstContact = true;
                this.showTempo = false;
            }

            if (this.currentFrame >= this.loopOutFrame && this.loopOutFrame > this.loopInFrame && this.loopOut != -1 && !this.isAllreadyClicked)
            {
                Bass.BASS_ChannelSetPosition(this.streamTempo, Bass.BASS_ChannelBytes2Seconds(this.streamTempo, this.loopIn));
            }

            if (this.state.Scratch && this.plateAngleHelper == 0 && this.state.Play)
            {
                if (this.state.Reverse == false)
                {
                    this.scratchAngle += 0.01f + (this.tempo / 10000);
                }
                else
                {
                    this.scratchAngle -= 0.01f + (this.tempo / 10000);
                }
            }

           
            this.newMousePosition = this.UpdateMouse();
            base.Update(gameTime);
        }
Esempio n. 7
0
 private void JmpToZeroAction(object sender, EventArgs e)
 {
     if (this.tempoSlider.GetPosition().Y != 450)
     {
         ////tempoSlider.SetPosition((int)this.tempoSlider.GetPosition().X, 450);
         this.jmpToZeroSlider = new Slide(this.tempoSlider.GetPosition().Y, 450, 0.5f);
         this.tempo = 0;
         this.jmpToZero.ChangeTex(false);
     }
 }