コード例 #1
0
        private void InitializeGraphicsFeet()
        {
            string texNameFoot;

            if (this._pawn.RaceProps.Humanlike)
            {
                texNameFoot = StringsFS.PathHumanlike + "Feet/" + this.CompAni.Props.handType + STR_Foot;
            }
            else
            {
                texNameFoot = "Paws/" + this.CompAni.Props.handType + STR_Foot;
            }
            Color skinColor;

            if (this._pawn.story == null)
            {
                PawnKindLifeStage curKindLifeStage = this._pawn.ageTracker.CurKindLifeStage;

                skinColor = curKindLifeStage.bodyGraphicData.color;
            }
            else
            {
                skinColor = this._pawn.story.SkinColor;
            }

            Color rightColorFoot = Color.red;
            Color leftColorFoot  = Color.blue;

            Color rightFootColor = skinColor;
            Color leftFootColor  = skinColor;
            Color metal          = new Color(0.51f, 0.61f, 0.66f);

            switch (this.CompAni.BodyStat.FootRight)
            {
            case PartStatus.Artificial:
                rightFootColor = metal;
                break;
            }

            switch (this.CompAni.BodyStat.FootLeft)
            {
            case PartStatus.Artificial:
                leftFootColor = metal;
                break;
            }

            Color rightFootShadowColor = rightFootColor * this._shadowColor;
            Color leftFootShadowColor  = leftFootColor * this._shadowColor;

            this.FootGraphicRight = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameFoot,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                rightFootColor,
                skinColor);

            this.FootGraphicLeft = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameFoot,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                leftFootColor,
                skinColor);

            this.FootGraphicRightShadow = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameFoot,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                rightFootShadowColor,
                skinColor);

            this.FootGraphicLeftShadow = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameFoot,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                leftFootShadowColor,
                skinColor);

            this.FootGraphicRightCol = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameFoot,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                rightColorFoot,
                skinColor);

            this.FootGraphicLeftCol = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameFoot,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                leftColorFoot,
                skinColor);
        }
コード例 #2
0
            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);
            }
コード例 #3
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     graphic = new Graphic_Multi();
     graphic = (Graphic_Multi)GraphicDatabase.Get <Graphic_Multi>("Things/Pawn/Vehicle/Cargo_Wheel", parent.def.shader, parent.def.DrawSize, parent.def.defaultColor, parent.def.defaultColorTwo);
 }
コード例 #4
0
 public override Graphic GetColoredVersion(Shader newShader, Color newColor, Color newColorTwo)
 {
     return(GraphicDatabase.Get <Graphic_CannonAnimate>(path, newShader, drawSize, newColor, newColorTwo, data));
 }
コード例 #5
0
ファイル: Graphic_Gachapon.cs プロジェクト: emipa606/RimGacha
        // Token: 0x06000034 RID: 52 RVA: 0x00002E0C File Offset: 0x0000100C
        public override void Init(GraphicRequest req)
        {
            data     = req.graphicData;
            path     = req.path;
            color    = req.color;
            colorTwo = req.colorTwo;
            drawSize = req.drawSize;
            var array = new Texture2D[mats.Length];

            array[0] = ContentFinder <Texture2D> .Get(req.path + "_south", false);

            array[1] = ContentFinder <Texture2D> .Get(req.path + "_west", false);

            array[2] = ContentFinder <Texture2D> .Get(req.path + "_north", false);

            array[3] = ContentFinder <Texture2D> .Get(req.path + "_east", false);

            if (array[0] == null)
            {
                if (array[2] != null)
                {
                    array[0] = array[2];
                    drawRotatedExtraAngleOffset = 180f;
                }
                else
                {
                    if (array[1] != null)
                    {
                        array[0] = array[1];
                        drawRotatedExtraAngleOffset = -90f;
                    }
                    else
                    {
                        if (!(array[3] != null))
                        {
                            Log.Error(
                                "Failed to find any texture while constructing " + this.ToStringSafe() +
                                ". Filenames have changed; if you are converting an old mod, recommend renaming textures from *_back to *_north, *_side to *_east, and *_front to *_south.");
                            return;
                        }

                        array[0] = array[3];
                        drawRotatedExtraAngleOffset = 90f;
                    }
                }
            }

            if (array[2] == null)
            {
                array[2] = array[0];
            }

            if (array[1] == null)
            {
                if (array[3] != null)
                {
                    array[1]    = array[3];
                    eastFlipped = DataAllowsFlip;
                }
                else
                {
                    array[1] = array[0];
                }
            }

            if (array[3] == null)
            {
                if (array[1] != null)
                {
                    array[3]    = array[1];
                    westFlipped = DataAllowsFlip;
                }
                else
                {
                    array[3] = array[0];
                }
            }

            float num  = array[0].width;
            var   num2 = 0f;

            for (var i = 0; i < mats.Length; i++)
            {
                var texture2D = array[i].CreateReadableCopy();
                var padding   = texture2D.GetPadding(16, 0.04f);
                texture2D.Desatuate();
                texture2D.NormalizeContrastGreyscale(16);
                array[i] = texture2D;
                num      = Mathf.Min(num, padding[0], (float)padding[1], (float)padding[2], (float)padding[3]);
                num2    += texture2D.CountFilledPixel(16);
            }

            num2 = (float)Math.Sqrt(num2 / 4f);
            var num3 = 0.5f * array[0].width / num2;

            drawSize *= num3;
            for (var j = 0; j < mats.Length; j++)
            {
                var materialRequest = default(MaterialRequest);
                materialRequest.mainTex          = array[j];
                materialRequest.shader           = req.shader;
                materialRequest.color            = color;
                materialRequest.colorTwo         = colorTwo;
                materialRequest.shaderParameters = req.shaderParameters;
                mats[j] = MaterialPool.MatFrom(materialRequest);
            }

            var graphicData = ThingDefOf.Gachapon.graphicData;

            baseGraphic = GraphicDatabase.Get <Graphic_Multi>(graphicData.texPath, req.graphicData.shaderType.Shader,
                                                              graphicData.drawSize, color, colorTwo, graphicData);
        }
コード例 #6
0
        public override void DrawGhost(IntVec3 at, Color color)
        {
            ThingDef blueprintDef = def.blueprintDef;

            GraphicDatabase.Get(blueprintDef.graphic.GetType(), blueprintDef.graphic.path, blueprintDef.graphic.Shader, blueprintDef.graphic.drawSize, color, Color.white, blueprintDef.graphicData, null).DrawFromDef(at.ToVector3ShiftedWithAltitude(AltitudeLayer.Blueprint), Rot4.North, def.blueprintDef);
        }
コード例 #7
0
        public static void Postfix(Plant __instance, ref Graphic __result)
        {
            string id = __instance.def.defName;

            if (!__instance.def.HasModExtension <ThingWeatherReaction>())
            {
                return;
            }

            ThingWeatherReaction mod = __instance.def.GetModExtension <ThingWeatherReaction>();
            Map map = __instance.Map;

            string path = "";

            //get flowering or drought graphic if it's over 70
            if (__instance.AmbientTemperature > 21)
            {
                Watcher  watcher = map.GetComponent <Watcher>();
                cellData cell;
                if (watcher.cellWeatherAffects[__instance.Position] != null)
                {
                    cell = watcher.cellWeatherAffects[__instance.Position];
                    Vector2 location = Find.WorldGrid.LongLatOf(__instance.MapHeld.Tile);
                    Season  season   = GenDate.Season((long)Find.TickManager.TicksAbs, location);

                    if (!String.IsNullOrEmpty(mod.floweringGraphicPath) && ((cell.howWetPlants > 60 && map.weatherManager.RainRate <= .001f) || season == Season.Spring))
                    {
                        id  += "flowering";
                        path = mod.floweringGraphicPath;
                    }

                    if (!String.IsNullOrEmpty(mod.droughtGraphicPath) && cell.howWetPlants < 20)
                    {
                        id  += "drought";
                        path = mod.droughtGraphicPath;
                    }
                    else
                    if (__instance.def.plant.leaflessGraphic != null && cell.howWetPlants < 20)
                    {
                        id  += "drought";
                        path = __instance.def.plant.leaflessGraphic.path;
                    }
                }
            }
            if (path != "")
            {
                if (!map.GetComponent <Watcher>().graphicHolder.ContainsKey(id))
                {
                    //only load the image once.
                    map.GetComponent <Watcher>().graphicHolder.Add(id, GraphicDatabase.Get(__instance.def.graphicData.graphicClass, path, __instance.def.graphic.Shader, __instance.def.graphicData.drawSize, __instance.def.graphicData.color, __instance.def.graphicData.colorTwo));
                }
                if (map.GetComponent <Watcher>().graphicHolder.ContainsKey(id))
                {
                    __result = map.GetComponent <Watcher>().graphicHolder[id];
                }
                return;
            }

            if (Settings.showCold)
            {
                //get snow graphic
                if (map.snowGrid.GetDepth(__instance.Position) >= 0.5f)
                {
                    if (!String.IsNullOrEmpty(mod.snowGraphicPath))
                    {
                        id  += "snow";
                        path = mod.snowGraphicPath;
                    }
                }
                else if (map.GetComponent <FrostGrid>().GetDepth(__instance.Position) >= 0.6f)
                {
                    if (!String.IsNullOrEmpty(mod.frostGraphicPath))
                    {
                        id  += "frost";
                        path = mod.frostGraphicPath;
                    }
                }

                if (String.IsNullOrEmpty(path))
                {
                    return;
                }
                //if it's leafless
                if (__instance.def.plant.leaflessGraphic == __result)
                {
                    id   += "leafless";
                    path  = path.Replace("Frosted", "Frosted/Leafless");
                    path  = path.Replace("Snow", "Snow/Leafless");
                    path += "_Leafless";
                }
                else if (__instance.def.blockWind)
                {
                    //make it so snow doesn't fall under the tree until it's leafless.
                    //	map.snowGrid.AddDepth(__instance.Position, -.05f);
                }
            }


            if (!map.GetComponent <Watcher>().graphicHolder.ContainsKey(id))
            {
                //only load the image once.
                map.GetComponent <Watcher>().graphicHolder.Add(id, GraphicDatabase.Get(__instance.def.graphicData.graphicClass, path, __instance.def.graphic.Shader, __instance.def.graphicData.drawSize, __instance.def.graphicData.color, __instance.def.graphicData.colorTwo));
            }
            if (map.GetComponent <Watcher>().graphicHolder.ContainsKey(id))
            {
                __result = map.GetComponent <Watcher>().graphicHolder[id];
            }
            return;
        }
