Exemplo n.º 1
0
 public override void ExtraInit(GraphicRequest req, GraphicExtraData extraData)
 {
     Debug.Warning(Debug.Flag.ConveyorGraphics, "Graphics ExtraInit for Graphic_LinkedConveyorWall: (" + req.graphicData.texPath + ")");
     base.ExtraInit(req, extraData);
     if (extraData == null)
     {
         Log.Error("PRF's Wall Conveyor graphic requires GraphicExtraData");
     }
     else if (extraData.graphicData1 == null)
     {
         Log.Error("PRF's Wall Conveyor grahpic requires GraphicExtraData's graphicData1");
     }
     else
     {
         transitionGData = new GraphicData();
         transitionGData.CopyFrom(extraData.graphicData1);
         // If this throws errors, that's okay - it's a config error that needs to be fixed:
         // NOTE: this can be changed later if the graphics needs to allow multilpe defs,
         //   not all of which may be actually listed...
         sameLinkDefs = new List <ThingDef>(extraData.specialLinkDefs.Select(
                                                s => DefDatabase <ThingDef> .GetNamed(s)));
         Debug.Message(Debug.Flag.ConveyorGraphics, "  added sameLinkDefs: " +
                       (sameLinkDefs == null ? "null" : String.Join(", ", sameLinkDefs)));
     }
 }
Exemplo n.º 2
0
        public StatDef ResistHediffStat = null;  //The default chance of adding a hediff.

        void CreateGraphics()
        {
            if (this.graphicData.graphicClass == typeof(Graphic_Random) || this.graphicData.graphicClass == typeof(Graphic_Flicker))
            {
                for (int i = 0; i < textures.Count; i++)
                {
                    List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(textures[i])
                                             where !x.name.EndsWith(Graphic_Single.MaskSuffix)
                                             orderby x.name
                                             select x).ToList <Texture2D>();
                    if (list.NullOrEmpty <Texture2D>())
                    {
                        Log.Error("Collection cannot init: No textures found at path " + textures[i], false);
                    }
                    for (int ii = 0; ii < list.Count; ii++)
                    {
                        GraphicData data = new GraphicData();
                        data.CopyFrom(this.graphicData);
                        data.texPath = textures[i];
                        materials.Add(data.Graphic.MatSingle);
                        //    materials.Add(MaterialPool.MatFrom(textures[i] + "/" + list[ii].name, this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam));
                    }
                }
            }
            else
            {
                for (int i = 0; i < textures.Count; i++)
                {
                    GraphicData data = new GraphicData();
                    data.CopyFrom(this.graphicData);
                    data.texPath = textures[i];
                    materials.Add(data.Graphic.MatSingle);
                    // materials.Add(MaterialPool.MatFrom(textures[i], this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam));
                }
            }
            if (flareData != null)
            {
                GraphicData data = new GraphicData();
                data.CopyFrom(this.flareData);
                flareMat = data.Graphic.MatSingle;
                //    flareMat = MaterialPool.MatFrom(flareMatPath, this.flareShaderType?.Shader ?? this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam);
            }
            else
            if (!flareMatPath.NullOrEmpty())
            {
                GraphicData data = new GraphicData();
                data.CopyFrom(this.graphicData);
                data.graphicClass = typeof(Graphic_Single);
                data.texPath      = flareMatPath;
                data.shaderType   = this.flareShaderType ?? this.graphicData.shaderType;
                flareMat          = data.Graphic.MatSingle;
                //    flareMat = MaterialPool.MatFrom(flareMatPath, this.flareShaderType?.Shader ?? this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam);
            }
        }
Exemplo n.º 3
0
        // Token: 0x06000036 RID: 54 RVA: 0x000031C4 File Offset: 0x000013C4
        public Graphic GetColoredVersion(ShaderTypeDef newShaderType, Color newColor, Color newColorTwo,
                                         ShadowData newShadowData)
        {
            var graphicData = new GraphicData();

            graphicData.CopyFrom(data);
            graphicData.shaderType = newShaderType;
            graphicData.color      = newColor;
            graphicData.colorTwo   = newColorTwo;
            graphicData.shadowData = newShadowData;
            return(graphicData.Graphic);
        }
Exemplo n.º 4
0
        public static GraphicData FogBlueprintGraphicFor(GraphicData baseGraphicData)
        {
            int         hashKey = Gen.HashCombine <GraphicData>(0, baseGraphicData);
            GraphicData graphicData;

            if (!fogGraphics.TryGetValue(hashKey, out graphicData))
            {
                graphicData = new GraphicData();
                graphicData.CopyFrom(baseGraphicData);
                graphicData.shaderType = ShaderTypeDefOf.MetaOverlay;
                fogGraphics.Add(hashKey, graphicData);
            }
            return(graphicData);
        }
Exemplo n.º 5
0
        //no idea if this is necessary, but *it works*
        //  - "it works" is a general theme here
        public static GraphicRequest CopyGraphicRequest(GraphicRequest req, string newTexPath = null)
        {
            GraphicData gData = new GraphicData();

            gData.CopyFrom(req.graphicData);
            var gr = new GraphicRequest(gData.graphicClass, gData.texPath, req.shader,
                                        req.drawSize, req.color, req.colorTwo, gData, req.renderQueue,
                                        req.shaderParameters);

            if (newTexPath != null)
            {
                gr.path = newTexPath;
                gr.graphicData.texPath = newTexPath;
            }
            return(gr);
        }
Exemplo n.º 6
0
        public static Graphic GhostGraphicFor(this VehicleDef vehicleDef, VehicleTurret cannon, Color ghostColor)
        {
            int num = 0;

            num = Gen.HashCombine(num, vehicleDef);
            num = Gen.HashCombine(num, cannon);
            num = Gen.HashCombineStruct(num, ghostColor);
            if (!cachedGhostGraphics.TryGetValue(num, out Graphic graphic))
            {
                cannon.ResolveCannonGraphics(vehicleDef, true);
                graphic = cannon.CannonGraphic;

                GraphicData graphicData = new GraphicData();
                AccessTools.Method(typeof(GraphicData), "Init").Invoke(graphicData, new object[] { });
                graphicData.CopyFrom(graphic.data);
                graphicData.shadowData = null;

                graphic = GraphicDatabase.Get(graphic.GetType(), graphic.path, ShaderTypeDefOf.EdgeDetect.Shader, graphic.drawSize, ghostColor, Color.white, graphicData, null);

                cachedGhostGraphics.Add(num, graphic);
            }
            return(graphic);
        }
 //public void CopyFrom(GraphicData other)
 public static void CopyFromRenderHigh(GraphicData instance, GraphicData other)
 {
     instance.CopyFrom(other);
     instance.renderQueue = queueOverFog;
 }