/// <summary> /// Do all process to change current track /// </summary> private IEnumerator ChangeMusicCoroutine() { yield return(DropVolume()); IsSongPlaying = false; AudioSourceBGM.volume = 0; AudioSourceBGM.clip = nextTrackClip; AudioSourceBGM.loop = isToLoopTrack; AudioSourceBGM.Play(); IsSongPlaying = true; if (PausePanelController.Instance && nextTrackInfo != null) { PausePanelController.Instance.SetTrackInfo(nextTrackInfo); } yield return(GainVolume()); if (!isToLoopTrack && isToChangeOnTrackEnd && PausePanelController.Instance) { yield return(new WaitForSecondsRealtime(AudioSourceBGM.clip.length)); int index = Random.Range(0, allNotLoopedSongs.Length); AudioClip nextClip = allNotLoopedSongs[index]; Track nextRandomTrack = Tracks.Find(t => t.FileName.Equals(nextClip.name)); ChangeMusic(nextClip, false, string.Empty, false, true, nextRandomTrack); } }
/// <summary> /// Add track at specific position in Playlist /// </summary> /// <param name="newTrack"></param> /// <param name="existingTrack"></param> public void AddTrackAfterTrack(Track newTrack, Track existingTrack) { LinkedListNode <Track> node = Tracks.Find(existingTrack); this.Tracks.AddAfter(node, newTrack); TrackInPlaylistManager.db_Add_Update_Record(newTrack.id, this.id); }
public ITrack TrackFactory(string track, string directory) { string myversion = rFactor2Track.ParseVersion(directory); ITrack t = Tracks.Find(tr => myversion == tr.Version && track.Equals(tr.Name)); if (t == null) { t = new rFactor2Track(track, directory); t.Scan(); Tracks.Add(t); } return(t); }
public List <String> OutputWaitingPlanes(String track) { Track trackFound = Tracks.Find(new Track(track)).Data; if (trackFound == null) { return(null); } else { return(trackFound.GetLengthType().WaitingPlanesForSearch.TraverseInOrderAsStringList()); } }
public String[] FindWaitingPlane(String code, String track) { String[] result = new string[8]; Track trackFound = Tracks.Find(new Track(track)).Data; if (trackFound == null) { return(null); } else { TreeNode <Plane> plane = trackFound.GetLengthType().WaitingPlanesForSearch.Find(new Plane(code)); if (plane != null) { result[0] = plane.Data.GetProducerName(); result[1] = plane.Data.GetPlaneType(); result[2] = code; result[3] = "" + plane.Data.GetMinimalTrackLength(); result[4] = plane.Data.GetArrivalTime().ToString(); result[5] = plane.Data.GetTrackRequirementTime().ToString(); result[6] = "" + plane.Data.GetPriority(); if (plane.Data.Track != null) { result[7] = plane.Data.Track.GetName(); } else { result[7] = ""; } return(result); } } result[0] = result[1] = result[3] = result[4] = result[5] = result[6] = result[7] = ""; result[2] = "NOT FOUND"; return(result); }
public void ReadFromFile() { SystemTime = DateTime.Parse(File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking\\PlaneDepartureTrackingMSTest\\SystemTime.txt")); String[] planes = File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking" + "\\PlaneDepartureTrackingMSTest\\Planes.txt").Split('\n'); int test = 0; for (int i = 0; i < planes.Length; i++) { String [] row = planes[i].Split(','); if (row.Length >= 6) { test++; Plane plane = new Plane(row[0], row[1], row[2], Double.Parse(row[3]), DateTime.Parse(row[4]), Double.Parse(row[6].Replace('.', ','))); plane.SetTrackRequirementTime(DateTime.Parse(row[5])); Planes.Add(plane); } } System.Windows.Forms.MessageBox.Show("" + test); String[] trackAllocations = File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking\\PlaneDepartureTrackingMSTest\\TrackAllocations.txt").Split(','); for (int i = 0; i < trackAllocations.Length; i++) { String allocation = trackAllocations[i]; TrackAllocations.Add(allocation); } ArrivedPlanes.SplayDisabled = true; String[] arrivedPlanes = File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking" + "\\PlaneDepartureTrackingMSTest\\ArrivedPlanes.txt").Split(); foreach (String planeID in arrivedPlanes) { TreeNode <Plane> plane = Planes.Find(new Plane(planeID)); if (plane != null) { ArrivedPlanes.Add(plane.Data); } } ArrivedPlanes.SplayDisabled = false; String[] planeArrivals = File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking\\PlaneDepartureTrackingMSTest\\PlaneArrivals.txt").Split(','); foreach (String arrival in planeArrivals) { PlaneArrivals.Add(arrival); } String[] planeDepartures = File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking\\PlaneDepartureTrackingMSTest\\PlaneDepartures.txt").Split(','); foreach (String departure in planeDepartures) { PlaneDepartures.Add(departure); } String[] pairs = File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking" + "\\PlaneDepartureTrackingMSTest\\TrackPlanes.txt").Split(','); foreach (String pair in pairs) { String[] splittedPair = pair.Split(':'); if (splittedPair.Length == 2) { String trackName = splittedPair[0]; String planeID = splittedPair[1]; TreeNode <Plane> plane = Planes.Find(new Plane(planeID)); TreeNode <Track> track = Tracks.Find(new Track(trackName)); if (plane != null && track != null) { plane.Data.Track = track.Data; track.Data.SetPlane(plane.Data); } } } WaitingPlanes.SplayDisabled = true; String[] waitingPlanes = File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking" + "\\PlaneDepartureTrackingMSTest\\WaitingPlanes.txt").Split(); foreach (String planeID in waitingPlanes) { TreeNode <Plane> plane = Planes.Find(new Plane(planeID)); if (plane != null) { WaitingPlanes.Add(plane.Data); } } WaitingPlanes.SplayDisabled = false; foreach (double length in TrackTypesLengthList) { TreeNode <TrackType> type = TrackTypes.Find(new TrackType(length)); if (type != null) { type.Data.WaitingPlanesForSearch.SplayDisabled = true; String[] waitingPlanesForSearchTrack = File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking" + "\\PlaneDepartureTrackingMSTest\\" + type.Data.Length + "WaitingPlanesForSearch.txt").Split(); foreach (String planeID in waitingPlanesForSearchTrack) { TreeNode <Plane> plane = Planes.Find(new Plane(planeID)); if (plane != null) { type.Data.WaitingPlanesForSearch.Add(plane.Data); } } type.Data.WaitingPlanesForSearch.SplayDisabled = false; String[] waitingPlanesTrack = File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking" + "\\PlaneDepartureTrackingMSTest\\" + type.Data.Length + "WaitingPlanes.txt").Split(); foreach (String planeID in waitingPlanesTrack) { TreeNode <Plane> plane = Planes.Find(new Plane(planeID)); if (plane != null) { type.Data.WaitingPlanes.Add(plane.Data); } } foreach (Track track in type.Data.Tracks) { String[] trackHistory = File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking" + "\\PlaneDepartureTrackingMSTest\\" + track.GetName() + "History.txt").Split('\n'); foreach (String entry in trackHistory) { String[] splittedEntry = entry.Split(','); if (splittedEntry.Length == 2) { track.DepartureHistory.Add(new PlaneShortInfo(splittedEntry[0], DateTime.Parse(splittedEntry[1]))); } } } } } waitingCount = Int32.Parse(File.ReadAllText("D:\\.NET Projects\\PlaneDepartureTracking" + "\\PlaneDepartureTrackingMSTest\\WaitingCount.txt")); }