コード例 #8
0
        public override void DrawWornExtras()
        {
            if (Wearer == null || !Wearer.Spawned)
            {
                return;
            }
            Building_Bed bed = Wearer.CurrentBed();

            if (bed != null && !bed.def.building.bed_showSleeperBody && !onHead)
            {
                return;
            }

            //Since I haven't a head apparel item to test the drawing code against for now we throw an error (ONCE) and exit.
            if (this.onHead)
            {
                Log.ErrorOnce(string.Concat("CombatExtended :: Apparel_VisibleAccessory: The head drawing code is incomplete and the apparel '",
                                            this.Label, "' will not be drawn."), this.def.debugRandomId);
                return;
            }

            // compute drawVec, angle and Rot4 vars
            Rot4    rotation;
            Rot4    bedRotation = new Rot4();
            float   angle       = 0;
            Vector3 drawVec     = Wearer.Drawer.DrawPos;

            if (Wearer.GetPosture() != PawnPosture.Standing)
            {
                rotation = LayingFacing();
                if (bed != null)
                {
                    bedRotation        = bed.Rotation;
                    bedRotation.AsInt += 2;
                    angle              = bedRotation.AsAngle;
                    AltitudeLayer altitude = (AltitudeLayer)((byte)Mathf.Max((int)bed.def.altitudeLayer, 14));
                    drawVec.y = Wearer.Position.ToVector3ShiftedWithAltitude(altitude).y;
                    drawVec  += bedRotation.FacingCell.ToVector3() * (-Wearer.Drawer.renderer.BaseHeadOffsetAt(Rot4.South).z);
                }
                else
                {
                    drawVec.y = Wearer.Position.ToVector3ShiftedWithAltitude(AltitudeLayer.LayingPawn).y;
                    if (Wearer.Downed)      // Wearer.Spawned == false when Pawn.Dead == true.
                    {
                        float?newAngle = (((((Wearer.Drawer == null) ? null : Wearer.Drawer.renderer) == null) ? null : Wearer.Drawer.renderer.wiggler) == null) ? (float?)null : Wearer.Drawer.renderer.wiggler.downedAngle;
                        if (newAngle != null)
                        {
                            angle = newAngle.Value;
                        }
                    }
                    else
                    {
                        angle = rotation.FacingCell.AngleFlat;
                    }
                }
                drawVec.y += 0.005f;
            }
            else
            {
                rotation  = Wearer.Rotation;
                drawVec.y = Wearer.Position.ToVector3ShiftedWithAltitude(AltitudeLayer.Pawn).y;
            }

            drawVec.y += GetAltitudeOffset(rotation);

            // Get the graphic path
            string  path    = def.graphicData.texPath + "_" + ((Wearer == null) ? null : Wearer.story.bodyType.ToString());
            Graphic graphic = GraphicDatabase.Get <Graphic_Multi>(path, ShaderDatabase.CutoutComplex, def.graphicData.drawSize, DrawColor);
            ApparelGraphicRecord apparelGraphic = new ApparelGraphicRecord(graphic, this);

            Material mat = apparelGraphic.graphic.MatAt(rotation);
            Vector3  s   = new Vector3(1.5f, 1.5f, 1.5f);

            //mat.shader = ShaderDatabase.CutoutComplex;
            //mat.color = DrawColor;
            Matrix4x4 matrix = default(Matrix4x4);

            matrix.SetTRS(drawVec, Quaternion.AngleAxis(angle, Vector3.up), s);
            Graphics.DrawMesh(rotation == Rot4.West ? MeshPool.plane10Flip : MeshPool.plane10, matrix, mat, 0);
        }
コード例 #9
0
 //public static Graphic Get<T>(string path, Shader shader, Vector2 drawSize, Color color) where T : Graphic, new()
 public static Graphic GetRenderHigh(string path, Shader shader, Vector2 drawSize, Color color)
 {
     return(GraphicDatabase.Get <Graphic_Single>(path, shader, drawSize, color, queueOverFog));
 }
