Exemple #1
0
        public override void Update(GameTime gameTime)
        {
            offsetX = (centerScreen.X - InputHandler.TouchVectorScaled.ToPoint().X) / 32;
            offsetY = (centerScreen.Y - InputHandler.TouchVectorScaled.ToPoint().Y) / 32;

            for (var i = 0; i < rects.Length; i++)
            {
                if (rects[i].Contains(InputHandler.TouchVectorScaled.ToPoint()))
                {
                    helperText = i;
                    break;
                }
                else
                {
                    helperText = -1;
                }
            }

//            if (InputHandler.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Escape))
//                ScreenManager.GameReference.ScreenControl(ScreenName, "Back");

            if (InputHandler.FingerRaised())
            {
                ScreenManager.GameReference.ScreenControl(ScreenName, "Back");
            }

            if (ScreenManager.GameReference.PlacardState != TempleMain.PlacardSlideStates.Closed)
            {
                ScreenManager.GameReference.ManagePlacardState(gameTime);
            }

            ControlManager.Update(gameTime);
        }
Exemple #2
0
        public override void Update(GameTime gameTime)
        {
            if ((Name == "Resume" || Name == "End") && !Active)
            {
                Active = true;
            }

            if (Active)
            {
                //				if (ButtonBounds.Contains(InputHandler.TouchVectorScaled.ToPoint()) && !ContainsMouse)
                //                    ContainsMouse = true;
                //				else if (!ButtonBounds.Contains(InputHandler.TouchVectorScaled.ToPoint()) && ContainsMouse)
                //                {
                //                    HasFocus = false;
                //                    ContainsMouse = false;
                //                }
                //				if (ButtonBounds.Contains(InputHandler.TouchVectorScaled.ToPoint()) &&
                //					InputHandler.IsScreenBeingTouched())
                //                {
                //                    HasFocus = true;
                //                    base.OnSelected(null);
                //                }
                #region Mouse
                if (ButtonBounds.Contains(InputHandler.TouchVectorScaled.ToPoint()) && !ContainsMouse)
                {
                    ContainsMouse = true;
                }
                else if (!ButtonBounds.Contains(InputHandler.TouchVectorScaled.ToPoint()) && ContainsMouse)
                {
                    HasFocus      = false;
                    ContainsMouse = false;
                }

                if (ContainsMouse && InputHandler.FingerRaised())
                {
                    HasFocus = true;
                    base.OnSelected(null);
                    #endregion

                    #region Touch
                    //if (ButtonBounds.Contains (InputHandler.TouchVectorScaled.ToPoint ()) && !ContainsMouse)
                    //    ContainsMouse = true;
                    //else if (!ButtonBounds.Contains (InputHandler.TouchVectorScaled.ToPoint ()) && ContainsMouse) {
                    //    HasFocus = false;
                    //    ContainsMouse = false;
                    //}

                    //if (ContainsMouse && InputHandler.FingerRaised ()) {
                    //    HasFocus = true;
                    //    base.OnSelected (null);
                }
                #endregion
            }
            else
            {
                var elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

                moveTimer += elapsed;

                if (moveTimer >= moveTimerDuration)
                {
                    moveTimer = 0;

                    if (!bounceUp)
                    {
                        Position = new Vector2(Position.X, Position.Y + 10);

                        if (Position.Y >= targetPoint + 22)
                        {
                            bounceUp = true;
                        }
                    }
                    else
                    {
                        Position = new Vector2(Position.X, Position.Y - 3);
                        if (Position.Y <= targetPoint)
                        {
                            Enabled = true;
                            Active  = true;

                            ButtonBounds = new Rectangle((int)Position.X, (int)Position.Y, ButtonBounds.Width, ButtonBounds.Height);
                        }
                    }
                }
            }
        }
Exemple #3
0
        public override void Update(GameTime gameTime)
        {
            #region Mouse
            if (!ButtonBounds.Contains(InputHandler.TouchVectorScaled.ToPoint()))
            {
                Highlighted = true;
                HasFocus    = false;

                if (HasPlayed)
                {
                    HasPlayed = false;
                }
            }

            if (ButtonBounds.Contains(InputHandler.TouchVectorScaled.ToPoint()))
            {
                Highlighted = true;
                HasFocus    = true;
            }

            if (ButtonBounds.Contains(InputHandler.TouchVectorScaled.ToPoint()) &&
                InputHandler.FingerRaised())
            {
                HasFocus = true;
                base.OnSelected(null);
            }
            #endregion

            #region Touch
            //if (!ButtonBounds.Contains(InputHandler.TouchVectorScaled.ToPoint()))
            //{
            //    Highlighted = true;
            //    HasFocus = false;

            //    if (HasPlayed)
            //        HasPlayed = false;

            //}


            //if (ButtonBounds.Contains(InputHandler.TouchVectorScaled.ToPoint()))
            //{
            //    Highlighted = true;
            //    HasFocus = true;

            //}

            //if (ButtonBounds.Contains(InputHandler.TouchVectorScaled.ToPoint()) &&
            //    InputHandler.FingerRaised())
            //{
            //    HasFocus = true;
            //    base.OnSelected(null);
            //}

            #endregion

            //if (HasFocus && !HasPlayed)
            //{
            //    SoundBoard.ButtonHighlight.Play();
            //    HasPlayed = true;
            //}
        }
