コード例 #1
0
        public static void LoadStaticContent(string contentManagerName)
        {
            if (string.IsNullOrEmpty(contentManagerName))
            {
                throw new System.ArgumentException("contentManagerName cannot be empty or null");
            }
            // Set the content manager for Gum
            var contentManagerWrapper = new FlatRedBall.Gum.ContentManagerWrapper();

            contentManagerWrapper.ContentManagerName = contentManagerName;
            RenderingLibrary.Content.LoaderManager.Self.ContentLoader = contentManagerWrapper;
            // Access the GumProject just in case it's async loaded
            var throwaway = GlobalContent.GumProject;

            #if DEBUG
            if (contentManagerName == FlatRedBall.FlatRedBallServices.GlobalContentManager)
            {
                HasBeenLoadedWithGlobalContentManager = true;
            }
            else if (HasBeenLoadedWithGlobalContentManager)
            {
                throw new System.Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
            }
            #endif
            Terrain = FlatRedBall.TileGraphics.LayeredTileMap.FromTiledMapSave("content/screens/gamescreen/terrain.tmx", contentManagerName);
            FlatRedBall.Gum.GumIdb.UpdateDisplayToMainFrbCamera(); GameScreenGum = GumRuntime.ElementSaveExtensions.CreateGueForElement(Gum.Managers.ObjectFinder.Self.GetScreen(FlatRedBall.IO.FileManager.RemoveExtension(FlatRedBall.IO.FileManager.RemovePath("content/gumproject/screens/gamescreengum.gusx"))), true);
            Pirates.Entities.Boat.LoadStaticContent(contentManagerName);
            Pirates.Entities.Player.LoadStaticContent(contentManagerName);
            Pirates.Entities.UI.SpeedMeter.LoadStaticContent(contentManagerName);
            CustomLoadStaticContent(contentManagerName);
        }
コード例 #2
0
        public override void Destroy()
        {
            base.Destroy();
            LoadingScreenGum.RemoveFromManagers();
            LoadingScreenGum = null;

            FlatRedBall.FlatRedBallServices.Game.TargetElapsedTime = TimeSpan.FromSeconds(mSavedTargetElapedTime);
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
コード例 #3
0
        public override void Destroy()
        {
            base.Destroy();
            MainMenuScreenGum.RemoveFromManagers();
            MainMenuScreenGum = null;

            if (ButtonPlay != null)
            {
                ButtonPlay.RemoveFromManagers();
            }
            if (ButtonSettings != null)
            {
                ButtonSettings.RemoveFromManagers();
            }
            if (ButtonQuit != null)
            {
                ButtonQuit.RemoveFromManagers();
            }
            if (ButtonBack != null)
            {
                ButtonBack.RemoveFromManagers();
            }
            if (MainContainer != null)
            {
                MainContainer.RemoveFromManagers();
            }
            if (SettingsContainer != null)
            {
                SettingsContainer.RemoveFromManagers();
            }
            if (SliderVolume != null)
            {
                SliderVolume.RemoveFromManagers();
            }
            if (TextVolumeLevel != null)
            {
                TextVolumeLevel.RemoveFromManagers();
            }
            if (ButtonSwitchFullscreen != null)
            {
                ButtonSwitchFullscreen.RemoveFromManagers();
            }
            if (ButtonApply != null)
            {
                ButtonApply.RemoveFromManagers();
            }
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
コード例 #4
0
 public ButtonForms(Gum.Wireframe.GraphicalUiElement visual)
     : base(visual)
 {
     CustomInitialize();
 }
コード例 #5
0
        public override void Destroy()
        {
            base.Destroy();
            Factories.DockFactory.Destroy();
            Factories.CannonballFactory.Destroy();
            Factories.ExplosionFactory.Destroy();
            Factories.BulletFactory.Destroy();
            Factories.SkeletonFactory.Destroy();
            Terrain.Destroy();
            Terrain = null;
            GameScreenGum.RemoveFromManagers();
            GameScreenGum = null;

            BoatList.MakeOneWay();
            DockList.MakeOneWay();
            CannonballList.MakeOneWay();
            ExplosionList.MakeOneWay();
            BulletList.MakeOneWay();
            EnemyList.MakeOneWay();
            if (PlayerBoat != null)
            {
                PlayerBoat.Destroy();
                PlayerBoat.Detach();
            }
            for (int i = BoatList.Count - 1; i > -1; i--)
            {
                BoatList[i].Destroy();
            }
            for (int i = DockList.Count - 1; i > -1; i--)
            {
                DockList[i].Destroy();
            }
            if (PlayerInstance != null)
            {
                PlayerInstance.Destroy();
                PlayerInstance.Detach();
            }
            if (UIBoatLayer != null)
            {
                FlatRedBall.SpriteManager.RemoveLayer(UIBoatLayer);
            }
            if (SandCollision != null)
            {
                SandCollision.Visible = false;
            }
            if (WaterCollision != null)
            {
                WaterCollision.Visible = false;
            }
            if (DirtCollision != null)
            {
                DirtCollision.Visible = false;
            }
            if (HulkCollision != null)
            {
                HulkCollision.Visible = false;
            }
            if (RockCollision != null)
            {
                RockCollision.Visible = false;
            }
            for (int i = CannonballList.Count - 1; i > -1; i--)
            {
                CannonballList[i].Destroy();
            }
            if (SpeedMeter != null)
            {
                SpeedMeter.Destroy();
                SpeedMeter.Detach();
            }
            for (int i = ExplosionList.Count - 1; i > -1; i--)
            {
                ExplosionList[i].Destroy();
            }
            if (ButtonPistol != null)
            {
                ButtonPistol.RemoveFromManagers();
            }
            if (ButtonShotgun != null)
            {
                ButtonShotgun.RemoveFromManagers();
            }
            for (int i = BulletList.Count - 1; i > -1; i--)
            {
                BulletList[i].Destroy();
            }
            for (int i = EnemyList.Count - 1; i > -1; i--)
            {
                EnemyList[i].Destroy();
            }
            if (InventoryBar != null)
            {
                InventoryBar.RemoveFromManagers();
            }
            if (InventoryGui != null)
            {
                InventoryGui.RemoveFromManagers();
            }
            BoatList.MakeTwoWay();
            DockList.MakeTwoWay();
            CannonballList.MakeTwoWay();
            ExplosionList.MakeTwoWay();
            BulletList.MakeTwoWay();
            EnemyList.MakeTwoWay();
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
コード例 #6
0
 public GameScreenGumForms(Gum.Wireframe.GraphicalUiElement visual)
 {
     Visual = visual;
     ReactToVisualChanged();
     CustomInitialize();
 }