예제 #1
0
        public static UIMotion CreateAndStart(Widget widget, string filePath)
        {
            UIMotion uIMotion = new UIMotion(widget, filePath);

            uIMotion.Start();
            return(uIMotion);
        }
예제 #2
0
            public uint InitLayer(UIAnimationPlayer.Layer parent, UIAnimationPlayer.UIAnimationData.Layer layerData, float x, float y, UIAnimationPlayer.UIAnimationData data)
            {
                uint        num       = 0u;
                List <uint> list      = new List <uint>();
                List <uint> list2     = new List <uint>();
                UIMotion    uIMotion  = null;
                UIMotion    uIMotion2 = null;

                this.timeLineForChildren.FrameRate = data.header.frameRate;
                this.SetPosition(x, y);
                using (List <UIAnimationPlayer.UIAnimationData.Frame> .Enumerator enumerator = layerData.frames.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        UIAnimationPlayer.UIAnimationData.Frame current = enumerator.Current;
                        if (current.instance != null)
                        {
                            UIAnimationPlayer.UIAnimationData.Instance instance = current.instance;
                            if (instance.header.hasBitmap && !list.Contains(instance.header.bitmapId))
                            {
                                this.SetPosition(x + instance.header.translationX + instance.header.matrix41, y + instance.header.translationY + instance.header.matrix42);
                                Widget widget = this.CreateBitmap(data.bitmaps[(int)instance.header.bitmapId]);
                                widget.SetSize(widget.Width * instance.header.scaleX, widget.Height * instance.header.scaleY);
                                this.transformRoot.AddChildLast(widget);
                                list.Add(instance.header.bitmapId);
                            }
                            if (instance.header.hasSymbol && !list2.Contains(instance.header.symbolId))
                            {
                                this.transformRoot.SetPosition(instance.header.transPointX, instance.header.transPointY);
                                this.SetPosition(x + instance.header.translationX + instance.header.matrix41, y + instance.header.translationY + instance.header.matrix42);
                                UIAnimationPlayer.UIAnimationData.Symbol symbol = data.symbols[(int)instance.header.symbolId];
                                using (List <UIAnimationPlayer.UIAnimationData.Layer> .Enumerator enumerator2 = symbol.timeLines[0].layers.GetEnumerator())
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        UIAnimationPlayer.UIAnimationData.Layer current2 = enumerator2.Current;
                                        UIAnimationPlayer.Layer layer = new UIAnimationPlayer.Layer();
                                        uint num2 = layer.InitLayer(this, current2, -instance.header.transPointX, -instance.header.transPointY, data);
                                        this.transformRoot.AddChildLast(layer);
                                        this.childLayers.Add(layer);
                                        if (this.timeLineForChildren.Duration < num2)
                                        {
                                            this.timeLineForChildren.Duration = num2;
                                        }
                                    }
                                }
                                list2.Add(instance.header.symbolId);
                            }
                            if (current.header.hasMotion)
                            {
                                UIMotion uIMotion3 = new UIMotion(this.transformRoot, current.motion);
                                this.motions.Add(uIMotion3);
                                if (uIMotion != null)
                                {
                                    uIMotion.EffectStopped -= new EventHandler <EventArgs>(this.OnEffectStopped);
                                }
                                uIMotion3.EffectStopped += new EventHandler <EventArgs>(this.OnEffectStopped);
                                this.motionStartTimes.Add(uIMotion3, this.timeLineForChildren.GetTimeFromFrameIndex(current.header.index));
                                uIMotion2 = uIMotion3;
                                uIMotion  = uIMotion3;
                            }
                            else
                            {
                                uIMotion = null;
                            }
                            this.instanceName = instance.name;
                            this.timeLineForChildren.Repeating = instance.header.repeating;
                            uint num3 = current.header.index + current.header.duration;
                            if (num < num3)
                            {
                                num = num3;
                            }
                        }
                    }
                }
                if (uIMotion2 != null)
                {
                    uIMotion2.EffectStopped -= new EventHandler <EventArgs>(this.OnEffectStopped);
                }
                this.initialTransform3Droot  = this.Transform3D;
                this.initialTransform3Dtroot = this.transformRoot.Transform3D;
                return(num);
            }