示例#1
0
        public override void ProcessEvent(Event ev)
        {
            if (!IsTopScreen)
            {
                return;
            }
            base.ProcessEvent(ev);

            if ((ev is MenuEvent))
            {
                if ((ev as MenuEvent).sender is Button && fader == null)
                {
                    if (((ev as MenuEvent).sender as Button).Text != null)
                    {
                        fader = new BlankNess();
                        fader.Initialize(Content);
                        fader.fullBlankity = 1.0f;
                        fader.RaiseFlag(Flags.FADE_IN);

                        Components.Add(fader);
                    }
                    else
                    {
                        Options p = new Options();
                        p.Initialize(Content);
                        ScreenManager.Get.AddScreen(p);
                    }
                }
            }
        }
示例#2
0
        public override void ProcessEvent(Event ev)
        {
            base.ProcessEvent(ev);

            if (ev is MenuEvent)
            {
                if ((ev as MenuEvent).sender is Button && (ev as MenuEvent).Type == MenuEvent.EventType.RELEASE)
                {
                    string text = ((ev as MenuEvent).sender as Button).CurrentFrame;

                    if (text == "restart" && !(ScreenManager.Get.TopScreen is GameplayScreen))
                    {
                        gameplay.Restart();
                        RaiseFlag(Flags.DELETE);
                    }
                    else if (text == "quit")
                    {
                        blank = new BlankNess();
                        blank.Initialize(Content);
                        blank.fullBlankity = 1.0f;
                        blank.RaiseFlag(Flags.FADE_IN);
                        Components.Add(blank);
                    }
                    else if (text == "doublearrow")
                    {
                        blank = new BlankNess();
                        blank.Initialize(Content);
                        blank.fullBlankity = 1.0f;
                        blank.RaiseFlag(Flags.FADE_IN);
                        Components.Add(blank);
                        NextLevelLoad = true;
                    }
                }
            }
        }
示例#3
0
        public override void Initialize(ContentManager content)
        {
            base.Initialize(content);

            MenuObj bg = new MenuObj("ui/mainmenu");

            bg.Initialize(Content);
            bg.CreateFramesFromXML("ui/mainmenu_frames");
            bg.CurrentFrame = "mainmenu";
            bg.ResetDimensions();

            float widthDif = BaseGame.Get.BackBufferWidth / 1000.0f;

            bg.Width  *= widthDif;
            bg.Height *= widthDif;
            Components.Add(bg);

            Button b = new Button("ui/ui");

            b.CreateFramesFromXML("ui/ui_frames");
            b.Initialize(Content);
            b.CurrentFrame = "levelbutton";
            b.ResetDimensions();
            b.RegularScale = ScaleFactor * 1.5f;
            b.ScaleOnHover = b.RegularScale * 1.1f;
            b.PosX         = -0.24f * BaseGame.Get.BackBufferWidth;
            b.PosY         = -0.3f * BaseGame.Get.HalfBackBufferHeight;
            b.SetText("Play", "ui/Play");
            b.Text.Colour      = Color.Black;
            b.PlaySFXOnRelease = "Sounds/PlayStateSelect";
            b.TextScaler       = 0.75f;
            b.UniformScale     = b.RegularScale;
            Components.Add(b);

            b = new Button("ui/ui");
            b.CreateFramesFromXML("ui/ui_frames");
            b.Initialize(Content);
            b.CurrentFrame = "settings";
            b.ResetDimensions();
            b.RegularScale = ScaleFactor * 0.5f;
            b.ScaleOnHover = b.RegularScale * 1.1f;
            b.PosX         = -0.45f * BaseGame.Get.BackBufferWidth;
            b.PosY         = -0.5f * BaseGame.Get.HalfBackBufferHeight;
            b.UniformScale = b.RegularScale;
            Components.Add(b);

            AudioManager.PlayMusic("troublemaker");


            BlankNess blank = new BlankNess();

            blank.Initialize(Content);
            blank.RaiseFlag(Flags.FADE_OUT);
            blank.fadeInTimer  = 1.0f;
            blank.fullBlankity = 1.0f;
            Components.Add(blank);
        }
示例#4
0
        public override void OnBackPress()
        {
            base.OnBackPress();

            EventManager.Get.SendEvent(new ScreenCancelEvent(this));
            backToMainMenu = true;
            blank          = new BlankNess();
            blank.Initialize(Content);
            blank.fullBlankity = 1.0f;
            Components.Add(blank);
            blank.RaiseFlag(Flags.FADE_IN);
        }
示例#5
0
        public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            base.Initialize(content);

            BlankNess n = new BlankNess();
            n.Initialize(Content);
            n.fadeSpeed = 3.0f;
            n.fullBlankity = 0.2f;
            Components.Add(n);

            PauseScreenPusher pauseScreenPusher = new PauseScreenPusher();
            pauseScreenPusher.Initialize(Content);
            pauseScreenPusher.screen = this;
            Components.Add(pauseScreenPusher);
        }
示例#6
0
        public override void ScreenFadeOut()
        {
            if (blank == null)
            {
                blank = new BlankNess();
                blank.Initialize(Content);
                blank.fullBlankity = 0.5f;
                if (IsQuitting)
                {
                    blank.fullBlankity = 1.0f;
                }
                blank.fadeSpeed = 2.0f;
                blank.RaiseFlag(Jabber.Flags.FADE_IN);

                base.ScreenFadeOut();
            }
        }
