public static CharacterSet Load(MapSet mapSet, XElement mapElemept) { CharacterSet result = new CharacterSet(mapElemept.Attribute("uid")?.Value, mapElemept.Attribute("keep") != null); result.LoadData(PathHelper.GetExactPath(mapSet.Path, mapElemept.Attribute("path")?.Value)); return(result); }
public static CharacterSet CreateFromFileName(String fontFileName) { CharacterSet result = new CharacterSet(); result.LoadData(PathHelper.GetExactPath(fontFileName)); return(result); }
public static Map Load(MapSet mapSet, String path, String mapFileName, CharacterSet characterSet) { Map map = Map.CreateNewMap(mapSet, characterSet); map.Path = PathHelper.GetExactPath(path, mapFileName); map.MapData = map.UseRleCompression() ? DecodeRLE(File.ReadAllBytes(map.Path)) : DecodeLZ4(map.Path); map.SetLoaded(); return(map); }
public static Map Load(MapSet mapSet, XElement mapElemept) { Map map = CreateNewMap(mapSet, mapSet.GetFont(GuidHelper.parse(mapElemept.Attribute("font")?.Value)), mapElemept.Attribute("uid")?.Value); map.Name = mapElemept.Attribute("name").Value; map.Path = PathHelper.GetExactPath(mapSet.Path, mapElemept.Attribute("path").Value); map.MapData = map.UseRleCompression() ? DecodeRLE(File.ReadAllBytes(map.Path)) : DecodeLZ4(map.Path); XElement dlis = mapElemept.Element("dlis"); List <DLI> DLIList = new List <DLI>(); foreach (XElement xdli in dlis.Elements("dli")) { DLI dli = DLI.Load(map, xdli); DLIList.Add(dli); } map.DLIS = DLIList.ToArray(); ImportTextFile(mapElemept, "InitRoutinePath", mapSet.Path, (Path, Content) => { map.InitRoutinePath = Path; map.InitRoutine = Content; }); ImportTextFile(mapElemept, "ExecRoutinePath", mapSet.Path, (Path, Content) => { map.ExecRoutinePath = Path; map.ExecRoutine = Content; }); ImportTextFile(mapElemept, "TileCollisionRoutinePath", mapSet.Path, (Path, Content) => { map.TileCollisionRoutinePath = Path; map.TileCollisionRoutine = Content; }); ImportBoolean(mapElemept, "foe", value => map.Foe = value); ImportByte(mapElemept, "YamoSpawnPosition", value => map.YamoSpawnPosition = value); ImportByte(mapElemept, "NinjaSpawnPosition", value => map.NinjaSpawnPosition = value); ImportByte(mapElemept, "NinjaEnterCount1", value => map.NinjaEnterCount1 = value); ImportByte(mapElemept, "NinjaEnterCount2", value => map.NinjaEnterCount2 = value); ImportByte(mapElemept, "YamoEnterCount1", value => map.YamoEnterCount1 = value); ImportByte(mapElemept, "YamoEnterCount2", value => map.YamoEnterCount2 = value); ImportColorDetection(mapElemept, "Colpf0Dectection", ref map.Colpf0Detection, ref map.Colpf0DetectionRects, ref map.Colpf0DetectionFlags); ImportColorDetection(mapElemept, "Colpf2Dectection", ref map.Colpf2Detection, ref map.Colpf2DetectionRects, ref map.Colpf2DetectionFlags); ImportColorDetection(mapElemept, "Colpf3Dectection", ref map.Colpf3Detection, ref map.Colpf3DetectionRects, ref map.Colpf3DetectionFlags); if (mapElemept.Elements("brucestart").Any()) { XElement brucestart = mapElemept.Element("brucestart"); map.BruceStartX1 = Convert.ToByte(brucestart.Element("x1").Value); map.BruceStartY1 = Convert.ToByte(brucestart.Element("y1").Value); map.BruceStartX2 = Convert.ToByte(brucestart.Element("x2").Value); map.BruceStartY2 = Convert.ToByte(brucestart.Element("y2").Value); } if (mapElemept.Elements("exit1").Any()) { XElement exit = mapElemept.Element("exit1"); map.Exit1MapID = GuidHelper.parse(exit.Element("map").Value); map.Exit1X = Convert.ToByte(exit.Element("x").Value); map.Exit1Y = Convert.ToByte(exit.Element("y").Value); } if (mapElemept.Elements("exit2").Any()) { XElement exit = mapElemept.Element("exit2"); map.Exit2MapID = GuidHelper.parse(exit.Element("map").Value); map.Exit2X = Convert.ToByte(exit.Element("x").Value); map.Exit2Y = Convert.ToByte(exit.Element("y").Value); } if (mapElemept.Elements("exit3").Any()) { XElement exit = mapElemept.Element("exit3"); map.Exit3MapID = GuidHelper.parse(exit.Element("map").Value); map.Exit3X = Convert.ToByte(exit.Element("x").Value); map.Exit3Y = Convert.ToByte(exit.Element("y").Value); } if (mapElemept.Elements("exit4").Any()) { XElement exit = mapElemept.Element("exit4"); map.Exit4MapID = GuidHelper.parse(exit.Element("map").Value); map.Exit4X = Convert.ToByte(exit.Element("x").Value); map.Exit4Y = Convert.ToByte(exit.Element("y").Value); } map.SetLoaded(); return(map); }
private CharacterSet findExistingCharsetByFileName(string fontFileName) { string exactFontPath = PathHelper.GetExactPath(Path, fontFileName); return(CharSets.FirstOrDefault(set => set.Path.Equals(exactFontPath, StringComparison.OrdinalIgnoreCase))); }