using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Threading.Tasks; namespace FirstPlugin.Turbo.CourseMuuntStructs { public class LapPathGroup : IObject { public const string N_LapPathGroup = "LapPathGroup"; public const string N_ReturnPointsError = "ReturnPointsError"; public const string N_UnitIdNum = "UnitIdNum"; public List PathPoints = new List(); public List ReturnPoints = new List(); public LapPathGroup(dynamic bymlNode) { if (bymlNode is Dictionary) Prop = (Dictionary)bymlNode; else throw new Exception("Not a dictionary"); foreach (var point in this["PathPt"]) { PathPoints.Add(new LapPathPoint(point)); } foreach (var point in this["ReturnPoints"]) { ReturnPoints.Add(new ReturnPoint(point)); } } [Browsable(false)] public Dictionary Prop { get; set; } = new Dictionary(); public int LapPathGroupId { get { return this[N_LapPathGroup]; } set { this[N_LapPathGroup] = value; } } public int ReturnPointsError { get { return this[N_ReturnPointsError]; } set { this[N_ReturnPointsError] = value; } } public int UnitIdNum { get { return this[N_UnitIdNum]; } set { this[N_UnitIdNum] = value; } } public dynamic this[string name] { get { if (Prop.ContainsKey(name)) return Prop[name]; else return null; } set { if (Prop.ContainsKey(name)) Prop[name] = value; else Prop.Add(name, value); } } } public class LapPathPoint : PathPoint { [Category("Properties")] public int CheckPoint { get { return this["CheckPoint"]; } set { this["CheckPoint"] = value; } } [Category("Properties")] public int ClipIdx { get { return this["ClipIdx"]; } set { this["ClipIdx"] = value; } } [Category("Properties")] public bool HeadLightSW { get { return this["HeadLightSW"]; } set { this["HeadLightSW"] = value; } } [Category("Properties")] public int LapCheck { get { return this["LapCheck"]; } set { this["LapCheck"] = value; } } [Category("Properties")] public int MapCameraFovy { get { return this["MapCameraFovy"]; } set { this["MapCameraFovy"] = value; } } [Category("Properties")] public int MapCameraY { get { return this["MapCameraY"]; } set { this["MapCameraY"] = value; } } public LapPathPoint(dynamic bymlNode) { if (bymlNode is Dictionary) Prop = (Dictionary)bymlNode; else throw new Exception("Not a dictionary"); foreach (var point in this["NextPt"]) { NextPoints.Add(new PointID(point)); } foreach (var point in this["PrevPt"]) { PrevPoints.Add(new PointID(point)); } } } }