コード例 #1
0
ファイル: PauseScreen.cs プロジェクト: Dialock/TempleGame
        private void BuildControls()
        {
//			optionsButton = new ImageButton(SpriteLoader.MenuButtonText, null, new Rectangle(8, 176, 408, 72), new Vector2(500, 304));
//			optionsButton.ButtonBounds = new Rectangle(500, 304, 408, 72);
//			optionsButton.HighlightColor = Color.White;
//			optionsButton.FocusColor = Color.Turquoise;
//			optionsButton.Selected += optionsButton_Selected;
//			optionsButton.HasFocus = false;
//			ControlManager.Add(optionsButton);


            resumeButton = new ImageButton(SpriteLoader.IosTextSheet, null, new Rectangle(432, 256, 376, 72), new Vector2(468, 304));
            resumeButton.ButtonBounds   = new Rectangle(500, 304, 376, 72);
            resumeButton.HighlightColor = Color.White;
            resumeButton.FocusColor     = Color.Turquoise;
            resumeButton.Selected      += resumeButton_Selected;
            resumeButton.HasFocus       = false;
            resumeButton.DrawLayer      = 0.15f;
            ControlManager.Add(resumeButton);


            endButton = new ImageButton(SpriteLoader.IosTextSheet, null, new Rectangle(432, 176, 392, 72), new Vector2(468, 400));
            endButton.ButtonBounds   = new Rectangle(492, 400, 392, 72);
            endButton.HighlightColor = Color.White;
            endButton.FocusColor     = Color.Turquoise;
            endButton.Selected      += endButton_Selected;
            endButton.HasFocus       = false;
            endButton.DrawLayer      = 0.15f;
            ControlManager.Add(endButton);

            if (TempleMain.Player.MusicActive)
            {
                musicButton = new ImageButton(SpriteLoader.IosMainSheet, null, new Rectangle(576, 576, 64, 64), new Vector2(468, 504));
            }
            else
            {
                musicButton = new ImageButton(SpriteLoader.IosMainSheet, null, new Rectangle(576, 640, 64, 64), new Vector2(468, 504));
            }

            musicButton.Selected      += musicButton_Selected;
            musicButton.HighlightColor = Color.White;
            musicButton.DrawLayer      = 0.44f;
            ControlManager.Add(musicButton);

            if (TempleMain.Player.SoundActive)
            {
                soundButton = new ImageButton(SpriteLoader.IosMainSheet, null, new Rectangle(512, 576, 64, 64), new Vector2(796, 504));
            }
            else
            {
                soundButton = new ImageButton(SpriteLoader.IosMainSheet, null, new Rectangle(512, 640, 64, 64), new Vector2(796, 504));
            }

            soundButton.Selected      += soundButton_Selected;
            soundButton.HighlightColor = Color.White;
            soundButton.DrawLayer      = 0.44f;
            ControlManager.Add(soundButton);

            if (TempleMain.Player.VibrateOn)
            {
                vibButton = new ImageButton(SpriteLoader.IosMainSheet, null, new Rectangle(640, 576, 64, 64), new Vector2(632, 504));
            }
            else
            {
                vibButton = new ImageButton(SpriteLoader.IosMainSheet, null, new Rectangle(640, 640, 64, 64), new Vector2(632, 504));
            }

            vibButton.Selected      += vibButton_Selected;
            vibButton.HighlightColor = Color.White;
            vibButton.DrawLayer      = 0.44f;
            ControlManager.Add(vibButton);
        }
コード例 #2
0
        public override void Update(GameTime gameTime)
        {
            numberSpitter.Update(currentEXPPool, xpNeededToLevel, matches, EndSeason, CurrentLvl);

            var elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

            timer += elapsed;

            if (timer >= 0.04f && !gaugeDone)
            {
                if (currentEXPPool > 0)
                {
                    var taker = 0;

                    var diff = xpNeededToLevel - tempDrainPool;

                    if (diff < 2000)
                    {
                        taker = 125;
                    }
                    else if (diff >= 2001 && diff < 5000)
                    {
                        taker = 200;
                    }
                    else if (diff >= 5001 && diff < 10000)
                    {
                        taker = 300;
                    }
                    else if (diff >= 10001 && diff < 15000)
                    {
                        taker = 900;
                    }
                    else
                    {
                        taker = 2000;
                    }

                    var buffer = currentEXPPool - taker;

                    if (buffer < 0)
                    {
                        taker = currentEXPPool;
                    }

                    buffer = (int)tempDrainPool + taker;

                    if (buffer > xpNeededToLevel)
                    {
                        taker = (int)xpNeededToLevel - (int)tempDrainPool;
                    }

                    currentEXPPool -= taker;

                    tempDrainPool += taker;

                    FullXPPool += taker;

                    if (tempDrainPool != 0)
                    {
                        _currentWidth = (int)(GaugeWidth * ((double)tempDrainPool / xpNeededToLevel));
                    }
                    else
                    {
                        _currentWidth = 0;
                    }

                    if (tempDrainPool >= xpNeededToLevel)
                    {
                        tempDrainPool = 0;

                        CurrentLvl++;

                        if (CurrentLvl == 5)
                        {
                            ScreenManager.GameReference.EvaluateAchievements("Lvl5");
                        }
                        else if (CurrentLvl == 10)
                        {
                            ScreenManager.GameReference.EvaluateAchievements("Lvl10");
                        }
                        else if (CurrentLvl == 15)
                        {
                            ScreenManager.GameReference.EvaluateAchievements("Lvl15");
                        }

                        Evalute();
                    }

                    timer = 0;
                }
                else
                {
                    gaugeDone      = true;
                    XPForThisLevel = (int)tempDrainPool;
                }
            }

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

            ControlManager.Update(gameTime);

            offsetX = (centerScreen.X - InputHandler.TouchVectorScaled.ToPoint().X) / 32;
            offsetY = (centerScreen.Y - InputHandler.TouchVectorScaled.ToPoint().Y) / 32;
        }
コード例 #3
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);
        }