Ejemplo n.º 1
0
        /// <summary>
        /// Load track data
        /// </summary>
        /// <param name="setFilename">Set filename</param>
        public static TrackData Load(string setFilename)
        {
            // Load track data
            StreamReader file = new StreamReader(FileHelper.LoadGameContentFile(
                                                     Directory + "\\" + setFilename + "." + Extension));

            // Load everything into this class with help of the XmlSerializer.
            TrackData loadedTrack = (TrackData)
                                    new XmlSerializer(typeof(TrackData)).
                                    Deserialize(file.BaseStream);

            // Close the file
            file.Close();

            // Return loaded file
            return(loadedTrack);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generate track binary data
        /// </summary>
        public static void GenerateTrackBinaryData()
        {
            // Load all tracks
            ColladaTrack[] tracks = new ColladaTrack[]
                {
                    new ColladaTrack("Tracks\\TrackBeginner"),
                    new ColladaTrack("Tracks\\TrackAdvanced"),
                    new ColladaTrack("Tracks\\TrackExpert"),
                };
            // Save them all
            foreach (ColladaTrack track in tracks)
            {
                // Create file
                StreamWriter file = new StreamWriter(
                    TrackData.Directory+"\\"+
                    StringHelper.ExtractFilename(track.Filename, true)+"."+
                    TrackData.Extension);

                // Construct TrackData from ColladaTrack
                TrackData trackData = new TrackData(
                    track.TrackPoints,
                    track.WidthHelpers,
                    track.RoadHelpers,
                    track.NeutralsObjects);

                // Save everything in this class with help of the XmlSerializer.
                new XmlSerializer(typeof(TrackData)).
                    Serialize(file.BaseStream, trackData);
                // That's it, more data is not saved in a track file.

                // Close the file
                file.Close();
            } // foreach (combo)
        }
Ejemplo n.º 3
0
            /// <summary>
            /// Create road helper position
            /// </summary>
            /// <param name="setStartNum">Set start number</param>
            /// <param name="setEndNum">Set end number</param>
            public RoadHelperPosition(TrackData.RoadHelper.HelperType setType,
				int setStartNum, int setEndNum)
            {
                type = setType;
                startNum = setStartNum;
                endNum = setEndNum;
            }
Ejemplo n.º 4
0
 /// <summary>
 /// Load
 /// </summary>
 /// <param name="colladaTrack">Collada track</param>
 /// <param name="landscape">Landscape</param>
 protected void Load(TrackData colladaTrack, Landscape landscape)
 {
     Load(colladaTrack.TrackPoints.ToArray(),
         colladaTrack.WidthHelpers,
         colladaTrack.RoadHelpers,
         colladaTrack.NeutralsObjects,
         landscape);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Create track line
        /// </summary>
        /// <param name="inputPointsFromColladaTrack">
        /// Input points from collada track</param>
        public TrackLine(TrackData inputPointsFromColladaTrack,
			Landscape landscape)
            : this(inputPointsFromColladaTrack.TrackPoints.ToArray(),
			inputPointsFromColladaTrack.WidthHelpers,
			inputPointsFromColladaTrack.RoadHelpers,
			inputPointsFromColladaTrack.NeutralsObjects,
			landscape)
        {
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Load
 /// </summary>
 /// <param name="trackData">track</param>
 /// <param name="landscape">Landscape</param>
 protected void Load(TrackData trackData, Landscape landscape)
 {
     Load(trackData.TrackPoints.ToArray(),
         trackData.WidthHelpers,
         trackData.RoadHelpers,
         trackData.NeutralsObjects,
         landscape);
 }