Exemplo n.º 1
0
        public override void Render()
        {
            Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * Ease.CubeOut(Alpha));
            base.Render();
            if (remappingEase <= 0.0)
            {
                return;
            }

            Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * 0.95f * Ease.CubeInOut(remappingEase));
            Vector2 position = new Vector2(1920f, 1080f) * 0.5f;

            if (remappingKeyboard || Input.GuiInputController())
            {
                ActiveFont.Draw(
                    remappingKeyboard
                        ? Dialog.Get(DialogIds.KeyConfigChanging)
                        : Dialog.Get(DialogIds.BtnConfigChanging),
                    position + new Vector2(0.0f, -8f),
                    new Vector2(0.5f, 1f),
                    Vector2.One * 0.7f,
                    Color.LightGray * Ease.CubeIn(remappingEase));
                ActiveFont.Draw(ButtonInfos[remappingType].GetLabel(),
                                position + new Vector2(0.0f, 8f), new Vector2(0.5f, 0.0f), Vector2.One * 2f,
                                Color.White * Ease.CubeIn(remappingEase));
            }
            else
            {
                ActiveFont.Draw(Dialog.Clean(DialogIds.BtnConfigNoController), position, new Vector2(0.5f, 0.5f),
                                Vector2.One,
                                Color.White * Ease.CubeIn(remappingEase));
            }
        }
Exemplo n.º 2
0
        public override void Render()
        {
            if (Scene.Paused)
            {
                return;
            }

            if (drawText)
            {
                Vector2 center = new Vector2(1920f, 1080f) / 2f;

                float   scaleFactor = 1.2f + pulse * 0.2f;
                Vector2 scaledSize  = size * scaleFactor;

                float ease = Ease.SineInOut(this.ease);

                Draw.Rect(center.X - (scaledSize.X + 64f) * 0.5f, center.Y - (scaledSize.Y + 32f) * 0.5f * ease, (scaledSize.X + 64f), (scaledSize.Y + 32f) * ease, Color.Black);

                Vector2 textPosition = center + new Vector2(-scaledSize.X * 0.5f, 0f);
                Vector2 scale        = new Vector2(1f, ease) * scaleFactor;
                Color   textColor    = Color.White * ease;
                ActiveFont.Draw(leftText, textPosition, new Vector2(0f, 0.5f), scale, textColor);
                ActiveFont.Draw(rightText, textPosition + Vector2.UnitX * (leftSize + numberSize) * scaleFactor, new Vector2(0f, 0.5f), scale, textColor);
                if (hasCount)
                {
                    ActiveFont.Draw(((int)Approach).ToString(), textPosition + Vector2.UnitX * (leftSize + numberSize * 0.5f) * scaleFactor, new Vector2(0.5f, 0.5f), scale, textColor);
                }
            }
        }
Exemplo n.º 3
0
        public void BeforeRender()
        {
            if (!Focused || !Visible || Lines == null)
            {
                return;
            }

            if (logBuffer == null)
            {
                logBuffer = VirtualContent.CreateRenderTarget("loggedprogress-log", logBounds.Width, logBounds.Height);
            }
            Engine.Graphics.GraphicsDevice.SetRenderTarget(logBuffer.Target);
            Engine.Graphics.GraphicsDevice.Clear(Color.Transparent);

            Draw.SpriteBatch.Begin();

            for (int i = 0; i < Lines.Count; i++)
            {
                ActiveFont.Draw(
                    Lines[i],
                    new Vector2(8f, logBuffer.Height - 8f - (30f * (Lines.Count - i))),
                    Vector2.Zero,
                    Vector2.One * 0.5f,
                    Color.White
                    );
            }

            Draw.SpriteBatch.End();
        }
Exemplo n.º 4
0
        public override void Render()
        {
            Vector2 position  = ((Level)Scene).Camera.Position;
            Vector2 value     = position + new Vector2(160f, 90f);
            Vector2 position2 = (Position - position + (Position - value) * 0.2f) * 6f;

            ActiveFont.Draw(text, position2, new Vector2(0.5f, 0.5f), Vector2.One * 1.25f, Color.White * alpha);
        }
Exemplo n.º 5
0
 private void RenderManual()
 {
     Draw.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp,
                            null, RasterizerState.CullNone, null, Engine.ScreenMatrix);
     ActiveFont.Draw("Cancel: Back to Previous Scene", new Vector2(8f, 80f),
                     new Vector2(0f, 0f), Vector2.One * 0.5f, Color.White);
     Draw.SpriteBatch.End();
 }