示例#7
0
        public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            base.Initialize(content);

            BlankNess n = new BlankNess();

            n.Initialize(Content);
            n.fadeSpeed    = 3.0f;
            n.fullBlankity = 0.2f;
            Components.Add(n);


            PauseScreenPusher pauseScreenPusher = new PauseScreenPusher();

            pauseScreenPusher.Initialize(Content);
            pauseScreenPusher.screen = this;
            Components.Add(pauseScreenPusher);
        }
示例#8
0
        public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            base.Initialize(content);

            BlankNess n = new BlankNess();

            n.Initialize(Content);
            n.RaiseFlag(Jabber.Flags.FADE_IN);
            n.fullBlankity = 0.25f;
            Components.Add(n);

            if (gameplay.GetRemainingFox() == 0)
            {
                MenuObj logo = new MenuObj("ui/ui");
                logo.Initialize(Content);
                logo.CreateFramesFromXML("ui/ui_frames");
                logo.CurrentFrame = "cannonfire";
                logo.ResetDimensions();
                logo.UniformScale = ScaleFactor;
                logo.PosX         = 0.1f * BaseGame.Get.BackBufferWidth;

                logo.PosY   = 0.1f * BaseGame.Get.BackBufferHeight;
                logo.PosY  -= 0.1f * BaseGame.Get.BackBufferHeight;
                logo.Colour = Color.White * 0.5f;
                Components.Add(logo);
            }
            else
            {
                MenuObj logo = new MenuObj("ui/ui");
                logo.Initialize(Content);
                logo.CreateFramesFromXML("ui/ui_frames");
                logo.CurrentFrame = "chickenincannon";
                logo.ResetDimensions();
                logo.UniformScale = ScaleFactor;

                logo.Colour = Color.White * 0.5f;
                logo.PosY  -= 0.1f * BaseGame.Get.BackBufferHeight;
                Components.Add(logo);
            }

            ThinBlackLine b = new ThinBlackLine();

            b.Initialize(Content);
            Components.Add(b);

            Button restart = new FadeInButton();

            restart.Initialize(Content);
            restart.CreateFramesFromXML("ui/ui_frames");
            restart.CurrentFrame = "restart";
            restart.ResetDimensions();
            restart.Colour       = Color.LightGreen;
            restart.RegularScale = ScaleFactor / 2.0f;
            restart.ScaleOnHover = restart.RegularScale * 1.1f;
            restart.PosY         = -BaseGame.Get.HalfBackBufferHeight * 0.5f;
            Components.Add(restart);

            if (gameplay.GetRemainingFox() == 0)
            {
                restart = new FadeInButton();
                restart.Initialize(Content);
                restart.CreateFramesFromXML("ui/ui_frames");
                restart.CurrentFrame = "doublearrow";
                restart.ResetDimensions();
                restart.Colour       = Color.LightBlue;
                restart.RegularScale = ScaleFactor / 2.0f;
                restart.ScaleOnHover = restart.RegularScale * 1.1f;
                restart.PosX         = BaseGame.Get.BackBufferWidth * 0.14f;
                restart.PosY         = -BaseGame.Get.HalfBackBufferHeight * 0.5f;
                Components.Add(restart);
            }

            restart = new FadeInButton();
            restart.Initialize(Content);
            restart.CreateFramesFromXML("ui/ui_frames");
            restart.CurrentFrame = "quit";
            restart.ResetDimensions();
            restart.Colour       = Color.Red * 0.8f;
            restart.RegularScale = ScaleFactor / 2.0f;
            restart.ScaleOnHover = restart.RegularScale * 1.1f;
            restart.PosX         = -BaseGame.Get.BackBufferWidth * 0.14f;
            restart.PosY         = -BaseGame.Get.HalfBackBufferHeight * 0.5f;
            Components.Add(restart);

            TextDrawer text = new TextDrawer("ui/LevelFont");

            text.Handle = BaseSprite.SpriteHandle.CENTER;
            text.Initialize(Content);
            text.Text         = "Best: " + ChicksnVixensGame.Get.GetLevelState(gameplay.location, gameplay.levelNum).Score;
            text.PosX         = 0 * BaseGame.Get.BackBufferWidth;
            text.PosY         = 0.1f * BaseGame.Get.BackBufferHeight;
            text.UniformScale = ScaleFactor * 0.7f;
            Components.Add(text);

            text        = new TextDrawer("ui/LevelFont");
            text.Handle = BaseSprite.SpriteHandle.CENTER;
            text.Initialize(Content);
            text.Text         = "Score: " + gameplay.score.score.ToString();
            text.Colour       = Color.OrangeRed;
            text.UniformScale = ScaleFactor;
            text.PosX         = 0;
            text.PosY         = 0.175f * BaseGame.Get.BackBufferHeight;
            Components.Add(text);

            StarDrawer s = new StarDrawer(gameplay.NumStars);

            s.Initialize(Content);
            Components.Add(s);

            Donut.Initialize(Content);
            Donut.CreateFramesFromXML("misc_frames");
            Donut.CurrentFrame = "donut";
            Donut.ResetDimensions();
            Donut.UniformScale = ScaleFactor;
            Donut.PosY         = -0.06f * BaseGame.Get.BackBufferHeight;
            Donut.Colour       = Color.White * 0.4f;
            Components.Add(Donut);


            text        = new TextDrawer("ui/LevelFont");
            text.Handle = BaseSprite.SpriteHandle.CENTER;
            text.Initialize(Content);
            text.Text         = "Donuts: " + gameplay.donutScore.TargetScore;
            text.Colour       = Color.OrangeRed;
            text.UniformScale = ScaleFactor;
            text.PosX         = 0;
            text.PosY         = -0.025f * BaseGame.Get.BackBufferHeight;
            Components.Add(text);

            text        = new TextDrawer("ui/LevelFont");
            text.Handle = BaseSprite.SpriteHandle.CENTER;
            text.Initialize(Content);
            text.Text         = "Best: " + ChicksnVixensGame.Get.GetLevelState(gameplay.location, gameplay.levelNum).NumDonuts;
            text.UniformScale = ScaleFactor * 0.7f;
            text.PosX         = 0;
            text.PosY         = -0.1f * BaseGame.Get.BackBufferHeight;
            Components.Add(text);
        }
