public override void Init(GraphicRequest req) { base.data = req.graphicData; base.path = req.path; base.color = req.color; base.drawSize = req.drawSize; List <StuffAppearanceDef> allDefsListForReading = DefDatabase <StuffAppearanceDef> .AllDefsListForReading; this.subGraphics = new Graphic[allDefsListForReading.Count]; for (int i = 0; i < this.subGraphics.Length; i++) { StuffAppearanceDef stuffAppearance = allDefsListForReading[i]; string text = req.path; if (!stuffAppearance.pathPrefix.NullOrEmpty()) { text = stuffAppearance.pathPrefix + "/" + text.Split('/').Last(); } Texture2D texture2D = (from x in ContentFinder <Texture2D> .GetAllInFolder(text) where x.name.EndsWith(stuffAppearance.defName) select x).FirstOrDefault(); if ((Object)texture2D != (Object)null) { this.subGraphics[i] = GraphicDatabase.Get <Graphic_Single>(text + "/" + texture2D.name, req.shader, base.drawSize, base.color); } } for (int j = 0; j < this.subGraphics.Length; j++) { if (this.subGraphics[j] == null) { this.subGraphics[j] = this.subGraphics[StuffAppearanceDefOf.Smooth.index]; } } }
public override void Init(GraphicRequest req) { this.data = req.graphicData; if (req.path.NullOrEmpty()) { throw new ArgumentNullException("folderPath"); } if (req.shader == null) { throw new ArgumentNullException("shader"); } this.path = req.path; this.color = req.color; this.drawSize = req.drawSize; List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(req.path) 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 " + req.path); this.subGraphics = new Graphic[] { BaseContent.BadGraphic }; return; } this.subGraphics = new Graphic[list.Count]; for (int i = 0; i < list.Count; i++) { string path = req.path + "/" + list[i].name; this.subGraphics[i] = GraphicDatabase.Get <Graphic_Single>(path, req.shader, this.drawSize, this.color); } }
public override void Init(GraphicRequest req) { data = req.graphicData; if (req.path.NullOrEmpty()) { throw new ArgumentNullException("folderPath"); } if (req.shader == null) { throw new ArgumentNullException("shader"); } base.path = req.path; color = req.color; colorTwo = req.colorTwo; drawSize = req.drawSize; List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(req.path) where !x.name.EndsWith(Graphic_Single.MaskSuffix) orderby x.name select x).ToList(); if (list.NullOrEmpty()) { list = (from x in ContentFinder <Texture2D> .GetAllInFolder("World/Hills") orderby x.name select x).ToList(); //FlodeMoveTo.Instance.InFloder(req.path); //.Error("Collection cannot init: No textures found at path " + req.path); //Log.Message("Use Default Texure"); subGraphics = new Graphic[1] { BaseContent.BadGraphic }; return; } subGraphics = new Graphic[list.Count]; for (int i = 0; i < list.Count; i++) { string path = req.path + "/" + list[i].name; subGraphics[i] = GraphicDatabase.Get(typeof(Graphic_Single), path, req.shader, drawSize, color, colorTwo, null, req.shaderParameters); } }
public override void Init(GraphicRequest req) { data = req.graphicData; path = req.path; color = req.color; drawSize = req.drawSize; List <StuffAppearanceDef> allDefsListForReading = DefDatabase <StuffAppearanceDef> .AllDefsListForReading; subGraphics = new Graphic[allDefsListForReading.Count]; for (int i = 0; i < subGraphics.Length; i++) { StuffAppearanceDef stuffAppearance = allDefsListForReading[i]; string text = req.path; if (!stuffAppearance.pathPrefix.NullOrEmpty()) { text = stuffAppearance.pathPrefix + "/" + text.Split('/').Last(); } Texture2D texture2D = (from x in ContentFinder <Texture2D> .GetAllInFolder(text) where x.name.EndsWith(stuffAppearance.defName) select x).FirstOrDefault(); if (texture2D != null) { subGraphics[i] = GraphicDatabase.Get <Graphic_Single>(text + "/" + texture2D.name, req.shader, drawSize, color); } else { texture2D = Resources.Load <Texture2D>("Textures/World/MouseTile"); // Debug.Log(">>>>>>" + text + ">>>>>>" + stuffAppearance.defName); } } for (int j = 0; j < subGraphics.Length; j++) { if (subGraphics[j] == null) { subGraphics[j] = subGraphics[StuffAppearanceDefOf.Smooth.index]; } } }