Exemplo n.º 6
0
        private static void LevelOnRender(On.Celeste.Level.orig_Render orig, Level self)
        {
            orig(self);
            if (!Settings.Enabled)
            {
                return;
            }

            Draw.SpriteBatch.Begin();

            int viewWidth  = Engine.ViewWidth;
            int viewHeight = Engine.ViewHeight;

            string  text = Variable.Parse(DisplayContent);
            Vector2 size = ActiveFont.Measure(text) * Settings.FontSize;

            float x;
            float y;

            switch (Settings.Position)
            {
            case Position.TopLeft:
                x = Settings.Margin;
                y = Settings.Margin;
                break;

            case Position.TopRight:
                x = viewWidth - size.X - Settings.Margin - Settings.Padding * 2;
                y = Settings.Margin;
                break;

            case Position.BottomLeft:
                x = Settings.Margin;
                y = viewHeight - size.Y - Settings.Margin - Settings.Padding * 2;
                break;

            case Position.BottomRight:
                x = viewWidth - size.X - Settings.Margin - Settings.Padding * 2;
                y = viewHeight - size.Y - Settings.Margin - Settings.Padding * 2;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Vector2 rectPosition = new Vector2(x, y);

            Draw.Rect(rectPosition, size.X + Settings.Padding * 2, size.Y + Settings.Padding * 2, Color.Black * Settings.BackgroundAlpha);

            Vector2 textPosition = new Vector2(x + Settings.Padding, y + Settings.Padding);
            Vector2 scale        = new Vector2(Settings.FontSize);

            ActiveFont.Draw(text, textPosition, Vector2.Zero, scale, Color.White * Settings.FontAlpha);

            Draw.SpriteBatch.End();
        }
            public override void Render(Vector2 center, float columnWidth)
            {
                float num         = ActiveFont.Measure(text).X *scale;
                float scaleFactor = 1f;

                if (!forceWidth && num > columnWidth)
                {
                    scaleFactor = columnWidth / num;
                }
                ActiveFont.Draw(text, center + new Vector2(-columnWidth / 2f + columnWidth * justify.X, 0f), justify, Vector2.One * scale * scaleFactor, color);
            }
Exemplo n.º 8
0
        public override void Render()
        {
            Vector2 value = new Vector2(60f + offset, 800f - MathHelper.Max(text.Length * 60 - 180, 0));

            for (int i = 0; i < text.Length; i++)
            {
                string item = text[i];
                ActiveFont.Draw(item, value + new Vector2(offsets[i], 60f * i), Color.White * fade[i]);
                //Logger.Log("AltSidesHelper", $"Rendering \"{item}\" (no. {i}) with {fade[i]} colour and {offsets[i]} offset at {value + new Vector2(offsets[i], 60f * i)}");
            }
        }
Exemplo n.º 9
0
        public override void Render()
        {
            Vector2 cam    = ((Level)Scene).Camera.Position;
            Vector2 posTmp = cam + new Vector2(160f, 90f);
            Vector2 pos    = (Position - cam + (Position - posTmp) * 0.2f) * 6f;

            if (SaveData.Instance != null && SaveData.Instance.Assists.MirrorMode)
            {
                pos.X = 1920f - pos.X;
            }
            ActiveFont.Draw(text, pos, new Vector2(0.5f, 0.5f), Vector2.One * 1.25f, Color.White * alpha);
        }
Exemplo n.º 10
0
 public override void Render()
 {
     Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * Ease.CubeOut(Alpha));
     RenderTextMenu();
     if (remappingEase > 0f)
     {
         Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * 0.95f * Ease.CubeInOut(remappingEase));
         Vector2 value = new Vector2(1920f, 1080f) * 0.5f;
         ActiveFont.Draw(additiveRemap ? Dialog.Get("KEY_CONFIG_ADDING") : Dialog.Get("KEY_CONFIG_CHANGING"), value + new Vector2(0f, -8f), new Vector2(0.5f, 1f), Vector2.One * 0.7f, Color.LightGray * Ease.CubeIn(remappingEase));
         ActiveFont.Draw(GetLabel(currentlyRemapping), value + new Vector2(0f, 8f), new Vector2(0.5f, 0f), Vector2.One * 2f, Color.White * Ease.CubeIn(remappingEase));
     }
 }
Exemplo n.º 11
0
        public override void Render()
        {
            title?.Render();

            if (subtitleEase > 0f)
            {
                Vector2 position = new Vector2(Width / 2f, Height / 2f + 80f);
                float   x        = 1f + Ease.BigBackIn(1f - subtitleEase) * 2f;
                float   y        = 0.25f + Ease.BigBackIn(subtitleEase) * 0.75f;
                ActiveFont.Draw(Presentation.GetCleanDialog("PAGE1_SUBTITLE"), position, new Vector2(0.5f, 0.5f), new Vector2(x, y), Color.Black * 0.8f);
            }
        }
