public static AvaliGraphic_Linked WrapLinked( AvaliGraphic subGraphic, LinkDrawerType linkDrawerType) { switch (linkDrawerType) { case LinkDrawerType.None: return((AvaliGraphic_Linked)null); case LinkDrawerType.Basic: return(new AvaliGraphic_Linked(subGraphic)); case LinkDrawerType.CornerFiller: return((AvaliGraphic_Linked) new AvaliGraphic_LinkedCornerFiller(subGraphic)); case LinkDrawerType.Transmitter: return((AvaliGraphic_Linked) new AvaliGraphic_LinkedTransmitter(subGraphic)); case LinkDrawerType.TransmitterOverlay: return((AvaliGraphic_Linked) new AvaliGraphic_LinkedTransmitterOverlay(subGraphic)); default: throw new ArgumentException(); } }
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); } } }
public override void DrawWorker( Vector3 loc, Rot4 rot, ThingDef thingDef, Thing thing, float extraRotation) { if (thingDef == null) { Log.ErrorOnce("Fire DrawWorker with null thingDef: " + (object)loc, 3427324, false); } else if (this.subGraphics == null) { Log.ErrorOnce("Graphic_Flicker has no subgraphics " + (object)thingDef, 358773632, false); } else { int ticksGame = Find.TickManager.TicksGame; if (thing != null) { ticksGame += Mathf.Abs(thing.thingIDNumber ^ 8453458); } int num1 = ticksGame / 15; int index = Mathf.Abs(num1 ^ (thing != null ? thing.thingIDNumber : 0) * 391) % this.subGraphics.Length; float num2 = 1f; CompProperties_FireOverlay propertiesFireOverlay = (CompProperties_FireOverlay)null; if (thing is Fire fire) { num2 = fire.fireSize; } else if (thingDef != null) { propertiesFireOverlay = thingDef.GetCompProperties <CompProperties_FireOverlay>(); if (propertiesFireOverlay != null) { num2 = propertiesFireOverlay.fireSize; } } if (index < 0 || index >= this.subGraphics.Length) { Log.ErrorOnce("Fire drawing out of range: " + (object)index, 7453435, false); index = 0; } AvaliGraphic subGraphic = this.subGraphics[index]; float num3 = Mathf.Min(num2 / 1.2f, 1.2f); Vector3 vector3 = GenRadial.RadialPattern[num1 % GenRadial.RadialPattern.Length].ToVector3() / GenRadial.MaxRadialPatternRadius * 0.05f; Vector3 pos = loc + vector3 * num2; if (propertiesFireOverlay != null) { pos += propertiesFireOverlay.offset; } Vector3 s = new Vector3(num3, 1f, num3); Matrix4x4 matrix = new Matrix4x4(); matrix.SetTRS(pos, Quaternion.identity, s); Graphics.DrawMesh(MeshPool.plane10, matrix, subGraphic.MatSingle, 0); } }
public static AvaliGraphic ExtractInnerGraphicFor(this AvaliGraphic outerGraphic, Thing thing) { switch (outerGraphic) { case AvaliGraphic_Random graphicRandom: return(graphicRandom.SubGraphicFor(thing)); case AvaliGraphic_Appearances graphicAppearances: return(graphicAppearances.SubGraphicFor(thing)); default: return(outerGraphic); } }
public virtual AvaliGraphic GetShadowlessGraphic() { if (this.data == null || this.data.shadowData == null) { return(this); } if (this.cachedShadowlessGraphicInt == null) { AvaliGraphicData graphicData = new AvaliGraphicData(); graphicData.CopyFrom(this.data); graphicData.shadowData = (ShadowData)null; this.cachedShadowlessGraphicInt = graphicData.Graphic; } return(this.cachedShadowlessGraphicInt); }
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); } }
public void CopyFrom(AvaliGraphicData other) { this.texPath = other.texPath; this.graphicClass = other.graphicClass; this.shaderType = other.shaderType; this.color = other.color; this.colorTwo = other.colorTwo; this.colorThree = other.colorThree; this.drawSize = other.drawSize; this.drawOffset = other.drawOffset; this.drawOffsetNorth = other.drawOffsetNorth; this.drawOffsetEast = other.drawOffsetEast; this.drawOffsetSouth = other.drawOffsetSouth; this.drawOffsetWest = other.drawOffsetSouth; this.onGroundRandomRotateAngle = other.onGroundRandomRotateAngle; this.drawRotated = other.drawRotated; this.allowFlip = other.allowFlip; this.flipExtraRotation = other.flipExtraRotation; this.shadowData = other.shadowData; this.damageData = other.damageData; this.linkType = other.linkType; this.linkFlags = other.linkFlags; this.cachedGraphic = (AvaliGraphic)null; }
public AvaliGraphic_Linked(AvaliGraphic subGraphic) { this.subGraphic = subGraphic; }
public AvaliGraphic_RandomRotated(AvaliGraphic subGraphic, float maxAngle) { this.subGraphic = subGraphic; this.maxAngle = maxAngle; this.drawSize = subGraphic.drawSize; }
public AvaliGraphic_LinkedTransmitterOverlay(AvaliGraphic subGraphic) : base(subGraphic) { }
public AvaliGraphic_LinkedCornerFiller(AvaliGraphic subGraphic) : base(subGraphic) { }