Пример #1
0
 public AvaliGraphic GetNakedGraphic(BodyTypeDef bodyType, Shader shader, Color skinColor, Color skinColorSecond, Color skinColorThird, string userpath, string gender) =>
 AvaliGraphicDatabase.Get(typeof(Graphic_Multi), GetNakedPath(bodyType, userpath, this.useGenderedBodies ? gender : ""), shader, Vector2.one,
                          skinColor, skinColorSecond, skinColorThird, data: null, shaderParameters: null);
Пример #2
0
            public virtual AvaliGraphic 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, 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() ?
                       AvaliGraphicDatabase.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 : AvaliShaderDatabase.Tricolor, //ShaderDatabase.Transparent,
                                                                                 this.drawSize * 1.5f,
                                                                                 channel.first, channel.second, channel.third, new AvaliGraphicData
                {
                    drawRotated = !this.drawRotated
                }) :
                       null);
            }