public static Graphic GetNakedBodyGraphic(BodyType bodyType, Shader shader, Color skinColor) { if (bodyType == BodyType.Undefined) { Log.Error("Getting naked body graphic with undefined body type."); bodyType = BodyType.Male; } string str = "Naked_" + bodyType.ToString(); string path = "Things/Pawn/Humanlike/Bodies/" + str; return(GraphicDatabase.Get <Graphic_Multi>(path, shader, Vector2.one, skinColor)); }
public void ResolveAllGraphics() { ClearCache(); if (pawn.RaceProps.Humanlike) { nakedGraphic = GraphicDatabase.Get <Graphic_Multi>(pawn.story.bodyType.bodyNakedGraphicPath, ShaderDatabase.CutoutSkin, Vector2.one, pawn.story.SkinColor); rottingGraphic = GraphicDatabase.Get <Graphic_Multi>(pawn.story.bodyType.bodyNakedGraphicPath, ShaderDatabase.CutoutSkin, Vector2.one, RottingColor); dessicatedGraphic = GraphicDatabase.Get <Graphic_Multi>(pawn.story.bodyType.bodyDessicatedGraphicPath, ShaderDatabase.Cutout); headGraphic = GraphicDatabaseHeadRecords.GetHeadNamed(pawn.story.HeadGraphicPath, pawn.story.SkinColor); desiccatedHeadGraphic = GraphicDatabaseHeadRecords.GetHeadNamed(pawn.story.HeadGraphicPath, RottingColor); skullGraphic = GraphicDatabaseHeadRecords.GetSkull(); headStumpGraphic = GraphicDatabaseHeadRecords.GetStump(pawn.story.SkinColor); desiccatedHeadStumpGraphic = GraphicDatabaseHeadRecords.GetStump(RottingColor); hairGraphic = GraphicDatabase.Get <Graphic_Multi>(pawn.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, pawn.story.hairColor); ResolveApparelGraphics(); return; } PawnKindLifeStage curKindLifeStage = pawn.ageTracker.CurKindLifeStage; if (pawn.gender != Gender.Female || curKindLifeStage.femaleGraphicData == null) { nakedGraphic = curKindLifeStage.bodyGraphicData.Graphic; } else { nakedGraphic = curKindLifeStage.femaleGraphicData.Graphic; } if (pawn.RaceProps.packAnimal) { packGraphic = GraphicDatabase.Get <Graphic_Multi>(nakedGraphic.path + "Pack", ShaderDatabase.Cutout, nakedGraphic.drawSize, Color.white); } rottingGraphic = nakedGraphic.GetColoredVersion(ShaderDatabase.CutoutSkin, RottingColor, RottingColor); if (curKindLifeStage.dessicatedBodyGraphicData != null) { if (pawn.gender != Gender.Female || curKindLifeStage.femaleDessicatedBodyGraphicData == null) { dessicatedGraphic = curKindLifeStage.dessicatedBodyGraphicData.GraphicColoredFor(pawn); } else { dessicatedGraphic = curKindLifeStage.femaleDessicatedBodyGraphicData.GraphicColoredFor(pawn); } } if (!pawn.kindDef.alternateGraphics.NullOrEmpty()) { Rand.PushState(pawn.thingIDNumber ^ 0xB415); if (Rand.Value <= pawn.kindDef.alternateGraphicChance) { nakedGraphic = pawn.kindDef.alternateGraphics.RandomElementByWeight((AlternateGraphic x) => x.Weight).GetGraphic(nakedGraphic); } Rand.PopState(); } }
public override void PostLoad() { placingDraggableDimensions = 2; LongEventHandler.ExecuteWhenFinished(delegate { Shader shader = null; switch (edgeType) { case TerrainEdgeType.Hard: shader = ShaderDatabase.TerrainHard; break; case TerrainEdgeType.Fade: shader = ShaderDatabase.TerrainFade; break; case TerrainEdgeType.FadeRough: shader = ShaderDatabase.TerrainFadeRough; break; case TerrainEdgeType.Water: shader = ShaderDatabase.TerrainWater; break; } graphic = GraphicDatabase.Get <Graphic_Terrain>(texturePath, shader, Vector2.one, color, 2000 + renderPrecedence); if (shader == ShaderDatabase.TerrainFadeRough || shader == ShaderDatabase.TerrainWater) { graphic.MatSingle.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex); } if (!waterDepthShader.NullOrEmpty()) { waterDepthMaterial = MaterialAllocator.Create(ShaderDatabase.LoadShader(waterDepthShader)); waterDepthMaterial.renderQueue = 2000 + renderPrecedence; waterDepthMaterial.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex); if (waterDepthShaderParameters != null) { for (int j = 0; j < waterDepthShaderParameters.Count; j++) { waterDepthShaderParameters[j].Apply(waterDepthMaterial); } } } }); if (tools != null) { for (int i = 0; i < tools.Count; i++) { tools[i].id = i.ToString(); } } base.PostLoad(); }
public Graphic_Multi GetGraphic(Color color) { for (int i = 0; i < this.graphics.Count; i++) { if (color.IndistinguishableFrom(this.graphics[i].Key)) { return(this.graphics[i].Value); } } Graphic_Multi graphic_Multi = (Graphic_Multi)GraphicDatabase.Get <Graphic_Multi>(this.graphicPath, ShaderDatabase.CutoutSkin, Vector2.one, color); this.graphics.Add(new KeyValuePair <Color, Graphic_Multi>(color, graphic_Multi)); return(graphic_Multi); }
public Graphic_Multi GetGraphic(Color color, bool dessicated = false) { for (int i = 0; i < graphics.Count; i++) { if (color.IndistinguishableFrom(graphics[i].Key)) { return(graphics[i].Value); } } Shader shader = dessicated ? ShaderDatabase.Cutout : ShaderDatabase.CutoutSkin; Graphic_Multi graphic_Multi = (Graphic_Multi)GraphicDatabase.Get <Graphic_Multi>(graphicPath, shader, Vector2.one, color); graphics.Add(new KeyValuePair <Color, Graphic_Multi>(color, graphic_Multi)); return(graphic_Multi); }
public static Graphic Get(Type graphicClass, string path, Shader shader, Vector2 drawSize, Color color, Color colorTwo, GraphicData data) { GraphicRequest graphicRequest = new GraphicRequest(graphicClass, path, shader, drawSize, color, colorTwo, data, 0); if (graphicRequest.graphicClass == typeof(Graphic_Single)) { return(GraphicDatabase.GetInner <Graphic_Single>(graphicRequest)); } if (graphicRequest.graphicClass == typeof(Graphic_Terrain)) { return(GraphicDatabase.GetInner <Graphic_Terrain>(graphicRequest)); } if (graphicRequest.graphicClass == typeof(Graphic_Multi)) { return(GraphicDatabase.GetInner <Graphic_Multi>(graphicRequest)); } if (graphicRequest.graphicClass == typeof(Graphic_Mote)) { return(GraphicDatabase.GetInner <Graphic_Mote>(graphicRequest)); } if (graphicRequest.graphicClass == typeof(Graphic_Random)) { return(GraphicDatabase.GetInner <Graphic_Random>(graphicRequest)); } if (graphicRequest.graphicClass == typeof(Graphic_Flicker)) { return(GraphicDatabase.GetInner <Graphic_Flicker>(graphicRequest)); } if (graphicRequest.graphicClass == typeof(Graphic_Appearances)) { return(GraphicDatabase.GetInner <Graphic_Appearances>(graphicRequest)); } if (graphicRequest.graphicClass == typeof(Graphic_StackCount)) { return(GraphicDatabase.GetInner <Graphic_StackCount>(graphicRequest)); } try { return((Graphic)GenGeneric.InvokeStaticGenericMethod(typeof(GraphicDatabase), graphicRequest.graphicClass, "GetInner", graphicRequest)); } catch (Exception ex) { Log.Error("Exception getting " + graphicClass + " at " + path + ": " + ex.ToString()); } return(BaseContent.BadGraphic); }
public override void PostLoad() { this.placingDraggableDimensions = 2; LongEventHandler.ExecuteWhenFinished(delegate { Shader shader = null; switch (this.edgeType) { case TerrainDef.TerrainEdgeType.Hard: shader = ShaderDatabase.TerrainHard; break; case TerrainDef.TerrainEdgeType.Fade: shader = ShaderDatabase.TerrainFade; break; case TerrainDef.TerrainEdgeType.FadeRough: shader = ShaderDatabase.TerrainFadeRough; break; case TerrainDef.TerrainEdgeType.Water: shader = ShaderDatabase.TerrainWater; break; } this.graphic = GraphicDatabase.Get <Graphic_Terrain>(this.texturePath, shader, Vector2.one, this.color, 2000 + this.renderPrecedence); if (shader == ShaderDatabase.TerrainFadeRough || shader == ShaderDatabase.TerrainWater) { this.graphic.MatSingle.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex); } if (!this.waterDepthShader.NullOrEmpty()) { this.waterDepthMaterial = new Material(ShaderDatabase.LoadShader(this.waterDepthShader)); this.waterDepthMaterial.renderQueue = 2000 + this.renderPrecedence; this.waterDepthMaterial.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex); if (this.waterDepthShaderParameters != null) { for (int i = 0; i < this.waterDepthShaderParameters.Count; i++) { this.waterDepthMaterial.SetFloat(this.waterDepthShaderParameters[i].name, this.waterDepthShaderParameters[i].value); } } } }); base.PostLoad(); }
public void ResolveAllGraphics() { this.ClearCache(); if (this.pawn.RaceProps.Humanlike) { this.nakedGraphic = GraphicDatabase.Get <Graphic_Multi>(this.pawn.story.bodyType.bodyNakedGraphicPath, ShaderDatabase.CutoutSkin, Vector2.one, this.pawn.story.SkinColor); this.rottingGraphic = GraphicDatabase.Get <Graphic_Multi>(this.pawn.story.bodyType.bodyNakedGraphicPath, ShaderDatabase.CutoutSkin, Vector2.one, PawnGraphicSet.RottingColor); this.dessicatedGraphic = GraphicDatabase.Get <Graphic_Multi>(this.pawn.story.bodyType.bodyDessicatedGraphicPath, ShaderDatabase.Cutout); this.headGraphic = GraphicDatabaseHeadRecords.GetHeadNamed(this.pawn.story.HeadGraphicPath, this.pawn.story.SkinColor); this.desiccatedHeadGraphic = GraphicDatabaseHeadRecords.GetHeadNamed(this.pawn.story.HeadGraphicPath, PawnGraphicSet.RottingColor); this.skullGraphic = GraphicDatabaseHeadRecords.GetSkull(); this.headStumpGraphic = GraphicDatabaseHeadRecords.GetStump(this.pawn.story.SkinColor); this.desiccatedHeadStumpGraphic = GraphicDatabaseHeadRecords.GetStump(PawnGraphicSet.RottingColor); this.hairGraphic = GraphicDatabase.Get <Graphic_Multi>(this.pawn.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, this.pawn.story.hairColor); this.ResolveApparelGraphics(); } else { PawnKindLifeStage curKindLifeStage = this.pawn.ageTracker.CurKindLifeStage; if (this.pawn.gender != Gender.Female || curKindLifeStage.femaleGraphicData == null) { this.nakedGraphic = curKindLifeStage.bodyGraphicData.Graphic; } else { this.nakedGraphic = curKindLifeStage.femaleGraphicData.Graphic; } this.rottingGraphic = this.nakedGraphic.GetColoredVersion(ShaderDatabase.CutoutSkin, PawnGraphicSet.RottingColor, PawnGraphicSet.RottingColor); if (this.pawn.RaceProps.packAnimal) { this.packGraphic = GraphicDatabase.Get <Graphic_Multi>(this.nakedGraphic.path + "Pack", ShaderDatabase.Cutout, this.nakedGraphic.drawSize, Color.white); } if (curKindLifeStage.dessicatedBodyGraphicData != null) { if (this.pawn.gender != Gender.Female || curKindLifeStage.femaleDessicatedBodyGraphicData == null) { this.dessicatedGraphic = curKindLifeStage.dessicatedBodyGraphicData.GraphicColoredFor(this.pawn); } else { this.dessicatedGraphic = curKindLifeStage.femaleDessicatedBodyGraphicData.GraphicColoredFor(this.pawn); } } } }
private void <PostLoad> m__0() { Shader shader = null; switch (this.edgeType) { case TerrainDef.TerrainEdgeType.Hard: shader = ShaderDatabase.TerrainHard; break; case TerrainDef.TerrainEdgeType.Fade: shader = ShaderDatabase.TerrainFade; break; case TerrainDef.TerrainEdgeType.FadeRough: shader = ShaderDatabase.TerrainFadeRough; break; case TerrainDef.TerrainEdgeType.Water: shader = ShaderDatabase.TerrainWater; break; } this.graphic = GraphicDatabase.Get <Graphic_Terrain>(this.texturePath, shader, Vector2.one, this.color, 2000 + this.renderPrecedence); if (shader == ShaderDatabase.TerrainFadeRough || shader == ShaderDatabase.TerrainWater) { this.graphic.MatSingle.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex); } if (!this.waterDepthShader.NullOrEmpty()) { this.waterDepthMaterial = MaterialAllocator.Create(ShaderDatabase.LoadShader(this.waterDepthShader)); this.waterDepthMaterial.renderQueue = 2000 + this.renderPrecedence; this.waterDepthMaterial.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex); if (this.waterDepthShaderParameters != null) { for (int i = 0; i < this.waterDepthShaderParameters.Count; i++) { this.waterDepthShaderParameters[i].Apply(this.waterDepthMaterial); } } } }
public override void Init(GraphicRequest req) { data = req.graphicData; if (req.path.NullOrEmpty()) { throw new ArgumentNullException("folderPath"); } if (req.shader == null) { throw new ArgumentNullException("shader"); } base.path = req.path; color = req.color; colorTwo = req.colorTwo; drawSize = req.drawSize; List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(req.path) where !x.name.EndsWith(Graphic_Single.MaskSuffix) orderby x.name select x).ToList(); if (list.NullOrEmpty()) { list = (from x in ContentFinder <Texture2D> .GetAllInFolder("World/Hills") orderby x.name select x).ToList(); //FlodeMoveTo.Instance.InFloder(req.path); //.Error("Collection cannot init: No textures found at path " + req.path); //Log.Message("Use Default Texure"); subGraphics = new Graphic[1] { BaseContent.BadGraphic }; return; } subGraphics = new Graphic[list.Count]; for (int i = 0; i < list.Count; i++) { string path = req.path + "/" + list[i].name; subGraphics[i] = GraphicDatabase.Get(typeof(Graphic_Single), path, req.shader, drawSize, color, colorTwo, null, req.shaderParameters); } }
public override void Init(GraphicRequest req) { data = req.graphicData; path = req.path; color = req.color; drawSize = req.drawSize; List <StuffAppearanceDef> allDefsListForReading = DefDatabase <StuffAppearanceDef> .AllDefsListForReading; subGraphics = new Graphic[allDefsListForReading.Count]; for (int i = 0; i < subGraphics.Length; i++) { StuffAppearanceDef stuffAppearance = allDefsListForReading[i]; string text = req.path; if (!stuffAppearance.pathPrefix.NullOrEmpty()) { text = stuffAppearance.pathPrefix + "/" + text.Split('/').Last(); } Texture2D texture2D = (from x in ContentFinder <Texture2D> .GetAllInFolder(text) where x.name.EndsWith(stuffAppearance.defName) select x).FirstOrDefault(); if (texture2D != null) { subGraphics[i] = GraphicDatabase.Get <Graphic_Single>(text + "/" + texture2D.name, req.shader, drawSize, color); } else { texture2D = Resources.Load <Texture2D>("Textures/World/MouseTile"); // Debug.Log(">>>>>>" + text + ">>>>>>" + stuffAppearance.defName); } } for (int j = 0; j < subGraphics.Length; j++) { if (subGraphics[j] == null) { subGraphics[j] = subGraphics[StuffAppearanceDefOf.Smooth.index]; } } }
public override void Init(GraphicRequest req) { base.data = req.graphicData; if (req.path.NullOrEmpty()) { throw new ArgumentNullException("folderPath"); } if ((UnityEngine.Object)req.shader == (UnityEngine.Object)null) { throw new ArgumentNullException("shader"); } base.path = req.path; base.color = req.color; base.drawSize = req.drawSize; List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(req.path) where !x.name.EndsWith(Graphic_Single.MaskSuffix) orderby x.name select x).ToList(); if (list.NullOrEmpty()) { Log.Error("Collection cannot init: No textures found at path " + req.path); this.subGraphics = new Graphic[1] { BaseContent.BadGraphic }; } else { this.subGraphics = new Graphic[list.Count]; for (int i = 0; i < list.Count; i++) { string path = req.path + "/" + list[i].name; this.subGraphics[i] = GraphicDatabase.Get <Graphic_Single>(path, req.shader, base.drawSize, base.color); } } }
public override void Init(GraphicRequest req) { this.data = req.graphicData; if (req.path.NullOrEmpty()) { throw new ArgumentNullException("folderPath"); } if (req.shader == null) { throw new ArgumentNullException("shader"); } this.path = req.path; this.color = req.color; this.drawSize = req.drawSize; List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(req.path) where !x.name.EndsWith(Graphic_Single.MaskSuffix) orderby x.name select x).ToList <Texture2D>(); if (list.NullOrEmpty <Texture2D>()) { Log.Error("Collection cannot init: No textures found at path " + req.path, false); this.subGraphics = new Graphic[] { BaseContent.BadGraphic }; } else { this.subGraphics = new Graphic[list.Count]; for (int i = 0; i < list.Count; i++) { string path = req.path + "/" + list[i].name; this.subGraphics[i] = GraphicDatabase.Get(typeof(Graphic_Single), path, req.shader, this.drawSize, this.color, Color.white, null, req.shaderParameters); } } }
public override void Init(GraphicRequest req) { this.data = req.graphicData; this.path = req.path; this.color = req.color; this.drawSize = req.drawSize; List <StuffAppearanceDef> allDefsListForReading = DefDatabase <StuffAppearanceDef> .AllDefsListForReading; this.subGraphics = new Graphic[allDefsListForReading.Count]; for (int i = 0; i < this.subGraphics.Length; i++) { StuffAppearanceDef stuffAppearance = allDefsListForReading[i]; string text = req.path; if (!stuffAppearance.pathPrefix.NullOrEmpty()) { text = stuffAppearance.pathPrefix + "/" + text.Split(new char[] { '/' }).Last <string>(); } Texture2D texture2D = (from x in ContentFinder <Texture2D> .GetAllInFolder(text) where x.name.EndsWith(stuffAppearance.defName) select x).FirstOrDefault <Texture2D>(); if (texture2D != null) { this.subGraphics[i] = GraphicDatabase.Get <Graphic_Single>(text + "/" + texture2D.name, req.shader, this.drawSize, this.color); } } for (int j = 0; j < this.subGraphics.Length; j++) { if (this.subGraphics[j] == null) { this.subGraphics[j] = this.subGraphics[(int)StuffAppearanceDefOf.Smooth.index]; } } }
public static Graphic GhostGraphicFor(Graphic baseGraphic, ThingDef thingDef, Color ghostCol) { if (thingDef.useSameGraphicForGhost) { return(baseGraphic); } int seed = 0; seed = Gen.HashCombine(seed, baseGraphic); seed = Gen.HashCombine(seed, thingDef); seed = Gen.HashCombineStruct(seed, ghostCol); if (!ghostGraphics.TryGetValue(seed, out var value)) { if (thingDef.graphicData.Linked || thingDef.IsDoor) { value = GraphicDatabase.Get <Graphic_Single>(thingDef.uiIconPath, ShaderTypeDefOf.EdgeDetect.Shader, thingDef.graphicData.drawSize, ghostCol); } else { if (baseGraphic == null) { baseGraphic = thingDef.graphic; } GraphicData graphicData = null; if (baseGraphic.data != null) { graphicData = new GraphicData(); graphicData.CopyFrom(baseGraphic.data); graphicData.shadowData = null; } value = GraphicDatabase.Get(baseGraphic.GetType(), baseGraphic.path, ShaderTypeDefOf.EdgeDetect.Shader, baseGraphic.drawSize, ghostCol, Color.white, graphicData, null); } ghostGraphics.Add(seed, value); } return(value); }
public override Graphic GetColoredVersion(Shader newShader, Color newColor, Color newColorTwo) { return(GraphicDatabase.Get <Graphic_Multi>(path, newShader, drawSize, newColor, newColorTwo, data)); }
public virtual Graphic GetCopy(Vector2 newDrawSize) { return(GraphicDatabase.Get(base.GetType(), this.path, this.Shader, newDrawSize, this.color, this.colorTwo)); }
public static Graphic Get <T>(string path, Shader shader, Vector2 drawSize, Color color, int renderQueue) where T : Graphic, new() { GraphicRequest req = new GraphicRequest(typeof(T), path, shader, drawSize, color, Color.white, null, renderQueue); return(GraphicDatabase.GetInner <T>(req)); }
/* * // Token: 0x060014FA RID: 5370 RVA: 0x0007A4F8 File Offset: 0x000786F8 * public override void Init(GraphicRequest req) * { * this.data = req.graphicData; * this.path = req.path; * this.color = req.color; * this.colorTwo = req.colorTwo; * this.drawSize = req.drawSize; * MaterialRequest req2 = default(MaterialRequest); * req2.mainTex = ContentFinder<Texture2D>.Get(req.path, true); * req2.shader = req.shader; * req2.color = this.color; * req2.colorTwo = this.colorTwo; * req2.renderQueue = req.renderQueue; * req2.shaderParameters = req.shaderParameters; * if (req.shader.SupportsMaskTex()) * { * req2.maskTex = ContentFinder<Texture2D>.Get(req.path + Graphic_Single.MaskSuffix, false); * } * this.mat = MaterialPool.MatFrom(req2); * } */ // Token: 0x060014FB RID: 5371 RVA: 0x0007A5D3 File Offset: 0x000787D3 public override Graphic GetColoredVersion(Shader newShader, Color newColor, Color newColorTwo) { return(GraphicDatabase.Get <Graphic_Single>(this.path, newShader, this.drawSize, newColor, newColorTwo, this.data)); }
public static Graphic Get(Type graphicClass, string path, Shader shader, Vector2 drawSize, Color color, Color colorTwo, GraphicData data, List <ShaderParameter> shaderParameters) { GraphicRequest graphicRequest = new GraphicRequest(graphicClass, path, shader, drawSize, color, colorTwo, data, 0, shaderParameters); Graphic result; if (graphicRequest.graphicClass == typeof(Graphic_Single)) { result = GraphicDatabase.GetInner <Graphic_Single>(graphicRequest); } else if (graphicRequest.graphicClass == typeof(Graphic_Terrain)) { result = GraphicDatabase.GetInner <Graphic_Terrain>(graphicRequest); } else if (graphicRequest.graphicClass == typeof(Graphic_Multi)) { result = GraphicDatabase.GetInner <Graphic_Multi>(graphicRequest); } else if (graphicRequest.graphicClass == typeof(Graphic_Mote)) { result = GraphicDatabase.GetInner <Graphic_Mote>(graphicRequest); } else if (graphicRequest.graphicClass == typeof(Graphic_Random)) { result = GraphicDatabase.GetInner <Graphic_Random>(graphicRequest); } else if (graphicRequest.graphicClass == typeof(Graphic_Flicker)) { result = GraphicDatabase.GetInner <Graphic_Flicker>(graphicRequest); } else if (graphicRequest.graphicClass == typeof(Graphic_Appearances)) { result = GraphicDatabase.GetInner <Graphic_Appearances>(graphicRequest); } else if (graphicRequest.graphicClass == typeof(Graphic_StackCount)) { result = GraphicDatabase.GetInner <Graphic_StackCount>(graphicRequest); } else { try { return((Graphic)GenGeneric.InvokeStaticGenericMethod(typeof(GraphicDatabase), graphicRequest.graphicClass, "GetInner", new object[] { graphicRequest })); } catch (Exception ex) { Log.Error(string.Concat(new object[] { "Exception getting ", graphicClass, " at ", path, ": ", ex.ToString() }), false); } result = BaseContent.BadGraphic; } return(result); }
private static void DoPlayLoad() { GraphicDatabase.Clear(); DeepProfiler.Start("Load all active mods."); try { LoadedModManager.LoadAllActiveMods(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Load language metadata."); try { LanguageDatabase.LoadAllMetadata(); } finally { DeepProfiler.End(); } LongEventHandler.SetCurrentEventText("LoadingDefs".Translate()); DeepProfiler.Start("Copy all Defs from mods to global databases."); try { foreach (Type item in typeof(Def).AllSubclasses()) { GenGeneric.InvokeStaticMethodOnGenericType(typeof(DefDatabase <>), item, "AddAllInMods"); } } finally { DeepProfiler.End(); } DeepProfiler.Start("Resolve cross-references between non-implied Defs."); try { DirectXmlCrossRefLoader.ResolveAllWantedCrossReferences(FailMode.Silent); } finally { DeepProfiler.End(); } DeepProfiler.Start("Rebind defs (early)."); try { DefOfHelper.RebindAllDefOfs(true); } finally { DeepProfiler.End(); } DeepProfiler.Start("Generate implied Defs (pre-resolve)."); try { DefGenerator.GenerateImpliedDefs_PreResolve(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Resolve cross-references between Defs made by the implied defs."); try { DirectXmlCrossRefLoader.ResolveAllWantedCrossReferences(FailMode.LogErrors); } finally { DeepProfiler.End(); } DeepProfiler.Start("Rebind DefOfs (final)."); try { DefOfHelper.RebindAllDefOfs(false); } finally { DeepProfiler.End(); } DeepProfiler.Start("Other def binding, resetting and global operations."); try { PlayerKnowledgeDatabase.ReloadAndRebind(); LessonAutoActivator.Reset(); CostListCalculator.Reset(); PawnApparelGenerator.Reset(); RestUtility.Reset(); ThoughtUtility.Reset(); PawnWeaponGenerator.Reset(); ThinkTreeKeyAssigner.Reset(); ThingCategoryNodeDatabase.FinalizeInit(); TrainableUtility.Reset(); HaulAIUtility.Reset(); GenConstruct.Reset(); WorkGiver_FillFermentingBarrel.Reset(); WorkGiver_DoBill.Reset(); Pawn.Reset(); WorkGiver_InteractAnimal.Reset(); WorkGiver_Warden_DoExecution.Reset(); WorkGiver_GrowerSow.Reset(); WorkGiver_Miner.Reset(); MedicalCareUtility.Reset(); InspectPaneUtility.Reset(); GraphicDatabaseHeadRecords.Reset(); DateReadout.Reset(); ResearchProjectDef.GenerateNonOverlappingCoordinates(); WorkGiver_FixBrokenDownBuilding.CacheTranslations(); ItemCollectionGeneratorUtility.Reset(); BaseGen.Reset(); HealthUtility.Reset(); ResourceCounter.ResetDefs(); WildSpawner.Reset(); ApparelProperties.Reset(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Resolve references."); try { foreach (Type item2 in typeof(Def).AllSubclasses()) { if (item2 != typeof(ThingDef)) { GenGeneric.InvokeStaticMethodOnGenericType(typeof(DefDatabase <>), item2, "ResolveAllReferences", true); } } DefDatabase <ThingDef> .ResolveAllReferences(true); } finally { DeepProfiler.End(); } DeepProfiler.Start("Generate implied Defs (post-resolve)."); try { DefGenerator.GenerateImpliedDefs_PostResolve(); } finally { DeepProfiler.End(); } if (Prefs.DevMode) { DeepProfiler.Start("Error check all defs."); try { foreach (Type item3 in typeof(Def).AllSubclasses()) { GenGeneric.InvokeStaticMethodOnGenericType(typeof(DefDatabase <>), item3, "ErrorCheckAllDefs"); } } finally { DeepProfiler.End(); } } LongEventHandler.SetCurrentEventText("Initializing".Translate()); DeepProfiler.Start("Load keyboard preferences."); try { KeyPrefs.Init(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Short hash giving."); try { ShortHashGiver.GiveAllShortHashes(); } finally { DeepProfiler.End(); } LongEventHandler.ExecuteWhenFinished(delegate { DeepProfiler.Start("Load backstories."); try { BackstoryDatabase.ReloadAllBackstories(); } finally { DeepProfiler.End(); } }); LongEventHandler.ExecuteWhenFinished(delegate { DeepProfiler.Start("Inject selected language data into game data."); try { LanguageDatabase.activeLanguage.InjectIntoData(); GenLabel.ClearCache(); } finally { DeepProfiler.End(); } }); LongEventHandler.ExecuteWhenFinished(delegate { StaticConstructorOnStartupUtility.CallAll(); if (Prefs.DevMode) { StaticConstructorOnStartupUtility.ReportProbablyMissingAttributes(); } }); }
static Building_AlertSwitch() { GraphicOn = GraphicDatabase.Get <Graphic_Single>("RedAlert"); GraphicOff = GraphicDatabase.Get <Graphic_Single>("GreenAlert"); }
public static Graphic Get <T>(string path, Shader shader) where T : Graphic, new() { GraphicRequest req = new GraphicRequest(typeof(T), path, shader, Vector2.one, Color.white, Color.white, null, 0); return(GraphicDatabase.GetInner <T>(req)); }
public virtual Graphic GetCopy(Vector2 newDrawSize) { return(GraphicDatabase.Get(GetType(), path, Shader, newDrawSize, color, colorTwo)); }
private static void DoPlayLoad() { DeepProfiler.Start("GraphicDatabase.Clear()"); try { GraphicDatabase.Clear(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Load all active mods."); try { LoadedModManager.LoadAllActiveMods(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Load language metadata."); try { LanguageDatabase.InitAllMetadata(); } finally { DeepProfiler.End(); } LongEventHandler.SetCurrentEventText("LoadingDefs".Translate()); DeepProfiler.Start("Copy all Defs from mods to global databases."); try { foreach (Type item in typeof(Def).AllSubclasses()) { GenGeneric.InvokeStaticMethodOnGenericType(typeof(DefDatabase <>), item, "AddAllInMods"); } } finally { DeepProfiler.End(); } DeepProfiler.Start("Resolve cross-references between non-implied Defs."); try { DirectXmlCrossRefLoader.ResolveAllWantedCrossReferences(FailMode.Silent); } finally { DeepProfiler.End(); } DeepProfiler.Start("Rebind defs (early)."); try { DefOfHelper.RebindAllDefOfs(earlyTryMode: true); } finally { DeepProfiler.End(); } DeepProfiler.Start("TKeySystem.BuildMappings()"); try { TKeySystem.BuildMappings(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Inject selected language data into game data (early pass)."); try { LanguageDatabase.activeLanguage.InjectIntoData_BeforeImpliedDefs(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Generate implied Defs (pre-resolve)."); try { DefGenerator.GenerateImpliedDefs_PreResolve(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Resolve cross-references between Defs made by the implied defs."); try { DirectXmlCrossRefLoader.ResolveAllWantedCrossReferences(FailMode.LogErrors); } finally { DirectXmlCrossRefLoader.Clear(); DeepProfiler.End(); } DeepProfiler.Start("Rebind DefOfs (final)."); try { DefOfHelper.RebindAllDefOfs(earlyTryMode: false); } finally { DeepProfiler.End(); } DeepProfiler.Start("Other def binding, resetting and global operations (pre-resolve)."); try { PlayerKnowledgeDatabase.ReloadAndRebind(); LessonAutoActivator.Reset(); CostListCalculator.Reset(); Pawn.ResetStaticData(); PawnApparelGenerator.Reset(); RestUtility.Reset(); ThoughtUtility.Reset(); ThinkTreeKeyAssigner.Reset(); ThingCategoryNodeDatabase.FinalizeInit(); TrainableUtility.Reset(); HaulAIUtility.Reset(); GenConstruct.Reset(); MedicalCareUtility.Reset(); InspectPaneUtility.Reset(); GraphicDatabaseHeadRecords.Reset(); DateReadout.Reset(); ResearchProjectDef.GenerateNonOverlappingCoordinates(); BaseGen.Reset(); ResourceCounter.ResetDefs(); ApparelProperties.ResetStaticData(); WildPlantSpawner.ResetStaticData(); PawnGenerator.Reset(); TunnelHiveSpawner.ResetStaticData(); Hive.ResetStaticData(); ExpectationsUtility.Reset(); WealthWatcher.ResetStaticData(); SkillUI.Reset(); QuestNode_GetThingPlayerCanProduce.ResetStaticData(); Pawn_PsychicEntropyTracker.ResetStaticData(); ColoredText.ResetStaticData(); QuestNode_GetRandomNegativeGameCondition.ResetStaticData(); RoyalTitleUtility.ResetStaticData(); RewardsGenerator.ResetStaticData(); WorkGiver_FillFermentingBarrel.ResetStaticData(); WorkGiver_DoBill.ResetStaticData(); WorkGiver_InteractAnimal.ResetStaticData(); WorkGiver_Warden_DoExecution.ResetStaticData(); WorkGiver_GrowerSow.ResetStaticData(); WorkGiver_Miner.ResetStaticData(); WorkGiver_FixBrokenDownBuilding.ResetStaticData(); WorkGiver_ConstructDeliverResources.ResetStaticData(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Resolve references."); try { DeepProfiler.Start("ThingCategoryDef resolver"); try { DefDatabase <ThingCategoryDef> .ResolveAllReferences(); } finally { DeepProfiler.End(); } DeepProfiler.Start("RecipeDef resolver"); try { DeepProfiler.enabled = false; DefDatabase <RecipeDef> .ResolveAllReferences(onlyExactlyMyType : true, parallel : true); DeepProfiler.enabled = true; } finally { DeepProfiler.End(); } DeepProfiler.Start("Static resolver calls"); try { foreach (Type item2 in typeof(Def).AllSubclasses()) { if (!(item2 == typeof(ThingDef)) && !(item2 == typeof(ThingCategoryDef)) && !(item2 == typeof(RecipeDef))) { GenGeneric.InvokeStaticMethodOnGenericType(typeof(DefDatabase <>), item2, "ResolveAllReferences", true, false); } } } finally { DeepProfiler.End(); } DeepProfiler.Start("ThingDef resolver"); try { DefDatabase <ThingDef> .ResolveAllReferences(); } finally { DeepProfiler.End(); } } finally { DeepProfiler.End(); } DeepProfiler.Start("Generate implied Defs (post-resolve)."); try { DefGenerator.GenerateImpliedDefs_PostResolve(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Other def binding, resetting and global operations (post-resolve)."); try { PawnWeaponGenerator.Reset(); BuildingProperties.FinalizeInit(); ThingSetMakerUtility.Reset(); } finally { DeepProfiler.End(); } if (Prefs.DevMode) { DeepProfiler.Start("Error check all defs."); try { foreach (Type item3 in typeof(Def).AllSubclasses()) { GenGeneric.InvokeStaticMethodOnGenericType(typeof(DefDatabase <>), item3, "ErrorCheckAllDefs"); } } finally { DeepProfiler.End(); } } LongEventHandler.SetCurrentEventText("Initializing".Translate()); DeepProfiler.Start("Load keyboard preferences."); try { KeyPrefs.Init(); } finally { DeepProfiler.End(); } DeepProfiler.Start("Short hash giving."); try { ShortHashGiver.GiveAllShortHashes(); } finally { DeepProfiler.End(); } LongEventHandler.ExecuteWhenFinished(delegate { DeepProfiler.Start("Load backstories."); try { BackstoryDatabase.ReloadAllBackstories(); } finally { DeepProfiler.End(); } }); LongEventHandler.ExecuteWhenFinished(delegate { DeepProfiler.Start("Inject selected language data into game data."); try { LanguageDatabase.activeLanguage.InjectIntoData_AfterImpliedDefs(); GenLabel.ClearCache(); } finally { DeepProfiler.End(); } }); LongEventHandler.ExecuteWhenFinished(delegate { DeepProfiler.Start("Static constructor calls"); try { StaticConstructorOnStartupUtility.CallAll(); if (Prefs.DevMode) { StaticConstructorOnStartupUtility.ReportProbablyMissingAttributes(); } } finally { DeepProfiler.End(); } DeepProfiler.Start("Garbage Collection"); try { AbstractFilesystem.ClearAllCache(); GC.Collect(int.MaxValue, GCCollectionMode.Forced); } finally { DeepProfiler.End(); } }); }
public static Graphic Get <T>(string path, Shader shader, Vector2 drawSize, Color color, Color colorTwo, GraphicData data) where T : Graphic, new() { GraphicRequest req = new GraphicRequest(typeof(T), path, shader, drawSize, color, colorTwo, data, 0); return(GraphicDatabase.GetInner <T>(req)); }
public static Graphic Get(Type graphicClass, string path, Shader shader, Vector2 drawSize, Color color, Color colorTwo) { return(GraphicDatabase.Get(graphicClass, path, shader, drawSize, color, colorTwo, null)); }