コード例 #1
0
ファイル: Game1.cs プロジェクト: ruizz/PangTank
        // Resets the starting values
        private void ResetValues()
        {
            funnel.Reset();
            nozzle.Reset();
            water.Reset();
            tank.Reset();

            // Set some starting values.
            seconds          = 0.0f;
            totalDropsCaught = 0;
            levelDropsCaught = 0;
            currentLevel     = 1;
            gameState        = 0;

            // -- CHANGE ANY DEFAULT STARTING VALUES HERE --
            waterInterval        = 2.0f;
            levelDropRequirement = 5;
            speedMultiplier      = 1.4f;

            startingAnimation.Reset();
            endingAnimation.Reset();
            FadeInAnimation.Reset();
            LevelChangeAnimation.Reset();
            MediaPlayer.Play(titleMusic);
        }
コード例 #2
0
ファイル: NavigationPage.xaml.cs プロジェクト: rubit0/Slate
        private async Task SetupMap()
        {
            MapControlls.Opacity = 0;
            Map.Opacity          = 0;
            Map.ZoomLevel        = 16;
            Map.MapServiceToken  =
                "UOBcq7qYTGSBYjpdwGvJ~ZoDecyJEsIhjGowIczjaTg~AmjcaSnBVS38715lpzn_KgdYiQf1AZ5KG-mLQHi0QWfPcl0xmo9WftqZ4fZtVUyO";
            Map.StyleSheet         = MapStyleSheet.RoadDark();
            Map.TrafficFlowVisible = false;

            switch (await Geolocator.RequestAccessAsync())
            {
            case GeolocationAccessStatus.Unspecified:
                break;

            case GeolocationAccessStatus.Allowed:
                _geolocator.DesiredAccuracy = PositionAccuracy.High;
                var position = await _geolocator.GetGeopositionAsync();

                Model.CurrentPosition = position.Coordinate.Point;
                Map.Center            = Model.CurrentPosition;
                FadeInAnimation.Begin();

                _geolocator.PositionChanged += OnGeoPositionChanged;
                break;

            case GeolocationAccessStatus.Denied:
                break;

            default:
                break;
            }
        }
コード例 #3
0
        private void OnLoaded(object sender, RoutedEventArgs eventArgs)
        {
            UpdateDockIndicators();

            // Start fade-in animation as soon as overlay is loaded.
            FadeInAnimation?.Begin(this, true);
        }
コード例 #4
0
ファイル: Game1.cs プロジェクト: ruizz/PangTank
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin();

            switch (gameState)
            {
            case 0:     // Title Screen

                title.Draw(spriteBatch);

                DrawText();
                break;

            case 1:     // Starting Animation

                startingAnimation.Draw(spriteBatch);
                break;

            case 2:     // Game Started

                // Drawing the background first.
                spriteBatch.Draw(gameplayBackgroundTexture, new Vector2(0, 0), Color.White);

                funnel.Draw(spriteBatch);
                nozzle.Draw(spriteBatch);
                water.Draw(spriteBatch);
                border.Draw(spriteBatch);
                tank.Draw(spriteBatch);

                DrawText();

                FadeInAnimation.Draw(blackTexture, spriteBatch, windowAreaRectangle);

                if (FadeInAnimation.IsFadeCompleted())
                {
                    LevelChangeAnimation.Draw(spriteBatch, levelFont, currentLevel);
                }
                break;

            case 3:     // Ending Animation

                endingAnimation.Draw(spriteBatch);
                break;

            case 4:     // High Scores
                spriteBatch.Draw(highScoresBackgroundTexture, new Vector2(0, 0), Color.White);
                DrawText();

                FadeInAnimation.Draw(blackTexture, spriteBatch, windowAreaRectangle);
                break;
            }

            spriteBatch.End();
            base.Draw(gameTime);
        }
コード例 #5
0
        public AnimationDefinition GetAnimation()
        {
            AnimationDefinition animationDefinition = null;

            var randomIndex = new Random().Next(0, 10);

            switch (randomIndex)
            {
            case 0:
                animationDefinition = new FadeInUpAnimation();
                break;

            case 1:
                animationDefinition = new BounceInLeftAnimation();
                break;

            case 2:
                animationDefinition = new BounceInUpAnimation();
                break;

            case 3:
                animationDefinition = new BounceInDownAnimation();
                break;

            case 4:
                animationDefinition = new FadeInDownAnimation();
                break;

            case 5:
                animationDefinition = new FadeInLeftAnimation();
                break;

            case 6:
                animationDefinition = new FadeInRightAnimation();
                break;

            case 7:
                animationDefinition = new BounceInRightAnimation();
                break;

            case 8:
                animationDefinition = new FadeInAnimation();
                break;

            case 9:
                animationDefinition = new BounceInAnimation();
                break;
            }

            return(animationDefinition);
        }