Exemple #4
0
        public override void Update(GameTime gameTime)
        {
            var elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;


            if (ready)
            {
                newFlowerTimer += elapsed;
                textInitTimer  += elapsed;

                if (!shiftMode)
                {
                    if (newFlowerTimer >= newFlowerTimerDuration)
                    {
                        newFlowerTimer = 0;
                        if (flowerPool.Any(r => !r.Active))
                        {
                            var pos = Vector2.Zero;

                            do
                            {
                                pos = new Vector2(MasterRandom.FRandom.Next(32, 1248), MasterRandom.FRandom.Next(32, 688));
                            }while (flowerPool.Any(t => t.Position.X >= (pos.X - 64) && t.Position.X < (pos.X + 64) &&
                                                   t.Position.Y >= (pos.Y - 64) && t.Position.Y < (pos.Y + 64)));

                            flowerPool.First(t => !t.Active).ActivateFlower(pos);
                        }
                    }

                    if (textInitTimer >= textInitTimerDuration)
                    {
                        timer += elapsed;
                        if (timer >= timerDuration && !titleMoveDone)
                        {
                            timer = 0;

                            if (!bounceUp)
                            {
                                titleTextPosition = new Vector2(titleTextPosition.X, titleTextPosition.Y + 7);

                                if (titleTextPosition.Y >= 248)
                                {
                                    bounceUp = true;
                                }
                            }
                            else
                            {
                                titleTextPosition = new Vector2(titleTextPosition.X, titleTextPosition.Y - 3);

                                if (titleTextPosition.Y <= 200)
                                {
                                    titleMoveDone = true;
                                }
                            }
                        }
                    }


                    foreach (var flower in flowerPool)
                    {
                        if (flower.Active)
                        {
                            flower.Update(gameTime);
                        }
                    }

                    foreach (var bee in bees)
                    {
                        bee.Update(gameTime);
                    }

                    if (InputHandler.FingerRaised() && titleMoveDone)
                    {
                        shiftMode = true;

                        for (var i = 0; i < flowerPool.Count; i++)
                        {
                            flowerPool[i].AllStop = true;
                        }

                        for (var i = 0; i < bees.Count; i++)
                        {
                            bees[i].AllStop = true;
                        }


                        ScreenManager.GameReference.ScreenControl(ScreenName, "NewUser");
                    }

                    if (InputHandler.FingerRaised() && titleMoveDone)
                    {
                        shiftMode = true;

                        for (var i = 0; i < flowerPool.Count; i++)
                        {
                            flowerPool[i].AllStop = true;
                        }

                        for (var i = 0; i < bees.Count; i++)
                        {
                            bees[i].AllStop = true;
                        }

                        if (isNewUser)
                        {
                            ScreenManager.GameReference.ScreenControl(ScreenName, "NewUser");
                        }
                    }
                }
                else
                {
                    if (timer >= timerDuration)
                    {
                        timerDuration = 0;

                        foreach (var flower in flowerPool)
                        {
                            if (flower.Active)
                            {
                                flower.Update(gameTime);
                            }
                        }

                        foreach (var bee in bees)
                        {
                            bee.Update(gameTime);
                        }

                        helperNode = new Vector2(helperNode.X, helperNode.Y + 55 * 5 * elapsed);

                        titleTextPosition = new Vector2(titleTextPosition.X, titleTextPosition.Y + 65 * 5 * elapsed);
                    }

                    if (helperNode.Y >= 256 && !startingNextScreen)
                    {
                        ScreenManager.GameReference.ScreenControl(ScreenName, "Begin");
                        Tiling             = null;
                        startingNextScreen = true;
                    }

                    if (helperNode.Y >= 768)
                    {
                        ScreenManager.GameReference.ScreenControl(ScreenName, "Next");
                    }
                }
            }
            else
            {
                initTimer += elapsed;

                if (initTimer > 5)
                {
                    ready = true;
                }
            }
            ControlManager.Update(gameTime);
        }