/// <summary> /// Allows references between course objects to be serialized into raw values stored in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public virtual void SerializeReferences(CourseDefinition courseDefinition) { // Solve the previous and next point references. IList <TPath> paths = GetPathReferenceList(courseDefinition); if (PreviousPoints == null) { PreviousPointIndices = null; } else { PreviousPointIndices = new List <PathPointReference>(); foreach (TPoint previousPoint in PreviousPoints) { int pathIndex = paths.IndexOf(previousPoint.Path); int pointIndex = previousPoint.Index; PreviousPointIndices.Add(new PathPointReference(pathIndex, pointIndex)); } } if (NextPoints == null) { NextPointIndices = null; } else { NextPointIndices = new List <PathPointReference>(); foreach (TPoint nextPoint in NextPoints) { int pathIndex = paths.IndexOf(nextPoint.Path); int pointIndex = nextPoint.Index; NextPointIndices.Add(new PathPointReference(pathIndex, pointIndex)); } } }
// ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- /// <summary> /// Allows references of course data objects to be resolved to provide real instances instead of the raw values /// in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public virtual void DeserializeReferences(CourseDefinition courseDefinition) { // Solve the previous and next point references. IList <TPath> paths = GetPathReferenceList(courseDefinition); if (PreviousPointIndices != null) { PreviousPoints = new List <TPoint>(); foreach (PathPointReference index in PreviousPointIndices) { TPath referencedPath = paths[index.PathIndex]; PreviousPoints.Add(referencedPath.Points[index.PointIndex]); } } if (NextPointIndices != null) { NextPoints = new List <TPoint>(); foreach (PathPointReference index in NextPointIndices) { TPath referencedPath = paths[index.PathIndex]; NextPoints.Add(referencedPath.Points[index.PointIndex]); } } }
/// <summary> /// Allows references between course objects to be serialized into raw values stored in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public virtual void SerializeReferences(CourseDefinition courseDefinition) { // Resolve the linked point list. foreach (TPoint point in Points) { point.SerializeReferences(courseDefinition); } }
// ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- /// <summary> /// Allows references of course data objects to be resolved to provide real instances instead of the raw values /// in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public virtual void DeserializeReferences(CourseDefinition courseDefinition) { // Resolve the linked point list and set the path as the parent. Debug.WriteLine(this); TPath thisTPath = (TPath)this; foreach (TPoint point in Points) { point.PathInternal = thisTPath; point.DeserializeReferences(courseDefinition); } }
// ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- /// <summary> /// Allows references of course data objects to be resolved to provide real instances instead of the raw values /// in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public override void DeserializeReferences(CourseDefinition courseDefinition) { // Solve the point references. base.DeserializeReferences(courseDefinition); // Solve the GCamera path references. if (_gCameraPathIndices != null) { GCameraPaths = new List <GCameraPath>(); foreach (int index in _gCameraPathIndices) { GCameraPaths.Add(courseDefinition.GCameraPaths[index]); } } }
/// <summary> /// Allows references between course objects to be serialized into raw values stored in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public override void SerializeReferences(CourseDefinition courseDefinition) { // Solve the point references. base.SerializeReferences(courseDefinition); // Solve the GCamera path references. if (GCameraPaths != null) { _gCameraPathIndices = new List <int>(); foreach (GCameraPath path in GCameraPaths) { _gCameraPathIndices.Add(courseDefinition.GCameraPaths.IndexOf(path)); } } }
/// <summary> /// Allows references between course objects to be serialized into raw values stored in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public override void SerializeReferences(CourseDefinition courseDefinition) { base.SerializeReferences(courseDefinition); // Gravity paths. if (GravityPaths == null) { _gravityPathIndices = null; } else { _gravityPathIndices = new List <int>(); foreach (GravityPath path in GravityPaths) { _gravityPathIndices.Add(courseDefinition.GravityPaths.IndexOf(path)); } } }
// ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- /// <summary> /// Allows references of course data objects to be resolved to provide real instances instead of the raw values /// in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public override void DeserializeReferences(CourseDefinition courseDefinition) { base.DeserializeReferences(courseDefinition); // Gravity paths. if (_gravityPathIndices == null) { GravityPaths = null; } else { GravityPaths = new List <GravityPath>(); foreach (int index in _gravityPathIndices) { GravityPaths.Add(courseDefinition.GravityPaths[index]); } } }
/// <summary> /// Allows references between course objects to be serialized into raw values stored in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public void SerializeReferences(CourseDefinition courseDefinition) { // References to paths and their points. _pathIndex = Path == null ? null : (int?)courseDefinition.Paths.IndexOf(Path); _pathPointIndex = PathPoint?.Index; _lapPathIndex = LapPath == null ? null : (int?)courseDefinition.LapPaths.IndexOf(LapPath); _lapPathPointIndex = LapPathPoint?.Index; _objPathIndex = ObjPath == null ? null : (int?)courseDefinition.ObjPaths.IndexOf(ObjPath); _objPathPointIndex = ObjPathPoint?.Index; _enemyPath1Index = EnemyPath1 == null ? null : (int?)courseDefinition.EnemyPaths.IndexOf(EnemyPath1); _enemyPath2Index = EnemyPath2 == null ? null : (int?)courseDefinition.EnemyPaths.IndexOf(EnemyPath2); _itemPath1Index = ItemPath1 == null ? null : (int?)courseDefinition.ItemPaths.IndexOf(ItemPath1); _itemPath2Index = ItemPath2 == null ? null : (int?)courseDefinition.ItemPaths.IndexOf(ItemPath2); // References to other unit objects. _areaIndex = ParentArea == null ? null : (int?)courseDefinition.Areas.IndexOf(ParentArea); _objIndex = ParentObj == null ? null : (int?)courseDefinition.Objs.IndexOf(ParentObj); }
/// <summary> /// Allows references of course data objects to be resolved to provide real instances instead of the raw values /// in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public void DeserializeReferences(CourseDefinition courseDefinition) { // References to paths and their points. Path = _pathIndex == null ? null : courseDefinition.Paths[_pathIndex.Value]; PathPoint = _pathPointIndex == null ? null : Path.Points[_pathPointIndex.Value]; LapPath = _lapPathIndex == null ? null : courseDefinition.LapPaths[_lapPathIndex.Value]; LapPathPoint = _lapPathPointIndex == null ? null : LapPath.Points[_lapPathPointIndex.Value]; ObjPath = _objPathIndex == null ? null : courseDefinition.ObjPaths[_objPathIndex.Value]; ObjPathPoint = _objPathPointIndex == null ? null : ObjPath.Points[_objPathPointIndex.Value]; EnemyPath1 = _enemyPath1Index == null ? null : courseDefinition.EnemyPaths[_enemyPath1Index.Value]; EnemyPath2 = _enemyPath2Index == null ? null : courseDefinition.EnemyPaths[_enemyPath2Index.Value]; ItemPath1 = _itemPath1Index == null ? null : courseDefinition.ItemPaths[_itemPath1Index.Value]; ItemPath2 = _itemPath2Index == null ? null : courseDefinition.ItemPaths[_itemPath2Index.Value]; // References to other unit objects. ParentArea = _areaIndex == null ? null : courseDefinition.Areas[_areaIndex.Value]; ParentObj = _objIndex == null ? null : courseDefinition.Objs[_objIndex.Value]; }
/// <summary> /// Allows references between course objects to be serialized into raw values stored in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public override void SerializeReferences(CourseDefinition courseDefinition) { base.SerializeReferences(courseDefinition); // TODO: Find out what ClipIndex references exactly and resolve the reference. }
/// <summary> /// Allows references between course objects to be serialized into raw values stored in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public void SerializeReferences(CourseDefinition courseDefinition) { _pathIndex = courseDefinition.Paths.IndexOf(Path); }
// ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- /// <summary> /// Allows references of course file objects to be resolved to provide real instances instead of the raw values /// in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public void DeserializeReferences(CourseDefinition courseDefinition) { Path = courseDefinition.Paths[_pathIndex]; }
// ---- METHODS (PROTECTED) ------------------------------------------------------------------------------------ /// <summary> /// Returns the array of paths in the <see cref="CourseDefinition"/> which can be referenced by previous and /// next points. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> to get the paths from.</param> /// <returns>The array of paths which can be referenced.</returns> protected override IList <JugemPath> GetPathReferenceList(CourseDefinition courseDefinition) { return(courseDefinition.JugemPaths); }
/// <summary> /// Allows references between course objects to be serialized into raw values stored in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public void SerializeReferences(CourseDefinition courseDefinition) { // TODO: Since JugemPath is just a string here, no clue what is meant with the path and point members. //_jugemPathIndex = courseDefinition.JugemPaths.IndexOf(JugemPathPoint.Path); //_jugemPathPointIndex = JugemPathPoint.Index; }
// ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- /// <summary> /// Allows references between BYAML instances to be resolved to provide real instances /// instead of the raw values in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public void DeserializeReferences(CourseDefinition courseDefinition) { Path = _pathIndex == null ? null : courseDefinition.Paths[_pathIndex.Value]; PullPath = _pullPathIndex == null ? null : courseDefinition.PullPaths[_pullPathIndex.Value]; }
// ---- METHODS (PROTECTED) ------------------------------------------------------------------------------------ /// <summary> /// Returns the array of paths in the <see cref="CourseDefinition"/> which can be referenced by previous and /// next points. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> to get the paths from.</param> /// <returns>The array of paths which can be referenced.</returns> protected abstract IList <TPath> GetPathReferenceList(CourseDefinition courseDefinition);
/// <summary> /// Allows references of course data objects to be resolved to provide real instances instead of the raw values /// in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public void DeserializeReferences(CourseDefinition courseDefinition) { // TODO: Since JugemPath is just a string here, no clue what is meant with the path and point members. //JugemPath jugemPath = courseDefinition.JugemPaths[_jugemPathIndex]; //JugemPathPoint = jugemPath.Points[_jugemPathPointIndex]; }
// ---- METHODS (PROTECTED) ------------------------------------------------------------------------------------ /// <summary> /// Returns the array of paths in the <see cref="CourseDefinition"/> which can be referenced by previous and /// next points. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> to get the paths from.</param> /// <returns>The array of paths which can be referenced.</returns> protected override IList <GravityPath> GetPathReferenceList(CourseDefinition courseDefinition) { return(courseDefinition.GravityPaths); }
// ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- /// <summary> /// Allows references of course data objects to be resolved to provide real instances instead of the raw values /// in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public void DeserializeReferences(CourseDefinition courseDefinition) { JugemPath jugemPath = courseDefinition.JugemPaths[_jugemPathIndex]; JugemPathPoint = jugemPath.Points[_jugemPathPointIndex]; }
/// <summary> /// Allows references between BYAML instances to be serialized into raw values stored in the /// BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public void SerializeReferences(CourseDefinition courseDefinition) { _pathIndex = Path == null ? null : (int?)courseDefinition.Paths.IndexOf(Path); _pullPathIndex = PullPath == null ? null : (int?)courseDefinition.PullPaths.IndexOf(PullPath); }
/// <summary> /// Allows references between course objects to be serialized into raw values stored in the BYAML. /// </summary> /// <param name="courseDefinition">The <see cref="CourseDefinition"/> providing the objects.</param> public void SerializeReferences(CourseDefinition courseDefinition) { _jugemPathIndex = courseDefinition.JugemPaths.IndexOf(JugemPathPoint.Path); _jugemPathPointIndex = JugemPathPoint.Index; }