Esempio n. 1
0
        private bool closeBox(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (eventtype == TouchType.TouchDown)
            {
                if (State.ShowingTutorial > 0)
                {
                    State.ShowingTutorial++;
                    Client.PlaySoundEffect(Assets.Sounds.Click);

                    if (State.ShowingTutorial > 2)
                    {
                        State.ShowingTutorial = 0;
                    }
                    return(false);
                }
                if (State.AboutState == AboutState.Opened)
                {
                    Client.PlaySoundEffect(Assets.Sounds.Click);
                    State.AboutState = AboutState.Closing;
                    AboutCloseAnimation.Restart();
                    AboutCloseDialogAnimation.Restart();
                    return(false);
                }
                return(true);
            }
            return(true);
        }
Esempio n. 2
0
        public bool toggleOpening(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (State.StartClicked)
            {
                return(false);
            }
            if (eventtype == TouchType.TouchDown)
            {
                if (State.AboutState == AboutState.Opened)
                {
                    Client.PlaySoundEffect(Assets.Sounds.Click);
                    State.AboutState = AboutState.Closing;
                    AboutCloseAnimation.Restart();
                    AboutCloseDialogAnimation.Restart();
                }
                else if (State.AboutState == AboutState.Closed)
                {
                    Client.PlaySoundEffect(Assets.Sounds.Click);
                    State.AboutState = AboutState.Opening;
                    AboutOpenAnimation.Restart();
                    AboutOpenDialogAnimation.Restart();
                }

                return(true);
            }
            return(false);
        }
Esempio n. 3
0
        public void Tick(TimeSpan elapsedGameTime)
        {
            if (DateTime.Now - State.StartHop > State.NextHop)
            {
                setNextHop();
                RandomPenguinHop.Restart();
            }

            if (!PenguinLogoAnimation.Completed)
            {
                PenguinLogoAnimation.Tick(elapsedGameTime);
            }
            if (!ShuffleLogoAnimation.Completed)
            {
                ShuffleLogoAnimation.Tick(elapsedGameTime);
            }
            if (!RandomPenguinHop.Completed)
            {
                RandomPenguinHop.Tick(elapsedGameTime);
            }
            if (!PlayButtonAnimation.Completed)
            {
                PlayButtonAnimation.Tick(elapsedGameTime);
            }
            if (!InitialPenguinHop.Completed)
            {
                InitialPenguinHop.Tick(elapsedGameTime);
            }

            switch (State.AboutState)
            {
            case AboutState.Closed:
                break;

            case AboutState.Opened:
                break;

            case AboutState.Opening:
                State.NextHop = new TimeSpan(1, 0, 0);
                AboutOpenAnimation.Tick(elapsedGameTime);
                AboutOpenDialogAnimation.Tick(elapsedGameTime);
                break;

            case AboutState.Closing:
                State.NextHop = new TimeSpan(1, 0, 0);
                AboutCloseAnimation.Tick(elapsedGameTime);
                AboutCloseDialogAnimation.Tick(elapsedGameTime);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            if (State.StartClicked)
            {
                StartGameAnimation.Tick(elapsedGameTime);
            }
            GameService.CloudSubLayout.TickLayoutView(elapsedGameTime);
            State.SoundSubLayout.TickLayoutView(elapsedGameTime);
        }
Esempio n. 4
0
        private void renderAbout()
        {
            if (!InitialPenguinHop.Completed)
            {
                InitialPenguinHop.Render(mainLayer);
                return;
            }
            switch (State.AboutState)
            {
            case AboutState.Closed:

                if (!RandomPenguinHop.Completed)
                {
                    RandomPenguinHop.Render(mainLayer);
                }
                else
                {
                    mainLayer.DrawImage(Assets.Images.About.MainPenguin, Positions.AboutPenguinPosition, true);
                }

                break;

            case AboutState.Opening:
                AboutOpenAnimation.Render(mainLayer);
                AboutOpenDialogAnimation.Render(mainLayer);
                break;

            case AboutState.Opened:
                mainLayer.DrawImage(Assets.Images.About.MainPenguin, Positions.AboutOpenPenguinPosition, true);
                aboutBoxRender(mainLayer);
                break;

            case AboutState.Closing:
                AboutCloseAnimation.Render(mainLayer);
                AboutCloseDialogAnimation.Render(mainLayer);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }