示例#1
0
        public override void Init(AvaliGraphicRequest req)
        {
            this.data     = req.graphicData;
            this.path     = req.path;
            this.color    = req.color;
            this.drawSize = req.drawSize;
            List <StuffAppearanceDef> defsListForReading = DefDatabase <StuffAppearanceDef> .AllDefsListForReading;

            this.subGraphics = new AvaliGraphic[defsListForReading.Count];
            for (int index = 0; index < this.subGraphics.Length; ++index)
            {
                StuffAppearanceDef stuffAppearance = defsListForReading[index];
                string             folderPath      = req.path;
                if (!stuffAppearance.pathPrefix.NullOrEmpty())
                {
                    folderPath = stuffAppearance.pathPrefix + "/" + ((IEnumerable <string>)folderPath.Split('/')).Last <string>();
                }
                Texture2D texture2D = ContentFinder <Texture2D> .GetAllInFolder(folderPath).Where <Texture2D>((Func <Texture2D, bool>)(x => x.name.EndsWith(stuffAppearance.defName))).FirstOrDefault <Texture2D>();

                if ((UnityEngine.Object)texture2D != (UnityEngine.Object)null)
                {
                    this.subGraphics[index] = AvaliGraphicDatabase.Get <AvaliGraphic_Single>(folderPath + "/" + texture2D.name, req.shader, this.drawSize, this.color);
                }
            }
            for (int index = 0; index < this.subGraphics.Length; ++index)
            {
                if (this.subGraphics[index] == null)
                {
                    this.subGraphics[index] = this.subGraphics[(int)StuffAppearanceDefOf.Smooth.index];
                }
            }
        }
示例#2
0
 public static void Avali_SpecificHatPatch(
     ref Apparel apparel,
     ref BodyTypeDef bodyType,
     ref ApparelGraphicRecord rec)
 {
     if (bodyType != AvaliMod.AvaliDefs.Avali && bodyType != AvaliMod.AvaliDefs.Avali)
     {
         return;
     }
     if (apparel.def.apparel.LastLayer == ApparelLayerDefOf.Overhead)
     {
         string path = apparel.def.apparel.wornGraphicPath + "_" + bodyType.defName;
         if (!((Object)ContentFinder <Texture2D> .Get(path + "_north", false) == (Object)null) && !((Object)ContentFinder <Texture2D> .Get(path + "_east", false) == (Object)null) && !((Object)ContentFinder <Texture2D> .Get(path + "_south", false) == (Object)null))
         {
             AvaliGraphic graphic = AvaliGraphicDatabase.Get <AvaliGraphic_Multi>(path, AvaliShaderDatabase.Tricolor, apparel.def.graphicData.drawSize, apparel.DrawColor);
             rec = new ApparelGraphicRecord(graphic, apparel);
         }
     }
     else if (!apparel.def.apparel.wornGraphicPath.NullOrEmpty())
     {
         string str = apparel.def.apparel.wornGraphicPath + "_" + bodyType.defName;
         if ((Object)ContentFinder <Texture2D> .Get(str + "_north", false) == (Object)null || (Object)ContentFinder <Texture2D> .Get(str + "_east", false) == (Object)null || (Object)ContentFinder <Texture2D> .Get(str + "_south", false) == (Object)null)
         {
             AvaliGraphic graphic = AvaliGraphicDatabase.Get <AvaliGraphic_Multi>(apparel.def.apparel.wornGraphicPath, AvaliShaderDatabase.Tricolor, apparel.def.graphicData.drawSize, apparel.DrawColor);
             rec = new ApparelGraphicRecord(graphic, apparel);
         }
     }
 }
示例#3
0
        public override void Init(AvaliGraphicRequest req)
        {
            this.data = req.graphicData;
            if (req.path.NullOrEmpty())
            {
                throw new ArgumentNullException("folderPath");
            }
            if ((UnityEngine.Object)req.shader == (UnityEngine.Object)null)
            {
                throw new ArgumentNullException("shader");
            }
            this.path     = req.path;
            this.color    = req.color;
            this.colorTwo = req.colorTwo;
            this.drawSize = req.drawSize;
            List <Texture2D> list = ContentFinder <Texture2D> .GetAllInFolder(req.path).Where <Texture2D>((Func <Texture2D, bool>)(x => !x.name.EndsWith(Graphic_Single.MaskSuffix))).OrderBy <Texture2D, string>((Func <Texture2D, string>)(x => x.name)).ToList <Texture2D>();

            if (list.NullOrEmpty <Texture2D>())
            {
                Log.Error("Collection cannot init: No textures found at path " + req.path, false);
                this.subGraphics = new AvaliGraphic[1]
                {
                    AvaliBaseContent.BadGraphic
                };
            }
            else
            {
                this.subGraphics = new AvaliGraphic[list.Count];
                for (int index = 0; index < list.Count; ++index)
                {
                    string path = req.path + "/" + list[index].name;
                    this.subGraphics[index] = AvaliGraphicDatabase.Get(typeof(Graphic_Single), path, req.shader, this.drawSize, this.color, this.colorTwo, this.colorThree, (AvaliGraphicData)null, req.shaderParameters);
                }
            }
        }
