示例#1
0
 public Graphic(TagDefineGraphic define)
 {
     _define = define;
     if (_define.className != null)
     {
         _view = new CCSprite(string.Format("{0}_{1}.png", define.flash.prefix, _define.className));
     }
     else
     {
         _view = new CCSprite(string.Format("{0}_ID{1}.png", define.flash.prefix, _define.characterId));
     }
     _view.cascadeColorEnabled   = true;
     _view.cascadeOpacityEnabled = true;
     _view.anchorPoint           = _define.anchorPoint;
     _view.gameObject.name       = define.characterId.ToString();
     _view.opacityModifyRGB      = false;
     addChild(_view);
     if (string.IsNullOrEmpty(define.className))
     {
         this.nameInHierarchy = define.characterId.ToString();
     }
     else
     {
         this.nameInHierarchy = define.className;
     }
     this.cascadeColorEnabled   = false;
     this.cascadeOpacityEnabled = false;
 }
示例#2
0
        public TagDefine parseDefine(Flash flash, byte[] data, Cursor cursor)
        {
            //find nextIndex
            int dataLength = Utils.ReadInt32(data, cursor);
            int nextIndex  = cursor.index + dataLength;

            //parse
            byte      type = Utils.ReadByte(data, cursor);
            TagDefine def  = null;

            if (type == TagDefine.DEF_TYPE_GRAPHIC)
            {
                def = new TagDefineGraphic(flash, data, cursor);
            }
            else if (type == TagDefine.DEF_TYPE_SPRITE)
            {
                def = new TagDefineMovie(flash, data, cursor);
            }

            //nextIndex
            cursor.index = nextIndex;

            return(def);
        }