Beispiel #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public MainMenuScreen()
        {
            TransitionOnTime = TimeSpan.FromSeconds(0.5f);
            TransitionOffTime = TimeSpan.FromSeconds(1.0f);

            this.spriteMain = new GameSprite2D();
            this.spriteButton = new GameSprite2D();
        }
Beispiel #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public LoadingScreen()
        {
            TransitionOnTime = TimeSpan.FromSeconds(0.5f);
            TransitionOffTime = TimeSpan.FromSeconds(0.5f);

            this.spriteBG = new GameSprite2D();
            this.spriteLoadingText = new GameSprite2D();
        }
Beispiel #3
0
        /// <summary>
        /// loads graphics contents.  This uses the shared ContentManager
        /// provided by the ScreenManager, so the content will remain loaded forever.
        /// Whenever a subsequent MessageBoxScreen tries to load this same content,
        /// it will just get back another reference to the already loaded instance.
        /// </summary>
        public override void LoadContent()
        {
            spriteBox = new GameSprite2D();
            spriteBox.Create(1, "Textures/Text_Window");

            refScene2DTopRoot.AddChild(spriteBox);
            spriteObjBox = spriteBox.AddSprite(0, "MessageBox frame");


            textMessageItem = 
                new TextItem(messageFont, message, 0, 0, new Color(136, 217, 224));
            FrameworkCore.TextManager.AddText(textMessageItem);

            textControlsItem = 
                new TextItem(messageFont, controls, 0, 0,Color.White);
            FrameworkCore.TextManager.AddText(textControlsItem);

            //  Resizing all images
            OnSize();
        }
Beispiel #4
0
        public override void UnloadContent()
        {
            this.refScene2DTopRoot.RemoveChild(this.spriteBox, false);
            if (FrameworkCore.TextManager != null)
            {
                FrameworkCore.TextManager.RemoveText(this.textControlsItem);
                FrameworkCore.TextManager.RemoveText(this.textMessageItem);
            }

            this.spriteBox = null;
            this.textMessageItem = null;
            this.textControlsItem = null;
        }
Beispiel #5
0
        /// <summary>
        /// Constructs a new screen manager component.
        /// </summary>
        public GameScreenManager(Game game)
            : base(game)
        {
            scene2DFadeRoot = FrameworkCore.Scene2DFadeLayer;
            fadeSprite = new GameSprite2D();

            scene2DFadeRoot.AddChild(fadeSprite);

            //  Controller
            screenInput[0] = new GameScreenInput(PlayerIndex.One);
            screenInput[1] = new GameScreenInput(PlayerIndex.Two);
            screenInput[2] = new GameScreenInput(PlayerIndex.Three);
            screenInput[3] = new GameScreenInput(PlayerIndex.Four);
        }
