Ejemplo n.º 1
0
        public static void UnloadContent()
        {
            UnloadContentOnAllScreens();

            if (m_spriteBatch != null)
            {
                m_spriteBatch.Dispose();
                m_spriteBatch = null;
            }

            if (m_fullscreenQuad != null)
            {
                m_fullscreenQuad.Dispose();
                m_fullscreenQuad = null;
            }

            MyGuiObjectBuilderHelpers.UnloadContent();
            MyGuiSmallShipHelpers.UnloadContent();
            MyGuiAsteroidHelpers.UnloadContent();
            MyGuiLargeShipHelpers.UnloadContent();
            MyGuiSmallDebrisHelpers.UnloadContent();
            MyGuiPrefabHelpers.UnloadContent();
            MyGuiContextMenuHelpers.UnloadContent();
            MyGuiInfluenceSphereHelpers.UnloadContent();
            MyGuiEditorVoxelHandHelpers.UnloadContent();
            MyGuiGameControlsHelpers.UnloadContent();
            MyGuiEventHelpers.UnloadContent();
            MyGuiInventoryTemplateTypeHelpers.UnloadContent();

            //m_backgroundInterferenceSpriteVideoPlayer.UnloadContent();
            //m_backgroundInterferenceSpriteVideoPlayer = null;
            if (m_dialoguePortraitNoiseVideoPlayer != null)
            {
                m_dialoguePortraitNoiseVideoPlayer.UnloadContent();
                m_dialoguePortraitNoiseVideoPlayer = null;
            }

            BlendState.UnloadContent();
            RasterizerState.UnloadContent();
            SamplerState.UnloadContent();
            DepthStencilState.UnloadContent();

            MyVertexFormats.UnloadContent();

            //m_spriteEffect.Dispose();
            //m_spriteEffect = null;
        }