示例#4
0
 public override AvaliGraphic GetColoredVersion(
     Shader newShader,
     Color newColor,
     Color newColorTwo,
     Color newColorThree)
 {
     //Log.Message("Imtryingtogetthis");
     return(AvaliGraphicDatabase.Get <AvaliGraphic_Multi>(this.path, newShader, this.drawSize, newColor, newColorTwo, newColorThree, this.data));
 }
示例#5
0
 public override AvaliGraphic GetColoredVersion(
     Shader newShader,
     Color newColor,
     Color newColorTwo,
     Color newColorThree)
 {
     Log.Message("actuallythisone");
     return(AvaliGraphicDatabase.Get <AvaliGraphic_Single>(this.path, newShader, this.drawSize, newColor, newColorTwo, Color.white, this.data));
 }
示例#6
0
 public override AvaliGraphic GetColoredVersion(
     Shader newShader,
     Color newColor,
     Color newColorTwo,
     Color newColorThree)
 {
     //Log.Message("ormaybhetisone");
     return(AvaliGraphicDatabase.Get <AvaliGraphic_StackCount>(this.path, newShader, this.drawSize, newColor, newColorTwo, newColorThree
                                                               , this.data));
 }
示例#7
0
 public virtual AvaliGraphic GetCopy(Vector2 newDrawSize)
 {
     return(AvaliGraphicDatabase.Get(this.GetType(),
                                     this.path,
                                     this.Shader,
                                     newDrawSize,
                                     this.color,
                                     this.colorTwo,
                                     this.colorThree));
 }
示例#8
0
 public static AvaliGraphic Get <T>(
     string path,
     Shader shader,
     Vector2 drawSize,
     Color color,
     Color colorTwo)
     where T : AvaliGraphic, new()
 {
     //Log.Message("Was Got3: " + shader.name + " Color3: ");
     return((AvaliGraphic)AvaliGraphicDatabase.GetInner <T>(new AvaliGraphicRequest(typeof(T), path, shader, drawSize, color, colorTwo, Color.white, (AvaliGraphicData)null, 0, (List <ShaderParameter>)null)));
 }
示例#9
0
 public static AvaliGraphic Get(
     System.Type graphicClass,
     string path,
     Shader shader,
     Vector2 drawSize,
     Color color,
     Color colorTwo,
     Color colorThree)
 {
     //Log.Message("Was Got1");
     return(AvaliGraphicDatabase.Get(graphicClass, path, shader, drawSize, color, colorTwo, colorThree, (AvaliGraphicData)null, (List <ShaderParameter>)null));
 }
示例#10
0
 public override AvaliGraphic GetColoredVersion(
     Shader newShader,
     Color newColor,
     Color newColorTwo,
     Color newColorThree)
 {
     //Log.Message("butalsothert");
     if (newColorTwo != Color.white)
     {
         Log.ErrorOnce("Cannot use Graphic_Random.GetColoredVersion with a non-white colorTwo.", 9910251, false);
     }
     return(AvaliGraphicDatabase.Get <AvaliGraphic_Random>(this.path, newShader, this.drawSize, newColor, Color.white, Color.white, this.data));
 }
示例#11
0
 public override AvaliGraphic GetColoredVersion(
     Shader newShader,
     Color newColor,
     Color newColorTwo,
     Color newColorThree)
 {
     Log.Message("treidmoasrasd");
     if (newColorTwo != Color.white)
     {
         Log.ErrorOnce("Cannot use Graphic_Appearances.GetColoredVersion with a non-white colorTwo.", 9910251, false);
     }
     return(AvaliGraphicDatabase.Get <AvaliGraphic_Appearances>(this.path, newShader, this.drawSize, newColor, Color.white, Color.white, this.data));
 }
