private void DrawWarning(SpriteBatch batch, SpriteFont font, GlyphTextRenderer tr, float alpha, string locString) { float scale = this.FontManager.SmallFactor * SettingsManager.GetViewScale(batch.GraphicsDevice); float num = (float)batch.GraphicsDevice.Viewport.Height / 2f; tr.DrawCenteredString(batch, font, StaticText.GetString(locString), new Color(1f, 1f, 1f, alpha), new Vector2(0.0f, num * 1.5f), scale); }
protected override void LoadContent() { base.LoadContent(); this.SpriteBatch = new SpriteBatch(this.GraphicsDevice); this.tr = new GlyphTextRenderer(this.Game); this.black = this.CMProvider.Global.Load <Texture2D>("Other Textures/FullBlack"); }
public virtual void PostDraw(SpriteBatch batch, SpriteFont font, GlyphTextRenderer tr, float alpha) { if (this.OnPostDraw == null) { return; } this.OnPostDraw(batch, font, tr, alpha); }
protected override void LoadContent() { this.sLetterAppear = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/MiscActors/LetterAppear"); this.letterTexture = this.CMProvider.CurrentLevel.Load <Texture2D>("Other Textures/mail/" + this.LetterName + "_1"); this.textRenderer = new GlyphTextRenderer(this.Game); this.sb = new SpriteBatch(this.GraphicsDevice); this.PlayerManager.CanControl = false; this.PlayerManager.Action = ActionType.ReadTurnAround; this.LetterText = GameText.GetString(this.LetterName); }
public override void PostDraw(SpriteBatch batch, SpriteFont font, GlyphTextRenderer tr, float alpha) { if (this.leaderboard == null) { this.InitLeaderboards(); } float viewScale = SettingsManager.GetViewScale(batch.GraphicsDevice); if (!this.leaderboard.InError) { tr.DrawString(batch, font, string.Format(StaticText.GetString("LeaderboardEntriesCount").ToUpper(CultureInfo.InvariantCulture), (object)this.leaderboard.TotalEntries), new Vector2(125f, 620f) * viewScale, new Color(1f, 1f, 1f, alpha), (Culture.IsCJK ? 0.2f : 1.5f) * viewScale); } float num1 = this.leaderboard.InError || this.leaderboard.Reading ? 0.0f : (this.leaderboard.CanPageUp ? 1f : 0.1f); float num2 = this.leaderboard.InError || this.leaderboard.Reading ? 0.0f : (this.leaderboard.CanPageDown ? 1f : 0.1f); float num3 = Culture.IsCJK ? -15f : 0.0f; if (this.Items.Count > 1) { int num4 = ServiceHelper.Game.GraphicsDevice.Viewport.Width / 2 - (int)viewScale * 20; int y = ServiceHelper.Game.GraphicsDevice.Viewport.Height / 2; this.leftArrowRect = new Rectangle?(new Rectangle((int)((double)num4 - (double)num4 * 5.0 / 7.0 + (double)num3 - (double)viewScale * 10.0), y, (int)(40.0 * (double)viewScale), (int)(25.0 * (double)viewScale))); this.rightArrowRect = new Rectangle?(new Rectangle((int)((double)num4 + (double)num4 * 5.0 / 7.0 + (double)num3), y, (int)(40.0 * (double)viewScale), (int)(25.0 * (double)viewScale))); tr.DrawString(batch, font, "{LA}", new Vector2((float)this.leftArrowRect.Value.Left + 15f * viewScale, (float)this.leftArrowRect.Value.Top), new Color(1f, 1f, 1f, num1 * alpha), (Culture.IsCJK ? 0.2f : 1f) * viewScale); tr.DrawString(batch, font, "{RA}", new Vector2((float)this.rightArrowRect.Value.Left + 15f * viewScale, (float)this.rightArrowRect.Value.Top), new Color(1f, 1f, 1f, num2 * alpha), (Culture.IsCJK ? 0.2f : 1f) * viewScale); } else { LeaderboardsMenuLevel leaderboardsMenuLevel1 = this; LeaderboardsMenuLevel leaderboardsMenuLevel2 = this; LeaderboardsMenuLevel leaderboardsMenuLevel3 = this; Rectangle? nullable1 = new Rectangle?(); Rectangle? nullable2 = nullable1; leaderboardsMenuLevel3.rightArrowRect = nullable2; Rectangle?nullable3; Rectangle?nullable4 = nullable3 = nullable1; leaderboardsMenuLevel2.rightArrowRect = nullable3; Rectangle?nullable5 = nullable4; leaderboardsMenuLevel1.leftArrowRect = nullable5; } if (!this.leaderboard.CanPageUp) { this.leftArrowRect = new Rectangle?(); } if (!this.leaderboard.CanPageDown) { this.rightArrowRect = new Rectangle?(); } if (!this.leaderboard.ChangingPage) { return; } tr.DrawCenteredString(batch, font, StaticText.GetString("LoadingLeaderboard"), new Color(1f, 1f, 1f, alpha), new Vector2(0.0f, 205f) * viewScale, (Culture.IsCJK ? 2f : 1f) * viewScale); }
public override void PostDraw(SpriteBatch batch, SpriteFont font, GlyphTextRenderer tr, float alpha) { float scale = 4f * SettingsManager.GetViewScale(batch.GraphicsDevice); Vector2 vector2_1 = new Vector2((float)batch.GraphicsDevice.Viewport.Width, (float)batch.GraphicsDevice.Viewport.Height) / 2f; Vector2 vector2_2 = new Vector2((float)this.HowToPlayImage.Width, (float)this.HowToPlayImage.Height) * scale; batch.End(); GraphicsDeviceExtensions.BeginPoint(batch); Vector2 position = vector2_1 - vector2_2 / 2f; batch.Draw(this.HowToPlayImage, position, new Rectangle?(), new Color(1f, 1f, 1f, alpha), 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0.0f); }
public override void PostDraw(SpriteBatch batch, SpriteFont font, GlyphTextRenderer tr, float alpha) { int width = batch.GraphicsDevice.Viewport.Width; int height = batch.GraphicsDevice.Viewport.Height; float viewScale = SettingsManager.GetViewScale(batch.GraphicsDevice); if (this.maskRT == null) { this.maskRT = new RenderTarget2D(this.GraphicsDevice, (int)(1024.0 * (double)viewScale), (int)(512.0 * (double)viewScale), false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24Stencil8, this.GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PlatformContents); this.Update(TimeSpan.Zero); } batch.Draw((Texture2D)this.maskRT, new Vector2((float)((double)width / 2.0 - 512.0 * (double)viewScale), (float)((double)height / 2.0 - 256.0 * (double)viewScale)), Color.White); }
protected override void LoadContent() { this.tr = new GlyphTextRenderer(this.Game); this.keyIcon = this.CMProvider.Global.Load <Texture2D>("Other Textures/hud/KEY_CUBE"); this.cubeIcon = this.CMProvider.Global.Load <Texture2D>("Other Textures/hud/NORMAL_CUBE"); this.antiIcon = this.CMProvider.Global.Load <Texture2D>("Other Textures/hud/ANTI_CUBE"); this.smallCubes = new Texture2D[8]; for (int index = 0; index < 8; ++index) { this.smallCubes[index] = this.CMProvider.Global.Load <Texture2D>("Other Textures/smallcubes/sc_" + (object)(index + 1)); } this.spriteBatch = new SpriteBatch(this.GraphicsDevice); }
public override void Initialize() { this.scalableTop = this.canvasMesh.AddFace(new Vector3(1f, 0.5f, 0.0f), Vector3.Zero, FaceOrientation.Front, false); this.scalableBottom = this.canvasMesh.CloneGroup(this.scalableTop); this.scalableMiddle = this.canvasMesh.AddFace(new Vector3(1f, 1f, 0.0f), Vector3.Zero, FaceOrientation.Front, false); this.neGroup = this.canvasMesh.AddFace(new Vector3(0.5f, 0.5f, 0.0f), Vector3.Zero, FaceOrientation.Front, false); this.nwGroup = this.canvasMesh.CloneGroup(this.neGroup); this.seGroup = this.canvasMesh.CloneGroup(this.neGroup); this.swGroup = this.canvasMesh.CloneGroup(this.neGroup); this.tailGroup = this.canvasMesh.AddFace(new Vector3(5.0 / 16.0, 0.25f, 0.0f), Vector3.Zero, FaceOrientation.Front, false, true); this.textGroup = this.textMesh.AddFace(new Vector3(1f, 1f, 0.0f), Vector3.Zero, FaceOrientation.Front, false); this.bGroup = this.canvasMesh.AddFace(new Vector3(1f, 1f, 0.0f), Vector3.Zero, FaceOrientation.Front, false); this.swGroup.Position = Vector3.Zero; this.scalableBottom.Position = new Vector3(0.5f, 0.0f, 0.0f); this.scalableMiddle.Position = new Vector3(0.0f, 0.5f, 0.0f); this.tailGroup.Position = new Vector3(0.5f, -0.25f, 0.0f); this.GTR = new GlyphTextRenderer(this.Game); this.LevelManager.LevelChanged += new Action(this.Hide); base.Initialize(); }
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); }
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; } }
public override void Initialize() { base.Initialize(); this.GraphicsDevice = ServiceHelper.Get <IGraphicsDeviceService>().GraphicsDevice; this.GraphicsDevice.DeviceReset += new EventHandler <EventArgs>(this.LoadCredits); this.SpriteBatch = new SpriteBatch(this.GraphicsDevice); this.gtr = new GlyphTextRenderer(ServiceHelper.Game); this.OnClose = (Action)(() => { if (this.started) { ServiceHelper.Get <ISoundManager>().PlayNewSong((string)null, 0.5f); ServiceHelper.Get <ISoundManager>().UnshelfSong(); ServiceHelper.Get <ISoundManager>().MusicVolumeFactor = this.wasFactor; } if (this.maskRT != null) { this.maskRT.Dispose(); this.maskRT = (RenderTarget2D)null; } this.started = false; }); this.scroller = new List <CreditsEntry>() { new CreditsEntry() { Size = new Vector2(512f, 512f) }, new CreditsEntry() { Text = CreditsText.GetString("PolytronProduction"), IsTitle = true }, new CreditsEntry() { Text = CreditsText.GetString("Design"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("ArtLevelDesignCredits") }, new CreditsEntry() { Text = CreditsText.GetString("Programming"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("ProgrammingCredits") }, new CreditsEntry() { Text = CreditsText.GetString("Producer"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("ProducerCredits") }, new CreditsEntry() { Text = CreditsText.GetString("Music"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("MusicCredits") }, new CreditsEntry() { Text = CreditsText.GetString("SoundEffects"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("SoundEffectsCredits") }, new CreditsEntry() { Text = CreditsText.GetString("Animation"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("AnimationCredits") }, new CreditsEntry() { Text = CreditsText.GetString("PcQaTeam"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("PcQaTeamCredits") }, new CreditsEntry() { Text = CreditsText.GetString("SupportedBy"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("SupportedByCredits") }, new CreditsEntry() { Text = CreditsText.GetString("PhilSpecialThanks"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("PhilSpecialThanksCredits") }, new CreditsEntry() { Text = CreditsText.GetString("RenoSpecialThanks"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("RenoSpecialThanksCredits") }, new CreditsEntry() { Text = CreditsText.GetString("XblaSpecialThanks"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("XblaSpecialThanksCredits") }, new CreditsEntry() { Text = CreditsText.GetString("ThirdParty"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("ThirdPartyCredits") }, new CreditsEntry() { Text = CreditsText.GetString("LicenseInfo"), IsSubtitle = true }, new CreditsEntry() { Text = CreditsText.GetString("PolytronFooter"), IsTitle = true } }; this.LoadCredits(); foreach (CreditsEntry creditsEntry in this.scroller) { if (creditsEntry.Text != null) { creditsEntry.Text = creditsEntry.Text.ToUpper(CultureInfo.InvariantCulture); creditsEntry.Size = !creditsEntry.IsTitle ? this.FontManager.Small.MeasureString(creditsEntry.Text) * this.FontManager.SmallFactor : this.FontManager.Big.MeasureString(creditsEntry.Text) * this.FontManager.BigFactor; } } }
private void LateLoadContent() { this.GTR = new GlyphTextRenderer(this.Game); SpriteFont big = this.FontManager.Big; float scale = (Culture.IsCJK ? 0.6f : 1f) * SettingsManager.GetViewScale(this.GraphicsDevice); Vector2 vector2_1 = this.GTR.MeasureWithGlyphs(big, this.Text, scale); this.MiddlePartSize = vector2_1 * new Vector2(1f, 1.25f); int width = (int)this.MiddlePartSize.X; int height = (int)this.MiddlePartSize.Y; Vector2 vector2_2 = this.MiddlePartSize; if (this.TextTexture != null) { this.TextTexture.Dispose(); this.TextTexture = (RenderTarget2D)null; } this.TextTexture = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, this.GraphicsDevice.PresentationParameters.DepthStencilFormat, this.GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents); using (SpriteBatch spriteBatch = new SpriteBatch(this.GraphicsDevice)) { this.GraphicsDevice.SetRenderTarget(this.TextTexture); GraphicsDeviceExtensions.PrepareDraw(this.GraphicsDevice); this.GraphicsDevice.Clear(ClearOptions.Target, new Color(215, 188, 122, 0), 1f, 0); GraphicsDeviceExtensions.BeginPoint(spriteBatch); this.GTR.DrawString(spriteBatch, big, this.Text, vector2_2 / 2f - vector2_1 / 2f + new Vector2(0.0f, this.FontManager.TopSpacing / 2f), TextScroll.TextColor, scale); spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D)null); } this.MiddlePartSize /= Culture.IsCJK ? 3f : 2f; this.MiddlePartSize -= new Vector2(16f, 0.0f); this.ScrollMesh = new Mesh() { Blending = new BlendingMode?(BlendingMode.Alphablending), Effect = (BaseEffect) new DefaultEffect.Textured(), AlwaysOnTop = true, DepthWrites = false, Material = { Opacity = 0.0f }, SamplerState = SamplerState.PointClamp }; this.LeftPart = this.ScrollMesh.AddFace(new Vector3(2f), new Vector3(0.0f, 0.5f, 0.0f), FaceOrientation.Front, true); this.LeftPart.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/SCROLL/SCROLL_A"); this.MiddlePart = this.ScrollMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true); this.MiddlePart.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/SCROLL/SCROLL_B"); this.RightPart = this.ScrollMesh.AddFace(new Vector3(2f), new Vector3(0.0f, -0.5f, 0.0f), FaceOrientation.Front, true); this.RightPart.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/SCROLL/SCROLL_C"); this.TextGroup = this.ScrollMesh.AddFace(new Vector3((float)(((double)this.MiddlePartSize.X + 16.0) / 16.0), this.MiddlePartSize.Y / 16f, 1f), new Vector3(-0.125f, 0.0f, 0.0f), FaceOrientation.Front, true); this.TextGroup.SamplerState = Culture.IsCJK ? SamplerState.AnisotropicClamp : SamplerState.PointClamp; this.TextGroup.Texture = (Texture)this.TextTexture; this.TextGroup.Material = new Material() { Opacity = 0.0f }; this.ScrollMesh.Effect.ForcedProjectionMatrix = new Matrix?(Matrix.Identity); this.ScrollMesh.Effect.ForcedViewMatrix = new Matrix?(Matrix.Identity); this.MiddlePartSize /= SettingsManager.GetViewScale(this.GraphicsDevice); this.GraphicsDevice.DeviceReset += new EventHandler <EventArgs>(this.UpdateViewScale); if (Culture.IsCJK) { this.MiddlePartSize.X /= 2f; } this.Ready = true; }