示例#9
0
        public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            base.Initialize(content);
            FarWorld world = new FarWorld();

            scene = new GameScene(world, Content);

            locationText.Initialize(Content);
            locationText.Text = "NONE";

            ArrowScroll a = new ArrowScroll();

            a.Initialize(Content);
            a.Right = false;
            scene.AddNode(a);


            a = new ArrowScroll();
            a.Initialize(Content);
            scene.AddNode(a);


            map = new MapUI();
            map.Initialize(Content);

            scene.AddNode(map);


            Components.Add(scene);


            for (int i = 0; i < ChicksnVixensGame.Get.locationOrder.Count; i++)
            {
                worldLocations.Add(ChicksnVixensGame.Get.locationOrder[i]);
            }

            BlankNess faderInner = new BlankNess();

            faderInner.Initialize(Content);

            faderInner.fullBlankity = 1.0f;
            faderInner.fadeInTimer  = 1.0f;
            faderInner.fadeSpeed    = 2.0f;
            faderInner.RaiseFlag(Flags.FADE_OUT);
            Components.Add(faderInner);


            locked = new MenuObj("ui/ui");
            locked.Initialize(content);
            locked.CreateFramesFromXML("ui/ui_frames");
            locked.CurrentFrame = "lock";
            locked.ResetDimensions();
            locked.UniformScale = ScaleFactor * 2.0f;
            locked.Position     = Vector2.Zero;
            locked.Colour       = new Color(0, 0, 0, 0);
            Components.Add(locked);

            EventManager.Get.SendImmediateEvent(new NewLocationSelected());

            string location = worldLocations[curLocation];

            Cam.TargetPos   = map.GetLocation(location);
            Cam.targetScale = 2;
            Cam.LevelSelect = false;
        }
示例#10
0
        public override void Initialize(ContentManager content)
        {
            base.Initialize(content);
            screenCamera = new LevelSelectCam();
            scene        = new Jabber.Scene.GameScene(new FarWorld(), Content);
            scene.Initialize(Content);

            BackButton b = new BackButton();

            b.Initialize(Content);
            scene.AddNode(b);

            Button movie = new Button("ui/ui");

            movie.Initialize(Content);
            movie.CreateFramesFromXML("ui/ui_frames");
            movie.CurrentFrame = "movie";
            movie.ResetDimensions();
            movie.RegularScale = ScaleFactor * 0.48f;
            movie.ScaleOnHover = movie.RegularScale * 1.1f;
            movie.UniformScale = ScaleFactor * 0.48f;
            movie.PosX         = -0.37f * BaseGame.Get.BackBufferWidth;
            movie.PosY         = -0.42f * BaseGame.Get.BackBufferHeight;
            scene.AddNode(movie);

            int numLevels = 0;

            switch (location)
            {
            case "uluru":
                numLevels = NumLevelsUluru;
                break;

            case "polar":
                numLevels = NumLevelsPolar;
                break;

            case "bavaria":
                numLevels = NumLevelsBavaria;
                break;

            case "paris":
                numLevels = NumLevelsParis;
                break;

            case "vesuvius":
                numLevels = NumLevelsVesuvius;
                break;
            }

            (screenCamera as LevelSelectCam).NumLevels = numLevels;

            /*
             #if WINDOWS_PHONE
             * using (IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication())
             * {
             *  while (true)
             *  {
             *
             *      string dir = "Content/Levels/" + location + "/Level" + (numLevels + 1) + ".xml";
             *      try
             *      {
             *          //  "Content/Levels/paris/Level2.xml";
             *
             *          XDocument.Load(dir);
             ++numLevels;
             *      }
             *      catch (Exception e)
             *      {
             *          break;
             *      }
             *  }
             * }
             #else
             * while (true)
             * {
             *  if (File.Exists("Content/Levels/" + location + "/Level" + (numLevels + 1) + ".xml"))
             ++numLevels;
             *  else
             *      break;
             * }
             #endif
             */
            while (numLevels > 0)
            {
                int currentColumn = 0;
                while (true)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        if (numLevels == 0)
                        {
                            break;
                        }
                        for (int i = 0; i < 5; i++)
                        {
                            LevelButton but = new LevelButton(i, j, currentColumn, location);
                            but.Initialize(Content);
                            scene.AddNode(but);
                            levelButtons.Add(but);
                            --numLevels;
                            if (numLevels == 0)
                            {
                                break;
                            }
                        }
                    }
                    if (numLevels == 0)
                    {
                        break;
                    }
                    ++currentColumn;
                }
            }

            blank = new BlankNess();
            blank.fullBlankity = 0.75f;
            blank.Initialize(Content);
            scene.AddNode(blank);
            blank.RaiseFlag(Flags.FADE_IN);

            Components.Add(scene);
        }
