// Should be called by StoryManager after all stanzas are loaded. // Attaches swipe handlers so that StorybookEvent ROS messages get sent when stanzas are swiped. public void SetStanzaSwipeHandlers() { for (int i = 0; i < this.stanzas.Count; i++) { Stanza stanza = this.stanzas[i].GetComponent <Stanza>(); string text = stanza.GetStanzaText(); stanza.AddSwipeHandler(this.rosManager.SendStanzaSwipedAction(i, text)); } }
// Should be called by StoryManager after all stanzas are loaded. // Attaches swipe handlers so that StorybookEvent ROS messages get sent when stanzas are swiped. public void SetSentenceSwipeHandlers() { for (int i = 0; i < this.stanzas.Count; i++) { Stanza stanza = this.stanzas[i].GetComponent <Stanza>(); // TODO: consider only first stanza in the sentence needs a swipe handler. // Decided not to since it might confuse kids. int sentenceIndex = stanza.GetSentenceIndex(); string text = this.sentences[sentenceIndex].GetSentenceText(); stanza.AddSwipeHandler(this.rosManager.SendSentenceSwipedAction(sentenceIndex, text)); } }