Ejemplo n.º 2
0
        public static void LoadContent()
        {
            MyMwcLog.WriteLine("MyGuiManager.LoadContent() - START");
            MyMwcLog.IncreaseIndent();

            MyVertexFormats.LoadContent(MyMinerGame.Static.GraphicsDevice);

            BlendState.LoadContent(MyMinerGame.Static.GraphicsDevice);
            RasterizerState.LoadContent(MyMinerGame.Static.GraphicsDevice);
            SamplerState.LoadContent(MyMinerGame.Static.GraphicsDevice);
            DepthStencilState.LoadContent(MyMinerGame.Static.GraphicsDevice);

            m_blankTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Blank", flags: TextureFlags.IgnoreQuality);
            //m_textboxSmallTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\TextboxSmall", flags: TextureFlags.IgnoreQuality);
            m_textboxMediumTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\TextboxMedium", flags: TextureFlags.IgnoreQuality);
            //m_textboxLargeTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\TextboxLarge", flags: TextureFlags.IgnoreQuality);
            m_buttonTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Button", flags: TextureFlags.IgnoreQuality);
            m_buttonTextureBg = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ButtonBg", flags: TextureFlags.IgnoreQuality);
            m_searchButtonTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\SearchButton", flags: TextureFlags.IgnoreQuality);
            m_smallButtonTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\SmallButton", flags: TextureFlags.IgnoreQuality);

            m_travelButtonTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\TravelButton", flags: TextureFlags.IgnoreQuality);

            m_comboboxMediumTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ComboboxMedium", flags: TextureFlags.IgnoreQuality);

            m_comboboxMediumItemTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ComboboxMediumItemTexture", flags: TextureFlags.IgnoreQuality);
            //m_comboboxMediumSelectedTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ComboboxMediumSelectedTexture", flags: TextureFlags.IgnoreQuality);
            m_comboboxMediumTopTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ComboboxMediumTopTexture", flags: TextureFlags.IgnoreQuality);
            m_comboboxMediumBottomTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ComboboxMediumBottomTexture", flags: TextureFlags.IgnoreQuality);

            m_scrollbarSlider = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ScrollbarSlider", flags: TextureFlags.IgnoreQuality);
            m_horizontalScrollbarSlider = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\HorizontalScrollbarSlider", flags: TextureFlags.IgnoreQuality);
            m_mouseCursorBitmap = System.Drawing.Bitmap.FromFile(Path.Combine(MyMinerGame.Static.RootDirectory, "Textures\\GUI\\MouseCursorHW.png")) as System.Drawing.Bitmap;
            SetHWCursorBitmap(m_mouseCursorBitmap);
            m_mouseCursorArrowTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\MouseCursor", flags: TextureFlags.IgnoreQuality);
            SetMouseCursorTexture(m_mouseCursorArrowTexture);
            m_mouseCursorHandTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\MouseCursorHand", flags: TextureFlags.IgnoreQuality);
            m_lockedButtonTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\LockedButton", flags: TextureFlags.IgnoreQuality);
            m_lockedInventoryItemTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\LockedInventoryButton", flags: TextureFlags.IgnoreQuality);
            m_sliderTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Slider", flags: TextureFlags.IgnoreQuality);
            m_sliderControlTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\SliderControl", flags: TextureFlags.IgnoreQuality);
            //m_configWheelBackground = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ConfigWheelBackground", flags: TextureFlags.IgnoreQuality);
            //m_configWheelHover = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ConfigWheelHover", flags: TextureFlags.IgnoreQuality);
            //m_configWheelBackgroundSmall = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ConfigWheelSmallBackground", flags: TextureFlags.IgnoreQuality);
            m_randomTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\RandomTexture", flags: TextureFlags.IgnoreQuality);
            m_checkBoxOnTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\CheckboxOn", flags: TextureFlags.IgnoreQuality);
            m_checkBoxOffTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\CheckboxOff", flags: TextureFlags.IgnoreQuality);
            m_comboboxSelectedTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ComboboxSelected", flags: TextureFlags.IgnoreQuality);
            m_ammoToolTipTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\AmmoToolTip", flags: TextureFlags.IgnoreQuality);
            m_ammoSelectLowBackgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\LowerBackground", flags: TextureFlags.IgnoreQuality);
            m_ammoSelectKeyConfirmBorderTexture = MyTextureManager.GetTexture<MyTexture2D>("textures\\GUI\\AmmoSelectionKeyConfirm", flags: TextureFlags.IgnoreQuality);
            m_fogTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\fog", flags: TextureFlags.IgnoreQuality);
            m_fogSmallTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\FogSmall", flags: TextureFlags.IgnoreQuality);
            m_fogSquareTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\fogSquare", flags: TextureFlags.IgnoreQuality);
            m_textureInterlanced = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackGroundScreen\\InterlaceTextureOverlap", flags: TextureFlags.IgnoreQuality);
            m_expandTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Expand", flags: TextureFlags.IgnoreQuality);
            m_collapseTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Collapse", flags: TextureFlags.IgnoreQuality);
            m_toolbarButton = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Toolbar\\ToolbarButton", flags: TextureFlags.IgnoreQuality);
            m_toolbarButtonHover = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Toolbar\\ToolbarButtonHover", flags: TextureFlags.IgnoreQuality);
            m_progressBarTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ProgressBar", flags: TextureFlags.IgnoreQuality);


            m_journalFilterAll = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Journal\\JournalFilterAll", flags: TextureFlags.IgnoreQuality);
            m_journalFilterGlobalEvents = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Journal\\JournalFilterGlobalEvents", flags: TextureFlags.IgnoreQuality);
            m_journalFilterMissions = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Journal\\JournalFilterMissions", flags: TextureFlags.IgnoreQuality);
            m_journalFilterStory = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Journal\\JournalFilterStory", flags: TextureFlags.IgnoreQuality);
            m_journalLine = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Journal\\line", flags: TextureFlags.IgnoreQuality);
            m_journalSelected = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Journal\\select", flags: TextureFlags.IgnoreQuality);
            m_journalCloseButton = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Journal\\CloseButton", flags: TextureFlags.IgnoreQuality);


            //m_inventoryScreenBackgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\InventoryScreenBackground", flags: TextureFlags.IgnoreQuality);
            m_inventoryButton = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\Button", flags: TextureFlags.IgnoreQuality);
            m_inventoryButtonBg = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\ButtonBg", flags: TextureFlags.IgnoreQuality);
            m_inventoryButtonTakeAll = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\ButtonTakeAll", flags: TextureFlags.IgnoreQuality);
            m_inventoryButtonTakeAllBg = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\ButtonTakeAllBg", flags: TextureFlags.IgnoreQuality);


            m_inventoryFilterSortAllOff = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortAllOff", flags: TextureFlags.IgnoreQuality);
            m_inventoryFilterSortAllOn = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortAllOn", flags: TextureFlags.IgnoreQuality);
            m_inventoryFilterSortConsumablesOff = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortConsumablesOff", flags: TextureFlags.IgnoreQuality);
            m_inventoryFilterSortConsumablesOn = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortConsumablesOn", flags: TextureFlags.IgnoreQuality);
            m_inventoryFilterSortEquipmentOff = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortEquipmentOff", flags: TextureFlags.IgnoreQuality);
            m_inventoryFilterSortEquipmentOn = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortEquipmentOn", flags: TextureFlags.IgnoreQuality);
            m_inventoryFilterSortGodsOff = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortGodsOff", flags: TextureFlags.IgnoreQuality);
            m_inventoryFilterSortGodsOn = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortGodsOn", flags: TextureFlags.IgnoreQuality);
            m_inventoryFilterSortOresOff = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortOresOff", flags: TextureFlags.IgnoreQuality);
            m_inventoryFilterSortOresOn = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortOresOn", flags: TextureFlags.IgnoreQuality);
            m_inventoryFilterSortWeaponsOff = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortWeaponsOff", flags: TextureFlags.IgnoreQuality);
            m_inventoryFilterSortWeaponsOn = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\SortWeaponsOn", flags: TextureFlags.IgnoreQuality);
            m_inventoryPreviousShip = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\PreviousShip", flags: TextureFlags.IgnoreQuality);
            m_inventoryNextShip = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\InventoryScreen\\NextShip", flags: TextureFlags.IgnoreQuality);


            //hub controls
            //m_hubBackground = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\HubBackground", flags: TextureFlags.IgnoreQuality);
            m_hubItemBackground = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\HubItemBackground", flags: TextureFlags.IgnoreQuality);
            m_hubButton = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\HubButton", flags: TextureFlags.IgnoreQuality);
            m_hubButtonBg = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\HubButtonBg", flags: TextureFlags.IgnoreQuality);
            m_MessageButton = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\MessageBoxButton", flags: TextureFlags.IgnoreQuality);

            //m_backgroundInterferenceSpriteVideoPlayer = new MySpriteListVideoPlayer("BackgroundInterferenceVid", MyMinerGame.GraphicsDeviceManager.GraphicsDevice,
            //   20, 0, 92);
            //m_backgroundInterferenceSpriteVideoPlayer.LoadContent();
            m_toltipLeft = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\TooltipLeft", flags: TextureFlags.IgnoreQuality);
            m_toltipBody = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\TooltipBody", flags: TextureFlags.IgnoreQuality);
            m_toltipRight = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\TooltipRight", flags: TextureFlags.IgnoreQuality);


            m_dialoguePortraitNoiseVideoPlayer = new MySpriteListVideoPlayer("DialoguePortraitNoise", MyMinerGame.GraphicsDeviceManager.GraphicsDevice, 10, 0, 9);
            m_dialoguePortraitNoiseVideoPlayer.LoadContent();

            m_backgroundScreenTextures = new List<MyGuiTextureScreen>
            {
                new MyGuiTextureScreen("Textures\\GUI\\BackgroundScreen\\Screen", 811, 811), 
                new MyGuiTextureScreen("Textures\\GUI\\BackgroundScreen\\ScreenWide", 811, 410), 
                new MyGuiTextureScreen("Textures\\GUI\\BackgroundScreen\\ScreenTall", 411, 810)
            };
            m_dialogueFriendBackgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\DialogueFriend", flags: TextureFlags.IgnoreQuality, loadingMode: LoadingMode.LazyBackground);
            m_dialogueEnemyBackgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\DialogueEnemy", flags: TextureFlags.IgnoreQuality, loadingMode: LoadingMode.LazyBackground);
            m_dialogueNeutralBackgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\DialogueNeutral", flags: TextureFlags.IgnoreQuality, loadingMode: LoadingMode.LazyBackground);
            //m_SelectEditorbackground = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\SelectEditorBakground", flags: TextureFlags.IgnoreQuality);
            //m_SandboxBackground = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\SandBoxbackground", flags: TextureFlags.IgnoreQuality);

            MyTextureManager.OverrideLoadingMode = LoadingMode.LazyBackground;
            MyGuiObjectBuilderHelpers.LoadContent();
            MyGuiSmallShipHelpers.LoadContent();
            MyGuiAsteroidHelpers.LoadContent();
            MyGuiLargeShipHelpers.LoadContent();
            MyGuiSmallDebrisHelpers.LoadContent();
            MyGuiPrefabHelpers.LoadContent();
            MyGuiContextMenuHelpers.LoadDefaultEditorContent();
            MyGuiInfluenceSphereHelpers.LoadContent();
            MyGuiEditorVoxelHandHelpers.LoadContent();
            MyGuiGameControlsHelpers.LoadContent();
            MyGuiEventHelpers.LoadContent();
            MyGuiInventoryTemplateTypeHelpers.LoadContent();
            MyTextureManager.OverrideLoadingMode = null;


            /*switch (MyConfig.Language)
            {
                case MyLanguagesEnum.Cesky:
                    m_fontCaptions = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\Captions\\Captions-de.xml");
                    m_fontGuiImpactLarge = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\GuiImpactLarge\\GuiImpactLarge-uni.xml");
                    break;
                case MyLanguagesEnum.Deutsch:
                    m_fontCaptions = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\Captions\\Captions-de.xml");
                    m_fontGuiImpactLarge = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\GuiImpactLarge\\GuiImpactLarge-uni.xml");
                    break;
                case MyLanguagesEnum.Slovensky:
                    m_fontCaptions = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\Captions\\Captions-de.xml");
                    m_fontGuiImpactLarge = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\GuiImpactLarge\\GuiImpactLarge-uni.xml");
                    break;
                case MyLanguagesEnum.Espanol:
                    m_fontCaptions = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\Captions\\Captions-de.xml");
                    m_fontGuiImpactLarge = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\GuiImpactLarge\\GuiImpactLarge-uni.xml");
                    break;
                case MyLanguagesEnum.France:
                    m_fontCaptions = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\Captions\\Captions-de.xml");
                    m_fontGuiImpactLarge = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\GuiImpactLarge\\GuiImpactLarge-uni.xml");
                    break;
                case MyLanguagesEnum.Italian:
                    m_fontCaptions = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\Captions\\Captions-de.xml");
                    m_fontGuiImpactLarge = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\GuiImpactLarge\\GuiImpactLarge-uni.xml");
                    break;
                case MyLanguagesEnum.English:
                default:
                    m_fontCaptions = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\Captions\\Captions.xml");
                    m_fontGuiImpactLarge = new MyGuiFont((MyCustomContentManager)MyMinerGame.Static.Content, "Fonts\\GuiImpactLarge\\GuiImpactLarge.xml");
                    break;
            }*/

            m_fontMinerWarsRed = new MyGuiFont("Fonts\\MinerWars-red\\MinerWars.xml");
            m_fontMinerWarsRed.Spacing = 1;
            m_fontMinerWarsGreen = new MyGuiFont("Fonts\\MinerWars-green\\MinerWars.xml");
            m_fontMinerWarsGreen.Spacing = 1;
            m_fontMinerWarsBlue = new MyGuiFont("Fonts\\MinerWars-blue\\MinerWars.xml");
            m_fontMinerWarsBlue.Spacing = 1;
            m_fontMinerWarsWhite = new MyGuiFont("Fonts\\MinerWars-white\\MinerWars.xml");
            m_fontMinerWarsWhite.Spacing = 1;

            if (m_input != null)
            {
                m_input.Dispose();
                m_input = null;

            }
            if (m_input == null)
                m_input = new MyGuiInput();

            MouseCursorPosition = new Vector2(0.5f, 0.5f);// new MyMwcVector2Int(MyMinerGame.ScreenSizeHalf.X, MyMinerGame.ScreenSizeHalf.Y);

            m_fullscreenQuad = new MyFullScreenQuad();
            //m_spriteBatchOwn = new MyGuiSpriteBatchOwn();
            m_spriteBatch = new SpriteBatch(MyMinerGame.Static.GraphicsDevice, "GuiManager");
            m_spriteBatchUsageCount = 0;

            //m_spriteEffect = new MyEffectSpriteBatchOriginal();

            //load/reload content of all screens in first call any screens should not exist
            foreach (MyGuiScreenBase screen in m_screens)
            {
                screen.LoadContent();
            }

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyGuiManager.LoadContent() - END");
        }