示例#11
0
        public override void Initialize(ContentManager content)
        {
            base.Initialize(content);

            blank = new BlankNess();
            blank.Initialize(Content);
            blank.RaiseFlag(Flags.FADE_IN);
            blank.fullBlankity = 0.85f;
            blank.fadeSpeed    = 4.0f;
            Components.Add(blank);

            VolumeControl v = new VolumeControl(AudioManager.MusicVolume);

            v.Initialize(Content);
            v.Name          = "MusicVol";
            v.CurrentVolume = AudioManager.MusicVolume;
            v.PosY          = 100.0f * ScaleFactor;
            Components.Add(v);


            TextDrawer text = new TextDrawer("ui/LevelFont");

            text.Initialize(Content);
            text.Text   = "Music Volume";
            text.Colour = Color.Gold;

            if (!AudioManager.IsMusicAllowed)
            {
                text.Text       = "Music Disabled";
                text.Colour     = Color.Red;
                v.Disabled      = true;
                v.CurrentVolume = 0;
            }

            text.Position     = v.Position;
            text.UniformScale = ScaleFactor;
            Components.Add(text);


            v = new VolumeControl(AudioManager.SoundVolume);
            v.Initialize(Content);
            v.Name             = "SoundVol";
            v.CurrentVolume    = AudioManager.SoundVolume;
            v.PosY             = 0 * ScaleFactor;
            v.PlayTickWhenDone = true;
            Components.Add(v);


            text = new TextDrawer("ui/LevelFont");
            text.Initialize(Content);
            text.Text         = "Sound Volume";
            text.Colour       = Color.Gold;
            text.Position     = v.Position;
            text.UniformScale = ScaleFactor;
            Components.Add(text);

            Button back = new Button("ui/ui");

            back.Initialize(Content);
            back.CreateFramesFromXML("ui/ui_frames");
            back.CurrentFrame = "quit";
            back.ResetDimensions();
            back.UniformScale     = ScaleFactor * 0.001f;
            back.RegularScale     = ScaleFactor * 0.5f;
            back.ScaleOnHover     = ScaleFactor * 0.55f;
            back.Colour           = Color.Red;
            back.Effect           = BaseSprite.SpriteEffect.FLIPHORIZONTAL;
            back.PosX             = 0.40f * BaseGame.Get.BackBufferWidth;
            back.PosY             = 0.40f * BaseGame.Get.BackBufferHeight;
            back.PlaySFXOnRelease = "Sounds/PlayStateSelect";
            Components.Add(back);


            arrowToggle = new Button("ui/ui");
            arrowToggle.CreateFramesFromXML("ui/ui_frames");
            arrowToggle.Initialize(Content);
            arrowToggle.CurrentFrame = "levelbutton";
            arrowToggle.ResetDimensions();
            arrowToggle.RegularScale = ScaleFactor * 1.5f;
            arrowToggle.ScaleOnHover = arrowToggle.RegularScale * 1.1f;
            arrowToggle.PosX         = 0 * BaseGame.Get.BackBufferWidth;
            arrowToggle.PosY         = -0.45f * BaseGame.Get.HalfBackBufferHeight;

            if (ChicksnVixensGame.Get.UseTrajectory)
            {
                arrowToggle.SetText("Trajectory", "ui/Play");
            }
            else
            {
                arrowToggle.SetText("Arrow", "ui/Play");
            }

            arrowToggle.Text.Colour      = Color.Black;
            arrowToggle.PlaySFXOnRelease = "Sounds/PlayStateSelect";
            arrowToggle.TextScaler       = 0.65f;
            arrowToggle.UniformScale     = arrowToggle.RegularScale;
            Components.Add(arrowToggle);
        }
