コード例 #1
0
        private void DrawLeftAligned(GlyphTextRenderer tr, SpriteBatch batch, SpriteFont font, string text, float alpha, Vector2 offset, float size)
        {
            float num = font.MeasureString(text).X *size;

            tr.DrawShadowedText(batch, font, text, offset - num * Vector2.UnitX, new Color(1f, 1f, 1f, alpha), size);
        }
コード例 #2
0
        public override void PostDraw(SpriteBatch batch, SpriteFont font, GlyphTextRenderer tr, float alpha)
        {
            float   smallFactor = this.FontManager.SmallFactor;
            float   num1        = (float)batch.GraphicsDevice.Viewport.Height / 2f;
            Vector2 position    = FezMath.Round(new Vector2((float)(batch.GraphicsDevice.Viewport.Width - this.ControlsImage.Width) / 2f, num1 - (float)this.ControlsImage.Height / 2f));
            float   viewScale   = SettingsManager.GetViewScale(batch.GraphicsDevice);
            int     num2        = batch.GraphicsDevice.Viewport.Width / 2;
            int     num3        = batch.GraphicsDevice.Viewport.Height / 2;
            int     num4        = num2 - 464;
            int     num5        = num2 + 464;

            if (this.SelectedIndex == this.Items.Count - 3)
            {
                batch.Draw(this.ControlsImage, position, new Color(1f, 1f, 1f, alpha));
                if (Culture.IsCJK)
                {
                    smallFactor /= viewScale;
                }
                tr.DrawShadowedText(batch, font, StaticText.GetString("Map_Title").ToUpper(CultureInfo.InvariantCulture), new Vector2((float)num4, num1 - 222f), new Color(1f, 1f, 1f, alpha), smallFactor);
                tr.DrawShadowedText(batch, font, StaticText.GetString("ControlsRotateLeft").ToUpper(CultureInfo.InvariantCulture), new Vector2((float)num4, num1 - 170f), new Color(1f, 1f, 1f, alpha), smallFactor);
                tr.DrawShadowedText(batch, font, StaticText.GetString("ControlsMove").ToUpper(CultureInfo.InvariantCulture), new Vector2((float)num4, num1 - 15f), new Color(1f, 1f, 1f, alpha), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsPause").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 - 222f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsRotateRight").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 - 170f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsAction").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 - 114f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsInventory").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 - 81f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsTalk").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 - 40f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsJump").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 + 3f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsLook").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 + 72f), smallFactor);
                if (Culture.IsCJK)
                {
                    float num6 = smallFactor * viewScale;
                }
            }
            float num7 = this.Items[this.chosen].Size.X + 70f;

            if (Culture.IsCJK)
            {
                num7 *= 0.5f;
            }
            if (this.SelectedIndex >= this.Items.Count - 3)
            {
                float num6 = 25f;
                float num8;
                if (!Culture.IsCJK)
                {
                    num8 = num6 * viewScale;
                }
                else
                {
                    num7 = num7 * 0.4f + 25f;
                    num8 = 5f * viewScale;
                    if (Culture.Language == Language.Chinese)
                    {
                        num8 = (float)(10.0 + 25.0 * (double)viewScale);
                    }
                }
                int     num9   = ServiceHelper.Game.GraphicsDevice.Viewport.Width / 2;
                Vector2 offset = new Vector2((float)(-(double)num7 + 25.0 * (double)viewScale - 40.0 * ((double)viewScale - 1.0)), (float)num3 + 180f * viewScale + num8);
                if (!this.noArrows)
                {
                    tr.DrawCenteredString(batch, this.FontManager.Big, "{LA}", new Color(1f, 1f, 1f, alpha), offset, (Culture.IsCJK ? 0.2f : 1f) * viewScale);
                    this.leftSliderRect = new Rectangle?(new Rectangle((int)((double)offset.X + (double)num9 - 25.0 * (double)viewScale), (int)offset.Y, (int)(40.0 * (double)viewScale), (int)(25.0 * (double)viewScale)));
                }
                else
                {
                    this.leftSliderRect = new Rectangle?();
                }
                offset = new Vector2(num7 + (float)(40.0 * ((double)viewScale - 1.0)), (float)num3 + 180f * viewScale + num8);
                if (!this.noArrows)
                {
                    tr.DrawCenteredString(batch, this.FontManager.Big, "{RA}", new Color(1f, 1f, 1f, alpha), offset, (Culture.IsCJK ? 0.2f : 1f) * viewScale);
                    this.rightSliderRect = new Rectangle?(new Rectangle((int)((double)offset.X + (double)num9 - 30.0 * (double)viewScale), (int)offset.Y, (int)(40.0 * (double)viewScale), (int)(25.0 * (double)viewScale)));
                }
                else
                {
                    this.rightSliderRect = new Rectangle?();
                }
            }
            else
            {
                ControlsMenuLevel controlsMenuLevel1 = this;
                ControlsMenuLevel controlsMenuLevel2 = this;
                ControlsMenuLevel controlsMenuLevel3 = this;
                Rectangle?        nullable1          = new Rectangle?();
                Rectangle?        nullable2          = nullable1;
                controlsMenuLevel3.rightSliderRect = nullable2;
                Rectangle?nullable3;
                Rectangle?nullable4 = nullable3 = nullable1;
                controlsMenuLevel2.rightSliderRect = nullable3;
                Rectangle?nullable5 = nullable4;
                controlsMenuLevel1.leftSliderRect = nullable5;
            }
        }