예제 #1
0
        public static bool TryGetGraphicApparel(Apparel apparel, BodyType bodyType, out ApparelGraphicRecord rec)
        {
            if (bodyType == BodyType.Undefined)
            {
                Log.Error("Getting apparel graphic with undefined body type.");
                bodyType = BodyType.Male;
            }
            if (apparel.def.apparel.wornGraphicPath.NullOrEmpty())
            {
                rec = new ApparelGraphicRecord(null, null);
                return(false);
            }
            string  path    = (apparel.def.apparel.LastLayer != ApparelLayer.Overhead) ? (apparel.def.apparel.wornGraphicPath + "_" + bodyType.ToString()) : apparel.def.apparel.wornGraphicPath;
            Graphic graphic = GraphicDatabase.Get <Graphic_Multi>(path, ShaderDatabase.Cutout, apparel.def.graphicData.drawSize, apparel.DrawColor);

            rec = new ApparelGraphicRecord(graphic, apparel);
            return(true);
        }
예제 #2
0
        public static bool TryGetGraphicApparel(Apparel apparel, BodyTypeDef bodyType, out ApparelGraphicRecord rec)
        {
            if (bodyType == null)
            {
                Log.Error("Getting apparel graphic with undefined body type.");
                bodyType = BodyTypeDefOf.Male;
            }
            if (apparel.def.apparel.wornGraphicPath.NullOrEmpty())
            {
                rec = new ApparelGraphicRecord(null, null);
                return(false);
            }
            string path   = (apparel.def.apparel.LastLayer != ApparelLayerDefOf.Overhead && !(apparel.def.apparel.wornGraphicPath == BaseContent.PlaceholderImagePath)) ? (apparel.def.apparel.wornGraphicPath + "_" + bodyType.defName) : apparel.def.apparel.wornGraphicPath;
            Shader shader = ShaderDatabase.Cutout;

            if (apparel.def.apparel.useWornGraphicMask)
            {
                shader = ShaderDatabase.CutoutComplex;
            }
            Graphic graphic = GraphicDatabase.Get <Graphic_Multi>(path, shader, apparel.def.graphicData.drawSize, apparel.DrawColor);

            rec = new ApparelGraphicRecord(graphic, apparel);
            return(true);
        }
예제 #3
0
        public static bool TryGetGraphicApparel(Apparel apparel, BodyTypeDef bodyType, out ApparelGraphicRecord rec)
        {
            if (bodyType == null)
            {
                Log.Error("Getting apparel graphic with undefined body type.", false);
                bodyType = BodyTypeDefOf.Male;
            }
            bool result;

            if (apparel.def.apparel.wornGraphicPath.NullOrEmpty())
            {
                rec    = new ApparelGraphicRecord(null, null);
                result = false;
            }
            else
            {
                string path;
                if (apparel.def.apparel.LastLayer == ApparelLayerDefOf.Overhead)
                {
                    path = apparel.def.apparel.wornGraphicPath;
                }
                else
                {
                    path = apparel.def.apparel.wornGraphicPath + "_" + bodyType.defName;
                }
                Graphic graphic = GraphicDatabase.Get <Graphic_Multi>(path, ShaderDatabase.Cutout, apparel.def.graphicData.drawSize, apparel.DrawColor);
                rec    = new ApparelGraphicRecord(graphic, apparel);
                result = true;
            }
            return(result);
        }