protected override void FillTab() { Rect rect = new Rect(0f, 0f, this.size.x, this.size.y).ContractedBy(5f); FactionColorUtilities.DrawFactionColorTab(rect); }
public static void DrawFactionColorTab(Rect rect) { GUI.BeginGroup(rect); Rect rect2 = new Rect(rect.x, rect.y + 20f, 250f, 55f); Text.Font = GameFont.Medium; Widgets.Label(rect2, "PlayerHeraldry".Translate(new object[] { Faction.OfPlayer.Name })); Text.Font = GameFont.Small; Rect rect4 = new Rect(rect.width - 205f, rect2.yMax + 5f, 200f, 200f); Rect rect5 = new Rect(rect2.x, rect2.height + 5f, 150f, 30f); Rect pos = new Rect(rect5.x + 150f, rect5.y, 15f, 15f); Widgets.Label(rect5, "PlayerColorOne".Translate()); Widgets.DrawRectFast(pos, FactionColorUtilities.currentPlayerStoryTracker.PlayerColorOne); if (Widgets.ButtonInvisible(pos, true)) { ShowColorDialog(FactionColorUtilities.currentPlayerStoryTracker.PlayerColorOne, false); } Rect rect6 = rect5; rect6.y += rect5.height + 5f; Rect pos2 = new Rect(rect6.x + 150f, rect6.y, 15f, 15f); Widgets.Label(rect6, "PlayerColorTwo".Translate()); Widgets.DrawRectFast(pos2, FactionColorUtilities.currentPlayerStoryTracker.PlayerColorTwo); if (Widgets.ButtonInvisible(pos2, true)) { ShowColorDialog(FactionColorUtilities.currentPlayerStoryTracker.PlayerColorTwo, true); } // Texture2D bannerTint = ContentFinder<Texture2D>.Get(FactionColorUtilities.currentPlayerStoryTracker.BannerGraphicPath); Texture2D bannerTint = currentPlayerBanner.MatSingle.GetMaskTexture(); Rect rect7 = rect6; rect7.y += rect6.height + 5f; Rect pos3 = new Rect(rect7.x + 150f, rect7.y, 15f, 15f); Widgets.Label(rect7, "BannerType".Translate()); if (Widgets.ButtonImage(pos3, bannerTint)) { FactionColorUtilities.ShowBannerDialog(); } Text.Font = GameFont.Small; RenderTexture image = new RenderTexture(64, 64, 24); Rect heraldryRect = new Rect(rect.width - 100f, rect.y + 50f, 64f, 64f); // Texture2D bannerTex = FactionColorUtilities.getColoredBannerTex(); // GUI.color = currentPlayerBanner.color; GUI.DrawTexture(heraldryRect, bannerTint); GUI.color = Color.white; Vector3 loc = new Vector3(UI.screenWidth / 2f, 50f, UI.screenHeight / 2f); loc.y += 50f; Mesh mesh = currentPlayerBanner.MeshAt(Rot4.North); Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(loc, Quaternion.AngleAxis(0f, Vector3.up), new Vector3(1f, 1f, 1f)); Graphics.DrawMesh(mesh, matrix, currentPlayerBanner.MatSingle, 0); GUI.EndGroup(); }