Exemple #1
0
    static int AddTextureAtlasData(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                DragonBones.BaseFactory      obj  = (DragonBones.BaseFactory)ToLua.CheckObject <DragonBones.BaseFactory>(L, 1);
                DragonBones.TextureAtlasData arg0 = (DragonBones.TextureAtlasData)ToLua.CheckObject <DragonBones.TextureAtlasData>(L, 2);
                obj.AddTextureAtlasData(arg0);
                return(0);
            }
            else if (count == 3)
            {
                DragonBones.BaseFactory      obj  = (DragonBones.BaseFactory)ToLua.CheckObject <DragonBones.BaseFactory>(L, 1);
                DragonBones.TextureAtlasData arg0 = (DragonBones.TextureAtlasData)ToLua.CheckObject <DragonBones.TextureAtlasData>(L, 2);
                string arg1 = ToLua.CheckString(L, 3);
                obj.AddTextureAtlasData(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: DragonBones.BaseFactory.AddTextureAtlasData"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
        /// <inheritDoc/>
        protected override TextureAtlasData _BuildTextureAtlasData(TextureAtlasData textureAtlasData, object textureAtlas)
        {
            if (textureAtlasData != null)
            {
                if (textureAtlas != null)
                {
                    //if ((textureAtlas as Material).name.IndexOf("UI_Mat") > -1)
                    //{
                    //    (textureAtlasData as UnityTextureAtlasData).uiTexture = textureAtlas as Material;
                    //}
                    //else
                    //{
                    //    (textureAtlasData as UnityTextureAtlasData).texture = textureAtlas as Material;
                    //}

                    (textureAtlasData as UnityTextureAtlasData).uiTexture = (textureAtlas as UnityDragonBonesData.TextureAtlas).uiMaterial;
                    (textureAtlasData as UnityTextureAtlasData).texture   = (textureAtlas as UnityDragonBonesData.TextureAtlas).material;
                }
            }
            else
            {
                textureAtlasData = BaseObject.BorrowObject <UnityTextureAtlasData>();
            }

            return(textureAtlasData);
        }
Exemple #3
0
        public Rectangle frame = null; // Initial value.

        protected override void _OnClear()
        {
            this.rotated = false;
            this.name    = "";
            this.region.Clear();
            this.parent = null; //
            this.frame  = null;
        }
 protected override void _onClear()
 {
     rotated = false;
     name    = null;
     region.Clear();
     frame  = null;
     parent = null;
 }
Exemple #5
0
        /**
         * @private
         */
        protected override void _OnClear()
        {
            if (this._clock != null)
            {
                // Remove clock first.
                this._clock.Remove(this);
            }

            foreach (var bone in this._bones)
            {
                bone.ReturnToPool();
            }

            foreach (var slot in this._slots)
            {
                slot.ReturnToPool();
            }

            if (this._animation != null)
            {
                this._animation.ReturnToPool();
            }

            if (this._proxy != null)
            {
                this._proxy.DBClear();
            }

            if (this._replaceTextureAtlasData != null)
            {
                this._replaceTextureAtlasData.ReturnToPool();
            }

            this.inheritAnimation = true;
            this.armatureData     = null; //
            this.userData         = null;

            this._lockUpdate      = false;
            this._bonesDirty      = false;
            this._slotsDirty      = false;
            this._zOrderDirty     = false;
            this._flipX           = false;
            this._flipY           = false;
            this._cacheFrameIndex = -1;
            this._bones.Clear();
            this._slots.Clear();
            this._actions.Clear();
            this._animation = null; //
            this._proxy     = null; //
            this._display   = null;
            this._replaceTextureAtlasData = null;
            this._replacedTexture         = null;
            this._dragonBones             = null; //
            this._clock  = null;
            this._parent = null;
        }
        /// <summary>
        /// - Cache a TextureAtlasData instance to the factory.
        /// </summary>
        /// <param name="data">- The TextureAtlasData instance.</param>
        /// <param name="name">- Specify a cache name for the instance so that the instance can be obtained through this name. (if not set, use the instance name instead)</param>
        /// <see cref="ParseTextureAtlasData()"/>
        /// <see cref="GetTextureAtlasData()"/>
        /// <see cref="RemoveTextureAtlasData()"/>
        /// <see cref="DragonBones.TextureAtlasData"/>
        /// <version>DragonBones 3.0</version>
        /// <language>en_US</language>

        /// <summary>
        /// - 将 TextureAtlasData 实例缓存到工厂中。
        /// </summary>
        /// <param name="data">- TextureAtlasData 实例。</param>
        /// <param name="name">- 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)</param>
        /// <see cref="ParseTextureAtlasData()"/>
        /// <see cref="GetTextureAtlasData()"/>
        /// <see cref="RemoveTextureAtlasData()"/>
        /// <see cref="DragonBones.TextureAtlasData"/>
        /// <version>DragonBones 3.0</version>
        /// <language>zh_CN</language>
        public void AddTextureAtlasData(TextureAtlasData data, string name = null)
        {
            name = !string.IsNullOrEmpty(name) ? name : data.name;
            var textureAtlasList = (this._textureAtlasDataMap.ContainsKey(name)) ?
                                   this._textureAtlasDataMap[name] :
                                   (this._textureAtlasDataMap[name] = new List <TextureAtlasData>());

            if (!textureAtlasList.Contains(data))
            {
                textureAtlasList.Add(data);
            }
        }
        /**
         * @private
         */
        override protected TextureAtlasData _generateTextureAtlasData(TextureAtlasData textureAtlasData, object textureAtlas)
        {
            if (textureAtlasData != null)
            {
                (textureAtlasData as UnityTextureAtlasData).texture = textureAtlas as Texture2D;
            }
            else
            {
                textureAtlasData = BaseObject.BorrowObject <UnityTextureAtlasData>();
            }

            return(textureAtlasData);
        }
Exemple #8
0
 static int AddTextureAtlasData(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         DragonBones.BaseFactory      obj  = (DragonBones.BaseFactory)ToLua.CheckObject(L, 1, typeof(DragonBones.BaseFactory));
         DragonBones.TextureAtlasData arg0 = (DragonBones.TextureAtlasData)ToLua.CheckObject(L, 2, typeof(DragonBones.TextureAtlasData));
         string arg1 = ToLua.CheckString(L, 3);
         obj.AddTextureAtlasData(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #9
0
    static int ParseTextureAtlasData(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3)
            {
                DragonBones.BaseFactory obj = (DragonBones.BaseFactory)ToLua.CheckObject <DragonBones.BaseFactory>(L, 1);
                System.Collections.Generic.Dictionary <string, object> arg0 = (System.Collections.Generic.Dictionary <string, object>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.Dictionary <string, object>));
                object arg1 = ToLua.ToVarObject(L, 3);
                DragonBones.TextureAtlasData o = obj.ParseTextureAtlasData(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 4)
            {
                DragonBones.BaseFactory obj = (DragonBones.BaseFactory)ToLua.CheckObject <DragonBones.BaseFactory>(L, 1);
                System.Collections.Generic.Dictionary <string, object> arg0 = (System.Collections.Generic.Dictionary <string, object>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.Dictionary <string, object>));
                object arg1 = ToLua.ToVarObject(L, 3);
                string arg2 = ToLua.CheckString(L, 4);
                DragonBones.TextureAtlasData o = obj.ParseTextureAtlasData(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 5)
            {
                DragonBones.BaseFactory obj = (DragonBones.BaseFactory)ToLua.CheckObject <DragonBones.BaseFactory>(L, 1);
                System.Collections.Generic.Dictionary <string, object> arg0 = (System.Collections.Generic.Dictionary <string, object>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.Dictionary <string, object>));
                object arg1 = ToLua.ToVarObject(L, 3);
                string arg2 = ToLua.CheckString(L, 4);
                float  arg3 = (float)LuaDLL.luaL_checknumber(L, 5);
                DragonBones.TextureAtlasData o = obj.ParseTextureAtlasData(arg0, arg1, arg2, arg3);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: DragonBones.BaseFactory.ParseTextureAtlasData"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemple #10
0
 static int ParseTextureAtlasData(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 5);
         DragonBones.BaseFactory obj = (DragonBones.BaseFactory)ToLua.CheckObject(L, 1, typeof(DragonBones.BaseFactory));
         System.Collections.Generic.Dictionary <string, object> arg0 = (System.Collections.Generic.Dictionary <string, object>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.Dictionary <string, object>));
         object arg1 = ToLua.ToVarObject(L, 3);
         string arg2 = ToLua.CheckString(L, 4);
         float  arg3 = (float)LuaDLL.luaL_checknumber(L, 5);
         DragonBones.TextureAtlasData o = obj.ParseTextureAtlasData(arg0, arg1, arg2, arg3);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #11
0
        public virtual void CopyFrom(TextureData value)
        {
            this.rotated = value.rotated;
            this.name    = value.name;
            this.region.CopyFrom(value.region);
            this.parent = value.parent;

            if (this.frame == null && value.frame != null)
            {
                this.frame = TextureData.CreateRectangle();
            }
            else if (this.frame != null && value.frame == null)
            {
                this.frame = null;
            }

            if (this.frame != null && value.frame != null)
            {
                this.frame.CopyFrom(value.frame);
            }
        }
        public void CopyFrom(TextureData value)
        {
            rotated = value.rotated;
            name    = value.name;

            if (frame == null && value.frame == null)
            {
                frame = GenerateRectangle();
            }
            else if (frame != null && value.frame == null)
            {
                frame = null;
            }

            if (frame != null && value.frame != null)
            {
                frame.CopyFrom(value.frame);
            }

            parent = value.parent;
            region.CopyFrom(value.region);
        }
Exemple #13
0
 /**
  * @private
  */
 override protected TextureAtlasData _generateTextureAtlasData(TextureAtlasData textureAtlasData, object textureAtlas)
 {
     if (textureAtlasData != null)
     {
         if (textureAtlas != null)
         {
             if ((textureAtlas as Material).name.IndexOf("UI_Mat") > -1)
             {
                 (textureAtlasData as UnityTextureAtlasData).uiTexture = textureAtlas as Material;
             }
             else
             {
                 (textureAtlasData as UnityTextureAtlasData).texture = textureAtlas as Material;
             }
         }
     }
     else
     {
         textureAtlasData = BaseObject.BorrowObject <UnityTextureAtlasData>();
     }
     return(textureAtlasData);
 }
        /**
         * @private
         */
        public void CopyFrom(TextureAtlasData value)
        {
            autoSearch = value.autoSearch;
            scale      = value.scale;
            width      = value.width;
            height     = value.height;
            name       = value.name;
            imagePath  = value.imagePath;

            foreach (var texture in textures.Values)
            {
                texture.ReturnToPool();
            }

            textures.Clear();

            foreach (var pair in value.textures)
            {
                var texture = GenerateTextureData();
                texture.CopyFrom(pair.Value);
                textures[pair.Key] = texture;
            }
        }
Exemple #15
0
 /**
  * @language zh_CN
  * 添加贴图集数据。
  * @param data 贴图集数据。
  * @param name 为数据指定一个名称,以便可以通过这个名称获取数据,如果未设置,则使用数据中的名称。
  * @see #ParseTextureAtlasData()
  * @see #GetTextureAtlasData()
  * @see #RemoveTextureAtlasData()
  * @see DragonBones.textures.TextureAtlasData
  * @version DragonBones 3.0
  */
 public void AddTextureAtlasData(TextureAtlasData data, string name = null)
 {
     if (data != null)
     {
         name = !string.IsNullOrEmpty(name) ? name : data.name;
         if (!string.IsNullOrEmpty(name))
         {
             var textureAtlasList = _textureAtlasDataMap.ContainsKey(name) ? _textureAtlasDataMap[name] : (_textureAtlasDataMap[name] = new List <TextureAtlasData>());
             if (!textureAtlasList.Contains(data))
             {
                 textureAtlasList.Add(data);
             }
         }
         else
         {
             DragonBones.Assert(false, "Unnamed data.");
         }
     }
     else
     {
         DragonBones.Assert(false, DragonBones.ARGUMENT_ERROR);
     }
 }
Exemple #16
0
 /**
  * @language zh_CN
  * 添加贴图集数据。
  * @param data 贴图集数据。
  * @param name 为数据指定一个名称,以便可以通过这个名称获取数据,如果未设置,则使用数据中的名称。
  * @see #parseTextureAtlasData()
  * @see #getTextureAtlasData()
  * @see #removeTextureAtlasData()
  * @see dragonBones.textures.TextureAtlasData
  * @version DragonBones 3.0
  */
 public void AddTextureAtlasData(TextureAtlasData data, string name = null)
 {
     if (data != null)
     {
         name = DragonBones.IsAvailableString(name) ? name : data.name;
         if (DragonBones.IsAvailableString(name))
         {
             var textureAtlasList = _textureAtlasDataMap.ContainsKey(name) ? _textureAtlasDataMap[name] : (_textureAtlasDataMap[name] = new List <TextureAtlasData>());
             if (!textureAtlasList.Contains(data))
             {
                 textureAtlasList.Add(data);
             }
         }
         else
         {
             DragonBones.Warn("Unnamed data.");
         }
     }
     else
     {
         DragonBones.Warn("");
     }
 }
Exemple #17
0
        /// <private/>
        public void CopyFrom(TextureAtlasData value)
        {
            this.autoSearch = value.autoSearch;
            this.scale      = value.scale;
            this.width      = value.width;
            this.height     = value.height;
            this.name       = value.name;
            this.imagePath  = value.imagePath;

            foreach (var texture in this.textures.Values)
            {
                texture.ReturnToPool();
            }

            this.textures.Clear();

            foreach (var pair in value.textures)
            {
                var texture = CreateTexture();
                texture.CopyFrom(pair.Value);
                textures[pair.Key] = texture;
            }
        }
Exemple #18
0
 public abstract bool ParseTextureAtlasData(object rawData,TextureAtlasData textureAtlasData,float scale);
Exemple #19
0
 /**
  * @private
  */
 public abstract void ParseTextureAtlasData(Dictionary <string,object> rawData,TextureAtlasData textureAtlasData,float scale = 0.0f);
Exemple #20
0
 /**
  * @private
  */
 protected abstract TextureAtlasData _generateTextureAtlasData(TextureAtlasData textureAtlasData, object textureAtlas);
Exemple #21
0
        /**
         * @private
         */
        protected override void _onClear()
        {
            foreach (var bone in _bones)
            {
                bone.ReturnToPool();
            }

            foreach (var slot in _slots)
            {
                slot.ReturnToPool();
            }

            foreach (var evt in _events)
            {
                evt.ReturnToPool();
            }

            if (_clock != null)
            {
                _clock.Remove(this);
            }

            if (_proxy != null)
            {
                _proxy._onClear();
            }

            if (_replaceTextureAtlasData != null)
            {
                _replaceTextureAtlasData.ReturnToPool();
            }

            if (_animation != null)
            {
                _animation.ReturnToPool();
            }

            inheritAnimation = true;
            userData         = null;

            _delayDispose = false;
            _lockDispose  = false;
            _bonesDirty   = false;
            _slotsDirty   = false;
            _zOrderDirty  = false;
            _flipX        = false;
            _flipY        = false;
            _bones.Clear();
            _slots.Clear();
            _actions.Clear();
            _events.Clear();
            _armatureData            = null;
            _skinData                = null;
            _animation               = null;
            _proxy                   = null;
            _display                 = null;
            _eventManager            = null;
            _parent                  = null;
            _clock                   = null;
            _replaceTextureAtlasData = null;
            _replacedTexture         = null;
        }
 /// <private/>
 protected abstract TextureAtlasData _BuildTextureAtlasData(TextureAtlasData textureAtlasData, object textureAtlas);