コード例 #10
0
        //public static bool Zombify(ReanimatedPawn pawn)
        //{
        //    if (pawn.Drawer == null)
        //    {
        //        return false;
        //    }
        //    if (pawn.Drawer.renderer == null)
        //    {
        //        return false;
        //    }
        //    if (pawn.Drawer.renderer.graphics == null)
        //    {
        //        return false;
        //    }
        //    if (!pawn.Drawer.renderer.graphics.AllResolved)
        //    {
        //        pawn.Drawer.renderer.graphics.ResolveAllGraphics();
        //    }
        //    if (pawn.Drawer.renderer.graphics.headGraphic == null)
        //    {
        //        return false;
        //    }
        //    if (pawn.Drawer.renderer.graphics.nakedGraphic == null)
        //    {
        //        return false;
        //    }
        //    if (pawn.Drawer.renderer.graphics.headGraphic.path == null)
        //    {
        //        return false;
        //    }
        //    if (pawn.Drawer.renderer.graphics.nakedGraphic.path == null)
        //    {
        //        return false;
        //    }
        //    GiveZombieSkinEffect(pawn);
        //    return true;
        //}

        // Credit goes to Justin C for the Zombie Apocalypse code.
        // Taken from Verse.ZombieMod_Utility
        public static Pawn GenerateClonePawnFromSource(Pawn sourcePawn)
        {
            PawnKindDef pawnKindDef   = PawnKindDef.Named("ReanimatedCorpse");
            Faction     factionDirect = Find.FactionManager.FirstFactionOfDef(FactionDefOf.SpacerHostile);
            Pawn        pawn          = (Pawn)ThingMaker.MakeThing(pawnKindDef.race);

            pawn.kindDef = pawnKindDef;
            pawn.SetFactionDirect(factionDirect);
            pawn.pather     = new Pawn_PathFollower(pawn);
            pawn.ageTracker = new Pawn_AgeTracker(pawn);
            pawn.health     = new Pawn_HealthTracker(pawn);
            pawn.jobs       = new Pawn_JobTracker(pawn);
            pawn.mindState  = new Pawn_MindState(pawn);
            pawn.filth      = new Pawn_FilthTracker(pawn);
            pawn.needs      = new Pawn_NeedsTracker(pawn);
            pawn.stances    = new Pawn_StanceTracker(pawn);
            pawn.natives    = new Pawn_NativeVerbs(pawn);
            PawnComponentsUtility.CreateInitialComponents(pawn);
            if (pawn.RaceProps.ToolUser)
            {
                pawn.equipment    = new Pawn_EquipmentTracker(pawn);
                pawn.carryTracker = new Pawn_CarryTracker(pawn);
                pawn.apparel      = new Pawn_ApparelTracker(pawn);
                pawn.inventory    = new Pawn_InventoryTracker(pawn);
            }
            if (pawn.RaceProps.Humanlike)
            {
                pawn.ownership    = new Pawn_Ownership(pawn);
                pawn.skills       = new Pawn_SkillTracker(pawn);
                pawn.relations    = new Pawn_RelationsTracker(pawn);
                pawn.story        = new Pawn_StoryTracker(pawn);
                pawn.workSettings = new Pawn_WorkSettings(pawn);
            }
            if (pawn.RaceProps.intelligence <= Intelligence.ToolUser)
            {
                pawn.caller = new Pawn_CallTracker(pawn);
            }
            //pawn.gender = Gender.None;
            pawn.gender = sourcePawn.gender;
            //Cthulhu.Utility.GenerateRandomAge(pawn, pawn.Map);
            pawn.ageTracker.AgeBiologicalTicks = sourcePawn.ageTracker.AgeBiologicalTicks;
            pawn.ageTracker.BirthAbsTicks      = sourcePawn.ageTracker.BirthAbsTicks;

            pawn.needs.SetInitialLevels();
            if (pawn.RaceProps.Humanlike)
            {
                string headGraphicPath = sourcePawn.story.HeadGraphicPath;
                typeof(Pawn_StoryTracker).GetField("headGraphicPath", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(pawn.story, headGraphicPath);
                pawn.story.melanin   = sourcePawn.story.melanin;
                pawn.story.crownType = sourcePawn.story.crownType;
                pawn.story.hairColor = sourcePawn.story.hairColor;
                NameTriple name = sourcePawn.Name as NameTriple;
                pawn.Name            = name;
                pawn.story.childhood = sourcePawn.story.childhood;
                pawn.story.adulthood = sourcePawn.story.adulthood;
                pawn.story.hairDef   = sourcePawn.story.hairDef;
                foreach (Trait current in sourcePawn.story.traits.allTraits)
                {
                    pawn.story.traits.GainTrait(current);
                }
                //pawn.story.GenerateSkillsFromBackstory();
            }
            GenerateApparelFromSource(pawn, sourcePawn);
            PawnGenerationRequest con = new PawnGenerationRequest();

            PawnInventoryGenerator.GenerateInventoryFor(pawn, con);
            Graphic nakedBodyGraphic = GraphicGetter_NakedHumanlike.GetNakedBodyGraphic(sourcePawn.story.bodyType, ShaderDatabase.CutoutSkin, sourcePawn.story.SkinColor);
            Graphic headGraphic      = GraphicDatabase.Get <Graphic_Multi>(sourcePawn.story.HeadGraphicPath, ShaderDatabase.CutoutSkin, Vector2.one, sourcePawn.story.SkinColor);
            Graphic hairGraphic      = GraphicDatabase.Get <Graphic_Multi>(sourcePawn.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, sourcePawn.story.hairColor);

            pawn.Drawer.renderer.graphics.headGraphic  = headGraphic;
            pawn.Drawer.renderer.graphics.nakedGraphic = nakedBodyGraphic;
            pawn.Drawer.renderer.graphics.hairGraphic  = hairGraphic;
            return(pawn);
        }
コード例 #11
0
        public bool ApplyNewSkin(int index)
        {
            // gender texture
            bool female = this.gender == Gender.Female && ageTracker.CurKindLifeStage.femaleGraphicData != null;

            string base_graphic_path =
                female ? ageTracker.CurKindLifeStage.femaleGraphicData.texPath
                                : ageTracker.CurKindLifeStage.bodyGraphicData.texPath;


            TryLoadSkinSet();

            // Throw an error when index out of range
            if (index > num_skins(ageTracker.CurLifeStageIndex, female))
            {
                Log.Error("Error in " + assembly_name + ": AnimalVaried.ApplyNewSkin tried to set skin index out of available range for " + def.defName);
                return(false);
            }

            Vector2 draw_size   = ageTracker.CurKindLifeStage.bodyGraphicData.drawSize;
            Color   draw_color  = Color.white;
            Color   draw_color2 = Color.white;
            Shader  shader      = ShaderDatabase.Cutout;

            int ageInd = ageTracker.CurLifeStageIndex;

            // Use the winter coat instead
            if ((winter_coat_timer == winter_coat_trans_time || winterized) && UsesWinterCoat(ageTracker.CurLifeStageIndex))
            {
                //
                string winter_graphic = base_graphic_path;

                // Look for a custom winter graphic
                // For males
                if (!female)
                {
                    if (GetWinterCoatValue(ageInd, "texName") != null)
                    {
                        winter_graphic = base_graphic_path.Substring(0, base_graphic_path.LastIndexOf('/') + 1) + GetWinterCoatValue(ageInd, "texName");
                    }
                    else
                    {
                        // Look for the default name instead
                        if (DoesTexSetExist(base_graphic_path + "_winter"))
                        {
                            winter_graphic = base_graphic_path + "_winter";
                        }
                    }
                }
                // For females
                else
                {
                    if (GetWinterCoatValue(ageInd, "texNameFemale") != null)
                    {
                        winter_graphic = base_graphic_path.Substring(0, base_graphic_path.LastIndexOf('/') + 1) + GetWinterCoatValue(ageInd, "texNameFemale");
                    }
                    else
                    {
                        // Look for the default name instead
                        if (DoesTexSetExist(base_graphic_path + "_winter"))
                        {
                            winter_graphic = base_graphic_path + "_winter";
                        }
                    }
                }

                if (bool.Parse(GetWinterCoatValue(ageInd, "useComplexShader")))
                {
                    shader = ShaderDatabase.CutoutComplex;
                }
                draw_color  = ParseXMLColor(GetWinterCoatValue(ageInd, "color"));
                draw_color2 = ParseXMLColor(GetWinterCoatValue(ageInd, "color2"));

                draw_size *= float.Parse(GetWinterCoatValue(ageInd, "scale"));

                //Drawer.renderer.graphics.ClearCache();
                Drawer.renderer.graphics.nakedGraphic = GraphicDatabase.Get <Graphic_Multi> (winter_graphic, shader, draw_size, draw_color, draw_color2);
                skin_index = index;
                ReloadGraphicData();
                return(true);
            }

            // Use the default skin
            if (index == 0)
            {
                // Get default values
                if (ageTracker.CurKindLifeStage.bodyGraphicData != null)
                {
                    draw_color  = ageTracker.CurKindLifeStage.bodyGraphicData.color;
                    draw_color2 = ageTracker.CurKindLifeStage.bodyGraphicData.colorTwo;
                    if (this.gender == Gender.Female && ageTracker.CurKindLifeStage.femaleGraphicData != null)
                    {
                        draw_size   = ageTracker.CurKindLifeStage.femaleGraphicData.drawSize;
                        draw_color  = ageTracker.CurKindLifeStage.femaleGraphicData.color;
                        draw_color2 = ageTracker.CurKindLifeStage.bodyGraphicData.colorTwo;
                    }
                }
                // Get default shader type
                GraphicData gdata = ageTracker.CurKindLifeStage.bodyGraphicData;
                if (gender == Gender.Female && ageTracker.CurKindLifeStage.femaleGraphicData != null)
                {
                    gdata = ageTracker.CurKindLifeStage.femaleGraphicData;
                }
                if (gdata.shaderType == ShaderTypeDefOf.CutoutComplex)
                {
                    shader = ShaderDatabase.CutoutComplex;
                }


                //Drawer.renderer.graphics.ClearCache();
                Drawer.renderer.graphics.nakedGraphic = GraphicDatabase.Get <Graphic_Multi> (base_graphic_path, shader, draw_size, draw_color, draw_color2);
                ReloadGraphicData();
                skin_index = 0;
                return(true);
            }

            // Use a variant skin
            if (GetSkinNode(ageInd, index, female) != null && index != 0)
            {
                draw_color  = ParseXMLColor(GetSkinValue(ageInd, index, "color", female));
                draw_color2 = ParseXMLColor(GetSkinValue(ageInd, index, "color2", female));

                XmlNode skin_node = GetSkinNode(ageInd, index, female);
                foreach (XmlNode node in skin_node.ChildNodes)
                {
                    // Get colors
                    if (node.Name == "color" || node.Name == "colour")
                    {
                        draw_color = ParseXMLColor(node.InnerText);
                    }

                    if (node.Name == "color2" || node.Name == "colour2")
                    {
                        draw_color2 = ParseXMLColor(node.InnerText);
                    }
                }
            }

            if (GetSkinValue(ageInd, index, "useComplexShader", female) == "true")
            {
                shader = ShaderDatabase.CutoutComplex;
            }

            // Set the scale of the skin
            draw_size *= float.Parse(GetSkinValue(ageInd, index, "scale", female));

            // Set a new skin
            string texSetPath = base_graphic_path;

            if (GetSkinValue(ageInd, index, "texName", female) == null)
            {
                texSetPath = base_graphic_path;
            }
            else
            {
                texSetPath = texSetPath.Substring(0, texSetPath.LastIndexOf('/') + 1) + GetSkinValue(ageInd, index, "texName", female);
            }

            //Drawer.renderer.graphics.ClearCache();
            Graphic_Multi new_graphic = (Graphic_Multi)GraphicDatabase.Get <Graphic_Multi> (texSetPath, shader, draw_size, draw_color, draw_color2);

            Drawer.renderer.graphics.nakedGraphic = new_graphic;
            skin_index = index;
            ReloadGraphicData();
            return(true);
        }
コード例 #12
0
        public override void DrawHands(Quaternion bodyQuat, Vector3 drawPos,
                                       bool portrait,
                                       Thing carriedThing = null, bool flip = false)
        {
            if (this.Pawn.Dead || this.Pawn.Downed)
            {
                return;
            }

            if (portrait && !HarmonyPatchesFS.AnimatorIsOpen())
            {
                return;
            }

            if (!this.CompAnimator.Props.bipedWithHands)
            {
                return;
            }

            // return if hands already drawn on carrything
            bool carrying = carriedThing != null;

            if (this.CarryStuff() && !carrying)
            {
                return;
            }


            if (carrying)
            {
                this.ApplyEquipmentWobble(ref drawPos);
                carriedThing.DrawAt(drawPos, flip);
            }

            BodyAnimDef body = this.CompAnimator.BodyAnim;

            Rot4 rot = this.BodyFacing;

            if (body == null)
            {
                return;
            }

            JointLister shoulperPos = this.GetJointPositions(JointType.Shoulder,
                                                             body.shoulderOffsets[rot.AsInt],
                                                             body.shoulderOffsets[Rot4.North.AsInt].x,
                                                             carrying, this.Pawn.ShowWeaponOpenly());

            List <float> handSwingAngle = new List <float> {
                0f, 0f
            };
            List <float> shoulderAngle = new List <float> {
                0f, 0f
            };
            Vector3      rightHand = Vector3.zero;
            Vector3      leftHand  = Vector3.zero;
            WalkCycleDef walkCycle = this.CompAnimator.WalkCycle;
            PoseCycleDef poseCycle = this.CompAnimator.PoseCycle;

            if (walkCycle != null)
            {
                float offsetJoint = walkCycle.ShoulderOffsetHorizontalX.Evaluate(this.CompAnimator.MovedPercent);

                this.DoWalkCycleOffsets(
                    body.armLength,
                    ref rightHand,
                    ref leftHand,
                    ref shoulderAngle,
                    ref handSwingAngle,
                    ref shoulperPos,
                    carrying,
                    walkCycle.HandsSwingAngle,
                    offsetJoint);
            }

            if (poseCycle != null)
            {
                this.DoPoseCycleOffsets(ref rightHand,
                                        ref shoulderAngle,
                                        ref handSwingAngle, poseCycle);
            }

            this.DoAttackAnimationHandOffsets(ref handSwingAngle, ref rightHand, false);

            this.GetBipedMesh(out Mesh handMeshRight, out Mesh handMeshLeft);

            Material matLeft  = this.LeftHandMat;
            Material matRight = this.RightHandMat;

            if (MainTabWindow_BaseAnimator.Colored)
            {
                matLeft  = this.CompAnimator.PawnBodyGraphic?.HandGraphicLeftCol?.MatSingle;
                matRight = this.CompAnimator.PawnBodyGraphic?.HandGraphicRightCol?.MatSingle;
            }
            else if (carriedThing == null)
            {
                switch (rot.AsInt)
                {
                case 1:
                    matLeft = this.LeftHandShadowMat;
                    break;

                case 3:
                    matRight = this.RightHandShadowMat;
                    break;
                }
            }

            bool drawLeft  = matLeft != null && this.CompAnimator.BodyStat.HandLeft != PartStatus.Missing;
            bool drawRight = matRight != null && this.CompAnimator.BodyStat.HandRight != PartStatus.Missing;

            if (drawLeft)
            {
                Quaternion quat;
                Vector3    position;
                bool       noTween = false;
                if (!this.CompAnimator.IsMoving && this.CompAnimator.HasLeftHandPosition)
                {
                    position = this.CompAnimator.SecondHandPosition;
                    quat     = this.CompAnimator.WeaponQuat;
                    noTween  = true;
                }
                else
                {
                    shoulperPos.LeftJoint = bodyQuat * shoulperPos.LeftJoint;
                    leftHand = bodyQuat * leftHand.RotatedBy(-handSwingAngle[0] - shoulderAngle[0]);

                    position = drawPos + shoulperPos.LeftJoint + leftHand;
                    quat     = bodyQuat * Quaternion.AngleAxis(-handSwingAngle[0], Vector3.up);
                }

                TweenThing handLeft = TweenThing.HandLeft;
                this.DrawTweenedHand(position, handMeshLeft, matLeft, quat, handLeft, portrait, noTween);
                //GenDraw.DrawMeshNowOrLater(
                //                           handMeshLeft, position,
                //                           quat,
                //                           matLeft,
                //                           portrait);
            }

            if (drawRight)
            {
                Quaternion quat;
                Vector3    position;
                bool       noTween = false;
                if (this.CompAnimator.FirstHandPosition != Vector3.zero)
                {
                    quat     = this.CompAnimator.WeaponQuat;
                    position = this.CompAnimator.FirstHandPosition;
                    noTween  = true;
                }
                else
                {
                    shoulperPos.RightJoint = bodyQuat * shoulperPos.RightJoint;
                    rightHand =
                        bodyQuat * rightHand.RotatedBy(handSwingAngle[1] - shoulderAngle[1]);

                    position = drawPos + shoulperPos.RightJoint + rightHand;
                    quat     = bodyQuat * Quaternion.AngleAxis(handSwingAngle[1], Vector3.up);
                }

                TweenThing handRight = TweenThing.HandRight;
                this.DrawTweenedHand(position, handMeshRight, matRight, quat, handRight, portrait, noTween);
                // GenDraw.DrawMeshNowOrLater(
                //                            handMeshRight, position,
                //                            quat,
                //                            matRight,
                //                            portrait);
            }

            if (MainTabWindow_BaseAnimator.Develop)
            {
                // for debug
                Material centerMat = GraphicDatabase.Get <Graphic_Single>(
                    "Hands/Human_Hand_dev",
                    ShaderDatabase.CutoutSkin,
                    Vector2.one,
                    Color.white).MatSingle;

                GenDraw.DrawMeshNowOrLater(
                    handMeshLeft,
                    drawPos + shoulperPos.LeftJoint + new Vector3(0, -0.301f, 0),
                    bodyQuat * Quaternion.AngleAxis(-shoulderAngle[0], Vector3.up),
                    centerMat,
                    portrait);

                GenDraw.DrawMeshNowOrLater(
                    handMeshRight,
                    drawPos + shoulperPos.RightJoint + new Vector3(0, 0.301f, 0),
                    bodyQuat * Quaternion.AngleAxis(-shoulderAngle[1], Vector3.up),
                    centerMat,
                    portrait);
            }
        }
コード例 #13
0
        public override void DrawFeet(Quaternion bodyQuat, Quaternion footQuat, Vector3 rootLoc, bool portrait)
        {
            if (this.Pawn.Dead || this.Pawn.Downed)
            {
                return;
            }
            /// No feet while sitting at a table
            Job curJob = this.Pawn.CurJob;

            if (curJob != null)
            {
                if (curJob.def == JobDefOf.Ingest && !this.Pawn.Rotation.IsHorizontal)
                {
                    if (curJob.targetB.IsValid)
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            Rot4    rotty  = new Rot4(i);
                            IntVec3 intVec = this.Pawn.Position + rotty.FacingCell;
                            if (intVec == curJob.targetB)
                            {
                                return;
                            }
                        }
                    }
                }
            }

            if (portrait && !HarmonyPatchesFS.AnimatorIsOpen())
            {
                return;
            }

            Quaternion drawQuat = this.CompAnimator.IsMoving ? footQuat : bodyQuat;

            Rot4 rot = this.BodyFacing;

            // Basic values
            BodyAnimDef body = this.CompAnimator.BodyAnim;

            if (body == null)
            {
                return;
            }

            JointLister groundPos = this.GetJointPositions(JointType.Hip,
                                                           body.hipOffsets[rot.AsInt],
                                                           body.hipOffsets[Rot4.North.AsInt].x);

            Vector3      rightFootCycle = Vector3.zero;
            Vector3      leftFootCycle  = Vector3.zero;
            float        footAngleRight = 0;
            float        footAngleLeft  = 0;
            float        offsetJoint    = 0;
            WalkCycleDef cycle          = this.CompAnimator.WalkCycle;

            if (cycle != null)
            {
                offsetJoint = cycle.HipOffsetHorizontalX.Evaluate(this.CompAnimator.MovedPercent);

                this.DoWalkCycleOffsets(
                    ref rightFootCycle,
                    ref leftFootCycle,
                    ref footAngleRight,
                    ref footAngleLeft,
                    ref offsetJoint,
                    cycle.FootPositionX,
                    cycle.FootPositionZ,
                    cycle.FootAngle);
            }

            this.GetBipedMesh(out Mesh footMeshRight, out Mesh footMeshLeft);

            Material matRight;
            Material matLeft;

            if (MainTabWindow_BaseAnimator.Colored)
            {
                matRight = this.CompAnimator.PawnBodyGraphic?.FootGraphicRightCol?.MatAt(rot);
                matLeft  = this.CompAnimator.PawnBodyGraphic?.FootGraphicLeftCol?.MatAt(rot);
            }
            else
            {
                Material rightFoot   = this.CompAnimator.PawnBodyGraphic?.FootGraphicRight?.MatAt(rot);
                Material leftFoot    = this.CompAnimator.PawnBodyGraphic?.FootGraphicLeft?.MatAt(rot);
                Material leftShadow  = this.CompAnimator.PawnBodyGraphic?.FootGraphicLeftShadow?.MatAt(rot);
                Material rightShadow = this.CompAnimator.PawnBodyGraphic?.FootGraphicRightShadow?.MatAt(rot);

                switch (rot.AsInt)
                {
                default:
                    matRight = this.Flasher.GetDamagedMat(rightFoot);
                    matLeft  = this.Flasher.GetDamagedMat(leftFoot);
                    break;

                case 1:
                    matRight = this.Flasher.GetDamagedMat(rightFoot);

                    matLeft = this.Flasher.GetDamagedMat(leftShadow);
                    break;

                case 3:

                    matRight = this.Flasher.GetDamagedMat(rightShadow);
                    matLeft  = this.Flasher.GetDamagedMat(leftFoot);
                    break;
                }
            }

            bool drawRight = matRight != null && this.CompAnimator.BodyStat.FootRight != PartStatus.Missing;

            bool drawLeft = matLeft != null && this.CompAnimator.BodyStat.FootLeft != PartStatus.Missing;

            groundPos.LeftJoint  = drawQuat * groundPos.LeftJoint;
            groundPos.RightJoint = drawQuat * groundPos.RightJoint;
            leftFootCycle        = drawQuat * leftFootCycle;
            rightFootCycle       = drawQuat * rightFootCycle;
            Vector3 ground = rootLoc + drawQuat * new Vector3(0, 0, OffsetGroundZ);

            if (drawLeft)
            {
                // TweenThing leftFoot = TweenThing.FootLeft;
                // PawnPartsTweener tweener = this.CompAnimator.PartTweener;
                // if (tweener != null)
                {
                    Vector3 position = ground + groundPos.LeftJoint + leftFootCycle;

                    // tweener.PartPositions[(int)leftFoot] = position;
                    // tweener.PreThingPosCalculation(leftFoot, spring: SpringTightness.Stff);

                    GenDraw.DrawMeshNowOrLater(
                        footMeshLeft,
                        position,                        // tweener.TweenedPartsPos[(int)leftFoot],
                        drawQuat * Quaternion.AngleAxis(footAngleLeft, Vector3.up),
                        matLeft,
                        portrait);
                }
            }

            if (drawRight)
            {
                // TweenThing rightFoot = TweenThing.FootRight;
                // PawnPartsTweener tweener = this.CompAnimator.PartTweener;
                // if (tweener != null)
                // {
                Vector3 position = ground + groundPos.RightJoint + rightFootCycle;

                // tweener.PartPositions[(int)rightFoot] = position;
                //     tweener.PreThingPosCalculation(rightFoot, spring: SpringTightness.Stff);
                GenDraw.DrawMeshNowOrLater(
                    footMeshRight,
                    position,                        // tweener.TweenedPartsPos[(int)rightFoot],
                    drawQuat * Quaternion.AngleAxis(footAngleRight, Vector3.up),
                    matRight,
                    portrait);

                // }
            }

            if (MainTabWindow_BaseAnimator.Develop)
            {
                // for debug
                Material centerMat = GraphicDatabase
                                     .Get <Graphic_Single>("Hands/Ground", ShaderDatabase.Transparent, Vector2.one,
                                                           Color.red).MatSingle;

                GenDraw.DrawMeshNowOrLater(
                    footMeshLeft,
                    ground + groundPos.LeftJoint +
                    new Vector3(offsetJoint, -0.301f, 0),
                    drawQuat * Quaternion.AngleAxis(0, Vector3.up),
                    centerMat,
                    portrait);

                GenDraw.DrawMeshNowOrLater(
                    footMeshRight,
                    ground + groundPos.RightJoint +
                    new Vector3(offsetJoint, 0.301f, 0),
                    drawQuat * Quaternion.AngleAxis(0, Vector3.up),
                    centerMat,
                    portrait);

                Material hipMat = GraphicDatabase
                                  .Get <Graphic_Single>("Hands/Human_Hand_dev", ShaderDatabase.Transparent, Vector2.one,
                                                        Color.blue).MatSingle;

                GenDraw.DrawMeshNowOrLater(
                    footMeshLeft,
                    groundPos.LeftJoint +
                    new Vector3(offsetJoint, -0.301f, 0),
                    drawQuat * Quaternion.AngleAxis(0, Vector3.up),
                    centerMat,
                    portrait);

                // UnityEngine.Graphics.DrawMesh(handsMesh, center + new Vector3(0, 0.301f, z),
                // Quaternion.AngleAxis(0, Vector3.up), centerMat, 0);
                // UnityEngine.Graphics.DrawMesh(handsMesh, center + new Vector3(0, 0.301f, z2),
                // Quaternion.AngleAxis(0, Vector3.up), centerMat, 0);
            }
        }