示例#12
0
        public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            base.Initialize(content);

            BlankNess n = new BlankNess();
            n.Initialize(Content);
            n.RaiseFlag(Jabber.Flags.FADE_IN);
            n.fullBlankity = 0.25f;
            Components.Add(n);

            if (gameplay.GetRemainingFox() == 0)
            {
                MenuObj logo = new MenuObj("ui/ui");
                logo.Initialize(Content);
                logo.CreateFramesFromXML("ui/ui_frames");
                logo.CurrentFrame = "cannonfire";
                logo.ResetDimensions();
                logo.UniformScale = ScaleFactor;
                logo.PosX = 0.1f * BaseGame.Get.BackBufferWidth;

                logo.PosY = 0.1f * BaseGame.Get.BackBufferHeight;
                logo.PosY -= 0.1f * BaseGame.Get.BackBufferHeight;
                logo.Colour = Color.White * 0.5f;
                Components.Add(logo);
            }
            else
            {
                MenuObj logo = new MenuObj("ui/ui");
                logo.Initialize(Content);
                logo.CreateFramesFromXML("ui/ui_frames");
                logo.CurrentFrame = "chickenincannon";
                logo.ResetDimensions();
                logo.UniformScale = ScaleFactor;

                logo.Colour = Color.White * 0.5f;
                logo.PosY -= 0.1f * BaseGame.Get.BackBufferHeight;
                Components.Add(logo);
            }

            ThinBlackLine b = new ThinBlackLine();
            b.Initialize(Content);
            Components.Add(b);

            Button restart = new FadeInButton();
            restart.Initialize(Content);
            restart.CreateFramesFromXML("ui/ui_frames");
            restart.CurrentFrame = "restart";
            restart.ResetDimensions();
            restart.Colour = Color.LightGreen;
            restart.RegularScale = ScaleFactor / 2.0f;
            restart.ScaleOnHover = restart.RegularScale * 1.1f;
            restart.PosY = -BaseGame.Get.HalfBackBufferHeight * 0.5f;
            Components.Add(restart);

            if (gameplay.GetRemainingFox() == 0)
            {
                restart = new FadeInButton();
                restart.Initialize(Content);
                restart.CreateFramesFromXML("ui/ui_frames");
                restart.CurrentFrame = "doublearrow";
                restart.ResetDimensions();
                restart.Colour = Color.LightBlue;
                restart.RegularScale = ScaleFactor / 2.0f;
                restart.ScaleOnHover = restart.RegularScale * 1.1f;
                restart.PosX = BaseGame.Get.BackBufferWidth * 0.14f;
                restart.PosY = -BaseGame.Get.HalfBackBufferHeight * 0.5f;
                Components.Add(restart);
            }

            restart = new FadeInButton();
            restart.Initialize(Content);
            restart.CreateFramesFromXML("ui/ui_frames");
            restart.CurrentFrame = "quit";
            restart.ResetDimensions();
            restart.Colour = Color.Red * 0.8f;
            restart.RegularScale = ScaleFactor / 2.0f;
            restart.ScaleOnHover = restart.RegularScale * 1.1f;
            restart.PosX = -BaseGame.Get.BackBufferWidth * 0.14f;
            restart.PosY = -BaseGame.Get.HalfBackBufferHeight * 0.5f;
            Components.Add(restart);

            TextDrawer text = new TextDrawer("ui/LevelFont");
            text.Handle = BaseSprite.SpriteHandle.CENTER;
            text.Initialize(Content);
            text.Text = "Best: " + ChicksnVixensGame.Get.GetLevelState(gameplay.location, gameplay.levelNum).Score;
            text.PosX = 0 * BaseGame.Get.BackBufferWidth;
            text.PosY = 0.1f * BaseGame.Get.BackBufferHeight;
            text.UniformScale = ScaleFactor * 0.7f;
            Components.Add(text);

            text = new TextDrawer("ui/LevelFont");
            text.Handle = BaseSprite.SpriteHandle.CENTER;
            text.Initialize(Content);
            text.Text = "Score: " + gameplay.score.score.ToString();
            text.Colour = Color.OrangeRed;
            text.UniformScale = ScaleFactor;
            text.PosX = 0;
            text.PosY = 0.175f * BaseGame.Get.BackBufferHeight;
            Components.Add(text);

            StarDrawer s = new StarDrawer(gameplay.NumStars);
            s.Initialize(Content);
            Components.Add(s);

            Donut.Initialize(Content);
            Donut.CreateFramesFromXML("misc_frames");
            Donut.CurrentFrame = "donut";
            Donut.ResetDimensions();
            Donut.UniformScale = ScaleFactor;
            Donut.PosY = -0.06f * BaseGame.Get.BackBufferHeight;
            Donut.Colour = Color.White * 0.4f;
            Components.Add(Donut);

            text = new TextDrawer("ui/LevelFont");
            text.Handle = BaseSprite.SpriteHandle.CENTER;
            text.Initialize(Content);
            text.Text = "Donuts: " + gameplay.donutScore.TargetScore;
            text.Colour = Color.OrangeRed;
            text.UniformScale = ScaleFactor;
            text.PosX = 0;
            text.PosY = -0.025f * BaseGame.Get.BackBufferHeight;
            Components.Add(text);

            text = new TextDrawer("ui/LevelFont");
            text.Handle = BaseSprite.SpriteHandle.CENTER;
            text.Initialize(Content);
            text.Text = "Best: " + ChicksnVixensGame.Get.GetLevelState(gameplay.location, gameplay.levelNum).NumDonuts;
            text.UniformScale = ScaleFactor * 0.7f;
            text.PosX = 0;
            text.PosY = -0.1f * BaseGame.Get.BackBufferHeight;
            Components.Add(text);
        }
示例#13
0
        public override void ProcessEvent(Event ev)
        {
            base.ProcessEvent(ev);

            if (ev is MenuEvent)
            {
                if ((ev as MenuEvent).sender is Button && (ev as MenuEvent).Type == MenuEvent.EventType.RELEASE)
                {
                    string text = ((ev as MenuEvent).sender as Button).CurrentFrame;

                    if (text == "restart" && !(ScreenManager.Get.TopScreen is GameplayScreen))
                    {
                        gameplay.Restart();
                        RaiseFlag(Flags.DELETE);
                    }
                    else if (text == "quit")
                    {
                        blank = new BlankNess();
                        blank.Initialize(Content);
                        blank.fullBlankity = 1.0f;
                        blank.RaiseFlag(Flags.FADE_IN);
                        Components.Add(blank);
                    }
                    else if (text == "doublearrow")
                    {
                        blank = new BlankNess();
                        blank.Initialize(Content);
                        blank.fullBlankity = 1.0f;
                        blank.RaiseFlag(Flags.FADE_IN);
                        Components.Add(blank);
                        NextLevelLoad = true;
                    }
                }
            }
        }
