示例#1
0
 override protected void CreateDisplayObject()
 {
     _content        = new MovieClip();
     _content.gOwner = this;
     _content.playState.ignoreTimeScale = true;
     displayObject = _content;
 }
示例#2
0
 static public int SetPlaySettings(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             FairyGUI.MovieClip self = (FairyGUI.MovieClip)checkSelf(l);
             self.SetPlaySettings();
             pushValue(l, true);
             return(1);
         }
         else if (argc == 5)
         {
             FairyGUI.MovieClip self = (FairyGUI.MovieClip)checkSelf(l);
             System.Int32       a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             System.Int32 a3;
             checkType(l, 4, out a3);
             System.Int32 a4;
             checkType(l, 5, out a4);
             self.SetPlaySettings(a1, a2, a3, a4);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#3
0
        public void Update(MovieClip mc, UpdateContext context)
        {
            if (_lastUpdateSeq == context.workCount) //PlayState may be shared, only update once per frame
                return;

            _lastUpdateSeq = context.workCount;
            float time = Time.time;
            float elapsed = time - _lastTime;
            _lastTime = time;

            reachEnding = false;
            frameStarting = false;
            _curFrameDelay += elapsed;
            int realFrame = reversed ? mc.frameCount - _curFrame - 1 : _curFrame;
            float interval = mc.interval + mc.frames[realFrame].addDelay + ((realFrame == 0 && repeatedCount > 0) ? mc.repeatDelay : 0);
            if (_curFrameDelay < interval)
                return;

            _curFrameDelay = 0;
            _curFrame++;
            frameStarting = true;

            if (_curFrame > mc.frameCount - 1)
            {
                _curFrame = 0;
                repeatedCount++;
                reachEnding = true;
                if (mc.swing)
                {
                    reversed = !reversed;
                    _curFrame++;
                }
            }
        }
示例#4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="anotherMc"></param>
 public void SyncStatus(MovieClip anotherMc)
 {
     _frame         = anotherMc._frame;
     _frameElapsed  = anotherMc._frameElapsed;
     _reversed      = anotherMc._reversed;
     _repeatedCount = anotherMc._repeatedCount;
     _displayFrame  = -1;
 }
示例#5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="anotherMc"></param>
 public void SyncStatus(MovieClip anotherMc)
 {
     _frame         = anotherMc._frame;
     _frameElapsed  = anotherMc._frameElapsed;
     _reversed      = anotherMc._reversed;
     _repeatedCount = anotherMc._repeatedCount;
     DrawFrame();
 }
示例#6
0
 override protected void CreateDisplayObject()
 {
     displayObject        = new Container("GLoader");
     displayObject.gOwner = this;
     _content             = new MovieClip();
     ((Container)displayObject).AddChild(_content);
     ((Container)displayObject).opaque = true;
 }
        public void Update(MovieClip mc, UpdateContext context)
        {
            if (_lastUpdateFrameId == UpdateContext.frameId) //PlayState may be shared, only update once per frame
                return;

            _lastUpdateFrameId = UpdateContext.frameId;
            float time = Time.time;
            float elapsed = time - _lastTime;
            if (ignoreTimeScale && Time.timeScale != 0)
                elapsed /= Time.timeScale;
            _lastTime = time;

            reachEnding = false;
            _curFrameDelay += elapsed;
            float interval = mc.interval + mc.frames[_curFrame].addDelay + ((_curFrame == 0 && repeatedCount > 0) ? mc.repeatDelay : 0);
            if (_curFrameDelay < interval)
                return;

            _curFrameDelay = 0;
            if (mc.swing)
            {
                if (reversed)
                {
                    _curFrame--;
                    if (_curFrame < 0)
                    {
                        _curFrame = Mathf.Min(1, mc.frameCount - 1);
                        repeatedCount++;
                        reversed = !reversed;
                    }
                }
                else
                {
                    _curFrame++;
                    if (_curFrame > mc.frameCount - 1)
                    {
                        _curFrame = Mathf.Max(0, mc.frameCount - 2);
                        repeatedCount++;
                        reachEnding = true;
                        reversed = !reversed;
                    }
                }
            }
            else
            {
                _curFrame++;
                if (_curFrame > mc.frameCount - 1)
                {
                    _curFrame = 0;
                    repeatedCount++;
                    reachEnding = true;
                }
            }
        }
示例#8
0
 static public int get_repeatDelay(IntPtr l)
 {
     try {
         FairyGUI.MovieClip self = (FairyGUI.MovieClip)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.repeatDelay);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#9
0
 static public int get_currentFrame(IntPtr l)
 {
     try {
         FairyGUI.MovieClip self = (FairyGUI.MovieClip)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.currentFrame);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#10
0
 static public int Clear(IntPtr l)
 {
     try {
         FairyGUI.MovieClip self = (FairyGUI.MovieClip)checkSelf(l);
         self.Clear();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#11
0
        protected void LoadFromPackage(string itemURL)
        {
            _contentItem = UIPackage.GetItemByURL(itemURL);

            if (_contentItem != null)
            {
                _contentItem.Load();
                if (_contentItem.type == PackageItemType.Image)
                {
                    _image.texture     = _contentItem.texture;
                    _image.scale9Grid  = _contentItem.scale9Grid;
                    _image.scaleByTile = _contentItem.scaleByTile;
                    _activeObject      = _image;

                    _contentSourceWidth  = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;
                    UpdateLayout();
                }
                else if (_contentItem.type == PackageItemType.MovieClip)
                {
                    if (_movieClip == null)
                    {
                        _movieClip = new MovieClip();
                        if (grayed)
                        {
                            _movieClip.SetGrayed(true);
                        }
                        _container.AddChild(_movieClip);
                    }

                    _contentSourceWidth  = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;

                    _movieClip.interval = _contentItem.interval;
                    _movieClip.SetData(_contentItem.texture, _contentItem.frames);
                    _movieClip.boundsRect   = new Rect(0, 0, _contentSourceWidth, _contentSourceHeight);
                    _movieClip.playing      = _playing;
                    _movieClip.currentFrame = _frame;
                    _activeObject           = _movieClip;

                    UpdateLayout();
                }
                else
                {
                    SetErrorState();
                }
            }
            else
            {
                SetErrorState();
            }
        }
示例#12
0
 static public int constructor(IntPtr l)
 {
     try {
         FairyGUI.MovieClip o;
         o = new FairyGUI.MovieClip();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#13
0
 static public int Update(IntPtr l)
 {
     try {
         FairyGUI.MovieClip     self = (FairyGUI.MovieClip)checkSelf(l);
         FairyGUI.UpdateContext a1;
         checkType(l, 2, out a1);
         self.Update(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#14
0
 static public int set_repeatDelay(IntPtr l)
 {
     try {
         FairyGUI.MovieClip self = (FairyGUI.MovieClip)checkSelf(l);
         System.Single      v;
         checkType(l, 2, out v);
         self.repeatDelay = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#15
0
 static public int set_currentFrame(IntPtr l)
 {
     try {
         FairyGUI.MovieClip self = (FairyGUI.MovieClip)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.currentFrame = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#16
0
 static public int set_playing(IntPtr l)
 {
     try {
         FairyGUI.MovieClip self = (FairyGUI.MovieClip)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.playing = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#17
0
 static int Update(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FairyGUI.PlayState     obj  = (FairyGUI.PlayState)ToLua.CheckObject <FairyGUI.PlayState>(L, 1);
         FairyGUI.MovieClip     arg0 = (FairyGUI.MovieClip)ToLua.CheckObject <FairyGUI.MovieClip>(L, 2);
         FairyGUI.UpdateContext arg1 = (FairyGUI.UpdateContext)ToLua.CheckObject <FairyGUI.UpdateContext>(L, 3);
         obj.Update(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#18
0
    static int get_movieClip(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GLoader   obj = (FairyGUI.GLoader)o;
            FairyGUI.MovieClip ret = obj.movieClip;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index movieClip on a nil value" : e.Message));
        }
    }
示例#19
0
 static public int SetData(IntPtr l)
 {
     try {
         FairyGUI.MovieClip self = (FairyGUI.MovieClip)checkSelf(l);
         FairyGUI.NTexture  a1;
         checkType(l, 2, out a1);
         FairyGUI.MovieClip.Frame[] a2;
         checkArray(l, 3, out a2);
         UnityEngine.Rect a3;
         checkValueType(l, 4, out a3);
         self.SetData(a1, a2, a3);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#20
0
        public void Update(MovieClip mc, UpdateContext context)
        {
            if (_lastUpdateFrameId == context.frameId)             //PlayState may be shared, only update once per frame
            {
                return;
            }

            _lastUpdateFrameId = context.frameId;
            float time    = Time.time;
            float elapsed = time - _lastTime;

            if (ignoreTimeScale && Time.timeScale != 0)
            {
                elapsed /= Time.timeScale;
            }
            _lastTime = time;

            reachEnding     = false;
            frameStarting   = false;
            _curFrameDelay += elapsed;
            int   realFrame = reversed ? mc.frameCount - _curFrame - 1 : _curFrame;
            float interval  = mc.interval + mc.frames[realFrame].addDelay + ((realFrame == 0 && repeatedCount > 0) ? mc.repeatDelay : 0);

            if (_curFrameDelay < interval)
            {
                return;
            }

            _curFrameDelay = 0;
            _curFrame++;
            frameStarting = true;

            if (_curFrame > mc.frameCount - 1)
            {
                _curFrame = 0;
                repeatedCount++;
                reachEnding = true;
                if (mc.swing)
                {
                    reversed = !reversed;
                    _curFrame++;
                }
            }
        }
示例#21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mc"></param>
        /// <param name="context"></param>
        public void Update(MovieClip mc, UpdateContext context)
        {
            float elapsed;
            int   frameId = Time.frameCount;

            if (frameId - _lastUpdateFrameId != 1)
            {
                //1、如果>1,表示不是连续帧了,说明刚启动(或者停止过),这里不能用流逝的时间了,不然会跳过很多帧
                //2、如果==0,表示在本帧已经处理过了,这通常是因为一个PlayState用于多个MovieClip共享,目的是多个MovieClip同步播放
                elapsed = 0;
            }
            else if (ignoreTimeScale)
            {
                elapsed = Time.unscaledDeltaTime;
            }
            else
            {
                elapsed = Time.deltaTime;
            }
            _lastUpdateFrameId = frameId;

            reachEnding     = false;
            _curFrameDelay += elapsed;
            float interval = mc.interval + mc.frames[_curFrame].addDelay + ((_curFrame == 0 && repeatedCount > 0) ? mc.repeatDelay : 0);

            if (_curFrameDelay < interval)
            {
                return;
            }

            _curFrameDelay -= interval;
            if (_curFrameDelay > mc.interval)
            {
                _curFrameDelay = mc.interval;
            }

            if (mc.swing)
            {
                if (reversed)
                {
                    _curFrame--;
                    if (_curFrame <= 0)
                    {
                        _curFrame = 0;
                        repeatedCount++;
                        reversed = !reversed;
                    }
                }
                else
                {
                    _curFrame++;
                    if (_curFrame > mc.frameCount - 1)
                    {
                        _curFrame = Mathf.Max(0, mc.frameCount - 2);
                        repeatedCount++;
                        reachEnding = true;
                        reversed    = !reversed;
                    }
                }
            }
            else
            {
                _curFrame++;
                if (_curFrame > mc.frameCount - 1)
                {
                    _curFrame = 0;
                    repeatedCount++;
                    reachEnding = true;
                }
            }
        }
 protected override void CreateDisplayObject()
 {
     _content = new MovieClip();
     _content.gOwner = this;
     _content.playState.ignoreTimeScale = true;
     displayObject = _content;
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="mc"></param>
        /// <param name="context"></param>
        public void Update(MovieClip mc, UpdateContext context)
        {
            if (_lastUpdateFrameId == UpdateContext.frameId)             //PlayState may be shared, only update once per frame
            {
                return;
            }

            _lastUpdateFrameId = UpdateContext.frameId;
            float time    = Time.time;
            float elapsed = time - _lastTime;

            if (ignoreTimeScale && Time.timeScale != 0)
            {
                elapsed /= Time.timeScale;
            }
            _lastTime = time;

            reachEnding     = false;
            _curFrameDelay += elapsed;
            float interval = mc.interval + mc.frames[_curFrame].addDelay + ((_curFrame == 0 && repeatedCount > 0) ? mc.repeatDelay : 0);

            if (_curFrameDelay < interval)
            {
                return;
            }

            _curFrameDelay -= interval;
            if (_curFrameDelay > mc.interval)
            {
                _curFrameDelay = mc.interval;
            }

            if (mc.swing)
            {
                if (reversed)
                {
                    _curFrame--;
                    if (_curFrame < 0)
                    {
                        _curFrame = Mathf.Min(1, mc.frameCount - 1);
                        repeatedCount++;
                        reversed = !reversed;
                    }
                }
                else
                {
                    _curFrame++;
                    if (_curFrame > mc.frameCount - 1)
                    {
                        _curFrame = Mathf.Max(0, mc.frameCount - 2);
                        repeatedCount++;
                        reachEnding = true;
                        reversed    = !reversed;
                    }
                }
            }
            else
            {
                _curFrame++;
                if (_curFrame > mc.frameCount - 1)
                {
                    _curFrame = 0;
                    repeatedCount++;
                    reachEnding = true;
                }
            }
        }
示例#24
0
        protected void LoadFromPackage(string itemURL)
        {
            _contentItem = UIPackage.GetItemByURL(itemURL);

            if (_contentItem != null)
            {
                _contentItem.Load();
                if (_contentItem.type == PackageItemType.Image)
                {
                    _image.texture = _contentItem.texture;
                    _image.scale9Grid = _contentItem.scale9Grid;
                    _image.scaleByTile = _contentItem.scaleByTile;
                    _activeObject = _image;

                    _contentSourceWidth = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;
                    UpdateLayout();
                }
                else if (_contentItem.type == PackageItemType.MovieClip)
                {
                    if (_movieClip == null)
                    {
                        _movieClip = new MovieClip();
                        if (grayed)
                            _movieClip.SetGrayed(true);
                        _container.AddChild(_movieClip);
                    }
                    _movieClip.interval = _contentItem.interval;
                    _movieClip.frames = _contentItem.frames;
                    _movieClip.boundsRect = new Rect(0, 0, _contentSourceWidth, _contentSourceHeight);
                    _movieClip.playing = _playing;
                    _movieClip.currentFrame = _frame;
                    _activeObject = _movieClip;

                    _contentSourceWidth = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;
                    UpdateLayout();
                }
                else
                    SetErrorState();
            }
            else
                SetErrorState();
        }
示例#25
0
 override protected void CreateDisplayObject()
 {
     _content        = new MovieClip();
     _content.gOwner = this;
     displayObject   = _content;
 }
示例#26
0
 protected override void CreateDisplayObject()
 {
     _content = new MovieClip();
     _content.gOwner = this;
     displayObject = _content;
 }
示例#27
0
 protected override void CreateDisplayObject()
 {
     displayObject = new Container("GLoader");
     displayObject.gOwner = this;
     _content = new MovieClip();
     ((Container)displayObject).AddChild(_content);
     ((Container)displayObject).opaque = true;
 }