コード例 #14
0
        protected override void FillTab()
        {
            if (!this.SelPawn.GetCompFace(out CompFace compFace))
            {
                return;
            }

            Rect rect = new Rect(10f, 10f, 330f, 330f);

            Rect checkbox = new Rect(rect.x, rect.y, rect.width, 24f);

            Widgets.CheckboxLabeled(checkbox, "Ignore renderer", ref compFace.IgnoreRenderer);

            Rect pawnRect = new Rect(rect.x, checkbox.yMax, rect.width, 24f);

            foreach (Pawn relatedPawn in this.SelPawn.relations.FamilyByBlood)
            {
                Widgets.Label(pawnRect, relatedPawn + " - " + this.SelPawn.GetRelations(relatedPawn).GetEnumerator());
                pawnRect.y += 24f;
            }

            Rect rect2 = new Rect(rect.x, pawnRect.yMax + 15f, rect.width, rect.height - checkbox.yMax);

            GUILayout.BeginArea(rect2);
            GUILayout.BeginVertical();

            // Listing_Standard list = new Listing_Standard();
            // list.Begin(rect2);

            this.SelPawn.GetCompAnim(out CompBodyAnimator _);
            if (compFace.IgnoreRenderer)
            {
                _rotation = GUILayout.SelectionGrid(_rotation, this._psiToolbarStrings, 4);
                if (GUI.changed)
                {
                    this.SelPawn.Rotation = new Rot4(_rotation);
                }
            }
            else
            {
                _rotation = this.SelPawn.Rotation.AsInt;
            }


            bool male = this.SelPawn.gender == Gender.Male;

            if (compFace.PawnCrownType == CrownType.Average)
            {
                switch (compFace.PawnHeadType)
                {
                case HeadType.Normal:
                    if (male)
                    {
                        GUILayout.Label(
                            "MaleAverageNormalOffset: " + MeshPoolFS.EyeMaleAverageNormalOffset.ToString("N5"));
                        MeshPoolFS.EyeMaleAverageNormalOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeMaleAverageNormalOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.EyeMaleAverageNormalOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeMaleAverageNormalOffset.y,
                            -0.2f,
                            0.2f);
                        GUILayout.Label(
                            "MouthMaleAverageNormalOffset: "
                            + MeshPoolFS.MouthMaleAverageNormalOffset.ToString("N5"));
                        MeshPoolFS.MouthMaleAverageNormalOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleAverageNormalOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthMaleAverageNormalOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleAverageNormalOffset.y,
                            -0.2f,
                            0.2f);
                    }
                    else
                    {
                        GUILayout.Label(
                            "FemaleAverageNormalOffset: " + MeshPoolFS.EyeFemaleAverageNormalOffset.ToString("N5"));
                        MeshPoolFS.EyeFemaleAverageNormalOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleAverageNormalOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.EyeFemaleAverageNormalOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleAverageNormalOffset.y,
                            -0.2f,
                            0.2f);
                        GUILayout.Label(
                            "MouthFemaleAverageNormalOffset: "
                            + MeshPoolFS.MouthFemaleAverageNormalOffset.ToString("N5"));
                        MeshPoolFS.MouthFemaleAverageNormalOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleAverageNormalOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthFemaleAverageNormalOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleAverageNormalOffset.y,
                            -0.2f,
                            0.2f);
                    }

                    break;

                case HeadType.Pointy:
                    if (male)
                    {
                        GUILayout.Label(
                            "MaleAveragePointyOffset: " + MeshPoolFS.EyeMaleAveragePointyOffset.ToString("N5"));
                        MeshPoolFS.EyeMaleAveragePointyOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeMaleAveragePointyOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.EyeMaleAveragePointyOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeMaleAveragePointyOffset.y,
                            -0.2f,
                            0.2f);
                        GUILayout.Label(
                            "MouthMaleAveragePointyOffset: "
                            + MeshPoolFS.MouthMaleAveragePointyOffset.ToString("N5"));
                        MeshPoolFS.MouthMaleAveragePointyOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleAveragePointyOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthMaleAveragePointyOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleAveragePointyOffset.y,
                            -0.2f,
                            0.2f);
                    }
                    else
                    {
                        GUILayout.Label(
                            "FemaleAveragePointyOffset: " + MeshPoolFS.EyeFemaleAveragePointyOffset.ToString("N5"));
                        MeshPoolFS.EyeFemaleAveragePointyOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleAveragePointyOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.EyeFemaleAveragePointyOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleAveragePointyOffset.y,
                            -0.2f,
                            0.2f);
                        GUILayout.Label(
                            "MouthFemaleAveragePointyOffset: "
                            + MeshPoolFS.MouthFemaleAveragePointyOffset.ToString("N5"));
                        MeshPoolFS.MouthFemaleAveragePointyOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleAveragePointyOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthFemaleAveragePointyOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleAveragePointyOffset.y,
                            -0.2f,
                            0.2f);
                    }

                    break;

                case HeadType.Wide:
                    if (male)
                    {
                        GUILayout.Label(
                            "MaleAverageWideOffset.x: " + MeshPoolFS.EyeMaleAverageWideOffset.ToString("N5"));
                        MeshPoolFS.EyeMaleAverageWideOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeMaleAverageWideOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.EyeMaleAverageWideOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeMaleAverageWideOffset.y,
                            -0.2f,
                            0.2f);
                        GUILayout.Label(
                            "MouthMaleAverageWideOffset.x: " + MeshPoolFS.MouthMaleAverageWideOffset.ToString("N5"));
                        MeshPoolFS.MouthMaleAverageWideOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleAverageWideOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthMaleAverageWideOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleAverageWideOffset.y,
                            -0.2f,
                            0.2f);
                    }
                    else
                    {
                        GUILayout.Label(
                            "FemaleAverageWideOffset: " + MeshPoolFS.EyeFemaleAverageWideOffset.ToString("N5"));
                        MeshPoolFS.EyeFemaleAverageWideOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleAverageWideOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.EyeFemaleAverageWideOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleAverageWideOffset.y,
                            -0.2f,
                            0.2f);
                        GUILayout.Label(
                            "MouthFemaleAverageWideOffset: "
                            + MeshPoolFS.MouthFemaleAverageWideOffset.ToString("N5"));
                        MeshPoolFS.MouthFemaleAverageWideOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleAverageWideOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthFemaleAverageWideOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleAverageWideOffset.y,
                            -0.2f,
                            0.2f);
                    }

                    break;
                }
            }
            else
            {
                switch (compFace.PawnHeadType)
                {
                case HeadType.Normal:
                    if (male)
                    {
                        GUILayout.Label(
                            "MaleNarrowNormalOffset.x: " + MeshPoolFS.EyeMaleNarrowNormalOffset.ToString("N5"));
                        MeshPoolFS.EyeMaleNarrowNormalOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeMaleNarrowNormalOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.EyeMaleNarrowNormalOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeMaleNarrowNormalOffset.y,
                            -0.2f,
                            0.2f);
                        GUILayout.Label(
                            "MouthMaleNarrowNormalOffset.x: "
                            + MeshPoolFS.MouthMaleNarrowNormalOffset.ToString("N5"));
                        MeshPoolFS.MouthMaleNarrowNormalOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleNarrowNormalOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthMaleNarrowNormalOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleNarrowNormalOffset.y,
                            -0.2f,
                            0.2f);
                    }
                    else
                    {
                        GUILayout.Label(
                            "FemaleNarrowNormalOffset: " + MeshPoolFS.EyeFemaleNarrowNormalOffset.ToString("N5"));
                        MeshPoolFS.EyeFemaleNarrowNormalOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleNarrowNormalOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.EyeFemaleNarrowNormalOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleNarrowNormalOffset.y,
                            -0.2f,
                            0.2f);
                        GUILayout.Label(
                            "MouthFemaleNarrowNormalOffset: "
                            + MeshPoolFS.MouthFemaleNarrowNormalOffset.ToString("N5"));
                        MeshPoolFS.MouthFemaleNarrowNormalOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleNarrowNormalOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthFemaleNarrowNormalOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleNarrowNormalOffset.y,
                            -0.2f,
                            0.2f);
                    }

                    break;

                case HeadType.Pointy:
                    if (male)
                    {
                        GUILayout.Label(
                            "MaleNarrowPointyOffset.x: " + MeshPoolFS.EyeMaleNarrowPointyOffset.ToString("N5"));
                        MeshPoolFS.EyeMaleNarrowPointyOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeMaleNarrowPointyOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.EyeMaleNarrowPointyOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeMaleNarrowPointyOffset.y,
                            -0.2f,
                            0.2f);
                        GUILayout.Label(
                            "MouthMaleNarrowPointyOffset.x: "
                            + MeshPoolFS.MouthMaleNarrowPointyOffset.ToString("N5"));
                        MeshPoolFS.MouthMaleNarrowPointyOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleNarrowPointyOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthMaleNarrowPointyOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleNarrowPointyOffset.y,
                            -0.2f,
                            0.2f);
                    }
                    else
                    {
                        GUILayout.Label(
                            "FemaleNarrowPointyOffset: " + MeshPoolFS.EyeFemaleNarrowPointyOffset.ToString("N5"));
                        MeshPoolFS.EyeFemaleNarrowPointyOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleNarrowPointyOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.EyeFemaleNarrowPointyOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleNarrowPointyOffset.y,
                            -0.2f,
                            0.2f);
                        GUILayout.Label(
                            "MouthFemaleNarrowPointyOffset: "
                            + MeshPoolFS.MouthFemaleNarrowPointyOffset.ToString("N5"));
                        MeshPoolFS.MouthFemaleNarrowPointyOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleNarrowPointyOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthFemaleNarrowPointyOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleNarrowPointyOffset.y,
                            -0.2f,
                            0.2f);
                    }

                    break;

                case HeadType.Wide:
                    if (male)
                    {
                        GUILayout.Label(
                            "MaleNarrowWideOffset.x: " + MeshPoolFS.EyeMaleNarrowWideOffset.ToString("N5"));
                        MeshPoolFS.EyeMaleNarrowWideOffset.x =
                            GUILayout.HorizontalSlider(MeshPoolFS.EyeMaleNarrowWideOffset.x, -0.2f, 0.2f);
                        MeshPoolFS.EyeMaleNarrowWideOffset.y =
                            GUILayout.HorizontalSlider(MeshPoolFS.EyeMaleNarrowWideOffset.y, -0.2f, 0.2f);
                        GUILayout.Label(
                            "MouthMaleNarrowWideOffset.x: " + MeshPoolFS.MouthMaleNarrowWideOffset.ToString("N5"));
                        MeshPoolFS.MouthMaleNarrowWideOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleNarrowWideOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthMaleNarrowWideOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthMaleNarrowWideOffset.y,
                            -0.2f,
                            0.2f);
                    }
                    else
                    {
                        GUILayout.Label(
                            "FemaleNarrowWideOffset: " + MeshPoolFS.EyeFemaleNarrowWideOffset.ToString("N5"));
                        MeshPoolFS.EyeFemaleNarrowWideOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleNarrowWideOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.EyeFemaleNarrowWideOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.EyeFemaleNarrowWideOffset.y,
                            -0.2f,
                            0.2f);
                        GUILayout.Label(
                            "MouthFemaleNarrowWideOffset: " + MeshPoolFS.MouthFemaleNarrowWideOffset.ToString("N5"));
                        MeshPoolFS.MouthFemaleNarrowWideOffset.x = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleNarrowWideOffset.x,
                            -0.2f,
                            0.2f);
                        MeshPoolFS.MouthFemaleNarrowWideOffset.y = GUILayout.HorizontalSlider(
                            MeshPoolFS.MouthFemaleNarrowWideOffset.y,
                            -0.2f,
                            0.2f);
                    }

                    break;
                }
            }

            // else
            // {
            // GUILayout.Label("FemaleOffset.y");
            // Settings.FemaleOffset.y =
            // GUILayout.HorizontalSlider(Settings.FemaleOffset.y, -0.2f, 0.2f);
            // }
            GUILayout.EndVertical();

            if (GUILayout.Button("Mouth"))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (MouthDef current in DefDatabase <MouthDef> .AllDefs)
                {
                    MouthDef localOut = current;
                    list.Add(
                        new FloatMenuOption(
                            localOut.label,
                            delegate
                    {
                        foreach (Pawn pawn in Find.CurrentMap.mapPawns.AllPawnsSpawned.Where(
                                     x => x.HasCompFace()))
                        {
                            Color color = Color.white;
                            pawn.GetCompFace(out CompFace comp2);
                            if (comp2.PawnFaceGraphic != null)
                            {
                                comp2.PawnFaceGraphic.MouthGraphic =
                                    GraphicDatabase.Get <Graphic_Multi_NaturalHeadParts>(
                                        current.texPath,
                                        ShaderDatabase
                                        .CutoutSkin,
                                        Vector2.one,
                                        color) as
                                    Graphic_Multi_NaturalHeadParts;
                            }
                        }
                    }));
コード例 #15
0
        public Graphic GetNakedGraphic(BodyTypeDef bodyType, Shader shader, Color skinColor, Color skinColorSecond, string userpath, string gender) =>
        GraphicDatabase.Get(typeof(Graphic_Multi), GetNakedPath(bodyType, userpath, this.useGenderedBodies ? gender : ""), shader, Vector2.one,

                            skinColor, skinColorSecond, data: null, shaderParameters: null);
コード例 #16
0
        public static void Postfix(Plant __instance, ThingDef parentDef)
        {
            if (__instance.def.HasModExtension <ThingWeatherReaction>())
            {
                ThingWeatherReaction mod = __instance.def.GetModExtension <ThingWeatherReaction>();

                if (!mod.frostGraphicPath.NullOrEmpty())
                {
                    string id = __instance.def.defName + "frost";
                    LongEventHandler.ExecuteWhenFinished(delegate
                    {
                        __instance.Map.GetComponent <Watcher>().graphicHolder.Add(id, GraphicDatabase.Get(__instance.def.graphicData.graphicClass, mod.frostGraphicPath, __instance.def.graphic.Shader, __instance.def.graphicData.drawSize, __instance.def.graphicData.color, __instance.def.graphicData.colorTwo));
                    });
                }
                if (!mod.droughtGraphicPath.NullOrEmpty())
                {
                    string id = __instance.def.defName + "drought";
                    LongEventHandler.ExecuteWhenFinished(delegate
                    {
                        __instance.Map.GetComponent <Watcher>().graphicHolder.Add(id, GraphicDatabase.Get(__instance.def.graphicData.graphicClass, mod.droughtGraphicPath, __instance.def.graphic.Shader, __instance.def.graphicData.drawSize, __instance.def.graphicData.color, __instance.def.graphicData.colorTwo));
                    });
                }
                if (!mod.floweringGraphicPath.NullOrEmpty())
                {
                    string id = __instance.def.defName + "flowering";
                    LongEventHandler.ExecuteWhenFinished(delegate
                    {
                        __instance.Map.GetComponent <Watcher>().graphicHolder.Add(id, GraphicDatabase.Get(__instance.def.graphicData.graphicClass, mod.floweringGraphicPath, __instance.def.graphic.Shader, __instance.def.graphicData.drawSize, __instance.def.graphicData.color, __instance.def.graphicData.colorTwo));
                    });
                }
            }
        }
コード例 #17
0
 static Building_Brazier()
 {
     graphicOn  = GraphicDatabase.Get <Graphic_Single>("PlaceholderBrazierFrontFire");
     graphicOff = GraphicDatabase.Get <Graphic_Single>("PlaceholderBrazierFront");
 }
コード例 #18
0
 /// <summary>
 /// Import the graphics
 /// </summary>
 private void UpdateGraphics()
 {
     graphic_Saddle = new Graphic_Multi();
     graphic_Saddle = GraphicDatabase.Get <Graphic_Multi>("Things/Pawn/Vehicle/Saddle", def.graphic.Shader, def.graphic.drawSize, def.graphic.color, def.graphic.colorTwo) as Graphic_Multi;
 }
コード例 #19
0
 public override Graphic GetColoredVersion(Shader newShader, Color newColor, Color newColorTwo)
 {
     return(GraphicDatabase.Get <Graphic_Vehicle>(path, newShader, drawSize, newColor, newColorTwo, DataRGB));
 }
コード例 #20
0
        internal static void ResolveAgeGraphics(PawnGraphicSet graphics)
        {
            LongEventHandler.ExecuteWhenFinished(delegate {
                //if (!graphics.pawn.RaceProps.Humanlike) {
                if (graphics.pawn.def.defName != "Human")
                {
                    return;
                }

                // Beards
                String beard = "";
                if (graphics.pawn.story.hairDef != null)
                {
                    if (graphics.pawn.story.hairDef.hairTags.Contains("Beard"))
                    {
                        if (graphics.pawn.apparel.BodyPartGroupIsCovered(BodyPartGroupDefOf.UpperHead) && !graphics.pawn.story.hairDef.hairTags.Contains("DrawUnderHat"))
                        {
                            beard = "_BeardOnly";
                        }
                        if (graphics.pawn.ageTracker.CurLifeStageIndex <= AgeStage.Teenager)
                        {
                            graphics.hairGraphic = GraphicDatabase.Get <Graphic_Multi> (DefDatabase <HairDef> .GetNamed("Mop").texPath, ShaderDatabase.Cutout, Vector2.one, graphics.pawn.story.hairColor);
                        }
                        else
                        {
                            graphics.hairGraphic = GraphicDatabase.Get <Graphic_Multi> (graphics.pawn.story.hairDef.texPath + beard, ShaderDatabase.Cutout, Vector2.one, graphics.pawn.story.hairColor);
                        }
                    }
                    else
                    {
                        graphics.hairGraphic = GraphicDatabase.Get <Graphic_Multi> (graphics.pawn.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, graphics.pawn.story.hairColor);
                    }
                }

                // Reroute the graphics for children
                // For babies and toddlers
                if (graphics.pawn.ageTracker.CurLifeStageIndex <= AgeStage.Baby)
                {
                    string toddler_hair = "Boyish";
                    if (graphics.pawn.gender == Gender.Female)
                    {
                        toddler_hair = "Girlish";
                    }
                    graphics.hairGraphic = GraphicDatabase.Get <Graphic_Multi> ("Things/Pawn/Humanlike/Children/Hairs/Child_" + toddler_hair, ShaderDatabase.Cutout, Vector2.one, graphics.pawn.story.hairColor);
                    graphics.headGraphic = GraphicDatabase.Get <Graphic_Multi> ("Things/Pawn/Humanlike/null", ShaderDatabase.Cutout, Vector2.one, Color.white);

                    // The pawn is a baby
                    if (graphics.pawn.ageTracker.CurLifeStageIndex == AgeStage.Baby)
                    {
                        graphics.nakedGraphic = GraphicDatabase.Get <Graphic_Single> ("Things/Pawn/Humanlike/Children/Bodies/Newborn", ShaderDatabase.CutoutSkin, Vector2.one, graphics.pawn.story.SkinColor);
                    }
                }

                // The pawn is a toddler
                if (graphics.pawn.ageTracker.CurLifeStageIndex == AgeStage.Toddler)
                {
                    string upright = "";
                    if (graphics.pawn.ageTracker.AgeBiologicalYears >= 1)
                    {
                        upright = "Upright";
                    }
                    graphics.nakedGraphic = GraphicDatabase.Get <Graphic_Multi> ("Things/Pawn/Humanlike/Children/Bodies/Toddler" + upright, ShaderDatabase.CutoutSkin, Vector2.one, graphics.pawn.story.SkinColor);
                }
                // The pawn is a child
                else if (graphics.pawn.ageTracker.CurLifeStageIndex == AgeStage.Child)
                {
                    graphics.nakedGraphic = Children_Drawing.GetChildBodyGraphics(graphics, ShaderDatabase.CutoutSkin, graphics.pawn.story.SkinColor);
                    graphics.headGraphic  = Children_Drawing.GetChildHeadGraphics(ShaderDatabase.CutoutSkin, graphics.pawn.story.SkinColor);
                }
            });
        }
コード例 #21
0
        // 水道管
        static MizuGraphics()
        {
            WaterBoxes = new List <Graphic>
            {
                GraphicDatabase.Get <Graphic_Single>("Things/Building/Production/Mizu_WaterBox0", ShaderDatabase.Transparent),
                GraphicDatabase.Get <Graphic_Single>("Things/Building/Production/Mizu_WaterBox1", ShaderDatabase.CutoutComplex),
                GraphicDatabase.Get <Graphic_Single>("Things/Building/Production/Mizu_WaterBox2", ShaderDatabase.CutoutComplex),
                GraphicDatabase.Get <Graphic_Single>("Things/Building/Production/Mizu_WaterBox3", ShaderDatabase.CutoutComplex),
                GraphicDatabase.Get <Graphic_Single>("Things/Building/Production/Mizu_WaterBox4", ShaderDatabase.CutoutComplex)
            };

            LinkedWaterBoxes = new List <Graphic_Linked>
            {
                new Graphic_Linked(WaterBoxes[0]),
                new Graphic_Linked(WaterBoxes[1]),
                new Graphic_Linked(WaterBoxes[2]),
                new Graphic_Linked(WaterBoxes[3]),
                new Graphic_Linked(WaterBoxes[4])
            };

            Buckets = new List <Graphic> {
                GraphicDatabase.Get <Graphic_Single>("Things/Item/Mizu_Bucket0", ShaderDatabase.Transparent), GraphicDatabase.Get <Graphic_Single>("Things/Item/Mizu_Bucket1", ShaderDatabase.CutoutComplex)
            };
        }
コード例 #22
0
 public override Graphic GetColoredVersion(Shader newShader, Color newColor, Color newColorTwo)
 {
     return(GraphicDatabase.Get <Graphic_StackCount>(this.path, newShader, this.drawSize, newColor, newColorTwo, this.data));
 }
コード例 #23
0
ファイル: Graphic_Gachapon.cs プロジェクト: emipa606/RimGacha
 // Token: 0x06000035 RID: 53 RVA: 0x0000318C File Offset: 0x0000138C
 public override Graphic GetColoredVersion(Shader newShader, Color newColor, Color newColorTwo)
 {
     Log.Warning(
         "Graphic_Gachapon.GetColoredVersion(Shader, Color, Color) should not be called. Use Graphic_Gachapon.GetColoredVersion(ShaderTypeDef, Color, Color, ShadowData) instead.");
     return(GraphicDatabase.Get <Graphic_Gachapon>(path, newShader, drawSize, newColor, newColorTwo, data));
 }
コード例 #24
0
 public static void RenewalBodyGraphic(PawnGraphicSet pawnGraphicSet, string bodyPath, Shader shader, RaceAddonComp racomp, Color rottingColor)
 {
     pawnGraphicSet.nakedGraphic   = GraphicDatabase.Get <Graphic_Multi>(bodyPath, shader, Vector2.one, racomp.skinColor_Main, racomp.skinColor_Sub);
     pawnGraphicSet.rottingGraphic = GraphicDatabase.Get <Graphic_Multi>(bodyPath, shader, Vector2.one, rottingColor);
     Traverse.Create(pawnGraphicSet).Field <int>("cachedMatsBodyBaseHash").Value = -1;
 }
コード例 #25
0
        public void UpdateGraphic()
        {
            if (Drawer?.pawn == null)
            {
                Graphic = null;
                return;
            }
            if (apparel.Wearer == null)
            {
                if (Drawer != null)
                {
                    Drawer.pawn = null;
                }
                Graphic = null;
                return;
            }
            if (Drawer.pawn != apparel.Wearer)
            {
                //    Log.Message("Old Wearer: "+ Drawer.pawn + "new Wearer: "+ apparel.Wearer);
                Drawer.pawn = apparel.Wearer;
            }
            Pawn   pawn   = Drawer.pawn;
            Shader shader = this.Shader;
            string path   = padTexPath;

            if (UseFactionTextures || UseVariableTextures)
            {
                bool notPlayer = pawn.Faction != null && (pawn.Faction != Faction.OfPlayer);
                if (notPlayer)
                {
                    FactionDefExtension ext = pawn.Faction.def.HasModExtension <FactionDefExtension>() ? pawn.Faction.def.GetModExtensionFast <FactionDefExtension>() : null;
                    bool factionTextures    = UseFactionTextures && ext?.factionTextureTag != null;
                    if (factionTextures)
                    {
                        //    Log.Message("using factionTextureTag " + ext.factionTextureTag);
                        for (int i = 0; i < Options.Count; i++)
                        {
                            if (Options[i].TexPath == ext.factionTextureTag)
                            {
                                Used = Options[i];
                                //    Log.Message("Found faction VariantTexture " + VariantTextures.Options[i].texPath);
                                break;
                            }
                        }
                    }
                    else
                    {
                        bool foundVar = false;
                        if (!Options.NullOrEmpty())
                        {
                            for (int i = 0; i < Options.Count; i++)
                            {
                                if (pawn.kindDef.apparelTags.Contains(Options[i].TexPath))
                                {
                                    Used     = Options[i];
                                    foundVar = true;
                                    //    Log.Message("Found KindDef VariantTexture " + VariantTextures.Options[i].texPath);
                                    break;
                                }
                            }
                            if (!foundVar)
                            {
                                Used = Options.RandomElement();
                            }
                        }
                    }
                }
                else
                {
                    if (UseFactionTextures)
                    {
                        //    Log.Message("UseFactionTextures");
                        //    CompColorableTwoFaction FC = Drawer.Colours as CompColorableTwoFaction;
                        if (Drawer.Colours is CompColorableTwoFaction FC)
                        {
                            //    Log.Message("FC != null");
                            if (FC.FactionDef != null)
                            {
                                //        Log.Message("FactionDef = " + FC.FactionDef.LabelCap);
                                FactionDefExtension e = FC.Extension;
                                if (e != null)
                                {
                                    //   Log.Message("FactionDefExtension != null");
                                    if (!Options.NullOrEmpty())
                                    {
                                        //    Log.Message("Options: " + Options.Count);
                                        for (int i = 0; i < Options.Count; i++)
                                        {
                                            //    Log.Message("checking " + e.factionTextureTag + " Vs " + Options[i].TexPath + " = " + (Options[i].TexPath == e.factionTextureTag));
                                            if (Options[i].TexPath == e.factionTextureTag)
                                            {
                                                Used = Options[i];
                                                //        Log.Message("Found faction VariantTexture " + Options[i].TexPath);
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            //    Log.Message("FC == null");
                            List <FactionDef> factions = DefDatabase <FactionDef> .AllDefsListForReading;
                            //    Log.Message("UpdateGraphic() 4 1 B 1 1 B 2 factions: "+ factions.Count);
                            for (int i = 0; i < factions.Count; i++)
                            {
                                //    Log.Message("UpdateGraphic() 4 1 B 1 1 B 2 faction: " + i);
                                FactionDef f = factions[i];

                                //    Log.Message("UpdateGraphic() 4 1 B 1 1 B 2 faction: " + f);
                                FactionDefExtension e = f.HasModExtension <FactionDefExtension>() ? f.GetModExtensionFast <FactionDefExtension>() : null;
                                //    Log.Message("UpdateGraphic() 4 1 B 1 1 B 2 faction: " + (e == null));
                                if (e == null)
                                {
                                    //    Log.Message("e == null");
                                    continue;
                                }
                                if (e.factionTextureTag.NullOrEmpty())
                                {
                                    //    Log.Message("factionTextureTag == null");
                                    continue;
                                }

                                if (!Options.NullOrEmpty())
                                {
                                    //    Log.Message("UpdateGraphic() 4 1 B 1 1 A 1 1 1");
                                    //    Log.Message("Options: " + Options.Count);
                                    for (int ii = 0; ii < Options.Count; ii++)
                                    {
                                        //    Log.Message("checking " + e.factionTextureTag + " Vs " + Options[i].TexPath + " = " + (Options[i].TexPath == e.factionTextureTag));
                                        if (Options[ii].TexPath == e.factionTextureTag)
                                        {
                                            faction = f;
                                            //        Log.Message("Found faction VariantTexture " + Options[i].TexPath);
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                path = padTexPath + "/" + Used.TexPath;
            }

            string body    = bodyTypeString(pawn.story.bodyType);
            string testRot = "_";

            if (CheckPauldronRotation(Rot4.South))
            {
                testRot += "south";
            }
            else
            if (CheckPauldronRotation(Rot4.North))
            {
                testRot += "north";
            }
            else
            if (CheckPauldronRotation(Rot4.East))
            {
                testRot += "east";
            }
            else
            if (CheckPauldronRotation(Rot4.West))
            {
                testRot += "west";
            }
            else
            {
                testRot = "";
            }
            string    testpath = path + body + testRot;
            Texture2D tex      = ContentFinder <Texture2D> .Get(testpath, false);

            Graphic graphic;

            if (tex == null)
            {
                this.UpdateProps();
                path = padTexPath;
                if (UseFactionTextures || UseVariableTextures)
                {
                    path = padTexPath + "/" + this.DefaultOption.TexPath;
                }
            }
            path += body;
            Color color    = Drawer.mainColorFor(this);
            Color colorTwo = Drawer.secondaryColorFor(this);

            graphic = GraphicDatabase.Get <Graphic_Multi>(path, shader, size, color, colorTwo);
            if (Drawer.Colours is CompColorableTwoFaction factionColors)
            {
                Texture texture;
                if (factionColors.ActiveFaction)
                {
                    if (!factionColors.Extension.factionMaskTag.NullOrEmpty())
                    {
                        string msk = "m_" + factionColors.Extension.factionMaskTag;
                        texture = ContentFinder <Texture2D> .Get(graphic.path + "_east" + msk, false);

                        if (texture != null)
                        {
                            graphic.MatEast.SetTexture(ShaderPropertyIDs.MaskTex, texture);
                        }
                        graphic.MatEast.SetColor(ShaderPropertyIDs.ColorTwo, colorTwo);

                        texture = ContentFinder <Texture2D> .Get(graphic.path + "_west" + msk, false);

                        if (texture != null)
                        {
                            graphic.MatWest.SetTexture(ShaderPropertyIDs.MaskTex, texture);
                        }
                        graphic.MatWest.SetColor(ShaderPropertyIDs.ColorTwo, colorTwo);

                        texture = ContentFinder <Texture2D> .Get(graphic.path + "_south" + msk, false);

                        if (texture != null)
                        {
                            graphic.MatSouth.SetTexture(ShaderPropertyIDs.MaskTex, texture);
                        }
                        graphic.MatSouth.SetColor(ShaderPropertyIDs.ColorTwo, colorTwo);

                        texture = ContentFinder <Texture2D> .Get(graphic.path + "_north" + msk, false);

                        if (texture != null)
                        {
                            graphic.MatNorth.SetTexture(ShaderPropertyIDs.MaskTex, texture);
                        }
                        graphic.MatNorth.SetColor(ShaderPropertyIDs.ColorTwo, colorTwo);
                    }
                }
            }
            //    Log.Message(this.Label + " " + graphic.path + " Shader: " + graphic.Shader.name + "Colour: " + graphic.Color + " Colour: " + graphic.ColorTwo);

            /*
             * if (!this.Drawer.apparel.def.apparel.wornGraphicPath.NullOrEmpty())
             * {
             *  SetApparelColours();
             * }
             */
            Graphic = graphic;
        }
コード例 #26
0
 public static void RenewalHeadGraphic(PawnGraphicSet pawnGraphicSet, string headPath, Shader shader, RaceAddonComp racomp, Color rottingColor)
 {
     pawnGraphicSet.headGraphic           = GraphicDatabase.Get <Graphic_Multi>(headPath, shader, Vector2.one, racomp.skinColor_Main, racomp.skinColor_Sub);
     pawnGraphicSet.desiccatedHeadGraphic = GraphicDatabase.Get <Graphic_Multi>(headPath, shader, Vector2.one, rottingColor);
 }
コード例 #27
0
 public static Graphic GetNakedGraphic(BodyType bodyType, Shader shader, Color skinColor, Color skinColorSecond, string userpath) => GraphicDatabase.Get <Graphic_Multi>(GetNakedPath(bodyType, userpath), shader, Vector2.one, skinColor, skinColorSecond);
コード例 #28
0
        public static void Postfix(Pawn pawn, ref Graphic __result)
        {
            if (pawn == null)
            {
                if (NudeSettings.debugMode)
                {
                    Log.Message("Pawn is null; patch stopped");
                }
            }
            else if (__result?.path == null)
            {
                if (NudeSettings.debugMode)
                {
                    Log.Message("Original graphic that's trying to be replaced doesn't exist!");
                }
            }
            else
            {
                string originalPath = __result.path;

                if (pawn.Dead)
                {
                    if (NudeSettings.debugMode)
                    {
                        Log.Message("Attempting to remove corpse genitals...");
                    }

                    if (pawn.Corpse != null && pawn.Corpse.CurRotDrawMode == RotDrawMode.Dessicated && ((originalPath.Length > 8 && originalPath.Contains("Genitals")) || (originalPath.Length > 7 && originalPath.Contains("Breasts"))))
                    {
                        __result = GraphicDatabase.Get <Graphic_Multi>("Genitals/FeaturelessCrotch", __result.Shader, __result.drawSize, __result.color, __result.colorTwo);
                    }
                    return;
                }
                else if (NudeSettings.pubicHair && originalPath.Length >= 5 && originalPath.Contains("Pubes"))
                {
                    __result = GraphicDatabase.Get <Graphic_Multi>("Genitals/Pubes/Shaved", __result.Shader, __result.drawSize, __result.color, __result.colorTwo);
                    return;
                }
                else if (originalPath.Length >= 9 && originalPath.Contains("penis"))
                {
                    string modifiedPath         = originalPath.Insert(9, "Flaccid/") + "_flaccid";
                    string modifiedPathNoNumber = originalPath.TrimEnd(NUMBERS).Length >= 9 ? originalPath.TrimEnd(NUMBERS).Insert(9, "Flaccid/") + "_flaccid" : "";

                    if (pawn.RaceHasSexNeed())
                    {
                        if (xxx.need_sex(pawn) > xxx.SexNeed.Frustrated && !(pawn.jobs.curDriver is JobDriver_Sex))
                        {
                            if (ContentFinder <Texture2D> .Get(modifiedPath + "_north", false) != null)
                            {
                                __result = GraphicDatabase.Get <Graphic_Multi>(modifiedPath, __result.Shader, __result.drawSize, __result.color, __result.colorTwo);
                                if (NudeSettings.debugMode)
                                {
                                    Log.Message("Modifying path " + originalPath + " with " + modifiedPath);
                                }
                                return;
                            }
                            else if (modifiedPathNoNumber != "" && ContentFinder <Texture2D> .Get(modifiedPathNoNumber + "_north", false) != null)
                            {
                                __result = GraphicDatabase.Get <Graphic_Multi>(modifiedPathNoNumber, __result.Shader, __result.drawSize, __result.color, __result.colorTwo);
                                if (NudeSettings.debugMode)
                                {
                                    Log.Message("Modifying path " + originalPath + " with " + modifiedPathNoNumber + " (with end numbers trimmed)");
                                }
                                return;
                            }
                            else
                            {
                                if (NudeSettings.debugMode)
                                {
                                    Log.Message("Could not find " + modifiedPath + " or " + modifiedPathNoNumber + " (with end numbers trimmed)");
                                    ContentFinder <Texture2D> .Get(modifiedPathNoNumber + "_north", true);
                                }
                            }
                        }
                        else
                        {
                            if (NudeSettings.debugMode)
                            {
                                Log.Message("Pawn is either: horny or has jobdriver sex");
                            }
                        }
                    }
                    else
                    {
                        if (NudeSettings.debugMode)
                        {
                            Log.Message("Pawn race does not have sexneed");
                        }
                    }
                }
                else
                {
                    if (NudeSettings.debugMode)
                    {
                        Log.Message(originalPath + " does not contain string \"penis\" or is shorter than a length of 9");
                    }
                }
            }
        }
コード例 #29
0
 public Graphic GetNakedGraphic(BodyType bodyType, Shader shader, Color skinColor, Color skinColorSecond, string userpath, string gender) => GraphicDatabase.Get <Graphic_Multi>(GetNakedPath(bodyType, userpath, (this.useGenderedBodies ? gender : "")), shader, Vector2.one, skinColor, skinColorSecond);
コード例 #30
0
        private void InitializeGraphicsHand()
        {
            if (!this.CompAni.Props.bipedWithHands)
            {
                return;
            }

            string texNameHand;
            Color  skinColor;

            if (this._pawn.story == null)
            {
                PawnKindLifeStage curKindLifeStage = this._pawn.ageTracker.CurKindLifeStage;

                skinColor   = curKindLifeStage.bodyGraphicData.color;
                texNameHand = "Paws/" + this.CompAni.Props.handType + STR_Hand;
            }
            else
            {
                skinColor   = this._pawn.story.SkinColor;
                texNameHand = StringsFS.PathHumanlike + "Hands/" + this.CompAni.Props.handType + STR_Hand;
            }

            Color rightColorHand = Color.cyan;
            Color leftColorHand  = Color.magenta;

            Color rightHandColor = skinColor;
            Color leftHandColor  = skinColor;

            Color metal = new Color(0.51f, 0.61f, 0.66f);

            switch (this.CompAni.BodyStat.HandRight)
            {
            case PartStatus.Artificial:
                rightHandColor = metal;
                break;
            }

            switch (this.CompAni.BodyStat.HandLeft)
            {
            case PartStatus.Artificial:
                leftHandColor = metal;
                break;
            }

            Color leftHandColorShadow  = leftHandColor * this._shadowColor;
            Color rightHandColorShadow = rightHandColor * this._shadowColor;

            this.HandGraphicRight = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameHand,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                rightHandColor,
                skinColor);

            this.HandGraphicLeft = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameHand,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                leftHandColor,
                skinColor);

            this.HandGraphicRightShadow = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameHand,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                rightHandColorShadow,
                skinColor);

            this.HandGraphicLeftShadow = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameHand,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                leftHandColorShadow,
                skinColor);

            // for development
            this.HandGraphicRightCol = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameHand,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                rightColorHand,
                skinColor);

            this.HandGraphicLeftCol = GraphicDatabase.Get <Graphic_Multi_Four>(
                texNameHand,
                ShaderDatabase.CutoutSkin,
                new Vector2(1f, 1f),
                leftColorHand,
                skinColor);
        }