示例#14
0
        void ReloadLevel()
        {
            if (scene != null)
            {
                SetLevelState();

                scene.UnloadContent();
                withChicks.UnloadContent();
            }
            //if (blank != null)
            {
                blank = null;
                LowerFlag(Jabber.Flags.FADE_OUT);
            }
            IsQuitting = false;
            Components.Clear();

            world = new FarWorld();
            world.Initialize(new Vector2(0, -15.0f));
            world.SimulationSpeedFactor = 1.0f;

            withChicks = new ChicksScene(this, world, Content);
            withChicks.DoWorldUpdateDraw = false;
            // withChicks.AddNode(cannon);

            scene = new ThisGamesScene(this, world, withChicks, Content);
            scene.DoWorldUpdateDraw = false;

            scene.AddTextureLoadInterceptor("textures\\Physical\\wood", "break", "break_frames", "wood");
            scene.AddTextureLoadInterceptor("textures\\Physical\\cement", "break", "break_frames", "cement");
            scene.AddTextureLoadInterceptor("textures\\Physical\\glass", "break", "break_frames", "glass");


            scene.AddTextureLoadInterceptor("textures\\Backgrounds\\Bavaria\\cowright", "textures/backgrounds/bavaria/bavaria", "textures/backgrounds/bavaria/bavaria_frames", "cowleft");
            scene.AddTextureLoadInterceptor("textures\\Backgrounds\\Bavaria\\cowleft", "textures/backgrounds/bavaria/bavaria", "textures/backgrounds/bavaria/bavaria_frames", "cowright");

            LevelDir = "Content/Levels/" + location + "/Level" + levelNum + ".xml";
            scene.LoadGScene(LevelDir);

            withChicks.startPos = scene.startPos;


            ChickenDrawer chickdrawer = new ChickenDrawer(withChicks, scene);

            chickdrawer.Initialize(Content);
            scene.AddNode(chickdrawer);

            ChickenBience bience = new ChickenBience(this);

            bience.Initialize(Content);
            bience.Position = scene.startPos;
            scene.AddNode(bience);

            cannon          = new Cannon(this);
            cannon.Position = scene.startPos;
            cannon.Initialize(Content);
            scene.AddNode(cannon);
            //scene.AddNode(cannon);


            if (withChicks.GetRightMaxPos() > scene.GetRightMaxPos())
            {
                rightMostPos = withChicks.GetRightMaxPos() + 200.0f;
            }
            else
            {
                rightMostPos = scene.GetRightMaxPos() + 200.0f;
            }


            leftMostPos = scene.startPos.X - 500;
            /// rightMostPos = 10000000;
            world.SetCollisionForAll(Fox.FOX_NONE_COLLISION_GROUP, false);
            world.SetCollisionForAll(BreakableBody.BodyNoneCollisionGroup, false);

            string country = scene.countryName;

            //scene.ToFire.Clear();
            if (scene.ToFire.Count == 0)
            {
                for (int i = 0; i < 4; i++)
                {
                    scene.ToFire.Add(0);
                }
            }
            //GameScene worldLoc = new GameScene(world, Content);
            //WorldLocation.CreateVesuvius(scene, (int)leftMostPos, (int)rightMostPos);

            // WorldLocation.CreatePolar(scene, (int)leftMostPos, (int)rightMostPos);

            switch (scene.countryName)
            {
            case "bavaria":
                WorldLocation.CreateBavaria(scene, (int)leftMostPos, (int)rightMostPos);
                break;

            case "paris":
                WorldLocation.CreateParis(scene, (int)leftMostPos, (int)rightMostPos);
                break;

            case "australia":
                WorldLocation.CreateAustralia(scene, (int)leftMostPos, (int)rightMostPos);
                break;

            case "polar":
                WorldLocation.CreatePolar(scene, (int)leftMostPos, (int)rightMostPos);
                break;

            case "vesuvius":
                WorldLocation.CreateVesuvius(scene, (int)leftMostPos, (int)rightMostPos);
                break;
            }

            feathers.RaiseFlag(Jabber.Flags.FADE_OUT);
            Components.Add(scene);
            Components.Add(withChicks);


            MenuObj pause = new Button("ui/ui");

            pause.Initialize(Content);
            pause.Name = "pause";
            pause.CreateFramesFromXML("ui/ui_frames");
            pause.CurrentFrame = "pause";
            pause.ResetDimensions();
            pause.UniformScale             = ScaleFactor;
            (pause as Button).RegularScale = ScaleFactor;
            (pause as Button).ScaleOnHover = (pause as Button).RegularScale * 1.4f;
            pause.PosX = -Jabber.BaseGame.Get.BackBufferWidth / 2.0f + pause.Width * pause.ScaleX;
            pause.PosY = Jabber.BaseGame.Get.BackBufferHeight / 2.0f - pause.Height * pause.ScaleY;
            Components.Add(pause);


            forceEndGame = new Button("ui/ui");
            forceEndGame.Initialize(Content);
            forceEndGame.UniformScale = 0.001f;
            forceEndGame.Name         = "forceendgame";
            forceEndGame.CreateFramesFromXML("ui/ui_frames");
            forceEndGame.CurrentFrame = "doublearrow";
            forceEndGame.ResetDimensions();
            forceEndGame.RegularScale = 0.0f; // ScaleFactor * 0.35f;
            forceEndGame.ScaleOnHover = 0.0f; // ScaleFactor * 1.1f * 0.35f;
            forceEndGame.PosX         = -Jabber.BaseGame.Get.BackBufferWidth / 2.0f + pause.Width * pause.ScaleX;
            forceEndGame.PosY         = Jabber.BaseGame.Get.BackBufferHeight / 2.0f - pause.Height * pause.ScaleY * 2.3f;
            Components.Add(forceEndGame);
            forceEndGame.RaiseFlag(Flags.PASSRENDER);


            float widthHeightToUse = pause.Width;

            pause = new Button("ui/ui");
            pause.Initialize(Content);
            pause.Name   = "restart";
            pause.Colour = Color.Green;
            pause.CreateFramesFromXML("ui/ui_frames");
            pause.CurrentFrame             = "restart";
            (pause as Button).RegularScale = ScaleFactor;
            (pause as Button).ScaleOnHover = (pause as Button).RegularScale * 1.4f;
            pause.ResetDimensions();
            pause.UniformScale = ScaleFactor;
            pause.Width        = pause.Height = widthHeightToUse;
            pause.PosX         = -Jabber.BaseGame.Get.BackBufferWidth / 2.0f + pause.Width * pause.ScaleX * 2.5f;
            pause.PosY         = Jabber.BaseGame.Get.BackBufferHeight / 2.0f - pause.Height * pause.ScaleY;
            Components.Add(pause);


            maxNumFox    = 0;
            maxNumDonuts = 0;
            for (int i = 0; i < scene.Nodes.Count; i++)
            {
                if (scene.Nodes[i] is Fox)
                {
                    ++maxNumFox;
                }
                else if (scene.Nodes[i] is Donut)
                {
                    ++maxNumDonuts;
                }
                else if (scene.Nodes[i] is DonutCase)
                {
                    maxNumDonuts += 5;
                }
            }

            donutScore = new DonutScore();
            donutScore.Initialize(Content);
            scene.AddNode(donutScore);



            score = new Score(scene, this.location, levelNum);
            score.Initialize(Content);
            scene.AddNode(score);

            AudioQueue q = new AudioQueue(this);

            q.Initialize(Content);

            scene.AddNode(q);
        }
