示例#1
0
 public Start(Animation animation, Unlock unlock, int introVideoWaitPeriod)
 {
     Animation = animation;
     Unlock = unlock;
     IntroVideoWaitPeriod = introVideoWaitPeriod;
 }
示例#2
0
        /// <summary>
        /// Gets the Start tag from the Ripple XML.
        /// </summary>
        /// <param name="tagContent"></param>
        /// <param name="animation"></param>
        /// <param name="unlock"></param>
        /// <param name="introVideoWaitPeriod"></param>
        /// <exception cref="System.FormatException
        ///     System.OverflowException
        ///     System.ArgumentNullException
        ///     RippleDictionary.UndefinedUnlockException" />
        private static void GetStartContent(XElement tagContent, out Animation animation, out Unlock unlock, out int introVideoWaitPeriod)
        {
            animation = null;
            unlock = null;
            introVideoWaitPeriod = 30; //Default

            foreach (var startContent in tagContent.Elements())
            {
                if (startContent.Name == XMLElementsAndAttributes.Animation)
                {
                    string animationName = startContent.Attribute(XMLElementsAndAttributes.Name).Value;
                    string animationContent = startContent.Attribute(XMLElementsAndAttributes.Content).Value;
                    string animationType = startContent.Attribute(XMLElementsAndAttributes.AnimationType).Value;

                    animation = new Animation(animationName, animationContent, GetAnimationType(animationType));
                }
                else if (startContent.Name == XMLElementsAndAttributes.Unlock)
                {
                    string mode = startContent.Attribute(XMLElementsAndAttributes.Mode).Value;
                    string unlockType = startContent.Attribute(XMLElementsAndAttributes.UnlockType).Value;

                    unlock = new Unlock(GetMode(mode), unlockType);
                }
                else if (startContent.Name == XMLElementsAndAttributes.IntroVideoWaitPeriod)
                {
                    string waitPeriod = startContent.Attribute(XMLElementsAndAttributes.Value).Value;

                    introVideoWaitPeriod = Convert.ToInt32(waitPeriod);
                }
            }

            if (unlock == null)
            {
                throw new UndefinedUnlockException();
            }
        }