Exemplo n.º 12
0
        private void DrawOptionText(string text, Vector2 at, Vector2 justify, Vector2 scale, bool selected, bool disabled = false)
        {
            Color color     = disabled ? disableColor : GetTextColor(selected);
            Color edgeColor = disabled ? Color.Lerp(disableColor, Color.Black, 0.7f) : Color.Gray;

            if (selected && pressedTimer > 0f)
            {
                ActiveFont.Draw(text, at + Vector2.UnitY, justify, scale, color);
            }
            else
            {
                ActiveFont.DrawEdgeOutline(text, at, justify, scale, color, 4f, edgeColor);
            }
        }
Exemplo n.º 13
0
            public override void Render()
            {
                float   num     = Ease.CubeOut(alpha);
                float   textCol = Ease.CubeOut(textAlpha);
                Vector2 value   = Celeste.Celeste.TargetCenter + new Vector2(0f, 64f);
                Vector2 value2  = Vector2.UnitY * 64f * (1f - num);

                Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * num * 0.8f);
                GFX.Gui[menuSprite].DrawJustified(value - value2 + new Vector2(0f, 32f), new Vector2(0.5f, 1f), Color.White * num);
                ActiveFont.Draw(text[Math.Min(textIndex, text.Length - 1)], value + value2, new Vector2(0.5f, 0f), Vector2.One, Color.White * textCol);
                if (waitForKeyPress)
                {
                    GFX.Gui["textboxbutton"].DrawCentered(new Vector2(1824f, 984 + ((timer % 1f < 0.25f) ? 6 : 0)));
                }
            }
Exemplo n.º 14
0
        public override void Render()
        {
            Level level = (Level)Scene;

            if (level.FrozenOrPaused || level.Completed)
            {
                return;
            }

            if (index <= 0f || alpha <= 0f)
            {
                return;
            }

            Camera  camera     = level.Camera;
            Vector2 pos        = new Vector2((Memorial.X - camera.X) * 6f, (Memorial.Y - camera.Y) * 6f - 350f - ActiveFont.LineHeight * 3.3f);
            float   alphaEased = Ease.CubeInOut(alpha);
            int     length     = (int)Math.Min(message.Length, index);
            int     lineIndex  = 0;
            float   sink       = 64f * (1f - alphaEased);
            int     lineLength = CountToNewline(0);

            for (int i = 0; i < length; i++)
            {
                char c = message[i];
                if (c == '\n')
                {
                    lineIndex  = 0;
                    lineLength = CountToNewline(i + 1);
                    sink      += ActiveFont.LineHeight * 1.1f;
                    continue;
                }

                float xJustify = 1f;
                float x        = -lineLength * widestCharacter / 2f + (lineIndex + 0.5f) * widestCharacter;
                float yOffs    = 0f;

                if (Dreamy && c != ' ' && c != '-' && c != '\n')
                {
                    c        = message[(i + (int)(Math.Sin((timer * 2f + i / 8f)) * 4.0) + message.Length) % message.Length];
                    yOffs    = (float)Math.Sin((timer * 2f + i / 8f)) * 8f;
                    xJustify = (Math.Sin((timer * 4f + i / 16f)) < 0.0) ? -1f : 1f;
                }

                ActiveFont.Draw(c, pos + new Vector2(x, sink + yOffs), new Vector2(0.5f, 1f), new Vector2(xJustify, 1f), Color.White * alphaEased);
                lineIndex++;
            }
        }
Exemplo n.º 15
0
        public override void Render()
        {
            if (Everest.Flags.IsDisabled)
            {
                orig_Render();
                return;
            }

            if (CoreModule.Settings.ShowEverestTitleScreen)
            {
                logo        = everestLogo;
                title       = everestTitle;
                reflections = everestReflections;
            }
            else
            {
                logo        = vanillaLogo;
                title       = vanillaTitle;
                reflections = vanillaReflections;
            }

            float alphaPrev   = alpha;
            float textYPrev   = textY;
            float switchAlpha = Ease.CubeInOut(Calc.Clamp(Math.Max(switchingToVanilla, switchingToVanillaBack), 0f, 1f));

            alpha  = Calc.Clamp(alpha - switchAlpha, 0f, 1f);
            textY += switchAlpha * 200f;

            orig_Render();

            arrowToVanilla?.DrawJustified(new Vector2(1920f - 80f + (textY - 1000f) * 2f, 540f), new Vector2(1f, 0.5f), Color.White * alpha);

            updateTex?.DrawJustified(new Vector2(80f - 4f, textY + 8f * (1f - updateAlpha) + 2f), new Vector2(1f, 1f), Color.White * updateAlpha, 0.8f);

            alpha = alphaPrev;
            textY = textYPrev;

            if (switchAlpha > 0f)
            {
                Draw.Rect(0f, 0f, 1920f, 1080f, Color.Black * switchAlpha);
                float offs = 40f * (1f - switchAlpha);
                ActiveFont.Draw(Dialog.Clean("MENU_TITLESCREEN_RESTART_VANILLA"), new Vector2(960f + offs, 540f - 4f), new Vector2(0.5f, 1f), Vector2.One, Color.White * switchAlpha);
                Draw.Rect(960f - 200f + offs, 540f + 4f, 400f, 4f, Color.Black * switchAlpha * switchAlpha);
                Draw.HollowRect(960f - 200f + offs, 540f + 4f, 400f, 4f, Color.DarkSlateGray * switchAlpha);
                Draw.Rect(960f - 200f + offs, 540f + 4f, 400f * Calc.Clamp(Math.Max(switchingToVanilla, switchingToVanillaBack) / switchingToVanillaDuration, 0f, 1f), 4f, Color.White * switchAlpha);
            }
        }
