public override void PostSpawnSetup(bool respawningAfterLoad) { base.PostSpawnSetup(respawningAfterLoad); if (!this.Props.ExtrasEntries.NullOrEmpty()) { extraPartEntry = this.Props.ExtrasEntries.RandomElementByWeight((ExtraPartEntry x) => x.commonality); this.graphicPath = extraPartEntry.extraTexPath; this.shader = ShaderDatabase.LoadShader(extraPartEntry.shaderType.shaderPath); this.useSecondaryColor = extraPartEntry.UseSecondaryColor; this.ExtraUseBodyOffset = extraPartEntry.UseBodytypeOffsets; } pauldronInitialized = true; }
public void GeneratePart() { StringBuilder msg = new StringBuilder(); if (extraPartEntryint >= 0) { extraPartEntry = this.Props.ExtrasEntries[extraPartEntryint]; } else { List <ExtraApparelPartProps> possibles = new List <ExtraApparelPartProps>(); if (extraPartEntryint == -1) { if (Apparel.TryGetQuality(out QualityCategory quality)) { msg.AppendLine(" QualityCategory: " + quality); possibles.AddRange(this.Props.ExtrasEntries.FindAll(x => x.AcceptableForQuality(quality))); } else { msg.AppendLine(" No CompQuality"); possibles = this.Props.ExtrasEntries; } } msg.AppendLine(" possibles: " + possibles.Count); if (!possibles.NullOrEmpty()) { Rand.PushState(); extraPartEntry = possibles.RandomElementByWeight((ExtraApparelPartProps x) => x.commonality); Rand.PopState(); extraPartEntryint = this.Props.ExtrasEntries.IndexOf(extraPartEntry); } else { extraPartEntryint = -2; } } if (extraPartEntry != null) { this.shader = ShaderDatabase.LoadShader(extraPartEntry.graphicData.shaderType.shaderPath); this.useSecondaryColor = extraPartEntry.useParentSecondaryColor; this.ExtraUseBodyTexture = extraPartEntry.UseBodytypeTextures; msg.AppendLine(" Using: " + extraPartEntry + " at position: " + extraPartEntryint); msg.AppendLine(" shader: " + shader + " useSecondaryColor: " + useSecondaryColor + " ExtraUseBodyTexture: " + ExtraUseBodyTexture); partInitialized = true; } else { extraPartEntryint = -2; } }
// Token: 0x06000078 RID: 120 RVA: 0x00004AE0 File Offset: 0x00002CE0 public void ResolveAllGraphics(float scale = 1f) { Shader shader = ShaderDatabase.LoadShader(this.data.shaderCutoutPath); this.ClearCache(); this.nakedGraphic = GraphicDatabase.Get <Graphic_Multi>(this.data.bodyType.bodyNakedGraphicPath, ShaderDatabase.CutoutSkin, Vector2.one, this.data.color); this.rottingGraphic = GraphicDatabase.Get <Graphic_Multi>(this.data.bodyType.bodyNakedGraphicPath, ShaderDatabase.CutoutSkin, Vector2.one, PawnGraphicSet.RottingColor); this.dessicatedGraphic = GraphicDatabase.Get <Graphic_Multi>(this.data.bodyType.bodyDessicatedGraphicPath, shader); this.headGraphic = GraphicDatabaseHeadRecords_Zombiefied.GetHeadNamed(this.data.headGraphicPath, this.data.color); this.desiccatedHeadGraphic = GraphicDatabaseHeadRecords_Zombiefied.GetHeadNamed(this.data.headGraphicPath, PawnGraphicSet.RottingColor); this.skullGraphic = GraphicDatabaseHeadRecords.GetSkull(); this.headStumpGraphic = GraphicDatabaseHeadRecords.GetStump(this.data.color); this.desiccatedHeadStumpGraphic = GraphicDatabaseHeadRecords.GetStump(PawnGraphicSet.RottingColor); this.hairGraphic = GraphicDatabase.Get <Graphic_Multi>(this.data.hairGraphicPath, shader, Vector2.one, this.data.hairColor); this.ResolveApparelGraphics(); }
// Token: 0x06000079 RID: 121 RVA: 0x00004BF8 File Offset: 0x00002DF8 public void ResolveApparelGraphics() { /* * Shader shader = ShaderDatabase.LoadShader(this.data.shaderCutoutPath); * this.ClearCache(); * this.apparelGraphics.Clear(); * for(int i = 0; i < data.wornApparel.Count; i++) * { * ApparelGraphicRecord item; * if (ZombieGraphicSet.TryGetGraphicApparel(data.wornApparel[i], data.wornApparel[i].DrawColor, this.data.bodyType, shader, out item)) * { * this.apparelGraphics.Add(item); * } * } */ Shader shader = ShaderDatabase.LoadShader(this.data.shaderCutoutPath); this.ClearCache(); this.apparelGraphics.Clear(); for (int i = 0; i < this.data.wornApparelDefs.Count; i++) { ApparelGraphicRecord item; Apparel newApparel = MakeApparel(i); if (ZombieGraphicSet.TryGetGraphicApparel(newApparel, newApparel.DrawColor, this.data.bodyType, shader, out item)) { this.apparelGraphics.Add(item); } } /* * using (List<ThingDef>.Enumerator enumerator = this.data.wornApparelDefs.GetEnumerator()) * { * while (enumerator.MoveNext()) * { * ApparelGraphicRecord item; * Apparel newApparel = ZombieGraphicSet.MakeApparel(enumerator.Current, this.data.color); * if (ZombieGraphicSet.TryGetGraphicApparel(newApparel, newApparel.DrawColor, this.data.bodyType, shader, out item)) * { * this.apparelGraphics.Add(item); * } * } * } */ }
public static void Reload(Thing t, string texPath) { Graphic graphic = GraphicDatabase.Get(t.def.graphicData.graphicClass, texPath, ShaderDatabase.LoadShader(t.def.graphicData.shaderType.shaderPath), t.def.graphicData.drawSize, t.DrawColor, t.DrawColorTwo); typeof(Thing).GetField("graphicInt", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(t, graphic); if (t.Map != null) { t.Map.mapDrawer.MapMeshDirty(t.Position, MapMeshFlag.Things); } }