public static void RunOption(PowerUI.MouseEvent e) { Dom.Node targetNode = (e.target as Dom.Node); // Get the unique ID: int uniqueId; if (!int.TryParse(targetNode.getAttribute("unique-id"), out uniqueId)) { Dom.Log.Add("A dialogue option did not have an unique-id attribute."); return; } // Get the widget: DialogueWidget dw = e.targetWidget as DialogueWidget; if (dw == null) { Dom.Log.Add("A dialogue option tried to run but it's not inside a DialogueWidget."); return; } // Great ok - we can now grab the active options entry. // Select the active slide with that unique ID: PowerSlide.DialogueSlide slide = dw.getSlide(uniqueId) as PowerSlide.DialogueSlide; if (slide == null) { Dom.Log.Add("Unable to resolve a DialogueSlide from a unique-id."); return; } // Get the GOTO: string gotoUrl = slide.slidesToGoTo; if (string.IsNullOrEmpty(gotoUrl)) { // Acts just like a continue does. // Just cue it: dw.timeline.cue(); return; } // Load it now (into the existing timeline): PowerSlide.Timeline.open(gotoUrl, PowerSlide.Dialogue.basePath, dw.timeline).then(delegate(object o){ // Successfully opened it! Should already be running, but just incase: PowerSlide.Timeline timeline = o as PowerSlide.Timeline; // Start: timeline.start(); }, delegate(object failure){ // Failed! Dom.Log.Add("Failed to load a timeline from an option URI: " + failure); }); // dw.timeline.document.startDialogue(gotoUrl,dw.Timeline.template); // Kill the event: e.stopPropagation(); }
/// <summary>Called when the given slide requested to hide. /// Note that there may be multiple visible slides.</summary> protected virtual void Hide(PowerSlide.DialogueSlide dialogue) { }