Exemplo n.º 16
0
        public void DrawTaskbar()
        {
            Draw.Rect(0f, Height - 80f, Width, 80f, taskbarColor);
            Draw.Rect(0f, Height - 80f, Width, 4f, Color.White * 0.5f);
            MTexture mtexture = Presentation.Gfx["desktop/startberry"];
            float    num      = 64f;
            float    num2     = num / mtexture.Height * 0.7f;
            string   text     = Presentation.GetCleanDialog("DESKTOP_STARTBUTTON");
            float    num3     = 0.6f;
            float    width    = mtexture.Width * num2 + ActiveFont.Measure(text).X *num3 + 32f;
            Vector2  vector   = new Vector2(8f, Height - 80f + 8f);

            Draw.Rect(vector.X, vector.Y, width, num, Color.White * 0.5f);
            mtexture.DrawJustified(vector + new Vector2(8f, num / 2f), new Vector2(0f, 0.5f), Color.White, Vector2.One * num2);
            ActiveFont.Draw(text, vector + new Vector2(mtexture.Width * num2 + 16f, num / 2f), new Vector2(0f, 0.5f), Vector2.One * num3, Color.Black * 0.8f);
            ActiveFont.Draw(time, new Vector2(Width - 24f, Height - 40f), new Vector2(1f, 0.5f), Vector2.One * 0.6f, Color.Black * 0.8f);
        }
        public override void Render()
        {
            base.Render();

            float currentWiggle = wiggler.Value * 8f;

            if (openingEase > 0f)
            {
                float   openingEaseEased = Ease.CubeOut(openingEase);
                Vector2 anchor           = new Vector2(960f, 540f);
                float   lineHeight       = ActiveFont.LineHeight;

                // draw background
                Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * openingEaseEased * 0.9f);

                // draw text
                ActiveFont.Draw(Dialog.Clean("collabutils2_assist_skip_confirm"),
                                position: anchor + new Vector2(
                                    x: 0f,
                                    y: -16f - 64f * (1f - openingEaseEased)),
                                justify: new Vector2(0.5f, 1f),
                                scale: Vector2.One,
                                color: Color.White * openingEaseEased);

                ActiveFont.DrawOutline(Dialog.Clean("collabutils2_assist_skip_confirm_yes"),
                                       position: anchor + new Vector2(
                                           x: ((opened && currentlySelectedOption == 0) ? currentWiggle : 0f) * 1.2f * openingEaseEased,
                                           y: 16f + 64f * (1f - openingEaseEased)),
                                       justify: new Vector2(0.5f, 0f),
                                       scale: Vector2.One * 0.8f,
                                       color: opened ? selectionColor(currentlySelectedOption == 0) : Color.Gray,
                                       stroke: 2f,
                                       strokeColor: Color.Black * openingEaseEased);

                ActiveFont.DrawOutline(Dialog.Clean("collabutils2_assist_skip_confirm_no"),
                                       position: anchor + new Vector2(
                                           x: ((opened && currentlySelectedOption == 1) ? currentWiggle : 0f) * 1.2f * openingEaseEased,
                                           y: 16f + lineHeight + 64f * (1f - openingEaseEased)),
                                       justify: new Vector2(0.5f, 0f),
                                       scale: Vector2.One * 0.8f,
                                       color: opened ? selectionColor(currentlySelectedOption == 1) : Color.Gray,
                                       stroke: 2f,
                                       strokeColor: Color.Black * openingEaseEased);
            }
        }
Exemplo n.º 18
0
        private void DrawIcon(Vector2 position, string icon, string text)
        {
            bool flag = cursor.X > position.X - 64f && cursor.Y > position.Y - 64f && cursor.X < position.X + 64f && cursor.Y < position.Y + 80f;

            if (selected && flag)
            {
                Draw.Rect(position.X - 80f, position.Y - 80f, 160f, 200f, Color.White * 0.25f);
            }
            if (flag)
            {
                DrawDottedRect(position.X - 80f, position.Y - 80f, 160f, 200f);
            }
            MTexture mtexture = Presentation.Gfx[icon];
            float    scale    = 128f / mtexture.Height;

            mtexture.DrawCentered(position, Color.White, scale);
            ActiveFont.Draw(text, position + new Vector2(0f, 80f), new Vector2(0.5f, 0f), Vector2.One * 0.6f, (selected && flag) ? Color.Black : Color.White);
        }
