Esempio n. 1
0
        }   // end of UnloadContent()

        public static void DeviceReset(GraphicsDevice device)
        {
            // Recreate rendertarget.
            InGame.RelRT("TutorialRT", rt);
            BokuGame.Release(ref rt);

            CreateRenderTarget();

            modalDisplay.DeviceReset(device);
        }   // end of DeviceReset()
Esempio n. 2
0
        }   // end of InitDeviceResources()

        public static void UnloadContent()
        {
            InGame.RelRT("TutorialRT", rt);
            BokuGame.Release(ref rt);

            BokuGame.Release(ref backdrop);
            BokuGame.Release(ref dropShadow);

            if (modalDisplay != null)
            {
                modalDisplay.UnloadContent();
            }
        }   // end of UnloadContent()
Esempio n. 3
0
 private static void ReleaseRenderTargets()
 {
     InGame.RelRT("UI2D.Shared:renderTargetDepthStencil1280_720", renderTargetDepthStencil1280_720);
     InGame.RelRT("UI2D.Shared:renderTargetDepthStencil1024_768", renderTargetDepthStencil1024_768);
     InGame.RelRT("UI2D.Shared:renderTarget512_512", renderTarget512_512);
     InGame.RelRT("UI2D.Shared:renderTarget512_302", renderTarget512_302);
     InGame.RelRT("UI2D.Shared:renderTarget256_256", renderTarget256_256);
     InGame.RelRT("UI2D.Shared:renderTarget128_128", renderTarget128_128);
     InGame.RelRT("UI2D.Shared:renderTarget64_64", renderTarget64_64);
     BokuGame.Release(ref renderTargetDepthStencil1280_720);
     BokuGame.Release(ref renderTarget1920_540);
     BokuGame.Release(ref renderTarget1024_768);
     BokuGame.Release(ref renderTarget512_512);
     BokuGame.Release(ref renderTarget512_302);
     BokuGame.Release(ref renderTarget256_256);
     BokuGame.Release(ref renderTarget128_128);
     BokuGame.Release(ref renderTarget64_64);
 }   // endof UnloadContent()
 private void ReleaseRenderTargets()
 {
     InGame.RelRT("UIGridModularRadioBoxElement", diffuse);
     BokuGame.Release(ref diffuse);
 }
Esempio n. 5
0
 private void ReleaseRenderTargets()
 {
     InGame.RelRT("UIGrid2DTextElement", diffuse);
     BokuGame.Release(ref diffuse);
 }
Esempio n. 6
0
 private void ReleaseRenderTargets()
 {
     InGame.RelRT("ModularMenu", diffuse);
     BokuGame.Release(ref diffuse);
 }
