void Narrate(Narration narration) { if (narration) { for(int i = 0; i < narration.content.Length; i++) { string text = narration.content[i]; text = text.Replace("\\n", "\n"); Debug.Log("Narrating: " + text); pendingNarrations.Add(text); } readingFinal = narration.isFinal; Destroy(narration); } }
void Start() { narrator = GameObject.Find("Narrator").GetComponent <Narration> (); }
private async void btnSave_Click(object sender, RoutedEventArgs e) { Narration outNarration = new Narration(); if (!isNew) { outNarration = InNarration; } if (!isNew) { outNarration.NarrationID = InNarration.NarrationID; } outNarration.OrphanID = InOrphan.OrphanID; outNarration.EntryDate = dtEntryDate.Date.Value.DateTime; outNarration.Subject = txtSubject.Text; outNarration.Note = txtNarration.Text; // Make sure you validate the above stuff...blows up otherwise. if (isNew) { if (AppSettings.UseWebApi) { using (var client = new HttpClient()) { var narrationRepo = new NarrationHttpRepository(client); var newNarration = new NarrationCreation { OrphanID = outNarration.OrphanID, Subject = outNarration.Subject, Note = outNarration.Note, EntryDate = outNarration.EntryDate }; await narrationRepo.AddNarrationAsync(newNarration); } } else { // Update to Database NarrationDataService.AddNarration(outNarration); } } else { // Go get the one of interest, then overwrite. if (AppSettings.UseWebApi) { using (var client = new HttpClient()) { var narrationRepo = new NarrationHttpRepository(client); var narrationUpdate = new NarrationUpdate { OrphanID = outNarration.OrphanID, Subject = outNarration.Subject, Note = outNarration.Note, EntryDate = outNarration.EntryDate }; await narrationRepo.UpdateNarrationAsync(outNarration.NarrationID, narrationUpdate); } } else { // Update to Database NarrationDataService.SaveNarration(InOrphan.OrphanID, outNarration); } } // Close the page OrphanMasterDetailPage.contentNarration.Hide(); }
private void AddToQueue(Narration narration) { _narrationQueue.Add(narration); }
public void Update(Narration pt) { pt.ObjectState = ObjectState.Modified; _unitOfWork.Repository <Narration>().Update(pt); }
/// <summary> /// Plays the given <see cref="Narration"/> and invokes a callback /// delegate once the narration exits. /// </summary> public void Narrate(Narration narration, NarrationCallback callback) { _callback = callback; Narrate(narration); }
public Narration Create(Narration pt) { pt.ObjectState = ObjectState.Added; _unitOfWork.Repository <Narration>().Insert(pt); return(pt); }
private void NotesListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { selectedNote = (Narration)(sender as ListView).SelectedItem; }
public void PlayNext(Narration narration) { queue.Clear(); Play(narration); }
public Narration Add(Narration pt) { _unitOfWork.Repository <Narration>().Insert(pt); return(pt); }
public void ForcePlay(Narration narration) { Stop(); Play(narration); }
public void Play(Narration narration) { queue.Enqueue(narration); }
private static AudioClip LoadAudioClip(Narration narration) { return(Resources.Load(narration.ToString()) as AudioClip); }
public ActionResult Post(Narration vm) { Narration pt = vm; if (ModelState.IsValid) { if (vm.NarrationId <= 0) { pt.CreatedDate = DateTime.Now; pt.ModifiedDate = DateTime.Now; pt.CreatedBy = User.Identity.Name; pt.ModifiedBy = User.Identity.Name; pt.ObjectState = Model.ObjectState.Added; _NarrationService.Create(pt); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(View("Create", vm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.Narration).DocumentTypeId, DocId = pt.NarrationId, ActivityType = (int)ActivityTypeContants.Added, })); return(RedirectToAction("Create").Success("Data saved successfully")); } else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); Narration temp = _NarrationService.Find(pt.NarrationId); Narration ExRec = Mapper.Map <Narration>(temp); temp.NarrationName = pt.NarrationName; temp.IsActive = pt.IsActive; temp.ModifiedDate = DateTime.Now; temp.ModifiedBy = User.Identity.Name; temp.ObjectState = Model.ObjectState.Modified; _NarrationService.Update(temp); LogList.Add(new LogTypeViewModel { ExObj = ExRec, Obj = temp, }); XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(View("Create", pt)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.Narration).DocumentTypeId, DocId = temp.NarrationId, ActivityType = (int)ActivityTypeContants.Modified, xEModifications = Modifications, })); return(RedirectToAction("Index").Success("Data saved successfully")); } } return(View("Create", vm)); }
public void Delete(Narration pt) { _unitOfWork.Repository <Narration>().Delete(pt); }
// Use this for initialization void Start() { narrator = GameObject.Find("Narrator").GetComponent <Narration> (); narrator.StartNarration("GameOver"); score.text = storage.score.ToString(); }
// Updates UI Elements to contain activeNarration's values private void updateUI() { // No narration, close dialog window if (activeNarration == null) { Narration next = activeThread.GetNext(); if (next == null) { body.gameObject.SetActive(false); speaker.gameObject.SetActive(false); if (GameManager.instance.GetFlag("HAS_CONTROL") == false) { GameManager.instance.TriggerFlag("HAS_CONTROL"); } if (GameManager.instance.GetFlag("DIALOGUE_VISIBLE") == false) { GameManager.instance.TriggerFlag("DIALOGUE_VISIBLE"); } StartCoroutine("cooldown"); DestroyAllButtons(); return; } else { activeNarration = next; } } // Populate text boxes if not empty if (!string.IsNullOrEmpty(activeNarration.speaker)) { speaker.gameObject.SetActive(true); speaker.GetComponentInChildren <TextMeshProUGUI>().text = activeNarration.speaker; } else { speaker.gameObject.SetActive(false); } body.gameObject.SetActive(true); body.GetComponentInChildren <TextMeshProUGUI>().text = string.IsNullOrWhiteSpace(activeNarration.body) ? "" : activeNarration.body; // Generate Button List string[] n_replies = activeNarration.GetReplies(); DestroyAllButtons(); for (int i = 0; i < n_replies.Length; i++) { // Create New Button GameObject b = (GameObject)Instantiate(Resources.Load("RuntimePrefabs/ReplyButton")); b.transform.SetParent(replyPool.transform, false); b.GetComponentInChildren <TextMeshProUGUI>().text = n_replies[i]; replies.Add(b.GetComponent <Button>()); } float offset = replies.Count == 0 ? -20 : -500; //Debug.Log(offset + " -> " + body.GetComponent<RectTransform>().offsetMax); body.GetComponent <RectTransform>().offsetMax = new Vector2(offset, body.GetComponent <RectTransform>().offsetMax.y); // Remove Sprites changeAlpha(left, 0); changeAlpha(right, 0); // Add sprite if necessary if (activeNarration != null && !String.IsNullOrWhiteSpace(activeNarration.sprite)) { Image activeSide = activeNarration.side == Narration.Direction.Right ? right : left; string[] callsign = activeNarration.sprite.Split('_'); activeSide.sprite = Resources.LoadAll <Sprite>(callsign[0])[int.Parse(callsign[1]) - 1]; changeAlpha(activeSide, 128f); } }