Exemplo n.º 19
0
        public override void Render()
        {
            Vector2 cam    = SceneAs <Level>().Camera.Position;
            Vector2 posTmp = cam + new Vector2(Celeste.Celeste.GameWidth, Celeste.Celeste.GameHeight) / 2;
            Vector2 pos    = (Position - cam + (Position - posTmp) * parallax) * 6f;

            if (SaveData.Instance != null && SaveData.Instance.Assists.MirrorMode)
            {
                pos.X = Celeste.Celeste.TargetWidth - pos.X;
            }
            if (outline)
            {
                ActiveFont.DrawOutline(text, pos, new Vector2(0.5f, 0.5f), Vector2.One * scale, Color.White * alpha, 2f, Color.Black * alpha);
            }
            else
            {
                ActiveFont.Draw(text, pos, new Vector2(0.5f, 0.5f), Vector2.One * scale, Color.White * alpha);
            }
        }
Exemplo n.º 20
0
        public void Render()
        {
            if (pixel == null)
            {
                pixel = new Texture2D(Draw.SpriteBatch.GraphicsDevice, 1, 1);
                pixel.SetData(new Color[1] {
                    Color.White
                });
            }

            if (texts.Count != 0)
            {
                Draw.SpriteBatch.Draw(pixel, new Rectangle((int)uiPos.X, (int)uiPos.Y + 5, maxWidth + 10, (texts.Count * 35) + 10), new Color(10, 10, 10, 200));

                for (int i = 0; i < texts.Count; i++)
                {
                    ActiveFont.Draw(texts[i], new Vector2(uiPos.X + 5, uiPos.Y + 5 + (i * 35)), new Vector2(0, 0), new Vector2(0.7f, 0.7f), Color.White);
                }
            }
        }
Exemplo n.º 21
0
        public override void Render()
        {
            Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * Ease.CubeOut(Alpha));
            Vector2 center = new Vector2(1920f, 1080f) * 0.5f;

            if (Input.GuiInputController())
            {
                RenderTextMenu();
                if (remappingEase > 0f)
                {
                    Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * 0.95f * Ease.CubeInOut(remappingEase));
                    ActiveFont.Draw(Dialog.Get("BTN_CONFIG_CHANGING"), center + new Vector2(0f, -8f), new Vector2(0.5f, 1f), Vector2.One * 0.7f, Color.LightGray * Ease.CubeIn(remappingEase));
                    ActiveFont.Draw(GetLabel(currentlyRemapping), center + new Vector2(0f, 8f), new Vector2(0.5f, 0f), Vector2.One * 2f, Color.White * Ease.CubeIn(remappingEase));
                }
            }
            else
            {
                ActiveFont.Draw(Dialog.Clean("BTN_CONFIG_NOCONTROLLER"), center, new Vector2(0.5f, 0.5f), Vector2.One, Color.White * Ease.CubeOut(Alpha));
            }
        }
Exemplo n.º 22
0
        private void DrawOptionText(string text, Vector2 at, Vector2 justify, Vector2 scale, bool selected, bool disabled = false)
        {
            // Only draw "interactively" if the input method is a gamepad, not a keyboard.
            if (!MInput.GamePads[Input.Gamepad].Attached)
            {
                selected = false;
                disabled = true;
            }

            Color color     = disabled ? disableColor : GetTextColor(selected);
            Color edgeColor = disabled ? Color.Lerp(disableColor, Color.Black, 0.7f) : Color.Gray;

            if (selected && pressedTimer > 0f)
            {
                ActiveFont.Draw(text, at + Vector2.UnitY, justify, scale, color);
            }
            else
            {
                ActiveFont.DrawEdgeOutline(text, at, justify, scale, color, 4f, edgeColor);
            }
        }
Exemplo n.º 23
0
        private void DrawOptionText(string text, Vector2 at, Vector2 justify, Vector2 scale, bool selected, bool disabled = false)
        {
            // Only draw "interactively" if not using the keyboard for input
            if (UseKeyboardInput)
            {
                selected = false;
                disabled = true;
            }

            Color color     = disabled ? disableColor : GetTextColor(selected);
            Color edgeColor = disabled ? Color.Lerp(disableColor, Color.Black, 0.7f) : Color.Gray;

            if (selected && pressedTimer > 0f)
            {
                ActiveFont.Draw(text, at + Vector2.UnitY, justify, scale, color);
            }
            else
            {
                ActiveFont.DrawEdgeOutline(text, at, justify, scale, color, 4f, edgeColor);
            }
        }
