public tv_MonthFishingViewModel(string month, tv_GearViewModel gear) : base(gear, true) { _month = month; _gear = gear._gear; _landingSite = gear._landingSite; _projectSetting = gear._projectSetting; }
private void Awake() { rotator = GetComponent <Rotator>(); osc = GetComponentInChildren <OctahedronSphereCreator>(); landingSite = GetComponentInChildren <LandingSite>(); Reset(); }
protected void FixedUpdate() { if(!deployed&&targetLanding!=null){ Vector3 dist = targetLanding.transform.position - transform.position; Quaternion nr = Quaternion.LookRotation(dist); rigidbody.rotation = Quaternion.Euler(new Vector3(nr.eulerAngles.x,nr.eulerAngles.y,nr.eulerAngles.z)); rigidbody.AddRelativeForce(Vector3.forward*500); if(Mathf.Abs(dist.magnitude)<30){ Quaternion ni = targetLanding.transform.rotation; rigidbody.velocity *=.5f; rigidbody.angularVelocity=Vector3.zero; iTween.RotateTo(gameObject, iTween.Hash("rotation", new Vector3(0,ni.eulerAngles.y,0), "time", 1.5f)); iTween.MoveTo(gameObject, iTween.Hash("position", targetLanding.transform.position, "time", 1.5f, "oncompletetarget", gameObject, "oncomplete", "DropToGround")); targetLanding=null; } //MoveForward(); } }
/// <summary> /// Parses the specified text looking for scripture references and converting them to links if they are not in /// code blocks, pre tags or anchors. /// </summary> /// <param name="text">The text.</param> /// <param name="defaultTranslation">The default translation.</param> /// <param name="landingSite">The landing site.</param> /// <param name="cssClass">The CSS class.</param> /// <param name="openInTab">if set to <c>true</c> [open in tab].</param> /// <returns></returns> public static string Parse(string text, string defaultTranslation = "NLT", LandingSite landingSite = LandingSite.YouVersion, string cssClass = "", bool openInTab = false) { var scripturizedString = new StringBuilder(); var tokens = TokenizeString(text); foreach (var token in tokens) { if (IsIgnoredToken(token)) { scripturizedString.Append(token); } else { scripturizedString.Append(AddScriptureLinks(token, defaultTranslation, landingSite, cssClass, openInTab)); } } return(scripturizedString.ToString()); }
protected void FixedUpdate() { if (!deployed && targetLanding != null) { Vector3 dist = targetLanding.transform.position - transform.position; Quaternion nr = Quaternion.LookRotation(dist); rigidbody.rotation = Quaternion.Euler(new Vector3(nr.eulerAngles.x, nr.eulerAngles.y, nr.eulerAngles.z)); rigidbody.AddRelativeForce(Vector3.forward * 500); if (Mathf.Abs(dist.magnitude) < 30) { Quaternion ni = targetLanding.transform.rotation; rigidbody.velocity *= .5f; rigidbody.angularVelocity = Vector3.zero; iTween.RotateTo(gameObject, iTween.Hash("rotation", new Vector3(0, ni.eulerAngles.y, 0), "time", 1.5f)); iTween.MoveTo(gameObject, iTween.Hash("position", targetLanding.transform.position, "time", 1.5f, "oncompletetarget", gameObject, "oncomplete", "DropToGround")); targetLanding = null; } //MoveForward(); } }
public void Add(LandingSite ls) { base.Children.Add(new tv_LandingSiteViewModel(ls, this)); }
public void sendLZ(LandingSite LZ) { targetLanding = LZ; oppositeSpawn = LZ.oppositeSpawn; attackTarget = new Vector3(oppositeSpawn.position.x, 2, oppositeSpawn.position.z); }
public tv_GearViewModel(Gear gear, tv_LandingSiteViewModel ls) : base(ls, true) { _gear = gear; _landingSite = ls._landingSite; _projectSetting = ls._projectSetting; }
/// <summary> /// Adds the scripture links to the token. /// </summary> /// <param name="token">The token.</param> /// <param name="defaultTranslation">The default translation.</param> /// <param name="landingSite">The landing site.</param> /// <param name="cssClass">The CSS class.</param> /// <param name="openInTab">if set to <c>true</c> [open in tab].</param> /// <returns></returns> private static string AddScriptureLinks(string token, string defaultTranslation, LandingSite landingSite, string cssClass = "", bool openInTab = false) { string regexVolumes = @"1|2|3|I|II|III|1st|2nd|3rd|First|Second|Third"; string regexBook = GetBookRegex(); string regexTranslations = GetTranslationRegex(); // 9/11/2019 - NA // Originally this matched 1-3 numbers a colon (:) then 1-3 numbers // with either a dash (-) ampersand (&) or comma (,) followed by numbers. // That could match something like 1:1-10, 13 -- but we're not supporting that // format since it incorrectly matches multiple book syntax (such as "John 3:16-18, 1 Peter 1:1-10") // ...so we're removing the comma below from the character set. // If this ends up breaking something, please add the test case to the ShortcodeTests first // and then fix it in the code. string regexChapterVerse = @"\d{1,3}(?::\d{1,3})?(?:\s?(?:[-&]\s?\d+))*"; string regexPassageRegex = string.Format(@"(?:({0})\s)?({1})\s({2})(?:\s?[,-]?\s?((?:{3})|\s?\((?:{3})\)))?", regexVolumes, // 0 regexBook, // 1 regexChapterVerse, // 2 regexTranslations // 3 ); return(Regex.Replace(token, regexPassageRegex, delegate(Match match) { // Ensure the match was in the correct format if (match.Groups.Count != 5) { return match.Value; } var volume = NormalizeVolume(match.Groups[1].ToString()); var book = match.Groups[2].ToString(); var verses = match.Groups[3].ToString(); var translation = match.Groups[4].ToString().Replace(")", "").Replace("(", ""); // Check that the reference isn't for a chapter range, this is not supported (e.g. John 1-16) if (verses.Contains("-") && !verses.Contains(":")) { return match.Value; } // Catch the case of 'The 3 of us went downtown' which triggers a link to 1 Thess 3 if (book.ToLower() == "the" && volume.IsNullOrWhiteSpace()) { return match.Value; } // Apply default translation if needed if (translation.IsNullOrWhiteSpace()) { translation = defaultTranslation; } var scriptureLink = string.Empty; var serviceLabel = string.Empty; switch (landingSite) { case LandingSite.YouVersion: { scriptureLink = FormatScriptureLinkYouVersion(volume, book, verses, translation); serviceLabel = "YouVersion"; break; } case LandingSite.BibleGateway: { scriptureLink = FormatScriptureLinkBibleGateway(volume, book, verses, translation); serviceLabel = "Bible Gateway"; break; } } if (scriptureLink.IsNullOrWhiteSpace()) { return match.Value; } var target = string.Empty; if (openInTab) { target = " target=\"_blank\""; } if (cssClass.IsNullOrWhiteSpace()) { return string.Format("<a href=\"{0}\" {1} title=\"{2}\">{3}</a>", scriptureLink, // 0 target, // 1 serviceLabel, // 2 match.Value // 3 ); } return string.Format("<a href=\"{0}\" {1} class=\"{2}\" title=\"{3}\">{4}</a>", scriptureLink, // 0 target, // 1 cssClass, // 2 serviceLabel, // 3 match.Value // 4 ); })); }
/// <summary> /// Adds the scripture links to the token. /// </summary> /// <param name="token">The token.</param> /// <param name="defaultTranslation">The default translation.</param> /// <param name="landingSite">The landing site.</param> /// <param name="cssClass">The CSS class.</param> /// <returns></returns> private static string AddScriptureLinks(string token, string defaultTranslation, LandingSite landingSite, string cssClass = "") { string regexVolumes = @"1|2|3|I|II|III|1st|2nd|3rd|First|Second|Third"; string regexBook = GetBookRegex(); string regexTranslations = GetTranslationRegex(); string regexChapterVerse = @"\d{1,3}(?::\d{1,3})?(?:\s?(?:[-&,]\s?\d+))*"; string regexPassageRegex = string.Format(@"(?:({0})\s)?({1})\s({2})(?:\s?[,-]?\s?((?:{3})|\s?\((?:{3})\)))?", regexVolumes, // 0 regexBook, // 1 regexChapterVerse, // 2 regexTranslations // 3 ); return(Regex.Replace(token, regexPassageRegex, delegate(Match match) { // Ensure the match was in the correct format if (match.Groups.Count != 5) { return match.Value; } var volume = NormalizeVolume(match.Groups[1].ToString()); var book = match.Groups[2].ToString(); var verses = match.Groups[3].ToString(); var translation = match.Groups[4].ToString().Replace(")", "").Replace("(", ""); // Check that the reference isn't for a chapter range, this is not supported (e.g. John 1-16) if (verses.Contains("-") && !verses.Contains(":")) { return match.Value; } // Catch the case of 'The 3 of us went downtown' which triggers a link to 1 Thess 3 if (book.ToLower() == "the" && volume.IsNullOrWhiteSpace()) { return match.Value; } // Apply default translation if needed if (translation.IsNullOrWhiteSpace()) { translation = defaultTranslation; } var scriptureLink = string.Empty; var serviceLabel = string.Empty; switch (landingSite) { case LandingSite.YouVersion: { scriptureLink = FormatScriptureLinkYouVersion(volume, book, verses, translation); serviceLabel = "YouVersion"; break; } case LandingSite.BibleGateway: { scriptureLink = FormatScriptureLinkBibleGateway(volume, book, verses, translation); serviceLabel = "Bible Gateway"; break; } } if (scriptureLink.IsNullOrWhiteSpace()) { return match.Value; } if (cssClass.IsNullOrWhiteSpace()) { return string.Format("<a href=\"{0}\" title=\"{1}\">{2}</a>", scriptureLink, // 0 serviceLabel, // 1 match.Value // 2 ); } return string.Format("<a href=\"{0}\" class=\"{1}\" title=\"{2}\">{3}</a>", scriptureLink, // 0 cssClass, // 1 serviceLabel, // 2 match.Value // 3 ); })); }
private void OnButtonClicked(object sender, RoutedEventArgs e) { switch (((Button)sender).Name) { case "buttonOk": if (textID.Text.Length > 0 && textName.Text.Length > 0 && textMunicipality.Text.Length > 0 && textProvince.Text.Length > 0) { LandingSite ls = new LandingSite { ID = int.Parse(textID.Text), Name = textName.Text, Municipality = textMunicipality.Text, Province = textProvince.Text }; if (textLatitude.Text.Length > 0 && textLongitude.Text.Length > 0) { if (double.TryParse(textLatitude.Text, out double lat)) { ls.Lat = lat; if (double.TryParse(textLongitude.Text, out double lon)) { ls.Lon = lon; } else { ls.Lon = null; ls.Lat = null; } } else { ls.Lon = null; ls.Lat = null; } } bool success = false; if (_isNew) { if (Entities.LandingSiteViewModel.AddRecordToRepo(ls)) { textName.Clear(); textMunicipality.Clear(); textProvince.Clear(); textLatitude.Clear(); textLongitude.Clear(); textID.Text = Entities.LandingSiteViewModel.NextRecordNumber().ToString(); success = true; } } else { Entities.LandingSiteViewModel.UpdateRecordInRepo(ls); success = true; Close(); } if (success) { ((MainWindow)Owner).RefreshLandingSiteGrid(); } } break; case "buttonCancel": Close(); break; } }
public tv_LandingSiteViewModel(LandingSite landingSite, tv_ProjectSettingViewModel parent) : base(parent, true) { _landingSite = landingSite; _projectSetting = parent._projectSetting; }
public void sendLZ(LandingSite LZ) { targetLanding = LZ; oppositeSpawn = LZ.oppositeSpawn; attackTarget = new Vector3(oppositeSpawn.position.x, 2,oppositeSpawn.position.z); }
private void OnTreeViewItemSelected(object sender, AllSamplingEntitiesEventHandler e) { TreeViewEntity = e.TreeViewEntity; ProjectSetting = e.ProjectSetting; LandingSite = e.LandingSite; Gear = e.Gear; MonthSampled = e.MonthSampled; switch (TreeViewEntity) { case "tv_ProjectSettingViewModel": break; case "tv_LandingSiteViewModel": break; case "tv_GearViewModel": break; case "tv_MonthFishingViewModel": _samplingRadioButtonWasClicked = false; rbSampling.IsChecked = true; OnEntityButtonClick(rbSampling, null); lblContentTitle.Content = $"{ProjectSetting.ProjectName} samplings in {LandingSite.ToString()}, caught using {Gear.GearName} on {((DateTime)MonthSampled).ToString("MMM-yyyy")}"; break; } }
private void OnButton_Click(object sender, RoutedEventArgs e) { string buttonName = ((Button)sender).Name; switch (buttonName) { case "buttonSubGrid1": switch (_entityType) { case "LandingSite": case "Gear": case "Fisher": SamplingHistoryWindow shw = new SamplingHistoryWindow(_entityType); shw.Owner = this; shw.ShowDialog(); break; case "GPS": GPSStatusWindow gsw = new GPSStatusWindow("gps_history"); gsw.Owner = this; gsw.Show(); break; } break; case "buttonSubGrid": switch (_entityType) { case "Fisher": FisherAndGPS fg = (FisherAndGPS)gridData.SelectedItem; FisherGPSWindow fgw = new FisherGPSWindow(fisher: fg.Fisher, readOnly: false, parentWindow: this); //FisherGPSWindow fgw = new FisherGPSWindow((Fisher)gridData.SelectedItem); fgw.ShowDialog(); if (!fgw.Cancelled && RefreshDataGridNeeded) { refreshDataGrid(); } break; case "GPS": GPSStatusWindow gsw = new GPSStatusWindow("assignment"); gsw.Owner = this; gsw.Show(); break; } //buttonSubGrid.IsEnabled = false; break; case "buttonAdd": AddEditWindow aew = new AddEditWindow(_entityType, true); aew.ShowDialog(); if (!aew.Cancelled) { refreshDataGrid(); } break; case "buttonEdit": aew = new AddEditWindow(_entityType, false, _entityID); aew.ShowDialog(); if (!aew.Cancelled) { refreshDataGrid(); } break; case "buttonDelete": string msgCannotDelete = ""; bool deleteSuccess = false; switch (_entityType) { case "Gear": if (BSCEntities.GearViewModel.CanDeleteEntity(Gear)) { BSCEntities.GearViewModel.DeleteRecordFromRepo(Gear.GearName); deleteSuccess = true; } else { msgCannotDelete = $"Cannot delete the gear '{Gear.GearName}' because it is already used by the database"; } break; case "Fisher": if (Entities.BSCEntities.FisherViewModel.CanDeleteEntity(Fisher)) { Entities.BSCEntities.FisherViewModel.DeleteRecordFromRepo(_entityID); deleteSuccess = true; } else { msgCannotDelete = $"Cannot delete the fisher '{Fisher.FisherName}' because it is already used by the database"; } break; case "LandingSite": if (BSCEntities.LandingSiteViewModel.CanDeleteEntity(LandingSite)) { Entities.BSCEntities.LandingSiteViewModel.DeleteRecordFromRepo(LandingSite.LandingSiteID); } else { msgCannotDelete = $"Cannot delete the GPS '{LandingSite.ToString()}' because it is already used by the database"; } break; case "GPS": if (Entities.BSCEntities.GPSViewModel.CanDeleteEntity(GPS)) { Entities.BSCEntities.GPSViewModel.DeleteRecordFromRepo(_entityID); deleteSuccess = true; } else { msgCannotDelete = $"Cannot delete the GPS '{GPS.ToString()}' because it is already used by the database"; } break; case "ProjectSetting": if (Entities.BSCEntities.ProjectSettingViewModel.CanDeleteEntity(ProjectSetting)) { Entities.BSCEntities.ProjectSettingViewModel.DeleteRecordFromRepo(ProjectSetting.ProjectID); deleteSuccess = true; } else { msgCannotDelete = $"Cannot delete the project '{ProjectSetting.ProjectName}' because it is already used by the database"; } break; } if (deleteSuccess) { //gridData.Items.Refresh(); refreshDataGrid(); } else { if (msgCannotDelete.Length > 0) { MessageBox.Show(msgCannotDelete, "Validation error", MessageBoxButton.OK, MessageBoxImage.Information); } } break; } }