示例#1
0
        /// <summary>
        /// Loads a slide deck or opens a dialog to select a slide deck from disk.
        /// </summary>
        /// <param name="deck">The deck to load. If <c>null</c>, this method shows open file dialog.</param>
        public void LoadDeck(SlideDeck deck = null)
        {
            if (deck == null)
            {
#if UNITY_EDITOR
                var path = EditorUtility.OpenFilePanel("Open Slide Deck", Application.dataPath, "asset");
                if (string.IsNullOrEmpty(path))
                {
                    return;
                }
                path = Path.Combine("Assets", path.Substring(Application.dataPath.Length + 1));
                var newDeck = AssetDatabase.LoadAssetAtPath <SlideDeck>(path);
                if (newDeck == null)
                {
                    EditorUtility.DisplayDialog("Error!", "Couldn't load the presentation.", "OK");
                    return;
                }
                this.deck = newDeck;
#endif
            }
            else
            {
                this.deck = deck;
            }
        }
 private bool shouldSelect(SlideDeck deck, int index)
 {
     if (engine.SlideDeck != deck)
     {
         return(false);
     }
     if (!engine.IsPresenting)
     {
         return(false);
     }
     return(engine.CurrentSlideId == index);
 }
 private void itemPlayHandler(SlideDeck deck, int index)
 {
     if (engine.SlideDeck != deck)
     {
         return;
     }
     if (engine.IsPresenting)
     {
         engine.GotoSlide(index);
     }
     else
     {
         engine.StartPresentation(index);
     }
 }
示例#4
0
 /// <summary>
 /// Creates a new Slide Deck.
 /// </summary>
 /// <returns>The deck.</returns>
 public SlideDeck NewDeck()
 {
     deck           = CreateInstance <SlideDeck>();
     deck.hideFlags = HideFlags.HideAndDontSave;
     return(deck);
 }