public Color SkinColor(Pawn alien, bool first = true) { AlienComp alienComp = alien.TryGetComp <AlienComp>(); ExposableValueTuple <Color, Color, Color> skinColors = alienComp.GetChannel(channel: "skin"); return(first ? skinColors.first : skinColors.second); }
public override Graphic GetPath(Pawn pawn, ref int sharedIndex, int?savedIndex = new int?()) { string returnPath = string.Empty; //if (!StaticCheck.IsOk) return null; if (!this.HandlePrioritization(pawn, out returnPath, out int variantCounting)) { returnPath = path; variantCounting = variantCount; } if (variantCounting <= 0) { variantCounting = 1; } ExposableValueTuple channel = pawn.GetComp <AlienComp>().GetChannel(ColorChannel); //Log.Message($"{pawn.Name.ToStringFull}\n{channel.first.ToString()} | {pawn.story.hairColor}"); if (returnPath.NullOrEmpty()) { return(null); } returnPath += linkVariantIndexWithPrevious.VariantIndexToString(savedIndex, sharedIndex, variantCounting, out sharedIndex, out int variantIndex); Shader shader = returnPath.DetermineShaderType(ShaderType.Shader); if (useBodyDependantBodyAddonGraphics) { string bodyname = pawn.story.bodyType.defName; string newPath = returnPath.InsertBodyTypeDirectoryBeforeFileName(bodyname); if (newPath.IsThereContent()) { return(GraphicDatabase.Get <Graphic_Multi_RotationFromData>( newPath, shader, drawSize * 1.5f, channel.first, channel.second, new GraphicData { drawRotated = !drawRotated })); } } return (GraphicDatabase.Get <Graphic_Multi_RotationFromData>( returnPath, shader, drawSize * 1.5f, channel.first, channel.second, new GraphicData { drawRotated = !drawRotated })); }
public virtual Graphic GetPath(Pawn pawn, ref int sharedIndex, int?savedIndex = new int?()) { string returnPath = string.Empty; int variantCounting = this.variantCount; foreach (BodyAddonPrioritization prio in this.Prioritization) { switch (prio) { case BodyAddonPrioritization.Backstory: if (this.backstoryGraphics?.FirstOrDefault(predicate: babgs => pawn.story.AllBackstories.Any(predicate: bs => bs.identifier == babgs.backstory)) is BodyAddonBackstoryGraphic babg) { returnPath = babg.path; variantCounting = babg.variantCount; } break; case BodyAddonPrioritization.Hediff: if (this.hediffGraphics?.FirstOrDefault(predicate: bahgs => pawn.health.hediffSet.hediffs.Any(predicate: h => h.def.defName == bahgs.hediff && (h.Part == null || this.bodyPart.NullOrEmpty() || (h.Part.untranslatedCustomLabel == this.bodyPart || h.Part.def.defName == this.bodyPart)))) is BodyAddonHediffGraphic bahg) { returnPath = bahg.path; variantCounting = bahg.variantCount; } break; default: throw new ArgumentOutOfRangeException(); } if (!returnPath.NullOrEmpty()) { break; } } if (returnPath.NullOrEmpty()) { returnPath = this.path; } ExposableValueTuple <Color, Color> channel = pawn.GetComp <AlienComp>().GetChannel(this.ColorChannel); int tv; return(!returnPath.NullOrEmpty() ? GraphicDatabase.Get <Graphic_Multi>(path: returnPath = (returnPath + ((tv = (savedIndex.HasValue ? (sharedIndex = savedIndex.Value) : (this.linkVariantIndexWithPrevious ? sharedIndex % variantCounting : (sharedIndex = Rand.Range(min: 0, max: variantCounting))))) == 0 ? "" : tv.ToString())), shader: ContentFinder <Texture2D> .Get(itemPath: returnPath + "_northm", reportFailure: false) == null ? this.ShaderType.Shader : ShaderDatabase.CutoutComplex, //ShaderDatabase.Transparent, drawSize: this.drawSize * 1.5f, color: channel.first, channel.second) : null); }
public Color SkinColor(Pawn alien, int channel = 1) { AlienComp alienComp = alien.TryGetComp <AlienComp>(); ExposableValueTuple <Color, Color, Color> skinColors = alienComp.GetChannel(channel: "skin"); switch (channel) { default: return(skinColors.first); case 2: return(skinColors.second); case 3: return(skinColors.third); } }
public Color SkinColor(Pawn alien, int number = 1) { AlienComp alienComp = alien.TryGetComp <AlienComp>(); ExposableValueTuple <Color, Color, Color> skinColors = alienComp.GetChannel(channel: "skin"); if (number == 1) { return(skinColors.first); } if (number == 2) { return(skinColors.second); } if (number == 3) { return(skinColors.third); } return(skinColors.first); //return first ? skinColors.first : skinColors.second; }
public virtual Graphic GetPath(Pawn pawn, ref int sharedIndex, int?savedIndex = new int?()) { string returnPath = string.Empty; int variantCounting = 0; foreach (BodyAddonPrioritization prio in this.Prioritization) { switch (prio) { case BodyAddonPrioritization.Backstory: if (this.backstoryGraphics?.FirstOrDefault(predicate: babgs => pawn.story.AllBackstories.Any(predicate: bs => bs.identifier == babgs.backstory)) is BodyAddonBackstoryGraphic babg) { returnPath = babg.path; variantCounting = babg.variantCount; } break; case BodyAddonPrioritization.Hediff: if (!this.hediffGraphics.NullOrEmpty()) { foreach (BodyAddonHediffGraphic bahg in this.hediffGraphics) { foreach (Hediff h in pawn.health.hediffSet.hediffs.Where(predicate: h => h.def == bahg.hediff && (h.Part == null || this.bodyPart.NullOrEmpty() || h.Part.untranslatedCustomLabel == this.bodyPart || h.Part.def.defName == this.bodyPart))) { returnPath = bahg.path; variantCounting = bahg.variantCount; if (!bahg.severity.NullOrEmpty()) { foreach (BodyAddonHediffSeverityGraphic bahsg in bahg.severity) { if (h.Severity >= bahsg.severity) { returnPath = bahsg.path; variantCounting = bahsg.variantCount; break; } } } break; } } } break; default: throw new ArrayTypeMismatchException(); } if (!returnPath.NullOrEmpty()) { break; } } if (returnPath.NullOrEmpty()) { returnPath = this.path; variantCounting = this.variantCount; } if (variantCounting <= 0) { variantCounting = 1; } ExposableValueTuple <Color, Color> channel = pawn.GetComp <AlienComp>().GetChannel(this.ColorChannel); int tv; //Log.Message($"{pawn.Name.ToStringFull}\n{channel.first.ToString()} | {pawn.story.hairColor}"); return(!returnPath.NullOrEmpty() ? GraphicDatabase.Get <Graphic_Multi_RotationFromData>(returnPath += (tv = (savedIndex.HasValue ? (sharedIndex = savedIndex.Value % variantCounting) : (this.linkVariantIndexWithPrevious ? sharedIndex % variantCounting : (sharedIndex = Rand.Range(min: 0, variantCounting))))) == 0 ? "" : tv.ToString(), ContentFinder <Texture2D> .Get(returnPath + "_northm", reportFailure: false) == null ? this.ShaderType.Shader : ShaderDatabase.CutoutComplex, //ShaderDatabase.Transparent, this.drawSize * 1.5f, channel.first, channel.second, new GraphicData { drawRotated = !this.drawRotated }) : null); }
public override Graphic GetPath(Pawn pawn, ref int sharedIndex, int?savedIndex = null) { string empty = string.Empty; int num = 0; using (List <BodyAddonPrioritization> .Enumerator enumerator = Prioritization.GetEnumerator()) { while (enumerator.MoveNext()) { switch (enumerator.Current) { case BodyAddonPrioritization.Backstory: { BodyAddonBackstoryGraphic bodyAddonBackstoryGraphic = backstoryGraphics?.FirstOrDefault((BodyAddonBackstoryGraphic babgs) => pawn.story.AllBackstories.Any((Backstory bs) => bs.identifier == babgs.backstory)); if (bodyAddonBackstoryGraphic != null) { empty = bodyAddonBackstoryGraphic.path; num = bodyAddonBackstoryGraphic.variantCount; } break; } case BodyAddonPrioritization.Hediff: if (!hediffGraphics.NullOrEmpty()) { foreach (BodyAddonHediffGraphic bahg in hediffGraphics) { using (IEnumerator <Hediff> enumerator3 = pawn.health.hediffSet.hediffs.Where((Hediff h) => h.def == bahg.hediff && (h.Part == null || bodyPart.NullOrEmpty() || h.Part.untranslatedCustomLabel == bodyPart || h.Part.def.defName == bodyPart)).GetEnumerator()) { if (enumerator3.MoveNext()) { Hediff current = enumerator3.Current; empty = bahg.path; num = bahg.variantCount; if (!bahg.severity.NullOrEmpty()) { foreach (BodyAddonHediffSeverityGraphic item in bahg.severity) { if (current.Severity >= item.severity) { empty = item.path; num = item.variantCount; break; } } } } } } } break; default: throw new ArrayTypeMismatchException(); } if (!empty.NullOrEmpty()) { break; } } } if (empty.NullOrEmpty()) { empty = path; num = variantCount; } if (num <= 0) { num = 1; } ExposableValueTuple <Color, Color> channel = pawn.GetComp <AlienComp>().GetChannel(ColorChannel); if (empty.NullOrEmpty()) { return(null); } int num2; string varPath = (((num2 = (savedIndex.HasValue ? (sharedIndex = savedIndex.Value % num) : (linkVariantIndexWithPrevious ? (sharedIndex % num) : (sharedIndex = Rand.Range(0, num))))) == 0) ? "" : num2.ToString()); if (!allowPairWith.NullOrEmpty()) { foreach (List <int> item in allowPairWith) { if (item.Contains(num2)) { sharedIndex = item.RandomElement(); // Log.Message("setting shared index to " + sharedIndex); break; } } } return(GraphicDatabase.Get <Graphic_Multi_RotationFromData>(empty += varPath, (ContentFinder <Texture2D> .Get(empty + "_northm", reportFailure: false) == null) ? ShaderType.Shader : ShaderDatabase.CutoutComplex, drawSize * 1.5f, channel.first, channel.second, new GraphicData { drawRotated = !drawRotated })); }