示例#1
0
        public override void Init()
        {
            _windowTarget = EngineGlobals.GameReference.AssetManager.CreateTargetObject("{achievementgenerator" + instanceNumber + "}", WIDGET_WIDTH, WIDGET_HEIGHT);

            _displayFont   = EngineGlobals.GameReference.AssetManager.GetFont("{smallfont}");
            _windowTexture = EngineGlobals.GameReference.AssetManager.CreatePixelTexture("{awind_texture}");

            _achievementTexture = EngineGlobals.GameReference.AssetManager.GetTexture("{achievement}");

            _windowTarget.RunTarget(GenerateWidget);

            Show();
        }
        public override void LoadContent()
        {
            //_messageBoxWindow = Systems.AssetManager.GetTexture("message_box");
            if (_messageBoxWindowTexture == null)
            {
                _messageBoxWindowTexture = new TextureObject("message_box", @"Graphics\UI\MessageBox");
                _nameBoxWindowTexture    = new TextureObject("name_box", @"Graphics\UI\namebox");
                _continueArrowTexture    = new TextureObject("continue_arrow", @"Graphics\UI\textbox_arrow");
            }

            _messageBoxFont = EquestriEngine.AssetManager.GetFont("{largefont}");
            boxOrigin       = new Vector2(_messageBoxWindowTexture.Width / 2, _messageBoxWindowTexture.Height / 2);
            name            = "Fluttershy";
            if (name != null)
            {
                _nameBoxWindow = EquestriEngine.AssetManager.CreateTargetObject("{namebox_texture}", (int)_messageBoxFont.Measure(name).X + 50, 74);
                _nameBoxWindow.RunTarget(DrawNameBox, Color.Transparent);
            }
            base.LoadContent();
        }
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
        {
            if (!_consoleClosed && !EngineGlobals.GameReference.AssetManager.FrameCapture)
            {
                if (Refresh_Required)
                {
                    _renderedText.RunTarget(RenderText, Color.Transparent);
                    Refresh_Required = false;
                }
                if (_currentMode == ConsoleMode.Stats)
                {
                    frames++;
                }

                SpriteBatch.Begin(Microsoft.Xna.Framework.Graphics.SpriteSortMode.Deferred, Microsoft.Xna.Framework.Graphics.BlendState.AlphaBlend,
                                  null, EquestriEngine.DepthState, null);
                if (_windowTexture.Ready)
                {
                    SpriteBatch.Draw(_windowTexture.Texture,
                                     new Rectangle(0, EngineGlobals.Settings.WindowHeight - windowShown, EngineGlobals.Settings.WindowWidth, windowShown), Color.Multiply(_consoleColor, showAmount));
                }

                SpriteBatch.Draw(_renderedText.Texture, _consoleTextPos, Color.Multiply(Color.White, showAmount));

                if (windowShown >= 128)
                {
                    SpriteBatch.Draw(_windowTexture.Texture,
                                     new Rectangle(0, EngineGlobals.Settings.WindowHeight - 32, EngineGlobals.Settings.WindowWidth, 32),
                                     showAmount > 0.75f ? Color.Multiply(_consoleColor, (showAmount - 0.75f) / 0.25f) : Color.Transparent);
                    SpriteBatch.DrawString(_font, _consoleInput.AsString + "|", new Vector2(4, EngineGlobals.Settings.WindowHeight - 26) + Vector2.One, Color.Black);
                    SpriteBatch.DrawString(_font, _consoleInput.AsString + "|", new Vector2(4, EngineGlobals.Settings.WindowHeight - 26), Color.Blue);
                }

                SpriteBatch.End();
            }
            base.Draw(gameTime);
        }