public static void Show([NotNull] TrackObject track) { new TrackSkinsDialog(track) { ShowInTaskbar = false }.ShowDialogWithoutBlocking(); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); TrackObject o = (TrackObject)e.Parameter; if (o == null) { o = MainPage.currentSong; this.songArtist.Text = o.trackArtistName; this.songTitle.Text = o.trackTitle; this.songArtwork.Source = o.albumCoverImage; this.songAlbumArtistName.Text = o.album.artist.name; this.songAlbumName.Text = o.album.name; await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { Uri webLink = new Uri(o.trackStreamURL); MediaPlaybackItem song = new MediaPlaybackItem(MediaSource.CreateFromUri(webLink)); MediaItemDisplayProperties props = song.GetDisplayProperties(); props.Type = MediaPlaybackType.Music; props.MusicProperties.Title = o.trackTitle; props.MusicProperties.Artist = o.trackArtistName; props.MusicProperties.Genres.Add(o.track.genreprimary); props.MusicProperties.Genres.Add(o.track.genresecondary); props.Thumbnail = RandomAccessStreamReference.CreateFromUri(new Uri(o.albumCoverURL)); song.ApplyDisplayProperties(props); mediaPlayer.Source = song; MainPage.nowPlaying.Text = "Now Playing: \"" + o.trackArtistName + " ~ " + o.trackTitle + "\""; }); } else { this.songArtist.Text = o.trackArtistName; this.songTitle.Text = o.trackTitle; this.songArtwork.Source = o.albumCoverImage; this.songAlbumArtistName.Text = o.album.artist.name; this.songAlbumName.Text = o.album.name; await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (MainPage.currentSong != o) { MainPage.currentSong = o; Uri webLink = new Uri(o.trackStreamURL); MediaPlaybackItem song = new MediaPlaybackItem(MediaSource.CreateFromUri(webLink)); MediaItemDisplayProperties props = song.GetDisplayProperties(); props.Type = MediaPlaybackType.Music; props.MusicProperties.Title = o.trackTitle; props.MusicProperties.Artist = o.trackArtistName; props.MusicProperties.Genres.Add(o.track.genreprimary); props.MusicProperties.Genres.Add(o.track.genresecondary); props.Thumbnail = RandomAccessStreamReference.CreateFromUri(new Uri(o.albumCoverURL)); song.ApplyDisplayProperties(props); mediaPlayer.Source = song; MainPage.nowPlaying.Text = "Now Playing: \"" + o.trackArtistName + " ~ " + o.trackTitle + "\""; } }); } }
public GameObject getRandomTrackObjectByType(TrackObject.ObjectType objectType) { List <GameObject> randomPool = new List <GameObject>(); foreach (GameObject currentObject in trackObjectPool) { TrackObject currentTrackObject = currentObject.GetComponent <TrackObject>(); if (currentTrackObject != null) { if (currentTrackObject.positioned == false && currentTrackObject.objectType == objectType) { randomPool.Add(currentObject); } } } if (randomPool.Count > 0) { GameObject selectedTrackObject = randomPool[Random.Range(0, randomPool.Count)]; selectedTrackObject.GetComponent <TrackObject>().positioned = true; selectedTrackObject.gameObject.SetActive(true); return(selectedTrackObject); } return(null); }
public TrackSkinContentEntry([NotNull] string path, [NotNull] string id, [NotNull] string trackId, string name, string version, byte[] iconData = null) : base(path, id, name, version, iconData) { _track = TracksManager.Instance.GetById(trackId) ?? throw new Exception($"Track “{trackId}” for the skin not found"); NewFormat = string.Format(ToolsStrings.ContentInstallation_CarSkinNew, "{0}", _track.DisplayName); ExistingFormat = string.Format(ToolsStrings.ContentInstallation_CarSkinExisting, "{0}", _track.DisplayName); }
public SpotifyPlaylistTrack(TrackObject track) { Name = track.Name; PreviewUrl = track.PreviewUrl; Uri = track.Uri; Id = track.Id; }
private async void MediaPlayer_MediaEnded(MediaPlayer sender, object args) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (!mediaPlayer.IsLoopingEnabled) { if (queue.Count > 0) { history.Push(currentSong); TrackObject o = queue.Pop(); currentSong = o; if (window.CurrentSourcePageType.Equals(typeof(QueueView))) { window.Navigate(typeof(QueueView)); } else { window.Navigate(typeof(SongView)); } } else if (queue.Count == 0) { EndGUIPlayback(); currentSong = null; mediaPlayer.Source = null; history = new Stack <TrackObject>(); ReturnToHomePage(); } } }); }
private void doGameOver(GameObject crashedObstacle) { isGameOver = true; if (onGameOver != null) { onGameOver.Invoke(); } if (crashedObstacle != null) { if (crashedObstacle.transform.parent != null) { TrackObject crashedObstacleElement = crashedObstacle.transform.parent.GetComponent <TrackObject>(); if (crashedObstacleElement != null) { if (crashedObstacleElement.objectGroup == TrackObject.ObjectGroup.CharacterObstacles) { CharacterObstacle charObstacle = crashedObstacle.transform.parent.GetComponent <CharacterObstacle>(); if (charObstacle != null) { charObstacle.onCharacterHit(); } } } } } //globals.crashedObstacle = crashedObstacle; }
public void Setup() { _trackObjects1 = new List <TrackObject>(); _trackObjects = new List <TrackObject>(); _trackObjects2 = new List <TrackObject>(); list1 = new List <string> { "MAR123", "50000", "50000", "1000", "20151006213456789" }; trackObject = new TrackObject(list1); _receivedTrackObjects = new List <TrackObject>(); _trackObjects.Add(trackObject); _transponderReceiver = Substitute.For <ITransponderReceiver>(); _transponderParsing = Substitute.For <ITransponderParsing>(); _trackingValidation = Substitute.For <ITrackingValidation>(); _dateFormatter = Substitute.For <IDateFormatter>(); _trackUpdater = Substitute.For <ITrackUpdater>(); _velocityCourseCalculator = Substitute.For <IVelocityCourseCalculator>(); _separationChecker = Substitute.For <ISeparationChecker>(); _print = Substitute.For <IPrint>(); _objectifier = Substitute.For <ITrackListEvent>(); _uut = new ATMSystem(_objectifier, _trackUpdater, _velocityCourseCalculator, _separationChecker, _print); _trackObjectDataEventArgs = new TrackListEventArgs(_trackObjects); _objectifier.TrackListReady += (sender, TrackListEventArgs) => { _receivedTrackObjects = TrackListEventArgs.TrackObjects; }; }
protected override SelectRating GetSelectedItem(IList <SelectRating> list, TrackObject obj) { if (obj == null) { return(null); } if (obj.IsFavourite) { for (var i = list.Count - 1; i >= 0; i--) { var x = list[i]; if (x.Rating == null) { return(x); } } } var value = (obj.Rating ?? 0d).FloorToInt(); if (value != 0) { for (var i = list.Count - 1; i >= 0; i--) { var x = list[i]; if (x.Rating == value) { return(x); } } } return(null); }
private void AddNewRatingIfMissing(IList <SelectRating> list, TrackObject obj) { if (obj == null) { return; } var value = (obj.Rating ?? 0d).FloorToInt(); if (value == 0) { return; } for (var i = list.Count - 1; i >= 0; i--) { var item = list[i]; if (item.Rating == value) { IncreaseCounter(obj, item); return; } } AddNewIfMissing(list, obj, new SelectRating(value)); }
public void calculateSpeed_PositiveXandNegativeY_HorizontalVelocityIsCorrect() { _trackPrior = new TrackObject("Tag123", 80000, 58000, 1000, DateTime.ParseExact("20180412111111111", "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)); _trackCurrent = new TrackObject("Tag123", 81500, 56000, 1000, DateTime.ParseExact("20180412111322111", "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)); horizontalVelocity = _uut.CalculateSpeed(_trackCurrent, _trackPrior); Assert.That(Math.Round(horizontalVelocity), Is.EqualTo(Math.Round(19.0840))); }
public void checkSeparationOf2Objects_StillTooClose_1SeparationEventWithNewData() { _listOfTracks.Clear(); _listOfTracks.Add(_track1); _listOfTracks.Add(_track2); _uut.CheckSeparationEvents(_listOfTracks); DateTime firstOccurence = new DateTime(); foreach (var separation in _receivedArgs.SeparationObjects) { firstOccurence = separation.TimeOfOcccurence; } _listOfTracks.Clear(); _track1 = new TrackObject("Tag123", 70000, 70000, 1000, DateTime.ParseExact("20180412111211111", "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)); _listOfTracks.Add(_track1); _listOfTracks.Add(_track2); _uut.CheckSeparationEvents(_listOfTracks); DateTime nextOccurence = new DateTime(); foreach (var separation in _receivedArgs.SeparationObjects) { nextOccurence = separation.TimeOfOcccurence; } // Assume, that when 1 pair of tracks is too close, this creates 1 separation event object with new data Assert.That(nextOccurence, !Is.EqualTo(firstOccurence)); }
public void RemoveTrack(TrackObject trackObject) { if (Tracks.Contains(trackObject)) { Tracks.Remove(trackObject); } }
public double CalculateCompassCourse(TrackObject p, TrackObject c) { //Vector pointing from the planes old position to the planes new position CompassCourseVector planeVector = new CompassCourseVector() { X = c.XCoordinate - p.XCoordinate, Y = c.YCoordinate - p.YCoordinate }; //Vector pointing north. Used to calculate the course the plane is heading CompassCourseVector northVector = new CompassCourseVector() { X = 0, Y = planeVector.Magnitude }; var dotProduct = (planeVector.X * northVector.X) + (planeVector.Y * northVector.Y); var determinant = (planeVector.X * northVector.Y) - (planeVector.Y * northVector.X); //Calculate course between north and plane vector. var compassCourse = Math.Atan2(determinant, dotProduct) * (180 / Math.PI); //Convert radians to degrees. //Convert negative course values between 0-1 PI to number between 0-360 degrees if (compassCourse < 0) { return(Math.Round(360 + compassCourse, 1)); } return(Math.Round(compassCourse, 1)); }
public static void Show([NotNull] TrackObject track) { new TrackSkinsDialog(track) { ShowInTaskbar = false }.ShowDialogAsync().Forget(); }
public void AddTrack(TrackObject trackObject) { if (!Tracks.Contains(trackObject)) { Tracks.Add(trackObject); } }
/// <summary> /// Adds a single build to the buildTracker /// </summary> /// <param name="source">The InventoryPart to increment</param> /// <param name="typeToAdd">Says whether this is a new build, inventoried build, or combo build (TOTAL)</param> /// <returns>The corresponding InventoryPart that's actually stored</returns> private InventoryPart addBuild(InventoryPart source, TrackType typeToAdd) { InventoryPart found = _buildTracker.Keys.FirstOrDefault(ip => ip.IsSameAs(source, _strictness)); if (found != null) { _buildTracker[found].buildsTotal++; //increment it } else { found = source; _buildTracker[source] = new TrackObject(); _buildTracker[source].buildsTotal = 1; //add it } if (typeToAdd == TrackType.INVENTORIED || typeToAdd == TrackType.TOTAL) { _buildTracker[found].buildsInventoried++; } if (typeToAdd == TrackType.NEW || typeToAdd == TrackType.TOTAL) { _buildTracker[found].buildsNew++; } Logging.Log($"{found.Name} has been used in {_buildTracker[found].buildsTotal}/{_buildTracker[found].buildsNew}/{_buildTracker[found].buildsInventoried} (T/N/I) builds."); return(found); }
private void clearAllRemainPowerupsForType(TrackObject.ObjectType type) { List <GameObject> acitveTracks = GameGlobals.Instance.trackGenerator.getActiveTracks(); foreach (GameObject track in acitveTracks) { Transform trackObjects = track.transform.Find("trackObjects"); if (trackObjects != null) { foreach (Transform trackItem in trackObjects.transform) { TrackObject trackObject = trackItem.GetComponent <TrackObject>(); if (trackObject != null) { if (trackObject.placeHolder == false && trackObject.objectType == type) { trackObject.positioned = false; trackObject.transform.parent = GameGlobals.Instance.trackGenerator.trackObjectsRoot.transform; trackObject.gameObject.transform.position = GameGlobals.Instance.trackGenerator.rootPos; trackObject.gameObject.SetActive(false); } } } } } }
/// <summary> /// Adds a single use to the useTracker. Automatically determines type /// </summary> /// <param name="source">The InventoryPart to increment</param> /// <returns>The corresponding InventoryPart that's actually stored</returns> private InventoryPart addUse(InventoryPart source) { InventoryPart found = _buildTracker.Keys.FirstOrDefault(ip => ip.IsSameAs(source, _strictness)); if (found != null) { _buildTracker[found].usesTotal++; //increment it } else { found = source; _buildTracker[source] = new TrackObject(); _buildTracker[source].usesTotal = 1; //add it } if (source.TrackerModule.Inventoried) { _buildTracker[found].usesInventoried++; } else { _buildTracker[found].usesNew++; } Logging.Log($"{found.Name} has been used {_buildTracker[found].usesTotal}/{_buildTracker[found].usesNew}/{_buildTracker[found].usesInventoried} (T/N/I) times."); return(found); }
private async void SongViewer_AddClick(object sender, RoutedEventArgs e) { if (MainPage.window.CurrentSourcePageType != typeof(SongView)) { Track t = null; var button = (Button)sender; foreach (Track s in tList) { if (s != null) { if (s.tracknumber == (int)button.Tag) { t = s; } } } TrackObject songObject = new TrackObject(a, t); Stack <TrackObject> temp = new Stack <TrackObject>(); while (MainPage.queue.Count >= 1) { TrackObject to = MainPage.queue.Pop(); temp.Push(to); } temp.Push(songObject); while (temp.Count >= 1) { TrackObject to = temp.Pop(); MainPage.queue.Push(to); } await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (MainPage.queue.Count == 0 && MainPage.queue.Count == 0) { MainPage.mediaPlayerGUI.TransportControls.IsNextTrackButtonVisible = false; MainPage.mediaPlayerGUI.TransportControls.IsPreviousTrackButtonVisible = false; } else if (MainPage.queue.Count >= 1 && MainPage.history.Count == 0) { MainPage.mediaPlayerGUI.TransportControls.IsNextTrackButtonVisible = true; MainPage.mediaPlayerGUI.TransportControls.IsPreviousTrackButtonVisible = false; } else if (MainPage.queue.Count == 0 && MainPage.history.Count >= 1) { MainPage.mediaPlayerGUI.TransportControls.IsNextTrackButtonVisible = false; MainPage.mediaPlayerGUI.TransportControls.IsPreviousTrackButtonVisible = true; } else if (MainPage.queue.Count >= 1 && MainPage.history.Count >= 1) { MainPage.mediaPlayerGUI.TransportControls.IsNextTrackButtonVisible = true; MainPage.mediaPlayerGUI.TransportControls.IsPreviousTrackButtonVisible = true; } }); } }
private void SongViewer_ItemClick(object sender, RoutedEventArgs e) { if (MainPage.window.CurrentSourcePageType != typeof(SongView)) { if (MainPage.currentSong != null) { MainPage.mediaPlayer.Pause(); MainPage.mediaPlayer.Source = null; MainPage.history.Clear(); MainPage.queue.Clear(); } Track t = null; var button = (Button)sender; foreach (Track s in tList) { if (s != null) { if (s.tracknumber == (int)button.Tag) { t = s; } } } TrackObject songObject = new TrackObject(a, t); MainPage.window.Navigate(typeof(SongView), songObject); } }
public static void Open(TrackObject track) { if (!(Application.Current?.MainWindow is MainWindow main) || Keyboard.Modifiers == ModifierKeys.Control && !User32.IsAsyncKeyPressed(Keys.K) || SettingsHolder.Interface.SkinsSetupsNewWindow) { TrackSkinsDialog.Show(track); }
public ViewModel(TrackObject track, TrackSkinObject trackSkin, IEnumerable <TextureEntry> images) { Track = track; TrackSkin = trackSkin; Images = new ChangeableObservableCollection <TextureEntry>(images); Images.ItemPropertyChanged += OnItemPropertyChanged; UpdateSummary(); }
public void SetUp() { TrackConverter = Substitute.For <Logic.Interfaces.ITrackConverter>(); sorter = new Sorter(TrackConverter); // _uut = new Controller(sorter); _trackPrior = new TrackObject("Tag123", 80000, 60000, 1000, DateTime.ParseExact("20180412111111111", "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)); _trackCurrent = new TrackObject("Tag123", 80500, 60400, 1000, DateTime.ParseExact("20180412111322111", "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)); }
public void CalculateCourseNegativeXandPostiveY() { track1 = new TrackObject("Tag123", 80000, 60000, 1000, DateTime.ParseExact("20180412111111111", "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)); track2 = new TrackObject("Tag123", 70500, 62000, 1000, DateTime.ParseExact("20180412111322111", "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)); trackcoure = _uut.CalculateCompassCourse(track1, track2); Assert.That(Math.Round(trackcoure), Is.EqualTo(Math.Round(282.0))); }
public void Setup() { trackUpdater = Substitute.For <ITrackUpdater>(); _uut = new TrackingFiltering(trackUpdater); trackData = new List <string> { "ATR423", "50000", "50000", "1000", "20151006213456789" }; trackObject = new TrackObject(trackData); trackObjects = new List <TrackObject>(); }
public void ShootLaser(TrackObject tracker) { Transform trackedObj = tracker.trackedObject; SoundManager.Instance.Play(laserAudio); GameObject explosion = Instantiate(laserExplosion); trackedObj.GetComponent <BaseCreature>().HitByLaser(explosion); tracker.gameObject.SetActive(false); //Remove crosshair }
private TrackSkinTexturesDialog(TrackObject track, TrackSkinObject trackSkin, IEnumerable <TextureEntry> images) { DataContext = new ViewModel(track, trackSkin, images); InitializeComponent(); Buttons = new[] { CreateCloseDialogButton("Override", true, false, MessageBoxResult.OK, Model.SaveCommand), CancelButton }; }
void SeedWorld(Vector3 position, Quaternion rotation, List <int> exceptions) { List <float> probabs = new List <float>(); for (int i = 0; i < Worlds.Count; ++i) { probabs.Add(Worlds[i].probability); } currentWorld = Probability(probabs, Worlds.Count); Tracklength = Random.Range(Worlds[currentWorld].minTracklength, Worlds[currentWorld].maxTracklength); Trackcount = 0; GameObject pooledObject; probabs.Clear(); for (int i = 0; i < Worlds[currentWorld].tracks.Count; ++i) { probabs.Add(Worlds[currentWorld].tracks[i].probability); } if (prevworld == currentWorld) { for (int j = 0; j < exceptions.Count; ++j) { probabs[exceptions[j]] = 0f; } } if (prevworld != currentWorld) { pooledObject = CheckPool(currentWorld, 0); prevworld = currentWorld; } else { int seedTrack = Probability(probabs, Worlds[currentWorld].tracks.Count); pooledObject = CheckPool(currentWorld, seedTrack); prevworld = currentWorld; } pooledObject.SetActive(true); pooledObject.transform.position = position; pooledObject.transform.rotation = rotation; TrackObject t = pooledObject.GetComponent <TrackObject>(); if (t) { for (int i = 0; i < t.TrackObstacles.Count; ++i) { t.TrackObstacles[i].seedobstacle(); } for (int i = 0; i < t.LevelPopulators.Count; i++) { t.LevelPopulators[i].PopulateObstacles(); } } }
public double CalculateSpeed(TrackObject c, TrackObject p) { // How much time has past? timeSpan = c.TimeStamp - p.TimeStamp; // How big is the displacement? horizontalDisplacement = Math.Sqrt(Math.Pow((c.XCoordinate - p.XCoordinate), 2) + Math.Pow((c.YCoordinate - p.YCoordinate), 2)); // velocity = displacement(m)/timespan(sec) horizontalVelocity = horizontalDisplacement / timeSpan.TotalSeconds; // round off value and return return(Math.Round(horizontalVelocity, 2)); }