コード例 #6
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (!SystemProtection.ScreenLocked)
            {
                ((App)App.Current).wasLocked = false;
                timer.Stop();
                videoTimer.Stop();
                NavigationService.Navigate(new Uri("/SettingsPage.xaml", UriKind.Relative));
            }
            else
            {
                ((App)App.Current).wasLocked = true;
                FadeInAnimation.Begin();
            }

            base.OnNavigatedTo(e);
        }
コード例 #7
0
        private async void grid_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
        {
            //虚拟化会重新执行此方法绑定数据
            //await grid.AnimateAsync(new FadeInLeftAnimation());
            //await grid.AnimateAsync(new BounceInDownAnimation());

            var g = sender as Grid;

            if (g != null && !isLoaded)
            {
                await Task.Delay(100);

                var animationName = new FadeInAnimation();
                //animationName.Distance = 150;
                g.AnimateAsync(animationName);

                isLoaded = true;
            }
        }
コード例 #8
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            var fadeOutAnimation = FadeOutAnimation;

            if (!_fadeOutAnimationCompleted && fadeOutAnimation != null)
            {
                // Stop fade-in animation.
                FadeInAnimation?.Stop(this);

                // Start fade-out animation and prevent window from closing until
                // fade-out animation has finished.
                Storyboard clonedAnimation = fadeOutAnimation.Clone();
                clonedAnimation.Completed += OnFadeOutAnimationCompleted;
                clonedAnimation.Begin(this);
                e.Cancel = true;
            }
        }
コード例 #9
0
        //public event PropertyChangedEventHandler TimeElapsedPercentageChanged;

        //void NotifySelectedPresetChanged(string info)
        //{
        //    TimeElapsedPercentageChanged?.Invoke(this, new PropertyChangedEventArgs(info));
        //}

        public TimerBackground()
        {
            this.InitializeComponent();

            if (Settings.Current.ColorModeIndex == 1)
            {
                SetRandomColor();
            }

            if (Settings.Current.BackgroundModeIndex == 2)
            {
                VisualStateManager.GoToState(this, "LinesMode", true);
            }
            else if (Settings.Current.BackgroundModeIndex == 1)
            {
                VisualStateManager.GoToState(this, "CirclesMode", true);
            }
            else
            {
                VisualStateManager.GoToState(this, "SquaresMode", true);
            }

            FadeInAnimation.Begin();
        }
コード例 #10
0
 private void VideoInfoView_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     this.Loaded -= VideoInfoView_Loaded;
     FadeInAnimation.Begin();
 }
コード例 #11
0
 private void ExtendedSplash_Loaded(object sender, RoutedEventArgs e)
 {
     FadeInAnimation.Begin();
 }
コード例 #12
0
 private void NoConnectionPage_Loaded(object sender, RoutedEventArgs e)
 {
     FadeInAnimation.Begin();
 }
コード例 #13
0
 private async void ExecuteRemaining(int?id)
 {
     App.Locator.CollectionArtist.SetArtist((int)id);
     FadeInAnimation.Begin();
     await System.Threading.Tasks.Task.Delay(1);
 }