Beispiel #6
0
        /// <summary>
        /// creates the Hud image which is communally used in a stage and 
        /// configures the Hud information.
        /// </summary>
        public virtual void CreateHud()
        {
            int viewCount = FrameworkCore.CurrentCamera.Count;

            //  Hud Aiming
            {
                int spriteCount = 0;

                this.spriteHudAiming = new GameSprite2D();
                this.spriteHudAiming.Create(2 * viewCount, "Textures/Hud_Aiming");

                this.refSceneHudRoot.AddChild(this.spriteHudAiming);

                spriteObjHudAimingSite = new Sprite2DObject[viewCount];
                spriteObjHudAlertSite = new Sprite2DObject[viewCount];

                for (int i = 0; i < viewCount; i++)
                {
                    //  Aiming Site
                    this.spriteObjHudAimingSite[i] =
                    this.spriteHudAiming.AddSprite(spriteCount++, "Firing site");

                    //  Alert Site
                    this.spriteObjHudAlertSite[i] =
                        this.spriteHudAiming.AddSprite(spriteCount++, "Alert site");

                    this.spriteObjHudAlertSite[i].Visible = false;
                }
            }

            // Hud State (Armor and ammo)
            {
                int spriteCount = 0;

                this.spriteHudState = new GameSprite2D();
                this.spriteHudState.Create(8 * viewCount, "Textures/Hud1");

                this.refSceneHudRoot.AddChild(this.spriteHudState);

                Color textColor = new Color(136, 217, 224);

                this.spriteObjHudArmorFrame = new Sprite2DObject[viewCount];
                this.spriteObjHudArmorState = new Sprite2DObject[viewCount];
                this.spriteObjHudWeaponWindow = new Sprite2DObject[viewCount];
                this.spriteObjHudBoosterCoolTime = new Sprite2DObject[viewCount];
                this.spriteObjHudPickupCoolTime = new Sprite2DObject[viewCount];
                this.spriteObjHudWeaponMachineGun = new Sprite2DObject[viewCount];
                this.spriteObjHudWeaponShotgun = new Sprite2DObject[viewCount];
                this.spriteObjHudWeaponHandgun = new Sprite2DObject[viewCount];
                this.textHudCurrentAmmo = new GameText[viewCount];
                this.textHudRemainAmmo = new GameText[viewCount];
                this.textPickup = new GameText[viewCount];
                this.textControlHelper = new GameText[viewCount, 2];

                for (int i = 0; i < viewCount; i++)
                {
                    //  Armor frame   
                    this.spriteObjHudArmorFrame[i] =
                            this.spriteHudState.AddSprite(spriteCount++, "Armor Frame");

                    //  Armor state bar
                    this.spriteObjHudArmorState[i] =
                            this.spriteHudState.AddSprite(spriteCount++, "Armor State");

                    //  Weapon window
                    this.spriteObjHudWeaponWindow[i] =
                            this.spriteHudState.AddSprite(spriteCount++, "Weapon Ammo");

                    //  Booster Cool Time
                    this.spriteObjHudBoosterCoolTime[i] =
                        this.spriteHudState.AddSprite(spriteCount++,
                        "Booster Cool Time");

                    //  Display message for pickup items
                    this.textPickup[i] = new GameText(this.fontHud,
                                                string.Format("Text pick up {0}", i),
                                                0, 0, hudPickupColor);

                    this.textPickup[i].Visible = false;

                    this.refSceneHudRoot.AddChild(this.textPickup[i]);

                    //  Pickup cool time bar
                    this.spriteObjHudPickupCoolTime[i] = this.spriteHudState.AddSprite(
                                            spriteCount++, "Pickup Cool Time Bar");

                    this.spriteObjHudPickupCoolTime[i].Color = new Color(200, 200, 255);
                    this.spriteObjHudPickupCoolTime[i].Visible = false;

                    //  MachineGun Image
                    this.spriteObjHudWeaponMachineGun[i] =
                        this.spriteHudState.AddSprite(spriteCount++,
                        "MachineGun Image");

                    this.spriteObjHudWeaponMachineGun[i].Visible = false;

                    //  Shotgun Image
                    this.spriteObjHudWeaponShotgun[i] =
                            this.spriteHudState.AddSprite(spriteCount++,
                            "Shotgun Image");

                    this.spriteObjHudWeaponShotgun[i].Visible = false;

                    //  Handgun Image
                    this.spriteObjHudWeaponHandgun[i] =
                            this.spriteHudState.AddSprite(spriteCount++,
                            "Handgun Image");

                    this.spriteObjHudWeaponHandgun[i].Visible = false;

                    // Weapon Infomation 
                    this.textHudCurrentAmmo[i] =
                                new GameText(this.fontHud, "0", 0, 0, textColor);

                    this.refSceneHudRoot.AddChild(this.textHudCurrentAmmo[i]);

                    this.textHudRemainAmmo[i] =
                                new GameText(this.fontHud, "0", 0, 0, textColor);

                    this.refSceneHudRoot.AddChild(this.textHudRemainAmmo[i]);

                    //  Control helper on screen
                    for (int column = 0; column < 2; column++)
                    {
                        this.textControlHelper[i, column] = new GameText(
                                                this.fontHud,
                                                String.Empty,
                                                0, 0,
                                                Color.White);

                        this.refSceneHudRoot.AddChild(this.textControlHelper[i, column]);
                    }
                }

                SetVisibleHud(true);
            }

            //  Mission Result
            {
                this.spriteMission = new GameSprite2D();
                this.spriteMission.Create(2, "Textures/Mission");

                this.refSceneMissionRoot.AddChild(this.spriteMission);

                //  Mission Complete
                this.spriteObjMissionClear =
                                    this.spriteMission.AddSprite(0, "Mission Complete");

                this.spriteObjMissionClear.Visible = false;


                //  Mission Failed
                this.spriteObjMissionFailed =
                                    this.spriteMission.AddSprite(1, "Mission Failed");

                this.spriteObjMissionFailed.Visible = false;
            }

            //  Calculate all image size
            OnSize();
        }