using RichCreator.Utility.Maps; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RichCreator.Utility.Structs { public class HousePathInfoObj { public HousePathInfoObj() { this.NextGates = new List(); this.PathGuides = new List(); } public HousePathInfoObj(Int32 width, Int32 height) { this.Width = width; this.Height = height; } /// /// 宽 /// public int Width { get; set; } /// /// 高 /// public int Height { get; set; } /// /// 障碍物 /// public List Obstacles { get; set; } /// /// 定位点 /// public List LocationPoints { get; set; } /// /// 寻路点 /// public List FindPathPoints { get; set; } /// /// 巡逻点 /// public ZTPointObj LoopPoint { get; set; } /// /// 寻路线 /// public List FindPathLines { get; set; } /// /// 下一关进门点 /// 参数意义 0:上 1:右 2:下 3:左 /// public List NextGates { get; set; } /// /// 路径向导,把某一区域的点导向某一点 /// public List PathGuides { get; set; } public HousePathInfo To() { HousePathInfo info = new HousePathInfo(this.Width, this.Height); info.Obstacles = new List(); foreach (var item in this.Obstacles) { info.Obstacles.Add(item.To()); } info.LocationPoints = new List(); foreach (var item in this.LocationPoints) { info.LocationPoints.Add(item.To()); } info.FindPathPoints = new List(); foreach (var item in this.FindPathPoints) { info.FindPathPoints.Add(item.To()); } if (this.LoopPoint == null) { info.LoopPoint = ZTPoint.Empty; } else { info.LoopPoint = this.LoopPoint.To(); } info.FindPathLines = new List(); foreach (var item in this.FindPathLines) { info.FindPathLines.Add(item.To()); } info.NextGates = new List(); foreach (var item in this.NextGates) { info.NextGates.Add(item.To()); } info.PathGuides = new List(); foreach (var item in this.PathGuides) { info.PathGuides.Add(item.To()); } return info; } public static HousePathInfoObj From(HousePathInfo info) { HousePathInfoObj infoObj = new HousePathInfoObj(info.Width, info.Height); infoObj.Obstacles = new List(); foreach (var item in info.Obstacles) { infoObj.Obstacles.Add(ZTPolygonObj.From(item)); } infoObj.LocationPoints = new List(); foreach (var item in info.LocationPoints) { infoObj.LocationPoints.Add(ParametersPointObj.From(item)); } infoObj.FindPathPoints = new List(); foreach (var item in info.FindPathPoints) { infoObj.FindPathPoints.Add(ZTPointObj.From(item)); } infoObj.LoopPoint = ZTPointObj.From(info.LoopPoint); infoObj.FindPathLines = new List(); foreach (var item in info.FindPathLines) { infoObj.FindPathLines.Add(ZTLinePointObj.From(item)); } infoObj.NextGates = new List(); foreach (var item in info.NextGates) { infoObj.NextGates.Add(ParametersPointObj.From(item)); } infoObj.PathGuides = new List(); foreach (var item in info.PathGuides) { infoObj.PathGuides.Add(ZTTargetPolygonObj.From(item)); } return infoObj; } } }