Пример #1
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);
        }
Пример #2
0
        public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager Content)
        {
            base.Initialize(Content);
            CreateFramesFromXML("ui/ui_frames");

            CurrentFrame = "chickenincannon";
            ResetDimensions();
            UniformScale = ScaleFactor * 0.75f;
            PosX = chickenCurrentX;
            chickenCurrentX = -BaseGame.Get.BackBufferWidth - Width * ScaleX;
            chickenPosY = -BaseGame.Get.BackBufferHeight / 2.0f + Height * ScaleY / 2.0f;
            chickenTargetX = -BaseGame.Get.BackBufferWidth / 2.0f + Width * ScaleX * 0.35f;

            int num = 1;
            float dist = 200;
            {
                Button restart = new Button("ui/ui");
                restart.Initialize(Content);
                restart.CreateFramesFromXML("ui/ui_frames");
                restart.CurrentFrame = "doublearrow";
                restart.Name = "Resume";
                restart.Colour = Color.Green;
                restart.Effect = SpriteEffect.FLIPHORIZONTAL;
                restart.ResetDimensions();
                restart.Colour = Color.LightBlue;
                restart.PosX = -BaseGame.Get.BackBufferWidth - 1 * ScaleFactor - dist * ScaleFactor * num;
                restart.RegularScale = ScaleFactor / 2.0f;
                restart.ScaleOnHover = restart.RegularScale * 1.1f;
                restart.UniformScale = restart.RegularScale * 10.0f;
                restart.PosY = -BaseGame.Get.HalfBackBufferHeight * 0.5f;
                texts.Add(new MenuInst(restart));
            }
            ++num;
            dist = 1000;
            {
                Button restart = new Button("ui/ui");
                restart.Initialize(Content);
                restart.CreateFramesFromXML("ui/ui_frames");
                restart.CurrentFrame = "restart";
                restart.Name = "Restart";
                restart.ResetDimensions();
                restart.Colour = Color.LightGreen;
                restart.PosX = -BaseGame.Get.BackBufferWidth - 1 * ScaleFactor - dist * ScaleFactor * num;
                restart.RegularScale = ScaleFactor / 2.0f;
                restart.ScaleOnHover = restart.RegularScale * 1.1f;
                restart.UniformScale = restart.RegularScale * 60.0f;
                restart.PosY = -BaseGame.Get.HalfBackBufferHeight * 0.5f;
                texts.Add(new MenuInst(restart));
            }
            ++num;
            dist = 2000;
            {
                Button restart = new Button("ui/ui");
                restart.Initialize(Content);
                restart.CreateFramesFromXML("ui/ui_frames");
                restart.CurrentFrame = "settings";
                restart.Colour = Color.Red;
                restart.Name = "Settings";
                restart.PlaySFXOnRelease = "Sounds/PlayStateSelect";
                restart.ResetDimensions();
                restart.Colour = Color.White;
                restart.PosX = -BaseGame.Get.BackBufferWidth - 1 * ScaleFactor - dist * ScaleFactor * num;
                restart.RegularScale = ScaleFactor / 2.0f;
                restart.ScaleOnHover = restart.RegularScale * 1.1f;
                restart.UniformScale = restart.RegularScale * 85.0f;
                restart.PosY = -BaseGame.Get.HalfBackBufferHeight * 0.5f;
                texts.Add(new MenuInst(restart));
            }
            ++num;
            dist = 3000;
            {
                Button restart = new Button("ui/ui");
                restart.Initialize(Content);
                restart.CreateFramesFromXML("ui/ui_frames");
                restart.CurrentFrame = "quit";
                restart.PlaySFXOnRelease = "Sounds/PlayStateSelect";
                restart.Name = "Quit";
                restart.ResetDimensions();
                restart.Colour = Color.Red;
                restart.PosX = -BaseGame.Get.BackBufferWidth - 1 * ScaleFactor - dist * ScaleFactor * num;
                restart.RegularScale = ScaleFactor / 2.0f;
                restart.ScaleOnHover = restart.RegularScale * 1.1f;
                restart.UniformScale = restart.RegularScale * 220.0f;
                restart.PosY = -BaseGame.Get.HalfBackBufferHeight * 0.5f;
                texts.Add(new MenuInst(restart));
            }
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #5
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);
        }