Ejemplo n.º 1
0
        private static UISAnimationTime AnimationTime()
        {
            UISNumber start;

            if (Test(Tag.LeftPar))
            {
                Expect(Tag.LeftPar);
                start = Expr() as UISNumber;
                ExpectGrammar(Tag.Split);
                if (Test(Tag.Add))
                {
                    ExpectGrammar(Tag.Add);
                }
                else
                {
                    return(new UISAnimationTime(start, Expr() as UISNumber));
                }

                UISNumber end = Expr() as UISNumber;
                ExpectGrammar(Tag.RightPar);

                return(new UISAnimationTime(start, end, true));
            }
            else
            {
                start = Expr() as UISNumber;
                return(new UISAnimationTime(start, new UISNumber(0), false));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// <para>Read animation repeat like (rA), (A, rB)</para>
        /// <see cref="AnimationRepeat"/> -> <see cref="UISAnimationRepeat"/>
        /// </summary>
        /// <returns></returns>
        private static UISAnimationRepeat AnimationRepeat()
        {
            bool      isLoop      = false;
            bool      allowSplit  = false;
            UISNumber repeatCount = null;
            UISNumber repeatTime  = null;

            if (Expect(Tag.LeftPar))
            {
                allowSplit = true;
            }
            if (Test(Tag.IDENTITY))
            {
                string repeatCountLiteral = (look as Word).Lexeme;
                if (repeatCountLiteral.StartsWith("r"))
                {
                    isLoop             = true;
                    repeatCountLiteral = repeatCountLiteral.Substring(1);
                    if (int.TryParse(repeatCountLiteral, out int result))
                    {
                        repeatCount = new UISNumber(result);
                        ExpectGrammar(Tag.IDENTITY);
                    }
                }
                else
                {
                    ThrowError(new UISUnsupportAnimationRepeatException((look as Word).Lexeme));
                }
            }
            else if (Test(Tag.NUMBER))
            {
                repeatCount = Expr() as UISNumber;
            }

            if (allowSplit && Test(Tag.Split))
            {
                ExpectGrammar(Tag.Split);
                repeatTime = Expr() as UISNumber;
            }
            else
            {
                repeatTime = new UISNumber(0);
            }

            if (allowSplit)
            {
                ExpectGrammar(Tag.RightPar);
            }
            return(new UISAnimationRepeat(repeatCount, repeatTime, isLoop));
        }
Ejemplo n.º 3
0
        private static UISList <UISNumber> Indexs()
        {
            ExpectGrammar(Tag.LeftBar);
            UISList <UISNumber> lists = new UISList <UISNumber>();

            do
            {
                lists.Add(Expr() as UISNumber);
            } while (Expect(Tag.Split));
            //[2.1更新]: 支持_sprite-[1-3]形式的写法以简化多个元素同时定义的场景
            if (Expect(Tag.Index))
            {
                UISNumber end = Expr() as UISNumber;
                lists.AddAll(Enumerable
                             .Range((int)lists.First().Number + 1,
                                    (int)end.Number)
                             .Select(p => new UISNumber(p)));
            }
            ExpectGrammar(Tag.RightBar);
            return(lists);
        }
Ejemplo n.º 4
0
 protected override void Refresh()
 {
     FRAME    = FindPropertyDefine <UISFrameFile>(Property.FRAME);
     INTERVAL = FindPropertyDefine <UISNumber>(Property.INTERVAL);
     BLEND    = FindPropertyDefine <UISNumber>(Property.BLEND);
 }
Ejemplo n.º 5
0
 protected override void Refresh()
 {
     FLIP  = FindPropertyDefine <UISNumber>(Property.FLIP);
     BLEND = FindPropertyDefine <UISNumber>(Property.BLEND);
 }