示例#12
0
 public static AvaliGraphic Get <T>(
     string path,
     Shader shader,
     Vector2 drawSize,
     Color color,
     Color colorTwo,
     Color colorThree,
     AvaliGraphicData data)
     where T : AvaliGraphic, new()
 {
     //if (shader.name != "Custom/Cutout") { shadertest = shader; }
     //if (shader.name == "Custom/Cutout") { shader = shadertest; }
     //Log.Message("Was Got2: " + shader.name + " Color3: " + colorThree);
     return((AvaliGraphic)AvaliGraphicDatabase.GetInner <T>(new AvaliGraphicRequest(typeof(T), path, shader, drawSize, color, colorTwo, colorThree, data, 0, (List <ShaderParameter>)null)));
 }
示例#13
0
 private void Init()
 {
     if (this.graphicClass == (System.Type)null)
     {
         this.cachedGraphic = (AvaliGraphic)null;
     }
     else
     {
         this.cachedGraphic = AvaliGraphicDatabase.Get(this.graphicClass, this.texPath, (this.shaderType ?? ShaderTypeDefOf.Cutout).Shader, this.drawSize, this.color, this.colorTwo, this.colorThree, this, this.shaderParameters);
         if ((double)this.onGroundRandomRotateAngle > 0.00999999977648258)
         {
             this.cachedGraphic = (AvaliGraphic) new AvaliGraphic_RandomRotated(this.cachedGraphic, this.onGroundRandomRotateAngle);
         }
         if (!this.Linked)
         {
             return;
         }
         this.cachedGraphic = (AvaliGraphic)AvaliGraphicUtility.WrapLinked(this.cachedGraphic, this.linkType);
     }
 }
示例#14
0
        public static AvaliGraphic Get(
            System.Type graphicClass,
            string path,
            Shader shader,
            Vector2 drawSize,
            Color color,
            Color colorTwo,
            Color colorThree,
            AvaliGraphicData data,
            List <ShaderParameter> shaderParameters)
        {
            AvaliGraphicRequest req = new AvaliGraphicRequest(graphicClass, path, shader, drawSize, color, colorTwo, colorThree, data, 0, shaderParameters);

            // liQdComment 2 This is what the game requests
            if (req.graphicClass == typeof(Graphic_Multi))
            {
                //Log.Message("AvaliGraphic request of type Graphic_Multi");
                return((AvaliGraphic)AvaliGraphicDatabase.GetInner <AvaliGraphic_Multi>(req));
            }
            if (req.graphicClass == typeof(AvaliGraphic_Single))
            {
                return((AvaliGraphic)AvaliGraphicDatabase.GetInner <AvaliGraphic_Single>(req));
            }
            if (req.graphicClass == typeof(AvaliGraphic_Terrain))
            {
                return((AvaliGraphic)AvaliGraphicDatabase.GetInner <AvaliGraphic_Terrain>(req));
            }
            if (req.graphicClass == typeof(AvaliGraphic_Multi))
            {
                return((AvaliGraphic)AvaliGraphicDatabase.GetInner <AvaliGraphic_Multi>(req));
            }
            if (req.graphicClass == typeof(AvaliGraphic_Mote))
            {
                return((AvaliGraphic)AvaliGraphicDatabase.GetInner <AvaliGraphic_Mote>(req));
            }
            if (req.graphicClass == typeof(AvaliGraphic_Random))
            {
                return((AvaliGraphic)AvaliGraphicDatabase.GetInner <AvaliGraphic_Random>(req));
            }
            if (req.graphicClass == typeof(AvaliGraphic_Flicker))
            {
                return((AvaliGraphic)AvaliGraphicDatabase.GetInner <AvaliGraphic_Flicker>(req));
            }
            if (req.graphicClass == typeof(AvaliGraphic_Appearances))
            {
                return((AvaliGraphic)AvaliGraphicDatabase.GetInner <AvaliGraphic_Appearances>(req));
            }
            if (req.graphicClass == typeof(AvaliGraphic_StackCount))
            {
                return((AvaliGraphic)AvaliGraphicDatabase.GetInner <AvaliGraphic_StackCount>(req));
            }
            try
            {
                return((AvaliGraphic)GenGeneric.InvokeStaticGenericMethod(typeof(AvaliGraphicDatabase), req.graphicClass, "GetInner", (object)req));
            }
            catch (Exception ex)
            {
                Log.Error("Exception getting " + (object)graphicClass + " at " + path + ": " + ex.ToString(), false);
            }
            return(AvaliBaseContent.BadGraphic);
        }
示例#15
0
 public static AvaliGraphic Get <T>(string path) where T : AvaliGraphic, new()
 {
     //Log.Message("Was Got8");
     return((AvaliGraphic)AvaliGraphicDatabase.GetInner <T>(new AvaliGraphicRequest(typeof(T), path, ShaderDatabase.Cutout, Vector2.one, Color.white, Color.white, Color.white, (AvaliGraphicData)null, 0, (List <ShaderParameter>)null)));
 }