Exemplo n.º 24
0
        private void DrawOptionText(string text, Vector2 at, Vector2 justify, Vector2 scale, bool selected, bool disabled = false)
        {
            // Only draw "interactively" if not using the keyboard for input
            // Also grey out invalid keys ("-" if negatives are forbidden, "." if decimals are forbidden).
            if (UseKeyboardInput || (text.Equals("-") && !allowNegatives) || (text.Equals(".") && !allowDecimals))
            {
                selected = false;
                disabled = true;
            }

            Color color     = disabled ? disableColor : GetTextColor(selected);
            Color edgeColor = disabled ? Color.Lerp(disableColor, Color.Black, 0.7f) : Color.Gray;

            if (selected && pressedTimer > 0f)
            {
                ActiveFont.Draw(text, at + Vector2.UnitY, justify, scale, color);
            }
            else
            {
                ActiveFont.DrawEdgeOutline(text, at, justify, scale, color, 4f, edgeColor);
            }
        }
Exemplo n.º 25
0
 public override void Render()
 {
     foreach (TitleText titleText in title)
     {
         titleText.Render();
     }
     if (list != null)
     {
         list.Draw(new Vector2(160f, 260f), new Vector2(0f, 0f), Vector2.One, 1f, 0, listIndex);
     }
     if (impossibleEase > 0f)
     {
         MTexture mtexture = Presentation.Gfx["Guy Clip Art"];
         float    num      = 0.75f;
         mtexture.Draw(new Vector2(Width - mtexture.Width * num, Height - 640f * impossibleEase), Vector2.Zero, Color.White, num);
         Matrix transformationMatrix = Matrix.CreateRotationZ(-0.5f + Ease.CubeIn(1f - impossibleEase) * 8f) * Matrix.CreateTranslation(Width - 500, Height - 600, 0f);
         Draw.SpriteBatch.End();
         Draw.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, transformationMatrix);
         ActiveFont.Draw(Presentation.GetCleanDialog("PAGE2_IMPOSSIBLE"), Vector2.Zero, new Vector2(0.5f, 0.5f), Vector2.One * (2f + (1f - impossibleEase) * 0.5f), Color.Black * impossibleEase);
         Draw.SpriteBatch.End();
         Draw.SpriteBatch.Begin();
     }
 }
Exemplo n.º 26
0
        public override void Render()
        {
            UpdateMouse();
            Draw.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, Camera.Matrix * Engine.ScreenMatrix);
            float num  = 1920f / Camera.Zoom;
            float num2 = 1080f / Camera.Zoom;
            int   num3 = 5;
            float num4 = (float)Math.Floor(Camera.Left / num3 - 1f) * num3;
            float num5 = (float)Math.Floor(Camera.Top / num3 - 1f) * num3;

            for (float num6 = num4; num6 <= num4 + num + 10f; num6 += 5f)
            {
                Draw.Line(num6, Camera.Top, num6, Camera.Top + num2, gridColor);
            }
            for (float num7 = num5; num7 <= num5 + num2 + 10f; num7 += 5f)
            {
                Draw.Line(Camera.Left, num7, Camera.Left + num, num7, gridColor);
            }
            Draw.Line(0f, Camera.Top, 0f, Camera.Top + num2, Color.DarkSlateBlue, 1f / Camera.Zoom);
            Draw.Line(Camera.Left, 0f, Camera.Left + num, 0f, Color.DarkSlateBlue, 1f / Camera.Zoom);

            foreach (BoardSpaceTemplate src in connections.Keys)
            {
                foreach (BoardSpaceTemplate dest in connections[src])
                {
                    DrawArrow(src.Position, dest.Position);
                }
            }

            // Draw line for current path being built
            if (MInput.Keyboard.Check(Keys.P))
            {
                BoardSpaceTemplate pathDest = TestCheck(mousePosition);
                BoardSpaceTemplate pathSrc;
                if (selection.Count == 1 && (pathSrc = selection.First()) != pathDest)
                {
                    DrawArrow(pathSrc.Position, pathDest?.Position ?? mousePosition);
                }
            }

            foreach (BoardSpaceTemplate space in spaces)
            {
                space.Render(Camera);
            }
            if (mouseMode == MouseModes.Hover)
            {
                Draw.Line(mousePosition.X - 12f / Camera.Zoom, mousePosition.Y, mousePosition.X + 12f / Camera.Zoom, mousePosition.Y, Color.Yellow, 3f / Camera.Zoom);
                Draw.Line(mousePosition.X, mousePosition.Y - 12f / Camera.Zoom, mousePosition.X, mousePosition.Y + 12f / Camera.Zoom, Color.Yellow, 3f / Camera.Zoom);
            }
            else if (mouseMode == MouseModes.Select)
            {
                Draw.Rect(GetMouseRect(mouseDragStart, mousePosition), Color.Lime * 0.25f);
            }
            if (saveFlash > 0f)
            {
                Draw.Rect(Camera.Left, Camera.Top, num, num2, Color.White * Ease.CubeInOut(saveFlash));
            }
            if (fade > 0f)
            {
                Draw.Rect(0f, 0f, 320f, 180f, Color.Black * fade);
            }
            Draw.SpriteBatch.End();
            Draw.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullNone, null, Engine.ScreenMatrix);
            Draw.Rect(0f, 0f, 1920f, 72f, Color.Black);
            Vector2 position  = new Vector2(16f, 4f);
            Vector2 position2 = new Vector2(1904f, 4f);

            if (hovered.Count == 0)
            {
                if (selection.Count > 0)
                {
                    ActiveFont.Draw(selection.Count + " spaces selected", position, Color.Red);
                }
                else
                {
                    ActiveFont.Draw("Hello", position, Color.Aqua);
                }
            }
            else if (hovered.Count == 1)
            {
                BoardSpaceTemplate levelTemplate = null;
                using (HashSet <BoardSpaceTemplate> .Enumerator enumerator2 = hovered.GetEnumerator()) {
                    if (enumerator2.MoveNext())
                    {
                        levelTemplate = enumerator2.Current;
                    }
                }
                string text = levelTemplate.X + "," + levelTemplate.Y + "   " + levelTemplate.Type + "   " + levelTemplate.HeartSpace;
                if (selection.Count > 0)
                {
                    ActiveFont.Draw(selection.Count + " spaces selected", position, Color.Red);
                }
                else
                {
                    ActiveFont.Draw("Hello", position, Color.Aqua);
                }
                ActiveFont.Draw(text, position2, Vector2.UnitX, Vector2.One, Color.Green);
            }
            else
            {
                ActiveFont.Draw(hovered.Count + " spaces", position, Color.Yellow);
            }
            Draw.SpriteBatch.End();
            RenderManualText();
        }