コード例 #14
0
ファイル: Game1.cs プロジェクト: ruizz/PangTank
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            mouseState = Mouse.GetState();
            switch (gameState)
            {
            case 0:     // Title screen

                this.IsMouseVisible = true;
                gamePadState        = GamePad.GetState(PlayerIndex.One);

                // Start the game
                if (title.isStartButtonPressed(mouseState))
                {
                    this.IsMouseVisible = false;
                    MediaPlayer.Stop();
                    startingAnimation.Start();
                    gameState = 1;
                }

                if (title.isMuteButtonPressed(mouseState))
                {
                    if (MediaPlayer.IsMuted == false)
                    {
                        MediaPlayer.IsMuted = true;
                    }
                    else
                    {
                        MediaPlayer.IsMuted = false;
                    }

                    startingAnimation.ChangeMute();
                    endingAnimation.ChangeMute();
                }


                break;

            case 1:     // Starting animation
                if (startingAnimation.isFinished() || mouseState.LeftButton == ButtonState.Pressed)
                {
                    startingAnimation.Stop();

                    MediaPlayer.Play(gameplayMusic);
                    gameState = 2;
                }

                break;

            case 2:     // Game Started

                // Allows the game to exit
                if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                {
                    this.Exit();
                }

                // Take care of the fade from black first
                if (!FadeInAnimation.IsFadeCompleted())
                {
                    break;
                }

                if (!LevelChangeAnimation.IsAnimationCompleted())
                {
                    funnel.Update();
                    border.Update(totalDropsCaught);
                    break;
                }

                // Update all objects to new positions
                funnel.Update();
                nozzle.Update();
                water.Update();
                border.Update(totalDropsCaught);

                // Release a drop during every specified interval
                seconds += gameTime.ElapsedGameTime.TotalSeconds;     // seconds += Elapsed time since last update
                if (seconds > waterInterval)
                {
                    seconds = 0.0;
                    water.releaseDrop(nozzle.GetBounds());
                }

                // Increase counters for any water-funnel collisions.
                // From level 8 onward, return the entire funnel collision bounds because the water
                // droplets move too fast between frames for collisions to be detected.
                int collisions;
                if (currentLevel < 8)
                {
                    collisions = water.getFunnelCollisions(funnel.GetCollisionBounds());
                }
                else
                {
                    collisions = water.getFunnelCollisions(funnel.GetBounds());
                }

                totalDropsCaught += collisions;
                levelDropsCaught += collisions;

                // Update the tank threshold
                int misses = water.getFunnelMisses();
                tank.updateThreshold(levelDropRequirement, misses);

                // Next level!
                if (levelDropsCaught == levelDropRequirement)
                {
                    currentLevel         += 1;
                    levelDropRequirement += 5;
                    levelDropsCaught      = 0;

                    // Increase speeds
                    nozzle.increaseSpeed(speedMultiplier);
                    water.increaseSpeed(speedMultiplier);
                    waterInterval /= speedMultiplier;

                    // Decrease the multiplier so that the speed increases per level don't become drastic.
                    if (speedMultiplier > 1.0f)
                    {
                        speedMultiplier *= 0.98f;
                    }

                    LevelChangeAnimation.Reset();
                }

                // Game Over
                if (tank.getTankLevel() == 3)
                {
                    MediaPlayer.Stop();
                    endingAnimation.Start();
                    gameState = 3;
                }

                base.Update(gameTime);
                break;

            case 3:     // Game Ended
                if (endingAnimation.isFinished() || mouseState.LeftButton == ButtonState.Pressed)
                {
                    endingAnimation.Stop();
                    FadeInAnimation.Reset();
                    MediaPlayer.Play(gameplayMusic);
                    highScores = new HighScores(totalDropsCaught);
                    gameState  = 4;
                }
                break;

            case 4:     // High Scores
                this.IsMouseVisible = true;
                //keyboardState = Keyboard.GetState();

                if ((mouseState.LeftButton == ButtonState.Pressed) &&
                    mouseState.X > retryButton.X &&
                    mouseState.X < retryButton.X + retryButton.Width &&
                    mouseState.Y > retryButton.Y &&
                    mouseState.Y < retryButton.Y + retryButton.Height)
                {
                    MediaPlayer.Stop();
                    gameState = 0;
                    ResetValues();
                }
                break;
            }
        }
コード例 #15
0
    public static void PushFadeIn(GameObject go, float delay = 0)
    {
        FadeInAnimation anim = new FadeInAnimation(go, delay);

        sSingleton._PushAnimation(anim);
    }
コード例 #16
0
 public override void StopAnimations()
 {
     base.StopAnimations();
     FadeInAnimation.Stop();
     FadeOutAnimation.Stop();
 }