Esempio n. 7
0
        }   // end of OnExitTutorial()

        public static void PreRender()
        {
            // Decide which font to use based on screen width.
            UI2D.Shared.GetFont prevFont = font;
            font = BokuGame.ScreenSize.X > 1280 ? UI2D.Shared.GetGameFont24Bold : UI2D.Shared.GetGameFont18Bold;

            // Did the font or window size change?  If so, reallocate the rendertarget.
            if (font != prevFont || rt == null || BokuGame.ScreenSize.X > rt.Width)
            {
                InGame.RelRT("TutorialRT", rt);
                BokuGame.Release(ref rt);
                CreateRenderTarget();
            }

            if (backdrop == null || rt == null)
            {
                return;
            }

            ScreenSpaceQuad quad = ScreenSpaceQuad.GetInstance();

            InGame.SetRenderTarget(rt);

            // Clear and add highlight.
            quad.Render(backdrop, Vector2.Zero, new Vector2(rt.Width, rt.Height), "TexturedRegularAlpha");

            if (Active)
            {
                int indent = 10;

                // Lazy allocation.
                if (titleBlob == null)
                {
                    titleBlob = new TextBlob(font, "test", (int)(rt.Width - 2.0f * indent));
                    //titleBlob.ProgrammingTileBackdrop = true;
                }
                if (instructionBlob == null)
                {
                    instructionBlob = new TextBlob(font, "test", (int)(rt.Width - 2.0f * indent));
                    //instructionBlob.ProgrammingTileBackdrop = true;
                }

                // Font may have changed, keep the blobs up to date.
                titleBlob.Font       = font;
                instructionBlob.Font = font;

                // Raw strings to put into blobs.
                string titleStr       = null;
                string instructionStr = null;

                // We only care about the non-modal text if there's no modal display.
                // TODO We could think about displaying this under the modal display but we'd have to
                // add a drop shadow first to avoid cluttering things up.
                if (!modalDisplay.Active)
                {
                    // We should only display text when the tutorial mode is fully open.
                    bool display = targetPositionY > 1 && BokuGame.ScreenPosition.Y > targetPositionY - 2.0f;
                    if (display)
                    {
                        if (curCrumb != null || targetModeReached)
                        {
                            // First line should be the goal of this section of the tutorial.  High level.
                            titleStr = curStep.GoalText;

                            // Second line is either from the crumb telling us where to go OR from the step telling us what to do now that we're here.
                            if (curCrumb == null)
                            {
                                if (GamePadInput.ActiveMode == GamePadInput.InputMode.KeyboardMouse)
                                {
                                    instructionStr = curStep.MouseText;
                                }
                                else if (GamePadInput.ActiveMode == GamePadInput.InputMode.Touch)
                                {
                                    instructionStr = curStep.TouchText;
                                }
                                else    // gamepad
                                {
                                    instructionStr = curStep.GamepadText;
                                }
                            }
                            else
                            {
                                if (GamePadInput.ActiveMode == GamePadInput.InputMode.KeyboardMouse)
                                {
                                    instructionStr = curCrumb.MouseText;
                                }
                                else if (GamePadInput.ActiveMode == GamePadInput.InputMode.Touch)
                                {
                                    instructionStr = curCrumb.TouchText;
                                }
                                else    // gamepad
                                {
                                    instructionStr = curCrumb.GamepadText;
                                }
                            }
#if DEBUG
                            // Add in some debug info.
                            //instructionStr += "\nCurMode = " + curGameMode.ToString() + "   curTargetMode = " + curStep.TargetMode.ToString();
#endif
                        }
                        else
                        {
                            if (DebugMode)
                            {
                                // We've got no crumb.  Need to add one!
                                instructionStr = "Missing Crumb!";
                                // Add in some debug info.
                                instructionStr += "\nCurMode = " + curGameMode.ToString() + "   HelpOverlay = " + HelpOverlay.Peek() + "\nUpdateMode = " + InGame.inGame.CurrentUpdateMode.ToString();
                                if (curStep != null)
                                {
                                    instructionStr += "\nTargetMode = " + curStep.TargetMode;
                                }
                            }
                        }

                        // Render text blob.

                        // TODO Center text vertically and if fewer lines, increase the spacing a bit.

                        titleBlob.RawText       = titleStr;
                        instructionBlob.RawText = instructionStr;

                        //Color titleColor = new Color(50, 255, 50);  // Same green as the hover text color we user elsewhere.
                        Color titleColor = new Color(20, 20, 20);   // Not quite black.
                        //Color titleColor = new Color(250, 190, 50); // Amber.
                        Color shadowColor = new Color(0, 0, 0, 40);
                        Color lightGrey   = new Color(200, 200, 200);
                        Color darkGrey    = new Color(100, 100, 100);

                        Color textColor = darkGrey;
                        if (DebugMode && curGameMode == GameMode.Unknown)
                        {
                            textColor = Color.Red;
                        }
                        titleBlob.RenderWithButtons(new Vector2(indent, 0), titleColor, shadowColor, new Vector2(0, 2), maxLines: 4);
                        // Vertically center the instruction text.
                        int yOffset = 0;
                        if (instructionBlob.NumLines == 1)
                        {
                            yOffset = instructionBlob.TotalSpacing;
                        }
                        else if (instructionBlob.NumLines == 2)
                        {
                            yOffset = (int)(instructionBlob.TotalSpacing / 2.0f);
                        }
                        instructionBlob.RenderWithButtons(new Vector2(indent, titleBlob.TotalSpacing + yOffset - 2), textColor, shadowColor, new Vector2(0, 2), maxLines: 4);
                    } // end if display true
                }     // end if not modal active
            }         // end if tutorial mode active

            InGame.RestoreRenderTarget();
        }   // end of PreRender()
Esempio n. 8
0
 private void ReleaseRenderTargets()
 {
     InGame.RelRT("Scoreboard", surface);
     BokuGame.Release(ref surface);
 }
 private void ReleaseRenderTargets()
 {
     InGame.RelRT("UIGridPictureListElement", rt);
     BokuGame.Release(ref rt);
 }
 private void ReleaseRenderTargets()
 {
     InGame.RelRT("MessageBoxElement", diffuse);
     BokuGame.Release(ref diffuse);
 }
Esempio n. 11
0
 private void ReleaseRenderTargets()
 {
     InGame.RelRT("TextLine", diffuse);
     BokuGame.Release(ref diffuse);
 }
 private void ReleaseRenderTargets()
 {
     InGame.RelRT("UIGridModularPictureListElement", diffuse);
     BokuGame.Release(ref diffuse);
 }