public override void Init(GraphicRequest req) { // Move all Init to ExtraInit var extraData = GraphicExtraData.Extract(req, out GraphicRequest newReq); ExtraInit(newReq, extraData); }
public override void Init(GraphicRequest req) { GraphicRequest newReq; var extraData = GraphicExtraData.Extract(req, out newReq); ExtraInit(newReq, extraData); }
public override void ExtraInit(GraphicRequest req, GraphicExtraData extraData) { base.ExtraInit(req, extraData); if (extraData == null) { Log.Error("PRF's Wall Conveyor graphic requires GraphicExtraData"); } else { transitionWest = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = extraData.texPath2 + "_West", drawSize = Vector2.one }; transitionSouth = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = extraData.texPath2 + "_South", drawSize = Vector2.one }; transitionEast = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = extraData.texPath2 + "_East", drawSize = Vector2.one }; sameLinkDefs = extraData.specialLinkDefs; } }
public override void Init(GraphicRequest req) { // I'm sure "req ... out req" is perfectly safe? var extraData = GraphicExtraData.Extract(req, out req); ExtraInit(req, extraData); }
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))); } }
public override void ExtraInit(GraphicRequest req, GraphicExtraData extraData) { base.ExtraInit(req, extraData); if (extraData == null) { Log.Error("PRF: invalid XML for conveyor Splitter's graphic:\n" + " it must have <texPath>[extraData]...[texPath2]path/to/building[/texPath2]</texPath>\n" + " but has string: " + req.path); return; } string doorBasePath = extraData.texPath2; splitterBuildingDoorOpen = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = doorBasePath + "_Open", drawSize = Vector2.one }; splitterBuildingDoorClosed = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = doorBasePath + "_Closed", drawSize = Vector2.one }; splitterBuildingBlueprint = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = doorBasePath + "_Blueprint", drawSize = Vector2.one }; }
public override void Init(GraphicRequest req) { // I'm sure "req ... out req" is perfectly safe? // Move all initialization to ExtraInit var extraData = GraphicExtraData.Extract(req, out req); ExtraInit(req, extraData); }
public virtual void ExtraInit(GraphicRequest req, GraphicExtraData extraData) { // All basically pointless: this.data = req.graphicData; this.color = req.color; this.colorTwo = req.colorTwo; this.drawSize = req.drawSize; this.path = extraData?.texPath ?? req.path; // What we want is two duplicate graphics with slightly different paths EW = MakeSubgraphic(req, extraData, "_East"); NS = MakeSubgraphic(req, extraData, "_North"); }
protected Graphic MakeSubgraphic(GraphicRequest req, GraphicExtraData extraData, string texSuffix) { var childReq = GraphicExtraData.CopyGraphicRequest(req); childReq.graphicClass = typeof(T); var tmpG = new T(); if (tmpG is IHaveGraphicExtraData ihged && extraData != null) { var tmpPath = extraData.texPath; extraData.texPath += texSuffix; ihged.ExtraInit(childReq, extraData); extraData.texPath = tmpPath; }
public virtual void ExtraInit(GraphicRequest req, GraphicExtraData extraData) { arrow = arrow00; this.data = req.graphicData; this.color = req.color; this.colorTwo = req.colorTwo; this.drawSize = req.drawSize; this.subGraphic = new Graphic_Single(); if (extraData == null) { this.subGraphic.Init(req); this.path = req.path; return; } var req2 = GraphicExtraData.CopyGraphicRequest(req, extraData.texPath); this.path = extraData.texPath; this.subGraphic.Init(req2); if (extraData.arrowDrawOffset != null) { var v = extraData.arrowDrawOffset.Value; for (int i = 0; i < 4; i++) { arrowOffsetsByRot4[i] = new Vector3(v.x, v.y, v.z); } } if (extraData.arrowEastDrawOffset != null) { arrowOffsetsByRot4[1] = extraData.arrowEastDrawOffset.Value; } if (extraData.arrowWestDrawOffset != null) { arrowOffsetsByRot4[3] = extraData.arrowWestDrawOffset.Value; } if (extraData.arrowNorthDrawOffset != null) { arrowOffsetsByRot4[0] = extraData.arrowNorthDrawOffset.Value; } if (extraData.arrowSouthDrawOffset != null) { arrowOffsetsByRot4[2] = extraData.arrowSouthDrawOffset.Value; } if (extraData.arrowTexPath1 != null) { this.arrow = MaterialPool.MatFrom(extraData.arrowTexPath1); } }