コード例 #17
0
        private static AnimationDefinition GetAnimationDefinition(string animationName)
        {
            AnimationDefinition animationDefinition = null;

            if (animationName != null)
            {
                switch (animationName.ToLower())
                {
                case "flash": animationDefinition = new FlashAnimation(); break;

                case "bounce": animationDefinition = new BounceAnimation(); break;

                case "shake": animationDefinition = new ShakeAnimation(); break;

                case "tada": animationDefinition = new TadaAnimation(); break;

                case "swing": animationDefinition = new SwingAnimation(); break;

                case "wobble": animationDefinition = new WobbleAnimation(); break;

                case "pulse": animationDefinition = new PulseAnimation(); break;

                case "breathing": animationDefinition = new BreathingAnimation(); break;

                case "jump": animationDefinition = new JumpAnimation(); break;

                case "flip": animationDefinition = new FlipAnimation(); break;

                case "flipinx": animationDefinition = new FlipInXAnimation(); break;

                case "flipoutx": animationDefinition = new FlipOutXAnimation(); break;

                case "flipiny": animationDefinition = new FlipInYAnimation(); break;

                case "flipouty": animationDefinition = new FlipOutYAnimation(); break;

                case "fadein": animationDefinition = new FadeInAnimation(); break;

                case "fadeout": animationDefinition = new FadeOutAnimation(); break;

                case "fadeinleft": animationDefinition = new FadeInLeftAnimation(); break;

                case "fadeinright": animationDefinition = new FadeInRightAnimation(); break;

                case "fadeinup": animationDefinition = new FadeInUpAnimation(); break;

                case "fadeindown": animationDefinition = new FadeInDownAnimation(); break;

                case "fadeoutleft": animationDefinition = new FadeOutLeftAnimation(); break;

                case "fadeoutright": animationDefinition = new FadeOutRightAnimation(); break;

                case "fadeoutup": animationDefinition = new FadeOutUpAnimation(); break;

                case "fadeoutdown": animationDefinition = new FadeOutDownAnimation(); break;

                case "bouncein": animationDefinition = new BounceInAnimation(); break;

                case "bounceout": animationDefinition = new BounceOutAnimation(); break;

                case "bounceinleft": animationDefinition = new BounceInLeftAnimation(); break;

                case "bounceinright": animationDefinition = new BounceInRightAnimation(); break;

                case "bounceinup": animationDefinition = new BounceInUpAnimation(); break;

                case "bounceindown": animationDefinition = new BounceInDownAnimation(); break;

                case "bounceoutleft": animationDefinition = new BounceOutLeftAnimation(); break;

                case "bounceoutright": animationDefinition = new BounceOutRightAnimation(); break;

                case "bounceoutup": animationDefinition = new BounceOutUpAnimation(); break;

                case "bounceoutdown": animationDefinition = new BounceOutDownAnimation(); break;

                case "scalein": animationDefinition = new ScaleInAnimation(); break;

                case "scaleout": animationDefinition = new ScaleOutAnimation(); break;

                case "lightspeedinleft": animationDefinition = new LightSpeedInLeftAnimation(); break;

                case "lightspeedinright": animationDefinition = new LightSpeedInRightAnimation(); break;

                case "lightspeedoutleft": animationDefinition = new LightSpeedOutLeftAnimation(); break;

                case "lightspeedoutright": animationDefinition = new LightSpeedOutRightAnimation(); break;

                case "hinge": animationDefinition = new HingeAnimation(); break;

                case "reset": animationDefinition = new ResetAnimation(); break;
                }
            }
            return(animationDefinition);
        }
コード例 #18
0
 private void FadeOutCompleted(object sender, EventArgs e)
 {
     SetImageSource(currentIndex);
     FadeInAnimation.Begin();
 }
コード例 #19
0
 public void Show()
 {
     UIAnimationHelper.FadeIn(this);
     FadeInAnimation.Begin();
 }
コード例 #20
0
ファイル: TransferView.xaml.cs プロジェクト: RomanGL/VKSaver
 private void TransferView_Loaded(object sender, RoutedEventArgs e)
 {
     this.Loaded -= TransferView_Loaded;
     FadeInAnimation.Begin();
 }
コード例 #21
0
 public override void NavigatedTo(NavigationMode mode, object parameter)
 {
     base.NavigatedTo(mode, parameter);
     FadeInAnimation.Begin();
 }
コード例 #22
0
        /// <summary>
        /// Clones all the animations provided to this animator, so the original
        /// scriptable objects don't get changed.
        /// </summary>
        private void CloneAnimations()
        {
            if (moveInAnimation != null)
            {
                moveInAnimation = Instantiate(moveInAnimation) as MoveInAnimation;
            }

            if (moveOutAnimation != null)
            {
                moveOutAnimation = Instantiate(moveOutAnimation) as MoveOutAnimation;
            }

            if (movePingPongAnimation != null)
            {
                movePingPongAnimation = Instantiate(movePingPongAnimation) as MovePingPongAnimation;
            }

            if (rotateInAnimation != null)
            {
                rotateInAnimation = Instantiate(rotateInAnimation) as RotateInAnimation;
            }

            if (rotateOutAnimation != null)
            {
                rotateOutAnimation = Instantiate(rotateOutAnimation) as RotateOutAnimation;
            }

            if (rotatePingPongAnimation != null)
            {
                rotatePingPongAnimation = Instantiate(rotatePingPongAnimation) as RotatePingPongAnimation;
            }

            if (scaleInAnimation != null)
            {
                scaleInAnimation = Instantiate(scaleInAnimation) as ScaleInAnimation;
            }

            if (scaleOutAnimation != null)
            {
                scaleOutAnimation = Instantiate(scaleOutAnimation) as ScaleOutAnimation;
            }

            if (scalePingPongAnimation != null)
            {
                scalePingPongAnimation = Instantiate(scalePingPongAnimation) as ScalePingPongAnimation;
            }

            if (fadeInAnimation != null)
            {
                fadeInAnimation = Instantiate(fadeInAnimation) as FadeInAnimation;
            }

            if (fadeOutAnimation != null)
            {
                fadeOutAnimation = Instantiate(fadeOutAnimation) as FadeOutAnimation;
            }

            if (fadePingPongAnimation != null)
            {
                fadePingPongAnimation = Instantiate(fadePingPongAnimation) as FadePingPongAnimation;
            }
        }
コード例 #23
0
 private void AudioAlbumView_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     this.Loaded -= AudioAlbumView_Loaded;
     FadeInAnimation.Begin();
 }