Exemplo n.º 27
0
        public override void Render()
        {
            if (Everest.Flags.IsDisabled)
            {
                orig_Render();
                return;
            }

            if (CoreModule.Settings.ShowEverestTitleScreen)
            {
                logo        = everestLogo;
                title       = everestTitle;
                reflections = everestReflections;
            }
            else
            {
                logo        = vanillaLogo;
                title       = vanillaTitle;
                reflections = vanillaReflections;
            }

            float alphaPrev   = alpha;
            float textYPrev   = textY;
            float switchAlpha = Ease.CubeInOut(Calc.Clamp(Math.Max(switchingToVanilla, switchingToVanillaBack), 0f, 1f));

            alpha  = Calc.Clamp(alpha - switchAlpha, 0f, 1f);
            textY += switchAlpha * 200f;

            orig_Render();

            arrowToVanilla?.DrawJustified(new Vector2(1920f - 80f + (textY - 1000f) * 2f, 540f), new Vector2(1f, 0.5f), Color.White * alpha);

            updateTex?.DrawJustified(new Vector2(80f - 4f, textY + 8f * (1f - updateAlpha) + 2f), new Vector2(1f, 1f), Color.White * updateAlpha, 0.8f);

            alpha = alphaPrev;
            textY = textYPrev;

            if (switchAlpha > 0f)
            {
                if (warningMessageMenu != null)
                {
                    // the restarting message should ease out as the warning message eases in.
                    switchAlpha -= Ease.CubeOut(warningEase);
                }

                Draw.Rect(0f, 0f, 1920f, 1080f, Color.Black * switchAlpha);
                float offs = 40f * (1f - switchAlpha);

                if (warningMessageMenu != null)
                {
                    // the restarting message should leave the opposite way it came from.
                    offs *= -1f;
                }

                ActiveFont.Draw(Dialog.Clean("MENU_TITLESCREEN_RESTART_VANILLA"), new Vector2(960f + offs, 540f - 4f), new Vector2(0.5f, 1f), Vector2.One, Color.White * switchAlpha);
                Draw.Rect(960f - 200f + offs, 540f + 4f, 400f, 4f, Color.Black * switchAlpha * switchAlpha);
                Draw.HollowRect(960f - 200f + offs, 540f + 4f, 400f, 4f, Color.DarkSlateGray * switchAlpha);
                Draw.Rect(960f - 200f + offs, 540f + 4f, 400f * Calc.Clamp(Math.Max(switchingToVanilla, switchingToVanillaBack) / switchingToVanillaDuration, 0f, 1f), 4f, Color.White * switchAlpha);
            }

            if (warningMessageMenu != null)
            {
                float warningAlpha = Ease.CubeOut(warningEase);
                float offs         = 40f * (1f - warningAlpha);
                warningMessageMenu.Position = new Vector2(960f + offs, 735f);
                warningMessageMenu.Alpha    = warningAlpha;
                ActiveFont.Draw(Dialog.Clean("MENU_TITLESCREEN_WARNING"), new Vector2(960f + offs, 285f), new Vector2(0.5f, 0f), Vector2.One * 1.2f, Color.OrangeRed * warningAlpha);
                ActiveFont.Draw(Dialog.Clean("MENU_TITLESCREEN_WARNING_TEXT"), new Vector2(960f + offs, 385f), new Vector2(0.5f, 0f), Vector2.One * 0.8f, Color.White * warningAlpha);
                ActiveFont.Draw(Dialog.Clean("MENU_TITLESCREEN_WARNING_TEXT2"), new Vector2(960f + offs, 510f), new Vector2(0.5f, 0f), Vector2.One * 0.8f, Color.White * warningAlpha);
            }
        }