示例#15
0
        public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            base.Initialize(content);
            FarWorld world = new FarWorld();
            scene = new GameScene(world, Content);

            locationText.Initialize(Content);
            locationText.Text = "NONE";

            ArrowScroll a = new ArrowScroll();
            a.Initialize(Content);
            a.Right = false;
            scene.AddNode(a);

            a = new ArrowScroll();
            a.Initialize(Content);
            scene.AddNode(a);

            map = new MapUI();
            map.Initialize(Content);

            scene.AddNode(map);

            Components.Add(scene);

            for (int i = 0; i < ChicksnVixensGame.Get.locationOrder.Count; i++)
            {
                worldLocations.Add(ChicksnVixensGame.Get.locationOrder[i]);
            }

            BlankNess faderInner = new BlankNess();
            faderInner.Initialize(Content);

            faderInner.fullBlankity = 1.0f;
            faderInner.fadeInTimer = 1.0f;
            faderInner.fadeSpeed = 2.0f;
            faderInner.RaiseFlag(Flags.FADE_OUT);
            Components.Add(faderInner);

            locked = new MenuObj("ui/ui");
            locked.Initialize(content);
            locked.CreateFramesFromXML("ui/ui_frames");
            locked.CurrentFrame = "lock";
            locked.ResetDimensions();
            locked.UniformScale = ScaleFactor * 2.0f;
            locked.Position = Vector2.Zero;
            locked.Colour = new Color(0, 0, 0, 0);
            Components.Add(locked);

            EventManager.Get.SendImmediateEvent(new NewLocationSelected());

            string location = worldLocations[curLocation];

            Cam.TargetPos = map.GetLocation(location);
            Cam.targetScale = 2;
            Cam.LevelSelect = false;
        }
示例#16
0
        public override void OnBackPress()
        {
            base.OnBackPress();

            EventManager.Get.SendEvent(new ScreenCancelEvent(this));
            backToMainMenu = true;
            blank = new BlankNess();
            blank.Initialize(Content);
            blank.fullBlankity = 1.0f;
            Components.Add(blank);
            blank.RaiseFlag(Flags.FADE_IN);
        }
