SetData() public method

public SetData ( NTexture texture, FairyGUI.Frame frames, Rect boundsRect ) : void
texture NTexture
frames FairyGUI.Frame
boundsRect UnityEngine.Rect
return void
Ejemplo n.º 1
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();
            }
        }
Ejemplo n.º 2
0
        override public void ConstructFromResource()
        {
            sourceWidth  = packageItem.width;
            sourceHeight = packageItem.height;
            initWidth    = sourceWidth;
            initHeight   = sourceHeight;

            _content.interval    = packageItem.interval;
            _content.swing       = packageItem.swing;
            _content.repeatDelay = packageItem.repeatDelay;
            _content.SetData(packageItem.texture, packageItem.frames, new Rect(0, 0, sourceWidth, sourceHeight));

            SetSize(sourceWidth, sourceHeight);
        }
Ejemplo n.º 3
0
        override public void ConstructFromResource(PackageItem pkgItem)
        {
            _packageItem = pkgItem;

            sourceWidth  = _packageItem.width;
            sourceHeight = _packageItem.height;
            initWidth    = sourceWidth;
            initHeight   = sourceHeight;

            _packageItem.Load();
            _content.interval = _packageItem.interval;
            _content.SetData(_packageItem.texture, _packageItem.frames);
            _content.boundsRect = new Rect(0, 0, sourceWidth, sourceHeight);

            SetSize(sourceWidth, sourceHeight);
        }
Ejemplo n.º 4
0
        protected void LoadFromPackage(string itemURL)
        {
            _contentItem = UIPackage.GetItemByURL(itemURL);

            if (_contentItem != null)
            {
                _contentItem.Load();

                if (_contentItem.type == PackageItemType.Image)
                {
                    _content.texture        = _contentItem.texture;
                    _content.scale9Grid     = _contentItem.scale9Grid;
                    _content.scaleByTile    = _contentItem.scaleByTile;
                    _content.tileGridIndice = _contentItem.tileGridIndice;

                    _contentSourceWidth  = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;
                    UpdateLayout();
                }
                else if (_contentItem.type == PackageItemType.MovieClip)
                {
                    _contentSourceWidth  = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;

                    _content.interval    = _contentItem.interval;
                    _content.swing       = _contentItem.swing;
                    _content.repeatDelay = _contentItem.repeatDelay;
                    _content.SetData(_contentItem.texture, _contentItem.frames, new Rect(0, 0, _contentSourceWidth, _contentSourceHeight));

                    UpdateLayout();
                }
                else
                {
                    if (_autoSize)
                    {
                        this.SetSize(_contentItem.width, _contentItem.height);
                    }

                    SetErrorState();
                }
            }
            else
            {
                SetErrorState();
            }
        }
Ejemplo n.º 5
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));
     }
 }
Ejemplo n.º 6
0
        protected void LoadFromPackage(string itemURL)
        {
            _contentItem = UIPackage.GetItemByURL(itemURL);

            if (_contentItem != null)
            {
                _contentItem.Load();

                if (_contentItem.type == PackageItemType.Image)
                {
                    _content.texture        = _contentItem.texture;
                    _content.scale9Grid     = _contentItem.scale9Grid;
                    _content.scaleByTile    = _contentItem.scaleByTile;
                    _content.tileGridIndice = _contentItem.tileGridIndice;

                    _contentSourceWidth  = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;
                    UpdateLayout();
                }
                else if (_contentItem.type == PackageItemType.MovieClip)
                {
                    _contentSourceWidth  = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;

                    _content.interval    = _contentItem.interval;
                    _content.swing       = _contentItem.swing;
                    _content.repeatDelay = _contentItem.repeatDelay;
                    _content.SetData(_contentItem.texture, _contentItem.frames, new Rect(0, 0, _contentSourceWidth, _contentSourceHeight));

                    UpdateLayout();
                }
                else if (_contentItem.type == PackageItemType.Component)
                {
                    _contentSourceWidth  = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;

                    GObject obj = UIPackage.CreateObjectFromURL(itemURL);
                    if (obj == null)
                    {
                        SetErrorState();
                    }
                    else if (!(obj is GComponent))
                    {
                        obj.Dispose();
                        SetErrorState();
                    }
                    else
                    {
                        _content2 = (GComponent)obj;
                        ((Container)displayObject).AddChild(_content2.displayObject);
                        UpdateLayout();
                    }
                }
                else
                {
                    if (_autoSize)
                    {
                        this.SetSize(_contentItem.width, _contentItem.height);
                    }

                    SetErrorState();
                }
            }
            else
            {
                SetErrorState();
            }
        }