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"); }
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) { 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); }
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); }
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); }
protected override void LoadContent() { base.LoadContent(); GTR = new GlyphTextRenderer(Game); PointerCursor = CMProvider.Global.Load<Texture2D>("Other Textures/cursor/CURSOR_POINTER"); CanClickCursor = CMProvider.Global.Load<Texture2D>("Other Textures/cursor/CURSOR_CLICKER_A"); ClickedCursor = CMProvider.Global.Load<Texture2D>("Other Textures/cursor/CURSOR_CLICKER_B"); GrabbedCursor = CMProvider.Global.Load<Texture2D>("Other Textures/cursor/CURSOR_GRABBER"); SpriteBatch = new SpriteBatch(GraphicsDevice); }
protected override void LoadContent() { ContentManager contentManager = this.CMProvider.Get(CM.Intro); StaticText.GetString("Loading"); bool flag = (double) SettingsManager.GetViewScale(this.GraphicsDevice) >= 1.5; this.TrixelEngineText = contentManager.Load<Texture2D>("Other Textures/splash/trixels" + (flag ? "_1440" : "")); this.TrapdoorLogo = contentManager.Load<Texture2D>("Other Textures/splash/trapdoor"); this.spriteBatch = new SpriteBatch(this.GraphicsDevice); this.tr = new GlyphTextRenderer(this.Game); this.TrixelPlanes.Position = (Vector3.Right + Vector3.Up) * -0.125f - Vector3.Up * 0.25f; this.TrixelPlanes.Scale = new Vector3(0.75f); this.TrixelPlanes.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Back, Color.Magenta, true, false); this.TrixelPlanes.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Top, Color.Yellow, true, false); this.TrixelPlanes.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Left, Color.Cyan, true, false); SettingsManager.SetupViewport(this.GraphicsDevice, false); float aspectRatio1 = this.GraphicsDevice.Viewport.AspectRatio; Mesh mesh1 = this.TrixelPlanes; DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored(); vertexColored1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(2f * aspectRatio1, 2f, 0.1f, 100f)); vertexColored1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.UnitY - Vector3.UnitZ - Vector3.UnitX, Vector3.Zero, Vector3.Up)); DefaultEffect.VertexColored vertexColored2 = vertexColored1; mesh1.Effect = (BaseEffect) vertexColored2; Intro intro1 = this; Mesh mesh2 = new Mesh(); mesh2.AlwaysOnTop = true; mesh2.DepthWrites = false; Mesh mesh3 = mesh2; DefaultEffect.VertexColored vertexColored3 = new DefaultEffect.VertexColored(); vertexColored3.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(5f * aspectRatio1, 5f, 0.1f, 100f)); vertexColored3.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.UnitY - Vector3.UnitZ - Vector3.UnitX, Vector3.Zero, Vector3.Up)); DefaultEffect.VertexColored vertexColored4 = vertexColored3; mesh3.Effect = (BaseEffect) vertexColored4; Mesh mesh4 = mesh2; intro1.TrialMesh = mesh4; this.TrialMesh.AddColoredBox(Vector3.One, Vector3.Zero, new Color(209, 0, 55), true); ServiceHelper.AddComponent((IGameComponent) (this.PolytronLogo = new PolytronLogo(this.Game))); this.screen = Intro.Screen.WhiteScreen; Intro.FirstBootComplete = true; if (this.Restarted && !this.FullLogos) this.screen = Intro.Screen.Fez; if (this.GameState.ForcedSignOut) { this.InputManager.ClearActiveController(); this.screen = Intro.Screen.SignInChooseDevice; ServiceHelper.AddComponent((IGameComponent) (Intro.Starfield = new StarField(this.Game))); } if (this.GameState.LoggedOutPlayerTag != null) { this.InputManager.ClearActiveController(); this.screen = Intro.Screen.SignOutPrompt; ServiceHelper.AddComponent((IGameComponent) (Intro.Starfield = new StarField(this.Game))); } if (Fez.SkipLogos) this.screen = Intro.Screen.Fez; if (this.Fake) { this.screen = Intro.Screen.Polytron; this.PolytronLogo.Enabled = true; } if (this.Sell) { this.SoundManager.MuteAmbienceTracks(); this.SoundManager.PlayNewSong("GOMEZ", 0.1f); this.screen = Intro.Screen.SellScreen; } this.GameState.ForceTimePaused = true; this.GameState.InCutscene = true; this.phaseTime = TimeSpan.FromSeconds(-0.600000023841858); this.sTitleBassHit = contentManager.Load<SoundEffect>("Sounds/Intro/LogoZoom"); this.sTrixelIn = contentManager.Load<SoundEffect>("Sounds/Intro/TrixelLogoIn"); this.sTrixelOut = contentManager.Load<SoundEffect>("Sounds/Intro/TrixelLogoOut"); this.sExitGame = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/ExitGame"); this.sConfirm = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/Confirm"); this.sDrone = contentManager.Load<SoundEffect>("Sounds/Intro/FezLogoDrone"); this.sStarZoom = contentManager.Load<SoundEffect>("Sounds/Intro/StarZoom"); ServiceHelper.AddComponent((IGameComponent) (this.FezLogo = new FezLogo(this.Game) { Glitched = this.Glitch })); if (this.Sell) { this.FezLogo.Inverted = true; this.FezLogo.TransitionStarted = true; this.FezLogo.LogoTextureXFade = 1f; this.FezLogo.Opacity = 1f; Intro.Starfield = this.FezLogo.Starfield; this.Enabled = this.Visible = false; } if (Intro.HasShownSaveIndicator) return; float aspectRatio2 = this.GraphicsDevice.Viewport.AspectRatio; Intro intro2 = this; Mesh mesh5 = new Mesh(); Mesh mesh6 = mesh5; DefaultEffect.VertexColored vertexColored5 = new DefaultEffect.VertexColored(); vertexColored5.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * aspectRatio2, 14f, 0.1f, 100f)); vertexColored5.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up)); DefaultEffect.VertexColored vertexColored6 = vertexColored5; mesh6.Effect = (BaseEffect) vertexColored6; mesh5.Blending = new BlendingMode?(BlendingMode.Alphablending); mesh5.AlwaysOnTop = true; mesh5.DepthWrites = false; Mesh mesh7 = mesh5; intro2.SaveIndicatorMesh = mesh7; this.SaveIndicatorMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, Color.Red, true); }
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 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); }
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; } } }
public void Preload() { GTR = new GlyphTextRenderer(Game); PointerCursor = CMProvider.Global.Load<Texture2D>("Other Textures/cursor/CURSOR_POINTER"); CanClickCursor = CMProvider.Global.Load<Texture2D>("Other Textures/cursor/CURSOR_CLICKER_A"); ClickedCursor = CMProvider.Global.Load<Texture2D>("Other Textures/cursor/CURSOR_CLICKER_B"); GrabbedCursor = CMProvider.Global.Load<Texture2D>("Other Textures/cursor/CURSOR_GRABBER"); SpriteBatch = new SpriteBatch(GraphicsDevice); }
public override void Initialize() { base.Initialize(); this.GTR = new GlyphTextRenderer(this.Game); this.spriteBatch = new SpriteBatch(this.GraphicsDevice); this.Scripting.CutsceneSkipped += new Action(this.OnCutsceneSkipped); this.Vertices = new List<Vector4>() { new Vector4(-1f, -1f, -1f, -1f), new Vector4(1f, -1f, -1f, -1f), new Vector4(-1f, 1f, -1f, -1f), new Vector4(1f, 1f, -1f, -1f), new Vector4(-1f, -1f, 1f, -1f), new Vector4(1f, -1f, 1f, -1f), new Vector4(-1f, 1f, 1f, -1f), new Vector4(1f, 1f, 1f, -1f), new Vector4(-1f, -1f, -1f, 1f), new Vector4(1f, -1f, -1f, 1f), new Vector4(-1f, 1f, -1f, 1f), new Vector4(1f, 1f, -1f, 1f), new Vector4(-1f, -1f, 1f, 1f), new Vector4(1f, -1f, 1f, 1f), new Vector4(-1f, 1f, 1f, 1f), new Vector4(1f, 1f, 1f, 1f) }; this.DotMesh = new Mesh() { Effect = (BaseEffect) new DotEffect(), Blending = new BlendingMode?(BlendingMode.Additive), DepthWrites = false, Culling = CullMode.None, AlwaysOnTop = true, Material = { Opacity = 0.3333333f } }; this.RaysMesh = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/smooth_ray")), Blending = new BlendingMode?(BlendingMode.Additive), SamplerState = SamplerState.AnisotropicClamp, DepthWrites = false, AlwaysOnTop = true }; this.FlareMesh = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/rainbow_flare")), Blending = new BlendingMode?(BlendingMode.Additive), SamplerState = SamplerState.AnisotropicClamp, DepthWrites = false, AlwaysOnTop = true }; DotHost dotHost = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DefaultEffect.Textured textured1 = new DefaultEffect.Textured(); textured1.IgnoreCache = true; DefaultEffect.Textured textured2 = textured1; mesh2.Effect = (BaseEffect) textured2; mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending); mesh1.SamplerState = SamplerStates.PointMipClamp; mesh1.DepthWrites = false; mesh1.AlwaysOnTop = true; Mesh mesh3 = mesh1; dotHost.VignetteMesh = mesh3; this.VignetteMesh.AddFace(new Vector3(1f), Vector3.Zero, FaceOrientation.Front, true); this.BPromptMesh = new Mesh() { AlwaysOnTop = true, SamplerState = SamplerState.PointClamp, Blending = new BlendingMode?(BlendingMode.Alphablending), Effect = (BaseEffect) new DefaultEffect.Textured() }; this.BPromptMesh.AddFace(new Vector3(1f, 1f, 0.0f), Vector3.Zero, FaceOrientation.Front, false); this.FlareMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true); this.DotMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) (this.DotWireGeometry = new IndexedUserPrimitives<FezVertexPositionColor>(PrimitiveType.LineList)); this.DotMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) (this.DotFacesGeometry = new IndexedUserPrimitives<FezVertexPositionColor>(PrimitiveType.TriangleList)); this.DotWireGeometry.Vertices = new FezVertexPositionColor[16]; for (int index = 0; index < 16; ++index) this.DotWireGeometry.Vertices[index].Color = new Color(1f, 1f, 1f, 1f); this.DotWireGeometry.Indices = new int[64] { 0, 1, 0, 2, 2, 3, 3, 1, 4, 5, 6, 7, 4, 6, 5, 7, 4, 0, 6, 2, 3, 7, 1, 5, 10, 11, 8, 9, 8, 10, 9, 11, 12, 14, 14, 15, 15, 13, 12, 13, 12, 8, 14, 10, 15, 11, 13, 9, 2, 10, 3, 11, 0, 8, 1, 9, 6, 14, 7, 15, 4, 12, 5, 13 }; this.DotFacesGeometry.Vertices = new FezVertexPositionColor[96]; for (int index1 = 0; index1 < 4; ++index1) { for (int index2 = 0; index2 < 6; ++index2) { Vector3 vector3 = Vector3.Zero; switch ((index2 + index1 * 6) % 6) { case 0: vector3 = new Vector3(0.0f, 1f, 0.75f); break; case 1: vector3 = new Vector3(0.1666667f, 1f, 0.75f); break; case 2: vector3 = new Vector3(0.3333333f, 1f, 0.75f); break; case 3: vector3 = new Vector3(0.5f, 1f, 0.75f); break; case 4: vector3 = new Vector3(0.6666667f, 1f, 0.75f); break; case 5: vector3 = new Vector3(0.8333333f, 1f, 0.75f); break; } for (int index3 = 0; index3 < 4; ++index3) this.DotFacesGeometry.Vertices[index3 + index2 * 4 + index1 * 24].Color = new Color(vector3.X, vector3.Y, vector3.Z); } } this.FaceVertexIndices = new int[96] { 0, 2, 3, 1, 1, 3, 7, 5, 5, 7, 6, 4, 4, 6, 2, 0, 0, 4, 5, 1, 2, 6, 7, 3, 8, 10, 11, 9, 9, 11, 15, 13, 13, 15, 14, 12, 12, 14, 10, 8, 8, 12, 13, 9, 10, 14, 15, 11, 0, 1, 9, 8, 0, 2, 10, 8, 2, 3, 11, 10, 3, 1, 9, 11, 4, 5, 13, 12, 6, 7, 15, 14, 4, 6, 14, 12, 5, 7, 15, 13, 4, 0, 8, 12, 6, 2, 10, 14, 3, 7, 15, 11, 1, 5, 13, 9 }; this.DotFacesGeometry.Indices = new int[144] { 0, 2, 1, 0, 3, 2, 4, 6, 5, 4, 7, 6, 8, 10, 9, 8, 11, 10, 12, 14, 13, 12, 15, 14, 16, 17, 18, 16, 18, 19, 20, 22, 21, 20, 23, 22, 24, 26, 25, 24, 27, 26, 28, 30, 29, 28, 31, 30, 32, 34, 33, 32, 35, 34, 36, 38, 37, 36, 39, 38, 40, 41, 42, 40, 42, 43, 44, 46, 45, 44, 47, 46, 48, 50, 49, 48, 51, 50, 52, 54, 53, 52, 55, 54, 56, 58, 57, 56, 59, 58, 60, 62, 61, 60, 63, 62, 64, 65, 66, 64, 66, 67, 68, 70, 69, 68, 71, 70, 72, 74, 73, 72, 75, 74, 76, 78, 77, 76, 79, 78, 80, 82, 81, 80, 83, 82, 84, 86, 85, 84, 87, 86, 88, 89, 90, 88, 90, 91, 92, 94, 93, 92, 95, 94 }; this.sHide = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/Hide"); this.sComeOut = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/ComeOut"); this.sMove = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/Move"); this.sIdle = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/Idle"); this.sHeyListen = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/HeyListen"); this.LevelManager.LevelChanged += new Action(this.RebuildFlare); }
public GlyphDescription(Texture2D image, GlyphTextRenderer.GlyphMetadata md) { this.Image = image; this.Metadata = md; }
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; }
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(); }
public override void Initialize() { base.Initialize(); SpriteBatch = new SpriteBatch(GraphicsDevice); GTR = new GlyphTextRenderer(Game); FontSmall = FontManager.Small; FontSmallFactor = 1f; FontBig = FontManager.Big; FontBigFactor = 1.5f; FezSpeedrun.DefaultSplitCases.Add(delegate(ISpeedrunClock clock) { if (LevelManager == null || LevelManager.Name == null) { return null; } if (LevelManager.Name.StartsWith("GOMEZ_HOUSE_END_") && (PlayerManager.Action == ActionType.EnterDoorSpin || PlayerManager.Action == ActionType.EnteringDoor)) { clock.Running = false; return "ZE_DOOR_AT_ZE_END"; } if (LevelManager.Name != PrevLevel) { PrevLevel = LevelManager.Name; return LevelManager.Name; } return null; }); }
protected override void LoadContent() { this.SpriteBatch = new SpriteBatch(this.GraphicsDevice); this.tr = new GlyphTextRenderer(this.Game); ContentManager contentManager = this.CMProvider.Get(CM.Menu); this.PointerCursor = contentManager.Load<Texture2D>("Other Textures/cursor/CURSOR_POINTER"); this.CanClickCursor = contentManager.Load<Texture2D>("Other Textures/cursor/CURSOR_CLICKER_A"); this.ClickedCursor = contentManager.Load<Texture2D>("Other Textures/cursor/CURSOR_CLICKER_B"); this.sAdvanceLevel = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/AdvanceLevel"); this.sCancel = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/Cancel"); this.sConfirm = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/Confirm"); this.sCursorUp = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/CursorUp"); this.sCursorDown = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/CursorDown"); this.sExitGame = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/Menu/ExitGame"); this.sReturnLevel = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/ReturnLevel"); this.sScreenNarrowen = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/ScreenNarrowen"); this.sScreenWiden = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/ScreenWiden"); this.sSliderValueDecrease = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/SliderValueDecrease"); this.sSliderValueIncrease = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/SliderValueIncrease"); this.sStartGame = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/Menu/StartGame"); this.sAppear = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/Appear"); this.sDisappear = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/Menu/Disappear"); this.LeaderboardsMenu.InputManager = this.InputManager; this.LeaderboardsMenu.GameState = this.GameState; this.LeaderboardsMenu.Font = this.Fonts.Big; this.LeaderboardsMenu.MouseState = this.MouseState; this.ControlsMenu.FontManager = this.Fonts; this.ControlsMenu.CMProvider = this.CMProvider; this.CreditsMenu.FontManager = this.Fonts; foreach (MenuLevel menuLevel in this.MenuLevels) { menuLevel.CMProvider = this.CMProvider; menuLevel.Initialize(); } MenuBase menuBase1 = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored(); vertexColored1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up)); vertexColored1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f)); DefaultEffect.VertexColored vertexColored2 = vertexColored1; mesh2.Effect = (BaseEffect) vertexColored2; mesh1.DepthWrites = false; mesh1.AlwaysOnTop = true; mesh1.Culling = CullMode.None; Mesh mesh3 = mesh1; menuBase1.Selector = mesh3; this.Selector.AddLines(new Color[4] { Color.White, Color.White, Color.White, Color.White }, new Vector3(-1f, -1f, 10f), new Vector3(-1f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(1f, -1f, 10f)); this.Selector.AddLines(new Color[4] { Color.White, Color.White, Color.White, Color.White }, new Vector3(-1f, 1f, 10f), new Vector3(0.0f, 1f, 10f), new Vector3(-1f, -1f, 10f), new Vector3(0.0f, -1f, 10f)); this.Selector.AddLines(new Color[4] { Color.White, Color.White, Color.White, Color.White }, new Vector3(0.0f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(0.0f, -1f, 10f), new Vector3(1f, -1f, 10f)); MenuBase menuBase2 = this; Mesh mesh4 = new Mesh(); Mesh mesh5 = mesh4; DefaultEffect.VertexColored vertexColored3 = new DefaultEffect.VertexColored(); vertexColored3.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up)); vertexColored3.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f)); DefaultEffect.VertexColored vertexColored4 = vertexColored3; mesh5.Effect = (BaseEffect) vertexColored4; mesh4.DepthWrites = false; mesh4.AlwaysOnTop = true; mesh4.Culling = CullMode.None; mesh4.Enabled = false; Mesh mesh6 = mesh4; menuBase2.Frame = mesh6; this.Frame.AddLines(new Color[8] { Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White }, new Vector3(-1f, -1f, 10f), new Vector3(-1f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(1f, -1f, 10f), new Vector3(-1f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(-1f, -1f, 10f), new Vector3(1f, -1f, 10f)); MenuBase menuBase3 = this; Mesh mesh7 = new Mesh(); Mesh mesh8 = mesh7; DefaultEffect.Textured textured1 = new DefaultEffect.Textured(); textured1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up)); textured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f)); DefaultEffect.Textured textured2 = textured1; mesh8.Effect = (BaseEffect) textured2; mesh7.DepthWrites = false; mesh7.AlwaysOnTop = true; mesh7.SamplerState = SamplerState.PointClamp; Mesh mesh9 = mesh7; menuBase3.MenuLevelOverlay = mesh9; this.MenuLevelOverlay.AddFace(new Vector3(2f, 2f, 1f), new Vector3(0.0f, 0.0f, 10f), FaceOrientation.Back, true); MenuBase menuBase4 = this; Mesh mesh10 = new Mesh(); Mesh mesh11 = mesh10; DefaultEffect.Textured textured3 = new DefaultEffect.Textured(); textured3.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up)); textured3.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f)); DefaultEffect.Textured textured4 = textured3; mesh11.Effect = (BaseEffect) textured4; mesh10.DepthWrites = false; mesh10.AlwaysOnTop = true; Mesh mesh12 = mesh10; menuBase4.Mask = mesh12; this.Mask.AddFace(new Vector3(2f, 2f, 1f), new Vector3(0.0f, 0.0f, 10f), FaceOrientation.Back, true); Waiters.Wait(0.0, new Action(this.Rescale)); this.RenderToTexture(); }
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); }
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); }