Exemplo n.º 28
0
        private static void OnChapterPanelDrawCheckpoint(On.Celeste.OuiChapterPanel.orig_DrawCheckpoint orig, OuiChapterPanel self, Vector2 center, object option, int checkpointIndex)
        {
            DynData <OuiChapterPanel> selfData = new DynData <OuiChapterPanel>(self);
            string collabCredits = selfData.Get <string>("collabCredits");

            if (collabCredits == null)
            {
                orig(self, center, option, checkpointIndex);
                return;
            }

            if (checkpointIndex > 0)
            {
                return;
            }

            // panel height is 730 pixels when completely open. Tags should fade out quicker than text, because they are near the bottom of the panel,
            // and it looks bad more quickly when the panel closes.
            float alphaText = Calc.ClampedMap(selfData.Get <float>("height"), 600, 730);
            float alphaTags = Calc.ClampedMap(selfData.Get <float>("height"), 700, 730);

            float heightTakenByTags = 0f;

            // draw tags.
            string collabCreditsTagsString = selfData.Get <string>("collabCreditsTags");

            if (collabCreditsTagsString != null)
            {
                // split on newlines to separate tags.
                string[] collabCreditsTags = collabCreditsTagsString.Split('\n');

                // split tags in lines, fitting as many tags as possible on each line.
                List <List <string> > lines      = new List <List <string> >();
                List <float>          lineWidths = new List <float>();

                // this block is responsible for splitting tags in lines.
                {
                    List <string> line      = new List <string>();
                    float         lineWidth = 0f;
                    for (int i = 0; i < collabCreditsTags.Length; i++)
                    {
                        float advanceX = ActiveFont.Measure(collabCreditsTags[i].Trim()).X * 0.5f + 30f; // 30 = margin between tags
                        if (lineWidth + advanceX > 800f)
                        {
                            // we exceeded the limit. we need a line break!
                            lines.Add(line.ToList());
                            lineWidths.Add(lineWidth);

                            line.Clear();
                            lineWidth = 0f;
                        }

                        // add the tag to the current line.
                        line.Add(collabCreditsTags[i].Trim());
                        lineWidth += advanceX;
                    }

                    // add the last line.
                    lines.Add(line.ToList());
                    lineWidths.Add(lineWidth);
                }

                // now, draw the tags bottom up.
                float y = center.Y + 230f;
                for (int i = lines.Count - 1; i >= 0; i--)
                {
                    // starting position is all the way left.
                    float x = center.X - (lineWidths[i] / 2f) + 15f;

                    foreach (string tag in lines[i])
                    {
                        // black edge > BaseColor text background > TextColor tag text
                        float width = ActiveFont.Measure(tag).X * 0.5f;
                        Draw.Rect(x - 10, y - 6, width + 20, 44, Color.Black * alphaTags);
                        Draw.Rect(x - 6, y - 2, width + 12, 36, self.Data.TitleBaseColor * alphaTags);
                        ActiveFont.Draw(tag, new Vector2(x, y), Vector2.Zero, Vector2.One * 0.5f, self.Data.TitleTextColor * alphaTags);

                        // advance the position to the next tag.
                        x += width + 30f;
                    }

                    // move up 1 line.
                    y -= 52f;
                    heightTakenByTags += 52f;
                }
            }

            // compute the maximum scale the credits can take (max 1) to fit the remaining space.
            Vector2 size  = ActiveFont.Measure(collabCredits);
            float   scale = Math.Min(1f, Math.Min((410f - heightTakenByTags) / size.Y, 800f / size.X));

            // draw the credits.
            ActiveFont.Draw(
                collabCredits,
                center + new Vector2(0f, 40f - heightTakenByTags / 2f),
                Vector2.One * 0.5f,
                Vector2.One * scale,
                Color.Black * 0.8f * alphaText
                );
        }