示例#17
0
        void ReloadLevel()
        {
            if (scene != null)
            {
                SetLevelState();

                scene.UnloadContent();
                withChicks.UnloadContent();
            }
            //if (blank != null)
            {
                blank = null;
                LowerFlag(Jabber.Flags.FADE_OUT);
            }
            IsQuitting = false;
            Components.Clear();

            world = new FarWorld();
            world.Initialize(new Vector2(0, -15.0f));
            world.SimulationSpeedFactor = 1.0f;

            withChicks = new ChicksScene(this, world, Content);
            withChicks.DoWorldUpdateDraw = false;
               // withChicks.AddNode(cannon);

            scene = new ThisGamesScene(this, world, withChicks, Content);
            scene.DoWorldUpdateDraw = false;

            scene.AddTextureLoadInterceptor("textures\\Physical\\wood", "break", "break_frames", "wood");
            scene.AddTextureLoadInterceptor("textures\\Physical\\cement", "break", "break_frames", "cement");
            scene.AddTextureLoadInterceptor("textures\\Physical\\glass", "break", "break_frames", "glass");

            scene.AddTextureLoadInterceptor("textures\\Backgrounds\\Bavaria\\cowright", "textures/backgrounds/bavaria/bavaria", "textures/backgrounds/bavaria/bavaria_frames", "cowleft");
            scene.AddTextureLoadInterceptor("textures\\Backgrounds\\Bavaria\\cowleft", "textures/backgrounds/bavaria/bavaria", "textures/backgrounds/bavaria/bavaria_frames", "cowright");

            LevelDir = "Content/Levels/" + location + "/Level" + levelNum + ".xml";
            scene.LoadGScene(LevelDir);

            withChicks.startPos = scene.startPos;

            ChickenDrawer chickdrawer = new ChickenDrawer(withChicks, scene);
            chickdrawer.Initialize(Content);
            scene.AddNode(chickdrawer);

            ChickenBience bience = new ChickenBience(this);
            bience.Initialize(Content);
            bience.Position = scene.startPos;
            scene.AddNode(bience);

            cannon = new Cannon(this);
            cannon.Position = scene.startPos;
            cannon.Initialize(Content);
            scene.AddNode(cannon);
            //scene.AddNode(cannon);

            if (withChicks.GetRightMaxPos() > scene.GetRightMaxPos())
            {
                rightMostPos = withChicks.GetRightMaxPos() + 200.0f;
            }
            else
            {
                rightMostPos = scene.GetRightMaxPos() + 200.0f;
            }

            leftMostPos = scene.startPos.X - 500;
            /// rightMostPos = 10000000;
            world.SetCollisionForAll(Fox.FOX_NONE_COLLISION_GROUP, false);
            world.SetCollisionForAll(BreakableBody.BodyNoneCollisionGroup, false);

            string country = scene.countryName;
            //scene.ToFire.Clear();
            if (scene.ToFire.Count == 0)
                for (int i = 0; i < 4; i++)
                {
                    scene.ToFire.Add(0);
                }
            //GameScene worldLoc = new GameScene(world, Content);
            //WorldLocation.CreateVesuvius(scene, (int)leftMostPos, (int)rightMostPos);

               // WorldLocation.CreatePolar(scene, (int)leftMostPos, (int)rightMostPos);

            switch (scene.countryName)
            {
                case "bavaria":
                    WorldLocation.CreateBavaria(scene, (int)leftMostPos, (int)rightMostPos);
                    break;
                case "paris":
                    WorldLocation.CreateParis(scene, (int)leftMostPos, (int)rightMostPos);
                    break;
                case "australia":
                    WorldLocation.CreateAustralia(scene, (int)leftMostPos, (int)rightMostPos);
                    break;
                case "polar":
                    WorldLocation.CreatePolar(scene, (int)leftMostPos, (int)rightMostPos);
                    break;
                case "vesuvius":
                    WorldLocation.CreateVesuvius(scene, (int)leftMostPos, (int)rightMostPos);
                    break;
            }

            feathers.RaiseFlag(Jabber.Flags.FADE_OUT);
            Components.Add(scene);
            Components.Add(withChicks);

            MenuObj pause = new Button("ui/ui");
            pause.Initialize(Content);
            pause.Name = "pause";
            pause.CreateFramesFromXML("ui/ui_frames");
            pause.CurrentFrame = "pause";
            pause.ResetDimensions();
            pause.UniformScale = ScaleFactor;
            (pause as Button).RegularScale = ScaleFactor;
            (pause as Button).ScaleOnHover = (pause as Button).RegularScale * 1.4f;
            pause.PosX = -Jabber.BaseGame.Get.BackBufferWidth / 2.0f + pause.Width * pause.ScaleX;
            pause.PosY = Jabber.BaseGame.Get.BackBufferHeight / 2.0f - pause.Height * pause.ScaleY;
            Components.Add(pause);

            forceEndGame = new Button("ui/ui");
            forceEndGame.Initialize(Content);
            forceEndGame.UniformScale = 0.001f;
            forceEndGame.Name = "forceendgame";
            forceEndGame.CreateFramesFromXML("ui/ui_frames");
            forceEndGame.CurrentFrame = "doublearrow";
            forceEndGame.ResetDimensions();
            forceEndGame.RegularScale = 0.0f;// ScaleFactor * 0.35f;
            forceEndGame.ScaleOnHover = 0.0f;// ScaleFactor * 1.1f * 0.35f;
            forceEndGame.PosX = -Jabber.BaseGame.Get.BackBufferWidth / 2.0f + pause.Width * pause.ScaleX;
            forceEndGame.PosY = Jabber.BaseGame.Get.BackBufferHeight / 2.0f - pause.Height * pause.ScaleY * 2.3f;
            Components.Add(forceEndGame);
            forceEndGame.RaiseFlag(Flags.PASSRENDER);

            float widthHeightToUse = pause.Width;

            pause = new Button("ui/ui");
            pause.Initialize(Content);
            pause.Name = "restart";
            pause.Colour = Color.Green;
            pause.CreateFramesFromXML("ui/ui_frames");
            pause.CurrentFrame = "restart";
            (pause as Button).RegularScale = ScaleFactor;
            (pause as Button).ScaleOnHover = (pause as Button).RegularScale * 1.4f;
            pause.ResetDimensions();
            pause.UniformScale = ScaleFactor;
            pause.Width = pause.Height = widthHeightToUse;
            pause.PosX = -Jabber.BaseGame.Get.BackBufferWidth / 2.0f + pause.Width * pause.ScaleX * 2.5f;
            pause.PosY = Jabber.BaseGame.Get.BackBufferHeight / 2.0f - pause.Height * pause.ScaleY;
            Components.Add(pause);

            maxNumFox = 0;
            maxNumDonuts = 0;
            for (int i = 0; i < scene.Nodes.Count; i++)
            {
                if (scene.Nodes[i] is Fox)
                {
                    ++maxNumFox;
                }
                else if (scene.Nodes[i] is Donut)
                {
                    ++maxNumDonuts;
                }
                else if (scene.Nodes[i] is DonutCase)
                {
                    maxNumDonuts += 5;
                }
            }

            donutScore = new DonutScore();
            donutScore.Initialize(Content);
            scene.AddNode(donutScore);

            score = new Score(scene, this.location, levelNum);
            score.Initialize(Content);
            scene.AddNode(score);

            AudioQueue q = new AudioQueue(this);
            q.Initialize(Content);

            scene.AddNode(q);
        }
示例#18
0
        public override void ScreenFadeOut()
        {
            if (blank == null)
            {
                blank = new BlankNess();
                blank.Initialize(Content);
                blank.fullBlankity = 0.5f;
                if (IsQuitting)
                    blank.fullBlankity = 1.0f;
                blank.fadeSpeed = 2.0f;
                blank.RaiseFlag(Jabber.Flags.FADE_IN);

                base.ScreenFadeOut();
            }
        }