예제 #1
0
        }   // end of Render()

        #endregion

        #region Internal

        public void LoadContent(bool immediate)
        {
            titleBarTexture   = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\GridElements\BlueTextTileWide");
            dialogBodyTexture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\LoadLevel\PopupFrame");

            // Get thumbnails for levels.
            foreach (NewWorldLevel level in levels)
            {
                level.ThumbnailTexture = Storage4.TextureLoad(level.ThumbnailName);
            }
        }
        }   // end of SetXButton()

        public override void Update(ref Matrix parentMatrix)
        {
            // Check for input but only if selected.
            if (selected)
            {
                GamePadInput pad = GamePadInput.GetGamePad0();

                if (Actions.Select.WasPressed)
                {
                    Actions.Select.ClearAllWasPressedState();

                    onSetNextLevel();
                }

                if (Actions.X.WasPressed)
                {
                    Actions.X.ClearAllWasPressedState();

                    NextLevel = null;
                    if (onClear != null)
                    {
                        onClear();
                    }
                }
            }

            //load thumbnail if it hasn't loaded yet
            if (nextLevel != null && !nextLevel.Thumbnail.IsLoaded)
            {
                if (nextLevel.ThumbnailBytes == null)
                {
                    string texFilename = BokuGame.Settings.MediaPath + Utils.FolderNameFromFlags(nextLevel.Genres) + nextLevel.WorldId.ToString();
                    Stream texStream   = Storage4.TextureFileOpenRead(texFilename);
                    if (texStream != null)
                    {
                        nextLevel.Thumbnail.Texture = Storage4.TextureLoad(texStream);
                        Storage4.Close(texStream);
                    }
                }
                else
                {
                    MemoryStream stream = new MemoryStream(nextLevel.ThumbnailBytes);
                    nextLevel.Thumbnail.Texture = Storage4.TextureLoad(stream);
                    nextLevel.ThumbnailBytes    = null;
                }
            }

            //refresh the render target
            RefreshTexture();

            base.Update(ref parentMatrix);
        }   // end of UIGridModularCheckboxElement Update()