window.fgui={},window.fairygui=window.fgui,window.__extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(o,r){function s(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){t.done?o(t.value):new i(function(e){e(t.value)}).then(s,a)}h((n=n.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var i,n,o,r,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(o=2&r[0]?n.return:r[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,r[1])).done)return o;switch(n=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,n=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]0){for(var i=0;i0){for(n=this._objectPool.length-i.listItemCount-1,o=0;o=s)return}t.GTimers.inst.remove(this.run,this);var h=this._objectPool[0];this._itemList.length=0,this._objectPool.length=0,null!=this.callback&&this.callback.call(this.callbackObj,h)},e}();t.AsyncOperation=e;var i=function(){return function(t,e){this.packageItem=t,this.type=e}}()}(fgui||(fgui={})),function(t){var e=function(e){function i(){var t=e.call(this)||this;return t._selectedIndex=0,t._previousIndex=0,t.changing=!1,t._pageIds=[],t._pageNames=[],t._selectedIndex=-1,t._previousIndex=-1,t}return __extends(i,e),i.prototype.dispose=function(){},Object.defineProperty(i.prototype,"selectedIndex",{get:function(){return this._selectedIndex},set:function(e){if(this._selectedIndex!=e){if(e>this._pageIds.length-1)throw"index out of bounds: "+e;this.changing=!0,this._previousIndex=this._selectedIndex,this._selectedIndex=e,this.parent.applyController(this),this.dispatchEvent(new t.StateChangeEvent(t.StateChangeEvent.CHANGED)),this.changing=!1}},enumerable:!0,configurable:!0}),i.prototype.setSelectedIndex=function(t){if(void 0===t&&(t=0),this._selectedIndex!=t){if(t>this._pageIds.length-1)throw"index out of bounds: "+t;this.changing=!0,this._previousIndex=this._selectedIndex,this._selectedIndex=t,this.parent.applyController(this),this.changing=!1}},Object.defineProperty(i.prototype,"previsousIndex",{get:function(){return this._previousIndex},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedPage",{get:function(){return-1==this._selectedIndex?null:this._pageNames[this._selectedIndex]},set:function(t){var e=this._pageNames.indexOf(t);-1==e&&(e=0),this.selectedIndex=e},enumerable:!0,configurable:!0}),i.prototype.setSelectedPage=function(t){var e=this._pageNames.indexOf(t);-1==e&&(e=0),this.setSelectedIndex(e)},Object.defineProperty(i.prototype,"previousPage",{get:function(){return-1==this._previousIndex?null:this._pageNames[this._previousIndex]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pageCount",{get:function(){return this._pageIds.length},enumerable:!0,configurable:!0}),i.prototype.getPageName=function(t){return void 0===t&&(t=0),this._pageNames[t]},i.prototype.addPage=function(t){void 0===t&&(t=""),this.addPageAt(t,this._pageIds.length)},i.prototype.addPageAt=function(t,e){void 0===e&&(e=0);var n=""+i._nextPageId++;e==this._pageIds.length?(this._pageIds.push(n),this._pageNames.push(t)):(this._pageIds.splice(e,0,n),this._pageNames.splice(e,0,t))},i.prototype.removePage=function(t){var e=this._pageNames.indexOf(t);-1!=e&&(this._pageIds.splice(e,1),this._pageNames.splice(e,1),this._selectedIndex>=this._pageIds.length?this.selectedIndex=this._selectedIndex-1:this.parent.applyController(this))},i.prototype.removePageAt=function(t){void 0===t&&(t=0),this._pageIds.splice(t,1),this._pageNames.splice(t,1),this._selectedIndex>=this._pageIds.length?this.selectedIndex=this._selectedIndex-1:this.parent.applyController(this)},i.prototype.clearPages=function(){this._pageIds.length=0,this._pageNames.length=0,-1!=this._selectedIndex?this.selectedIndex=-1:this.parent.applyController(this)},i.prototype.hasPage=function(t){return-1!=this._pageNames.indexOf(t)},i.prototype.getPageIndexById=function(t){return this._pageIds.indexOf(t)},i.prototype.getPageIdByName=function(t){var e=this._pageNames.indexOf(t);return-1!=e?this._pageIds[e]:null},i.prototype.getPageNameById=function(t){var e=this._pageIds.indexOf(t);return-1!=e?this._pageNames[e]:null},i.prototype.getPageId=function(t){return void 0===t&&(t=0),this._pageIds[t]},Object.defineProperty(i.prototype,"selectedPageId",{get:function(){return-1==this._selectedIndex?null:this._pageIds[this._selectedIndex]},set:function(t){var e=this._pageIds.indexOf(t);this.selectedIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"oppositePageId",{set:function(t){this._pageIds.indexOf(t)>0?this.selectedIndex=0:this._pageIds.length>1&&(this.selectedIndex=1)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"previousPageId",{get:function(){return-1==this._previousIndex?null:this._pageIds[this._previousIndex]},enumerable:!0,configurable:!0}),i.prototype.runActions=function(){if(this._actions)for(var t=this._actions.length,e=0;e=2)switch(e.readByte()){case 1:s=e.readShort();break;case 2:-1==(s=this._pageNames.indexOf(t.UIPackage.branch))&&(s=0);break;case 3:-1==(s=this._pageNames.indexOf(t.UIPackage.getVar(e.readS())))&&(s=0)}if(e.seek(o,2),(r=e.readShort())>0)for(null==this._actions&&(this._actions=new Array),i=0;i0?this._selectedIndex=s:this._selectedIndex=-1},i._nextPageId=0,i}(egret.EventDispatcher);t.Controller=e}(fgui||(fgui={})),function(t){var e=function(){function e(){this._agent=new t.GLoader,this._agent.draggable=!0,this._agent.touchable=!1,this._agent.setSize(100,100),this._agent.setPivot(.5,.5,!0),this._agent.align=t.AlignType.Center,this._agent.verticalAlign=t.VertAlignType.Middle,this._agent.sortingOrder=1e6,this._agent.addEventListener(t.DragEvent.DRAG_END,this.__dragEnd,this)}return Object.defineProperty(e,"inst",{get:function(){return null==e._inst&&(e._inst=new e),e._inst},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dragAgent",{get:function(){return this._agent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dragging",{get:function(){return null!=this._agent.parent},enumerable:!0,configurable:!0}),e.prototype.startDrag=function(e,i,n,o){if(void 0===o&&(o=-1),null==this._agent.parent){this._sourceData=n,this._agent.url=i,t.GRoot.inst.addChild(this._agent);var r=t.GRoot.inst.globalToLocal(t.GRoot.mouseX,t.GRoot.mouseY);this._agent.setXY(r.x,r.y),this._agent.startDrag(o)}},e.prototype.cancel=function(){null!=this._agent.parent&&(this._agent.stopDrag(),t.GRoot.inst.removeChild(this._agent),this._sourceData=null)},e.prototype.__dragEnd=function(e){if(null!=this._agent.parent){t.GRoot.inst.removeChild(this._agent);var i=this._sourceData;this._sourceData=null;for(var n=t.GRoot.inst.getObjectUnderPoint(e.stageX,e.stageY);null!=n;){if(n.hasEventListener(t.DropEvent.DROP)){var o=new t.DropEvent(t.DropEvent.DROP,i);return n.requestFocus(),void n.dispatchEvent(o)}n=n.parent}}},e}();t.DragDropManager=e}(fgui||(fgui={})),function(t){!function(t){t[t.Common=0]="Common",t[t.Check=1]="Check",t[t.Radio=2]="Radio"}(t.ButtonMode||(t.ButtonMode={})),function(t){t[t.None=0]="None",t[t.Both=1]="Both",t[t.Height=2]="Height"}(t.AutoSizeType||(t.AutoSizeType={})),function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right"}(t.AlignType||(t.AlignType={})),function(t){t[t.Top=0]="Top",t[t.Middle=1]="Middle",t[t.Bottom=2]="Bottom"}(t.VertAlignType||(t.VertAlignType={})),function(t){t[t.None=0]="None",t[t.Scale=1]="Scale",t[t.ScaleMatchHeight=2]="ScaleMatchHeight",t[t.ScaleMatchWidth=3]="ScaleMatchWidth",t[t.ScaleFree=4]="ScaleFree",t[t.ScaleNoBorder=5]="ScaleNoBorder"}(t.LoaderFillType||(t.LoaderFillType={})),function(t){t[t.SingleColumn=0]="SingleColumn",t[t.SingleRow=1]="SingleRow",t[t.FlowHorizontal=2]="FlowHorizontal",t[t.FlowVertical=3]="FlowVertical",t[t.Pagination=4]="Pagination"}(t.ListLayoutType||(t.ListLayoutType={})),function(t){t[t.Single=0]="Single",t[t.Multiple=1]="Multiple",t[t.Multiple_SingleClick=2]="Multiple_SingleClick",t[t.None=3]="None"}(t.ListSelectionMode||(t.ListSelectionMode={})),function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden",t[t.Scroll=2]="Scroll"}(t.OverflowType||(t.OverflowType={})),function(t){t[t.Image=0]="Image",t[t.MovieClip=1]="MovieClip",t[t.Sound=2]="Sound",t[t.Component=3]="Component",t[t.Atlas=4]="Atlas",t[t.Font=5]="Font",t[t.Swf=6]="Swf",t[t.Misc=7]="Misc",t[t.Unknown=8]="Unknown"}(t.PackageItemType||(t.PackageItemType={})),function(t){t[t.Image=0]="Image",t[t.MovieClip=1]="MovieClip",t[t.Swf=2]="Swf",t[t.Graph=3]="Graph",t[t.Loader=4]="Loader",t[t.Group=5]="Group",t[t.Text=6]="Text",t[t.RichText=7]="RichText",t[t.InputText=8]="InputText",t[t.Component=9]="Component",t[t.List=10]="List",t[t.Label=11]="Label",t[t.Button=12]="Button",t[t.ComboBox=13]="ComboBox",t[t.ProgressBar=14]="ProgressBar",t[t.Slider=15]="Slider",t[t.ScrollBar=16]="ScrollBar",t[t.Tree=17]="Tree"}(t.ObjectType||(t.ObjectType={})),function(t){t[t.Percent=0]="Percent",t[t.ValueAndMax=1]="ValueAndMax",t[t.Value=2]="Value",t[t.Max=3]="Max"}(t.ProgressTitleType||(t.ProgressTitleType={})),function(t){t[t.Default=0]="Default",t[t.Visible=1]="Visible",t[t.Auto=2]="Auto",t[t.Hidden=3]="Hidden"}(t.ScrollBarDisplayType||(t.ScrollBarDisplayType={})),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical",t[t.Both=2]="Both"}(t.ScrollType||(t.ScrollType={})),function(t){t[t.None=0]="None",t[t.Horizontal=1]="Horizontal",t[t.Vertical=2]="Vertical",t[t.Both=3]="Both"}(t.FlipType||(t.FlipType={})),function(t){t[t.Ascent=0]="Ascent",t[t.Descent=1]="Descent",t[t.Arch=2]="Arch"}(t.ChildrenRenderOrder||(t.ChildrenRenderOrder={})),function(t){t[t.None=0]="None",t[t.Horizontal=1]="Horizontal",t[t.Vertical=2]="Vertical"}(t.GroupLayoutType||(t.GroupLayoutType={})),function(t){t[t.Auto=0]="Auto",t[t.Up=1]="Up",t[t.Down=2]="Down"}(t.PopupDirection||(t.PopupDirection={})),function(t){t[t.Left_Left=0]="Left_Left",t[t.Left_Center=1]="Left_Center",t[t.Left_Right=2]="Left_Right",t[t.Center_Center=3]="Center_Center",t[t.Right_Left=4]="Right_Left",t[t.Right_Center=5]="Right_Center",t[t.Right_Right=6]="Right_Right",t[t.Top_Top=7]="Top_Top",t[t.Top_Middle=8]="Top_Middle",t[t.Top_Bottom=9]="Top_Bottom",t[t.Middle_Middle=10]="Middle_Middle",t[t.Bottom_Top=11]="Bottom_Top",t[t.Bottom_Middle=12]="Bottom_Middle",t[t.Bottom_Bottom=13]="Bottom_Bottom",t[t.Width=14]="Width",t[t.Height=15]="Height",t[t.LeftExt_Left=16]="LeftExt_Left",t[t.LeftExt_Right=17]="LeftExt_Right",t[t.RightExt_Left=18]="RightExt_Left",t[t.RightExt_Right=19]="RightExt_Right",t[t.TopExt_Top=20]="TopExt_Top",t[t.TopExt_Bottom=21]="TopExt_Bottom",t[t.BottomExt_Top=22]="BottomExt_Top",t[t.BottomExt_Bottom=23]="BottomExt_Bottom",t[t.Size=24]="Size"}(t.RelationType||(t.RelationType={})),function(t){t[t.None=0]="None",t[t.Horizontal=1]="Horizontal",t[t.Vertical=2]="Vertical",t[t.Radial90=3]="Radial90",t[t.Radial180=4]="Radial180",t[t.Radial360=5]="Radial360"}(t.FillMethod||(t.FillMethod={})),function(t){t[t.Top=0]="Top",t[t.Bottom=1]="Bottom",t[t.Left=2]="Left",t[t.Right=3]="Right",t[t.TopLeft=0]="TopLeft",t[t.TopRight=1]="TopRight",t[t.BottomLeft=2]="BottomLeft",t[t.BottomRight=3]="BottomRight"}(t.FillOrigin||(t.FillOrigin={})),function(t){t[t.TopLeft=0]="TopLeft",t[t.TopRight=1]="TopRight",t[t.BottomLeft=2]="BottomLeft",t[t.BottomRight=3]="BottomRight"}(t.FillOrigin90||(t.FillOrigin90={})),function(t){t[t.Text=0]="Text",t[t.Icon=1]="Icon",t[t.Color=2]="Color",t[t.OutlineColor=3]="OutlineColor",t[t.Playing=4]="Playing",t[t.Frame=5]="Frame",t[t.DeltaTime=6]="DeltaTime",t[t.TimeScale=7]="TimeScale",t[t.FontSize=8]="FontSize",t[t.Selected=9]="Selected"}(t.ObjectPropID||(t.ObjectPropID={}))}(fgui||(fgui={})),function(t){var e=function(e){function i(){var n=e.call(this)||this;return n._x=0,n._y=0,n._alpha=1,n._rotation=0,n._visible=!0,n._touchable=!0,n._grayed=!1,n._draggable=!1,n._scaleX=1,n._scaleY=1,n._skewX=0,n._skewY=0,n._pivotX=0,n._pivotY=0,n._pivotAsAnchor=!1,n._pivotOffsetX=0,n._pivotOffsetY=0,n._sortingOrder=0,n._internalVisible=!0,n._handlingController=!1,n._focusable=!1,n._pixelSnapping=!1,n._disposed=!1,n.sourceWidth=0,n.sourceHeight=0,n.initWidth=0,n.initHeight=0,n.minWidth=0,n.minHeight=0,n.maxWidth=0,n.maxHeight=0,n._width=0,n._height=0,n._rawWidth=0,n._rawHeight=0,n._sizePercentInGroup=0,n._id=""+i._gInstanceCounter++,n._name="",n.createDisplayObject(),n._relations=new t.Relations(n),n._gears=new Array(10),n}return __extends(i,e),Object.defineProperty(i.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"name",{get:function(){return this._name},set:function(t){this._name=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"x",{get:function(){return this._x},set:function(t){this.setXY(t,this._y)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"y",{get:function(){return this._y},set:function(t){this.setXY(this._x,t)},enumerable:!0,configurable:!0}),i.prototype.setXY=function(e,n){if(this._x!=e||this._y!=n){var o=e-this._x,r=n-this._y;this._x=e,this._y=n,this.handleXYChanged(),this instanceof t.GGroup&&this.moveChildren(o,r),this.updateGear(1),!this._parent||this._parent instanceof t.GList||(this._parent.setBoundsChangedFlag(),null!=this._group&&this._group.setBoundsChangedFlag(!0),this.dispatchEventWith(i.XY_CHANGED)),i.draggingObject!=this||i.sUpdateInDragging||this.localToGlobalRect(0,0,this._width,this._height,i.sGlobalRect)}},Object.defineProperty(i.prototype,"xMin",{get:function(){return this._pivotAsAnchor?this._x-this._width*this._pivotX:this._x},set:function(t){this._pivotAsAnchor?this.setXY(t+this._width*this._pivotX,this._y):this.setXY(t,this._y)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"yMin",{get:function(){return this._pivotAsAnchor?this._y-this._height*this._pivotY:this._y},set:function(t){this._pivotAsAnchor?this.setXY(this._x,t+this._height*this._pivotY):this.setXY(this._x,t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pixelSnapping",{get:function(){return this._pixelSnapping},set:function(t){this._pixelSnapping!=t&&(this._pixelSnapping=t,this.handleXYChanged())},enumerable:!0,configurable:!0}),i.prototype.center=function(e){var i;void 0===e&&(e=!1),i=null!=this._parent?this.parent:this.root,this.setXY((i.width-this._width)/2,(i.height-this._height)/2),e&&(this.addRelation(i,t.RelationType.Center_Center),this.addRelation(i,t.RelationType.Middle_Middle))},Object.defineProperty(i.prototype,"width",{get:function(){return this.ensureSizeCorrect(),this._relations.sizeDirty&&this._relations.ensureRelationsSizeCorrect(),this._width},set:function(t){this.setSize(t,this._rawHeight)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.ensureSizeCorrect(),this._relations.sizeDirty&&this._relations.ensureRelationsSizeCorrect(),this._height},set:function(t){this.setSize(this._rawWidth,t)},enumerable:!0,configurable:!0}),i.prototype.setSize=function(e,n,o){if(void 0===o&&(o=!1),this._rawWidth!=e||this._rawHeight!=n){this._rawWidth=e,this._rawHeight=n,e0&&e>this.maxWidth&&(e=this.maxWidth),this.maxHeight>0&&n>this.maxHeight&&(n=this.maxHeight);var r=e-this._width,s=n-this._height;this._width=e,this._height=n,this.handleSizeChanged(),0==this._pivotX&&0==this._pivotY||(this._pivotAsAnchor?this.applyPivot():(o||this.setXY(this.x-this._pivotX*r,this.y-this._pivotY*s),this.updatePivotOffset())),this instanceof t.GGroup&&this.resizeChildren(r,s),this.updateGear(2),this._parent&&(this._relations.onOwnerSizeChanged(r,s,this._pivotAsAnchor||!o),this._parent.setBoundsChangedFlag(),null!=this._group&&this._group.setBoundsChangedFlag()),this.dispatchEventWith(i.SIZE_CHANGED)}},i.prototype.makeFullScreen=function(){this.setSize(t.GRoot.inst.width,t.GRoot.inst.height)},i.prototype.ensureSizeCorrect=function(){},Object.defineProperty(i.prototype,"actualWidth",{get:function(){return this.width*Math.abs(this._scaleX)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"actualHeight",{get:function(){return this.height*Math.abs(this._scaleY)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scaleX",{get:function(){return this._scaleX},set:function(t){this.setScale(t,this._scaleY)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scaleY",{get:function(){return this._scaleY},set:function(t){this.setScale(this._scaleX,t)},enumerable:!0,configurable:!0}),i.prototype.setScale=function(t,e){this._scaleX==t&&this._scaleY==e||(this._scaleX=t,this._scaleY=e,this.handleScaleChanged(),this.applyPivot(),this.updateGear(2))},Object.defineProperty(i.prototype,"skewX",{get:function(){return this._skewX},set:function(t){this.setSkew(t,this._skewY)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"skewY",{get:function(){return this._skewY},set:function(t){this.setSkew(this._skewX,t)},enumerable:!0,configurable:!0}),i.prototype.setSkew=function(t,e){this._skewX==t&&this._skewY==e||(this._skewX=t,this._skewY=e,null!=this._displayObject&&(this._displayObject.skewX=t,this._displayObject.skewY=e),this.applyPivot())},Object.defineProperty(i.prototype,"pivotX",{get:function(){return this._pivotX},set:function(t){this.setPivot(t,this._pivotY)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pivotY",{get:function(){return this._pivotY},set:function(t){this.setPivot(this._pivotX,t)},enumerable:!0,configurable:!0}),i.prototype.setPivot=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=!1),this._pivotX==t&&this._pivotY==e&&this._pivotAsAnchor==i||(this._pivotX=t,this._pivotY=e,this._pivotAsAnchor=i,this.updatePivotOffset(),this.handleXYChanged())},Object.defineProperty(i.prototype,"pivotAsAnchor",{get:function(){return this._pivotAsAnchor},enumerable:!0,configurable:!0}),i.prototype.internalSetPivot=function(t,e,i){void 0===e&&(e=0),this._pivotX=t,this._pivotY=e,this._pivotAsAnchor=i,i&&this.handleXYChanged()},i.prototype.updatePivotOffset=function(){if(null!=this._displayObject)if(0!=this._pivotX||0!=this._pivotY){var t=this._pivotX*this._width,e=this._pivotY*this._height,n=this._displayObject.matrix.transformPoint(t,e,i.sHelperPoint);this._pivotOffsetX=this._pivotX*this._width-(n.x-this._displayObject.x),this._pivotOffsetY=this._pivotY*this._height-(n.y-this._displayObject.y)}else this._pivotOffsetX=0,this._pivotOffsetY=0},i.prototype.applyPivot=function(){0==this._pivotX&&0==this._pivotY||(this.updatePivotOffset(),this.handleXYChanged())},Object.defineProperty(i.prototype,"touchable",{get:function(){return this._touchable},set:function(e){if(this._touchable!=e){if(this._touchable=e,this.updateGear(3),this instanceof t.GImage||this instanceof t.GMovieClip||this instanceof t.GTextField&&!(this instanceof t.GTextInput)&&!(this instanceof t.GRichTextField))return;null!=this._displayObject&&(this._displayObject.touchEnabled=this._touchable,this._displayObject instanceof egret.DisplayObjectContainer&&(this._displayObject.touchChildren=this._touchable))}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"grayed",{get:function(){return this._grayed},set:function(t){this._grayed!=t&&(this._grayed=t,this.handleGrayedChanged(),this.updateGear(3))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"enabled",{get:function(){return!this._grayed&&this._touchable},set:function(t){this.grayed=!t,this.touchable=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!=t&&(this._rotation=t,this._displayObject&&(this._displayObject.rotation=this.normalizeRotation),this.applyPivot(),this.updateGear(3))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"normalizeRotation",{get:function(){var t=this._rotation%360;return t>180?t-=360:t<-180&&(t+=360),t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!=t&&(this._alpha=t,this.handleAlphaChanged(),this.updateGear(3))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){this._visible!=t&&(this._visible=t,this.handleVisibleChanged(),this._parent&&this._parent.setBoundsChangedFlag(),this._group&&this._group.excludeInvisibles&&this._group.setBoundsChangedFlag())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"internalVisible",{get:function(){return this._internalVisible&&(!this._group||this._group.internalVisible)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"internalVisible2",{get:function(){return this._visible&&(!this._group||this._group.internalVisible2)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"internalVisible3",{get:function(){return this._visible&&this._internalVisible},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"sortingOrder",{get:function(){return this._sortingOrder},set:function(t){if(t<0&&(t=0),this._sortingOrder!=t){var e=this._sortingOrder;this._sortingOrder=t,null!=this._parent&&this._parent.childSortingOrderChanged(this,e,this._sortingOrder)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"focusable",{get:function(){return this._focusable},set:function(t){this._focusable=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"focused",{get:function(){return this.root.focus==this},enumerable:!0,configurable:!0}),i.prototype.requestFocus=function(){for(var t=this;t&&!t._focusable;)t=t.parent;null!=t&&(this.root.focus=t)},Object.defineProperty(i.prototype,"tooltips",{get:function(){return this._tooltips},set:function(t){this._tooltips=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"blendMode",{get:function(){return this._displayObject.blendMode},set:function(t){this._displayObject.blendMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"filters",{get:function(){return this._displayObject.filters},set:function(t){this._displayObject.filters=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"inContainer",{get:function(){return null!=this._displayObject&&null!=this._displayObject.parent},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onStage",{get:function(){return null!=this._displayObject&&null!=this._displayObject.stage},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"resourceURL",{get:function(){return null!=this.packageItem?"ui://"+this.packageItem.owner.id+this.packageItem.id:null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"group",{get:function(){return this._group},set:function(t){this._group!=t&&(null!=this._group&&this._group.setBoundsChangedFlag(),this._group=t,null!=this._group&&this._group.setBoundsChangedFlag())},enumerable:!0,configurable:!0}),i.prototype.getGear=function(e){var i=this._gears[e];return null==i&&(this._gears[e]=i=t.GearBase.create(this,e)),i},i.prototype.updateGear=function(t){if(!this._underConstruct&&!this._gearLocked){var e=this._gears[t];null!=e&&null!=e.controller&&e.updateState()}},i.prototype.checkGearController=function(t,e){return null!=this._gears[t]&&this._gears[t].controller==e},i.prototype.updateGearFromRelations=function(t,e,i){null!=this._gears[t]&&this._gears[t].updateFromRelations(e,i)},i.prototype.addDisplayLock=function(){var t=this._gears[0];if(t&&t.controller){var e=t.addLock();return this.checkGearDisplay(),e}return 0},i.prototype.releaseDisplayLock=function(t){var e=this._gears[0];e&&e.controller&&(e.releaseLock(t),this.checkGearDisplay())},i.prototype.checkGearDisplay=function(){if(!this._handlingController){var t=null==this._gears[0]||this._gears[0].connected;this._gears[8]&&(t=this._gears[8].evaluate(t)),t!=this._internalVisible&&(this._internalVisible=t,this._parent&&this._parent.childStateChanged(this),this._group&&this._group.excludeInvisibles&&this._group.setBoundsChangedFlag())}},Object.defineProperty(i.prototype,"gearXY",{get:function(){return this.getGear(1)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"gearSize",{get:function(){return this.getGear(2)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"gearLook",{get:function(){return this.getGear(3)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"relations",{get:function(){return this._relations},enumerable:!0,configurable:!0}),i.prototype.addRelation=function(t,e,i){void 0===i&&(i=!1),this._relations.add(t,e,i)},i.prototype.removeRelation=function(t,e){void 0===e&&(e=0),this._relations.remove(t,e)},Object.defineProperty(i.prototype,"displayObject",{get:function(){return this._displayObject},enumerable:!0,configurable:!0}),i.prototype.setDisplayObject=function(t){this._displayObject!=t&&(this._displayObject&&delete this._displayObject.$owner,this._displayObject=t,this._displayObject.$owner=this)},Object.defineProperty(i.prototype,"parent",{get:function(){return this._parent},set:function(t){this._parent=t},enumerable:!0,configurable:!0}),i.prototype.removeFromParent=function(){this._parent&&this._parent.removeChild(this)},Object.defineProperty(i.prototype,"root",{get:function(){if(this instanceof t.GRoot)return this;for(var e=this._parent;e;){if(e instanceof t.GRoot)return e;e=e.parent}return t.GRoot.inst},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asCom",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asButton",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asLabel",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asProgress",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asTextField",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asRichTextField",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asTextInput",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asLoader",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asList",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asTree",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asGraph",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asGroup",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asSlider",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asComboBox",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asImage",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"asMovieClip",{get:function(){return this},enumerable:!0,configurable:!0}),i.cast=function(t){return t.$owner},Object.defineProperty(i.prototype,"text",{get:function(){return null},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"icon",{get:function(){return null},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"treeNode",{get:function(){return this._treeNode},enumerable:!0,configurable:!0}),i.prototype.dispose=function(){if(!this._disposed){this._disposed=!0,this.removeFromParent(),this._relations.dispose(),this._displayObject=null;for(var t=0;t<10;t++){var e=this._gears[t];null!=e&&e.dispose()}}},i.prototype.addClickListener=function(t,e){this.addEventListener(egret.TouchEvent.TOUCH_TAP,t,e)},i.prototype.removeClickListener=function(t,e){this.removeEventListener(egret.TouchEvent.TOUCH_TAP,t,e)},i.prototype.hasClickListener=function(){return this.hasEventListener(egret.TouchEvent.TOUCH_TAP)},i.prototype.addEventListener=function(t,i,n){e.prototype.addEventListener.call(this,t,i,n),null!=this._displayObject&&this._displayObject.addEventListener(t,this._reDispatch,this)},i.prototype.removeEventListener=function(t,i,n){e.prototype.removeEventListener.call(this,t,i,n),null==this._displayObject||this.hasEventListener(t)||this._displayObject.removeEventListener(t,this._reDispatch,this)},i.prototype._reDispatch=function(t){this.dispatchEvent(t)},Object.defineProperty(i.prototype,"draggable",{get:function(){return this._draggable},set:function(t){this._draggable!=t&&(this._draggable=t,this.initDrag())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"dragBounds",{get:function(){return this._dragBounds},set:function(t){this._dragBounds=t},enumerable:!0,configurable:!0}),i.prototype.startDrag=function(t){void 0===t&&(t=-1),null!=this._displayObject.stage&&this.dragBegin(null)},i.prototype.stopDrag=function(){this.dragEnd()},Object.defineProperty(i.prototype,"dragging",{get:function(){return i.draggingObject==this},enumerable:!0,configurable:!0}),i.prototype.localToGlobal=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),this._pivotAsAnchor&&(t+=this._pivotX*this._width,e+=this._pivotY*this._height),this._displayObject.localToGlobal(t,e,i)},i.prototype.globalToLocal=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0);var n=this._displayObject.globalToLocal(t,e,i);return this._pivotAsAnchor&&(n.x-=this._pivotX*this._width,n.y-=this._pivotY*this._height),n},i.prototype.localToRoot=function(e,i,n){void 0===e&&(e=0),void 0===i&&(i=0);var o=this._displayObject.localToGlobal(e,i,n);return o.x/=t.GRoot.contentScaleFactor,o.y/=t.GRoot.contentScaleFactor,o},i.prototype.rootToLocal=function(e,i,n){return void 0===e&&(e=0),void 0===i&&(i=0),e*=t.GRoot.contentScaleFactor,i*=t.GRoot.contentScaleFactor,this._displayObject.globalToLocal(e,i,n)},i.prototype.localToGlobalRect=function(t,e,i,n,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),null==o&&(o=new egret.Rectangle);var r=this.localToGlobal(t,e);return o.x=r.x,o.y=r.y,r=this.localToGlobal(t+i,e+n),o.right=r.x,o.bottom=r.y,o},i.prototype.globalToLocalRect=function(t,e,i,n,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),null==o&&(o=new egret.Rectangle);var r=this.globalToLocal(t,e);return o.x=r.x,o.y=r.y,r=this.globalToLocal(t+i,e+n),o.right=r.x,o.bottom=r.y,o},i.prototype.handleControllerChanged=function(t){this._handlingController=!0;for(var e=0;e<10;e++){var i=this._gears[e];null!=i&&i.controller==t&&i.apply()}this._handlingController=!1,this.checkGearDisplay()},i.prototype.createDisplayObject=function(){},i.prototype.switchDisplayObject=function(t){if(t!=this._displayObject){var e=this._displayObject;if(null!=this._displayObject.parent){var i=this._displayObject.parent.getChildIndex(this._displayObject);this._displayObject.parent.addChildAt(t,i),this._displayObject.parent.removeChild(this._displayObject)}this._displayObject=t,this._displayObject.x=e.x,this._displayObject.y=e.y,this._displayObject.rotation=e.rotation,this._displayObject.alpha=e.alpha,this._displayObject.visible=e.visible,this._displayObject.touchEnabled=e.touchEnabled,this._displayObject.scaleX=e.scaleX,this._displayObject.scaleY=e.scaleY,this._displayObject instanceof egret.DisplayObjectContainer&&(this._displayObject.touchChildren=this._touchable)}},i.prototype.handleXYChanged=function(){if(this._displayObject){var t=this._x,e=this._y;this._pivotAsAnchor&&(t-=this._pivotX*this._width,e-=this._pivotY*this._height),this._pixelSnapping&&(t=Math.round(t),e=Math.round(e)),this._displayObject.x=t+this._pivotOffsetX,this._displayObject.y=e+this._pivotOffsetY}},i.prototype.handleSizeChanged=function(){this._displayObject&&(this._displayObject.width=this._width,this._displayObject.height=this._height)},i.prototype.handleScaleChanged=function(){this._displayObject&&(this._displayObject.scaleX=this._scaleX,this._displayObject.scaleY=this._scaleY)},i.prototype.handleGrayedChanged=function(){this._displayObject&&t.ToolSet.setColorFilter(this._displayObject,this._grayed)},i.prototype.handleAlphaChanged=function(){this._displayObject&&(this._displayObject.alpha=this._alpha)},i.prototype.handleVisibleChanged=function(){this._displayObject&&(this._displayObject.visible=this.internalVisible2),this instanceof t.GGroup&&this.handleVisibleChanged()},i.prototype.getProp=function(e){switch(e){case t.ObjectPropID.Text:return this.text;case t.ObjectPropID.Icon:return this.icon;case t.ObjectPropID.Color:case t.ObjectPropID.OutlineColor:return NaN;case t.ObjectPropID.Playing:return!1;case t.ObjectPropID.Frame:case t.ObjectPropID.DeltaTime:return 0;case t.ObjectPropID.TimeScale:return 1;case t.ObjectPropID.FontSize:return 0;case t.ObjectPropID.Selected:return!1;default:return}},i.prototype.setProp=function(e,i){switch(e){case t.ObjectPropID.Text:this.text=i;break;case t.ObjectPropID.Icon:this.icon=i}},i.prototype.constructFromResource=function(){},i.prototype.setup_beforeAdd=function(e,i){var n,o;e.seek(i,0),e.skip(5),this._id=e.readS(),this._name=e.readS(),n=e.readInt(),o=e.readInt(),this.setXY(n,o),e.readBool()&&(this.initWidth=e.readInt(),this.initHeight=e.readInt(),this.setSize(this.initWidth,this.initHeight,!0)),e.readBool()&&(this.minWidth=e.readInt(),this.maxWidth=e.readInt(),this.minHeight=e.readInt(),this.maxHeight=e.readInt()),e.readBool()&&(n=e.readFloat(),o=e.readFloat(),this.setScale(n,o)),e.readBool()&&(n=e.readFloat(),o=e.readFloat(),this.setSkew(n,o)),e.readBool()&&(n=e.readFloat(),o=e.readFloat(),this.setPivot(n,o,e.readBool())),1!=(n=e.readFloat())&&(this.alpha=n),0!=(n=e.readFloat())&&(this.rotation=n),e.readBool()||(this.visible=!1),e.readBool()||(this.touchable=!1),e.readBool()&&(this.grayed=!0);var r=e.readByte();2==r?this.blendMode=egret.BlendMode.ADD:5==r&&(this.blendMode=egret.BlendMode.ERASE),1==e.readByte()&&this._displayObject&&t.ToolSet.setColorFilter(this._displayObject,[e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()]);var s=e.readS();null!=s&&(this.data=s)},i.prototype.setup_afterAdd=function(t,e){t.seek(e,1);var i=t.readS();null!=i&&(this.tooltips=i);var n=t.readShort();n>=0&&(this.group=this.parent.getChildAt(n)),t.seek(e,2);for(var o=t.readShort(),r=0;rr.right&&(n=r.right-i.sGlobalRect.width)r.bottom&&(o=r.bottom-i.sGlobalRect.height)=0;--t){var n=this._children[t];n.parent=null,n.dispose()}this._boundsChanged=!1,e.prototype.dispose.call(this)},Object.defineProperty(i.prototype,"displayListContainer",{get:function(){return this._container},enumerable:!0,configurable:!0}),i.prototype.addChild=function(t){return this.addChildAt(t,this._children.length),t},i.prototype.addChildAt=function(t,e){if(void 0===e&&(e=0),!t)throw"child is null";var i=this._children.length;if(e>=0&&e<=i){if(t.parent==this)this.setChildIndex(t,e);else{t.removeFromParent(),t.parent=this;var n=this._children.length;0!=t.sortingOrder?(this._sortingChildCount++,e=this.getInsertPosForSortingChild(t)):this._sortingChildCount>0&&e>n-this._sortingChildCount&&(e=n-this._sortingChildCount),e==n?this._children.push(t):this._children.splice(e,0,t),this.childStateChanged(t),this.setBoundsChangedFlag()}return t}throw"Invalid child index"},i.prototype.getInsertPosForSortingChild=function(t){var e=this._children.length,i=0;for(i=0;i=0&&e=this.numChildren)&&(e=this.numChildren-1);for(var n=t;n<=e;++n)this.removeChildAt(t,i)},i.prototype.getChildAt=function(t){if(void 0===t&&(t=0),t>=0&&t0&&e>n-this._sortingChildCount-1&&(e=n-this._sortingChildCount-1),this._setChildIndex(t,i,e)}},i.prototype.setChildIndexBefore=function(t,e){var i=this._children.indexOf(t);if(-1==i)throw"Not a child of this container";if(0!=t.sortingOrder)return i;var n=this._children.length;return this._sortingChildCount>0&&e>n-this._sortingChildCount-1&&(e=n-this._sortingChildCount-1),io&&(n=o),i==n)return i;if(this._children.splice(i,1),this._children.splice(n,0,e),e.inContainer){var r,s=0;if(this._childrenRenderOrder==t.ChildrenRenderOrder.Ascent){for(r=0;rn;r--)this._children[r].inContainer&&s++;s==this._container.numChildren&&s--,this._container.setChildIndex(e.displayObject,s)}else t.GTimers.inst.callLater(this.buildNativeDisplayList,this);this.setBoundsChangedFlag()}return n},i.prototype.swapChildren=function(t,e){var i=this._children.indexOf(t),n=this._children.indexOf(e);if(-1==i||-1==n)throw"Not a child of this container";this.swapChildrenAt(i,n)},i.prototype.swapChildrenAt=function(t,e){void 0===e&&(e=0);var i=this._children[t],n=this._children[e];this.setChildIndex(i,e),this.setChildIndex(n,t)},Object.defineProperty(i.prototype,"numChildren",{get:function(){return this._children.length},enumerable:!0,configurable:!0}),i.prototype.isAncestorOf=function(t){if(null==t)return!1;for(var e=t.parent;e;){if(e==this)return!0;e=e.parent}return!1},i.prototype.addController=function(t){this._controllers.push(t),t.parent=this,this.applyController(t)},i.prototype.getControllerAt=function(t){return this._controllers[t]},i.prototype.getController=function(t){for(var e=this._controllers.length,i=0;i=0&&(i=this._children[n])!=e;n--)null!=i.displayObject&&null!=i.displayObject.parent&&r++;this._container.addChildAt(e.displayObject,r)}else this._container.addChild(e.displayObject),t.GTimers.inst.callLater(this.buildNativeDisplayList,this)}}else e.displayObject.parent&&this._container.removeChild(e.displayObject)}},i.prototype.buildNativeDisplayList=function(){var e,i,n=this._children.length;if(0!=n)switch(this._childrenRenderOrder){case t.ChildrenRenderOrder.Ascent:for(e=0;e=0;e--)null!=(i=this._children[e]).displayObject&&i.internalVisible&&this._container.addChild(i.displayObject);break;case t.ChildrenRenderOrder.Arch:var o=t.ToolSet.clamp(this._apexIndex,0,n);for(e=0;e=o;e--)null!=(i=this._children[e]).displayObject&&i.internalVisible&&this._container.addChild(i.displayObject)}},i.prototype.applyController=function(t){this._applyingController=t;for(var e=this._children.length,i=0;ia&&(a=n);s=0&&t.x<=this.width&&t.y+t.height>=0&&t.y<=this.height:null==this._scrollPane||this._scrollPane.isChildInView(t)},i.prototype.getFirstChildInView=function(){for(var t=this._children.length,e=0;e0)for(var e=0;e0)for(var e=0;e0){t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY;var r=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,a=0,h=0;for(h=0;hr&&(r=a),(a=l.y+l.actualHeight)>s&&(s=a)}i=r-t,n=s-e}this.setBounds(t,e,i,n)},i.prototype.setBounds=function(t,e,i,n){void 0===n&&(n=0),this._boundsChanged=!1,this._scrollPane&&this._scrollPane.setContentSize(Math.round(t+i),Math.round(e+n))},Object.defineProperty(i.prototype,"viewWidth",{get:function(){return null!=this._scrollPane?this._scrollPane.viewWidth:this.width-this._margin.left-this._margin.right},set:function(t){null!=this._scrollPane?this._scrollPane.viewWidth=t:this.width=t+this._margin.left+this._margin.right},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"viewHeight",{get:function(){return null!=this._scrollPane?this._scrollPane.viewHeight:this.height-this._margin.top-this._margin.bottom},set:function(t){null!=this._scrollPane?this._scrollPane.viewHeight=t:this.height=t+this._margin.top+this._margin.bottom},enumerable:!0,configurable:!0}),i.prototype.getSnappingPosition=function(t,e,i){i||(i=new egret.Point);var n=this._children.length;if(0==n)return i.x=0,i.y=0,i;this.ensureBoundsCorrect();var o=null,r=null,s=0;if(0!=e){for(;s0&&s--;s0&&(this.displayObject.addEventListener(egret.Event.ADDED_TO_STAGE,this.___added,this),this.displayObject.addEventListener(egret.Event.REMOVED_FROM_STAGE,this.___removed,this)),this.applyAllControllers(),this._buildingDisplayList=!1,this._underConstruct=!1,this.buildNativeDisplayList(),this.setBoundsChangedFlag(),this.packageItem.objectType!=t.ObjectType.Component&&this.constructExtension(u),this.onConstruct()},i.prototype.onConstruct=function(){this.constructFromXML(null)},i.prototype.constructExtension=function(t){},i.prototype.constructFromXML=function(t){},i.prototype.setup_afterAdd=function(t,i){e.prototype.setup_afterAdd.call(this,t,i),t.seek(i,4);var n=t.readShort();null!=n&&null!=this._scrollPane&&(this._scrollPane.pageController=this._parent.getControllerAt(n));for(var o=t.readShort(),r=0;r=2)for(o=t.readShort(),r=0;r=0&&(this._relatedController=this.parent.getControllerAt(o)),this._relatedPageId=t.readS(),null!=(n=t.readS())&&(this._sound=n),t.readBool()&&(this._soundVolumeScale=t.readFloat()),this.selected=t.readBool()))},i.prototype.__rollover=function(t){this._buttonController&&this._buttonController.hasPage(i.OVER)&&(this._over=!0,this._down||this.setState(this._selected?i.SELECTED_OVER:i.OVER))},i.prototype.__rollout=function(t){this._buttonController&&this._buttonController.hasPage(i.OVER)&&(this._over=!1,this._down||this.setState(this._selected?i.DOWN:i.UP))},i.prototype.__mousedown=function(e){this._down=!0,t.GRoot.inst.nativeStage.addEventListener(egret.TouchEvent.TOUCH_END,this.__mouseup,this),this._mode==t.ButtonMode.Common&&(this.grayed&&this._buttonController&&this._buttonController.hasPage(i.DISABLED)?this.setState(i.SELECTED_DISABLED):this.setState(i.DOWN)),null!=this._linkedPopup&&(this._linkedPopup instanceof t.Window?this._linkedPopup.toggleStatus():this.root.togglePopup(this._linkedPopup,this))},i.prototype.__mouseup=function(e){if(this._down){if(t.GRoot.inst.nativeStage.removeEventListener(egret.TouchEvent.TOUCH_END,this.__mouseup,this),this._down=!1,null==this.displayObject)return;this._mode==t.ButtonMode.Common&&(this.grayed&&this._buttonController&&this._buttonController.hasPage(i.DISABLED)?this.setState(i.DISABLED):this._over?this.setState(i.OVER):this.setState(i.UP))}},i.prototype.__click=function(e){if(this._sound){var i=t.UIPackage.getItemByURL(this._sound);if(i){var n=i.owner.getItemAsset(i);n&&t.GRoot.inst.playOneShotSound(n,this._soundVolumeScale)}}this._mode==t.ButtonMode.Check?this._changeStateOnClick&&(this.selected=!this._selected,this.dispatchEvent(new t.StateChangeEvent(t.StateChangeEvent.CHANGED))):this._mode==t.ButtonMode.Radio?this._changeStateOnClick&&!this._selected&&(this.selected=!0,this.dispatchEvent(new t.StateChangeEvent(t.StateChangeEvent.CHANGED))):this._relatedController&&(this._relatedController.selectedPageId=this._relatedPageId)},i.UP="up",i.DOWN="down",i.OVER="over",i.SELECTED_OVER="selectedOver",i.DISABLED="disabled",i.SELECTED_DISABLED="selectedDisabled",i}(t.GComponent);t.GButton=e}(fgui||(fgui={})),function(t){var e=function(e){function i(){var i=e.call(this)||this;return i._visibleItemCount=0,i._selectedIndex=0,i._popupDirection=t.PopupDirection.Auto,i._visibleItemCount=t.UIConfig.defaultComboBoxVisibleItemCount,i._itemsUpdated=!0,i._selectedIndex=-1,i._items=[],i._values=[],i}return __extends(i,e),Object.defineProperty(i.prototype,"text",{get:function(){return this._titleObject?this._titleObject.text:null},set:function(t){this._titleObject&&(this._titleObject.text=t),this.updateGear(6)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"icon",{get:function(){return this._iconObject?this._iconObject.icon:null},set:function(t){this._iconObject&&(this._iconObject.icon=t),this.updateGear(7)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"titleColor",{get:function(){var t=this.getTextField();return null!=t?t.color:0},set:function(t){var e=this.getTextField();null!=e&&(e.color=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"titleFontSize",{get:function(){var t=this.getTextField();return null!=t?t.fontSize:0},set:function(t){var e=this.getTextField();null!=e&&(e.fontSize=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visibleItemCount",{get:function(){return this._visibleItemCount},set:function(t){this._visibleItemCount=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"popupDirection",{get:function(){return this._popupDirection},set:function(t){this._popupDirection=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"items",{get:function(){return this._items},set:function(t){t?this._items=t.concat():this._items.length=0,this._items.length>0?(this._selectedIndex>=this._items.length?this._selectedIndex=this._items.length-1:-1==this._selectedIndex&&(this._selectedIndex=0),this.text=this._items[this._selectedIndex],null!=this._icons&&this._selectedIndex=0&&this.selectedIndex0?(this._selectedIndex=0,this.text=this._items[0]):this._selectedIndex=-1,null!=(s=t.readS())&&(this.icon=s),t.readBool()&&(this.titleColor=t.readColor()),(o=t.readInt())>0&&(this._visibleItemCount=o),this._popupDirection=t.readByte(),(o=t.readShort())>=0&&(this._selectionController=this.parent.getControllerAt(o))}},i.prototype.showDropdown=function(){if(this._itemsUpdated){this._itemsUpdated=!1,this._list.removeChildrenToPool();for(var e=this._items.length,i=0;i=0?this.text=this._items[this._selectedIndex]:this.text="",this.dispatchEvent(new t.StateChangeEvent(t.StateChangeEvent.CHANGED))},i.prototype.__rollover=function(e){this._over=!0,this._down||this.dropdown&&this.dropdown.parent||this.setState(t.GButton.OVER)},i.prototype.__rollout=function(e){this._over=!1,this._down||this.dropdown&&this.dropdown.parent||this.setState(t.GButton.UP)},i.prototype.__mousedown=function(e){e.target instanceof egret.TextField&&e.target.type==egret.TextFieldType.INPUT||(this._down=!0,t.GRoot.inst.nativeStage.addEventListener(egret.TouchEvent.TOUCH_END,this.__mouseup,this),this.dropdown&&this.showDropdown())},i.prototype.__mouseup=function(e){this._down&&(this._down=!1,t.GRoot.inst.nativeStage.removeEventListener(egret.TouchEvent.TOUCH_END,this.__mouseup,this),this.dropdown&&!this.dropdown.parent&&(this._over?this.setState(t.GButton.OVER):this.setState(t.GButton.UP)))},i}(t.GComponent);t.GComboBox=e}(fgui||(fgui={})),function(t){var e=function(e){function i(){var t=e.call(this)||this;return t._type=0,t._lineSize=0,t._lineColor=0,t._fillColor=0,t._lineSize=1,t._lineAlpha=1,t._fillAlpha=1,t._fillColor=16777215,t._sides=3,t._startAngle=0,t}return __extends(i,e),Object.defineProperty(i.prototype,"graphics",{get:function(){return this._graphics},enumerable:!0,configurable:!0}),i.prototype.drawRect=function(t,e,i,n,o,r){void 0===r&&(r=null),this._type=1,this._lineSize=t,this._lineColor=e,this._lineAlpha=i,this._fillColor=n,this._fillAlpha=o,this._cornerRadius=r,this.updateGraph()},i.prototype.drawEllipse=function(t,e,i,n,o){this._type=2,this._lineSize=t,this._lineColor=e,this._lineAlpha=i,this._fillColor=n,this._fillAlpha=o,this._cornerRadius=null,this.updateGraph()},i.prototype.drawRegularPolygon=function(t,e,i,n,o,r,s,a){void 0===s&&(s=0),void 0===a&&(a=null),this._type=3,this._lineSize=t,this._lineColor=e,this._lineAlpha=i,this._fillColor=n,this._fillAlpha=o,this._sides=r,this._startAngle=s,this._distances=a,this.updateGraph()},i.prototype.drawPolygon=function(t,e,i,n,o,r){this._type=4,this._lineSize=t,this._lineColor=e,this._lineAlpha=i,this._fillColor=n,this._fillAlpha=o,this._polygonPoints=r,this.updateGraph()},Object.defineProperty(i.prototype,"distances",{get:function(){return this._distances},set:function(t){this._distances=t,3==this._type&&this.updateGraph()},enumerable:!0,configurable:!0}),i.prototype.clearGraphics=function(){this._graphics&&(this._type=0,this._graphics.clear())},Object.defineProperty(i.prototype,"color",{get:function(){return this._fillColor},set:function(t){this._fillColor=t,0!=this._type&&this.updateGraph()},enumerable:!0,configurable:!0}),i.prototype.updateGraph=function(){var e=this.graphics;e.clear();var i=this.width,n=this.height;if(0!=i&&0!=n){if(0==this._lineSize?e.lineStyle(0,0,0):e.lineStyle(this._lineSize,this._lineColor,this._lineAlpha),e.beginFill(this._fillColor,this._fillAlpha),1==this._type)this._cornerRadius?1==this._cornerRadius.length?e.drawRoundRect(0,0,i,n,2*this._cornerRadius[0],2*this._cornerRadius[0]):e.drawRoundRect(0,0,i,n,2*this._cornerRadius[0],2*this._cornerRadius[1]):e.drawRect(0,0,i,n);else if(2==this._type)e.drawEllipse(0,0,i,n);else if(3==this._type)t.ToolSet.fillPath(e,this._polygonPoints,0,0);else if(4==this._type){this._polygonPoints||(this._polygonPoints=[]);var o=Math.min(this._width,this._height)/2;this._polygonPoints.length=0;for(var r,s=this._startAngle*Math.PI/180,a=2*Math.PI/this._sides,h=0;h>24&255)/255,r=t.readColor(!0),this._fillColor=16777215&r,this._fillAlpha=(r>>24&255)/255,t.readBool())for(this._cornerRadius=new Array(4),n=0;n<4;n++)this._cornerRadius[n]=t.readFloat();if(3==this._type)for(o=t.readShort(),this._polygonPoints=[],this._polygonPoints.length=o,n=0;n0))for(this._distances=[],n=0;na&&(a=n),(n=i.yMin+i.height)>h&&(h=n),l=!1);var c=0,u=0;l||(this._updating|=1,this.setXY(r,s),this._updating&=2,c=a-r,u=h-s),0==(2&this._updating)?(this._updating|=2,this.setSize(c,u),this._updating&=1):(this._updating&=1,this.resizeChildren(this._width-c,this._height-u))},i.prototype.handleLayout=function(){var e,i,n;if(this._updating|=1,this._layout==t.GroupLayoutType.Horizontal){var o=this.x;for(n=this._parent.numChildren,i=0;i0?o._sizePercentInGroup=(1==this._layout?o.width:o.height)/this._totalSize:o._sizePercentInGroup=0)}var a=0,h=1,l=!1;if(1==this._layout){a=this.width-(this._numChildren-1)*this._columnGap,-1!=this._mainChildIndex&&a>=this._totalSize&&((o=this._parent.getChildAt(this._mainChildIndex)).setSize(a-(this._totalSize-this._mainGridMinSize),o._rawHeight+i,!0),a-=o.width,h-=o._sizePercentInGroup,l=!0);var c=this.x;for(n=0;n=this._totalSize&&((o=this._parent.getChildAt(this._mainChildIndex)).setSize(o._rawWidth+e,a-(this._totalSize-this._mainGridMinSize),!0),a-=o.height,h-=o._sizePercentInGroup,l=!0);var u=this.y;for(n=0;n=2&&(this._excludeInvisibles=t.readBool(),this._autoSizeDisabled=t.readBool(),this._mainChildIndex=t.readInt())},i.prototype.setup_afterAdd=function(t,i){e.prototype.setup_afterAdd.call(this,t,i),this.visible||this.handleVisibleChanged()},i}(t.GObject);t.GGroup=e}(fgui||(fgui={})),function(t){var e=function(e){function i(){var i=e.call(this)||this;return i._flip=t.FlipType.None,i}return __extends(i,e),Object.defineProperty(i.prototype,"color",{get:function(){return this._content.color},set:function(t){this._content.color!=t&&(this._content.color=t,this.updateGear(4))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"flip",{get:function(){return this._flip},set:function(e){if(this._flip!=e){this._flip=e;var i=1,n=1;this._flip!=t.FlipType.Horizontal&&this._flip!=t.FlipType.Both||(i=-1),this._flip!=t.FlipType.Vertical&&this._flip!=t.FlipType.Both||(n=-1),this._content.scaleX=i,this._content.scaleY=n,this.handleXYChanged()}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fillMethod",{get:function(){return this._content.fillMethod},set:function(t){this._content.fillMethod=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fillOrigin",{get:function(){return this._content.fillOrigin},set:function(t){this._content.fillOrigin=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fillClockwise",{get:function(){return this._content.fillClockwise},set:function(t){this._content.fillClockwise=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fillAmount",{get:function(){return this._content.fillAmount},set:function(t){this._content.fillAmount=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"texture",{get:function(){return this._content.texture},set:function(t){null!=t?(this.sourceWidth=t.textureWidth,this.sourceHeight=t.textureHeight):(this.sourceWidth=0,this.sourceHeight=0),this.initWidth=this.sourceWidth,this.initHeight=this.sourceHeight,this._content.scale9Grid=null,this._content.fillMode=egret.BitmapFillMode.SCALE,this._content.texture=t},enumerable:!0,configurable:!0}),i.prototype.createDisplayObject=function(){this._content=new t.Image,this._content.touchEnabled=!1,this.setDisplayObject(this._content)},i.prototype.constructFromResource=function(){var t=this.packageItem.getBranch();this.sourceWidth=t.width,this.sourceHeight=t.height,this.initWidth=this.sourceWidth,this.initHeight=this.sourceHeight,this.setSize(this.sourceWidth,this.sourceHeight),(t=t.getHighResolution()).load(),this._content.scale9Grid=t.scale9Grid,this._content.smoothing=t.smoothing,t.scaleByTile&&(this._content.fillMode=egret.BitmapFillMode.REPEAT),this.setSize(this.sourceWidth,this.sourceHeight),this._content.texture=t.texture},i.prototype.handleXYChanged=function(){e.prototype.handleXYChanged.call(this),this._flip!=t.FlipType.None&&(-1==this._content.scaleX&&(this._content.x+=this.width),-1==this._content.scaleY&&(this._content.y+=this.height))},i.prototype.getProp=function(i){return i==t.ObjectPropID.Color?this.color:e.prototype.getProp.call(this,i)},i.prototype.setProp=function(i,n){i==t.ObjectPropID.Color?this.color=n:e.prototype.setProp.call(this,i,n)},i.prototype.setup_beforeAdd=function(t,i){e.prototype.setup_beforeAdd.call(this,t,i),t.seek(i,5),t.readBool()&&(this.color=t.readColor()),this.flip=t.readByte(),this._content.fillMethod=t.readByte(),0!=this._content.fillMethod&&(this._content.fillOrigin=t.readByte(),this._content.fillClockwise=t.readBool(),this._content.fillAmount=t.readFloat())},i}(t.GObject);t.GImage=e}(fgui||(fgui={})),function(t){var e=function(e){function i(){return e.call(this)||this}return __extends(i,e),Object.defineProperty(i.prototype,"icon",{get:function(){if(null!=this._iconObject)return this._iconObject.icon},set:function(t){null!=this._iconObject&&(this._iconObject.icon=t),this.updateGear(7)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"title",{get:function(){return this._titleObject?this._titleObject.text:null},set:function(t){this._titleObject&&(this._titleObject.text=t),this.updateGear(6)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"text",{get:function(){return this.title},set:function(t){this.title=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"titleColor",{get:function(){var t=this.getTextField();return null!=t?t.color:0},set:function(t){var e=this.getTextField();null!=e&&(e.color=t),this.updateGear(4)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"titleFontSize",{get:function(){var t=this.getTextField();return null!=t?t.fontSize:0},set:function(t){var e=this.getTextField();null!=e&&(e.fontSize=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"editable",{get:function(){return!!(this._titleObject&&this._titleObject instanceof t.GTextInput)&&this._titleObject.asTextInput.editable},set:function(t){this._titleObject&&(this._titleObject.asTextInput.editable=t)},enumerable:!0,configurable:!0}),i.prototype.getTextField=function(){return this._titleObject instanceof t.GTextField?this._titleObject:this._titleObject instanceof i?this._titleObject.getTextField():this._titleObject instanceof t.GButton?this._titleObject.getTextField():null},i.prototype.getProp=function(i){switch(i){case t.ObjectPropID.Color:return this.titleColor;case t.ObjectPropID.OutlineColor:var n=this.getTextField();return n?n.strokeColor:0;case t.ObjectPropID.FontSize:return this.titleFontSize;default:return e.prototype.getProp.call(this,i)}},i.prototype.setProp=function(i,n){switch(i){case t.ObjectPropID.Color:this.titleColor=n;break;case t.ObjectPropID.OutlineColor:var o=this.getTextField();o&&(o.strokeColor=n);break;case t.ObjectPropID.FontSize:this.titleFontSize=n;break;default:e.prototype.setProp.call(this,i,n)}},i.prototype.constructExtension=function(t){this._titleObject=this.getChild("title"),this._iconObject=this.getChild("icon")},i.prototype.setup_afterAdd=function(t,i){if(e.prototype.setup_afterAdd.call(this,t,i),t.seek(i,6)&&t.readByte()==this.packageItem.objectType){var n;null!=(n=t.readS())&&(this.title=n),null!=(n=t.readS())&&(this.icon=n),t.readBool()&&(this.titleColor=t.readColor());var o=t.readInt();if(0!=o&&(this.titleFontSize=o),t.readBool()){var r=this.getTextField();null!=r?(null!=(n=t.readS())&&(r.promptText=n),null!=(n=t.readS())&&(r.restrict=n),0!=(o=t.readInt())&&(r.maxLength=o),o=t.readInt(),t.readBool()&&(r.password=!0)):t.skip(13)}}},i}(t.GComponent);t.GLabel=e}(fgui||(fgui={})),function(t){var e=function(e){function n(){var i=e.call(this)||this;return i.scrollItemToViewOnClick=!0,i.foldInvisibleItems=!1,i._lineCount=0,i._columnCount=0,i._lineGap=0,i._columnGap=0,i._lastSelectedIndex=0,i._numItems=0,i._realNumItems=0,i._firstIndex=0,i._curLineItemCount=0,i._curLineItemCount2=0,i._virtualListChanged=0,i.itemInfoVer=0,i._trackBounds=!0,i._pool=new t.GObjectPool,i._layout=t.ListLayoutType.SingleColumn,i._autoResizeItem=!0,i._lastSelectedIndex=-1,i._selectionMode=t.ListSelectionMode.Single,i.opaque=!0,i._align=t.AlignType.Left,i._verticalAlign=t.VertAlignType.Top,i._container=new egret.DisplayObjectContainer,i._rootContainer.addChild(i._container),i}return __extends(n,e),n.prototype.dispose=function(){this._pool.clear(),e.prototype.dispose.call(this)},Object.defineProperty(n.prototype,"layout",{get:function(){return this._layout},set:function(t){this._layout!=t&&(this._layout=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"lineCount",{get:function(){return this._lineCount},set:function(t){this._lineCount!=t&&(this._lineCount=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"columnCount",{get:function(){return this._columnCount},set:function(t){this._columnCount!=t&&(this._columnCount=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"lineGap",{get:function(){return this._lineGap},set:function(t){this._lineGap!=t&&(this._lineGap=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"columnGap",{get:function(){return this._columnGap},set:function(t){this._columnGap!=t&&(this._columnGap=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"align",{get:function(){return this._align},set:function(t){this._align!=t&&(this._align=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"verticalAlign",{get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!=t&&(this._verticalAlign=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"virtualItemSize",{get:function(){return this._itemSize},set:function(t){this._virtual&&(null==this._itemSize&&(this._itemSize=new egret.Point),this._itemSize.copyFrom(t),this.setVirtualListChangedFlag(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"defaultItem",{get:function(){return this._defaultItem},set:function(t){this._defaultItem=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"autoResizeItem",{get:function(){return this._autoResizeItem},set:function(t){this._autoResizeItem!=t&&(this._autoResizeItem=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"selectionMode",{get:function(){return this._selectionMode},set:function(t){this._selectionMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"selectionController",{get:function(){return this._selectionController},set:function(t){this._selectionController=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"itemPool",{get:function(){return this._pool},enumerable:!0,configurable:!0}),n.prototype.getFromPool=function(t){void 0===t&&(t=null),t||(t=this._defaultItem);var e=this._pool.getObject(t);return null!=e&&(e.visible=!0),e},n.prototype.returnToPool=function(t){t.displayObject.cacheAsBitmap=!1,this._pool.returnObject(t)},n.prototype.addChildAt=function(i,n){if(void 0===n&&(n=0),e.prototype.addChildAt.call(this,i,n),i instanceof t.GButton){var o=i;o.selected=!1,o.changeStateOnClick=!1}return i.addEventListener(egret.TouchEvent.TOUCH_TAP,this.__clickItem,this),i},n.prototype.addItem=function(e){return void 0===e&&(e=null),e||(e=this._defaultItem),this.addChild(t.UIPackage.createObjectFromURL(e))},n.prototype.addItemFromPool=function(t){return void 0===t&&(t=null),this.addChild(this.getFromPool(t))},n.prototype.removeChildAt=function(t,i){void 0===i&&(i=!1);var n=e.prototype.removeChildAt.call(this,t,i);return n.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.__clickItem,this),n},n.prototype.removeChildToPoolAt=function(t){void 0===t&&(t=0);var i=e.prototype.removeChildAt.call(this,t);this.returnToPool(i)},n.prototype.removeChildToPool=function(t){e.prototype.removeChild.call(this,t),this.returnToPool(t)},n.prototype.removeChildrenToPool=function(t,e){void 0===t&&(t=0),void 0===e&&(e=-1),(e<0||e>=this._children.length)&&(e=this._children.length-1);for(var i=t;i<=e;++i)this.removeChildToPoolAt(t)},Object.defineProperty(n.prototype,"selectedIndex",{get:function(){var e;if(this._virtual)for(e=0;e=0&&e=0&&(this.clearSelection(),this.addSelection(i,!0));else if(this._layout==t.ListLayoutType.FlowHorizontal||this._layout==t.ListLayoutType.Pagination){for(var n=this._children[i],o=0,r=i-1;r>=0;r--){var s=this._children[r];if(s.y!=n.y){n=s;break}o++}for(;r>=0;r--)if((s=this._children[r]).y!=n.y){this.clearSelection(),this.addSelection(r+o+1,!0);break}}break;case 3:if(this._layout==t.ListLayoutType.SingleRow||this._layout==t.ListLayoutType.FlowHorizontal||this._layout==t.ListLayoutType.Pagination)++i=0&&(this.clearSelection(),this.addSelection(i,!0));else if(this._layout==t.ListLayoutType.FlowVertical){for(n=this._children[i],o=0,r=i-1;r>=0;r--){if((s=this._children[r]).x!=n.x){n=s;break}o++}for(;r>=0;r--)if((s=this._children[r]).x!=n.x){this.clearSelection(),this.addSelection(r+o+1,!0);break}}}},n.prototype.__clickItem=function(e){if(null==this._scrollPane||!this._scrollPane.isDragged){var i=e.currentTarget;this.setSelectionOnEvent(i),this._scrollPane&&this.scrollItemToViewOnClick&&this._scrollPane.scrollToView(i,!0);var n=new t.ItemEvent(t.ItemEvent.CLICK,i);n.stageX=e.stageX,n.stageY=e.stageY,this.dispatchItemEvent(n)}},n.prototype.dispatchItemEvent=function(t){this.dispatchEvent(t)},n.prototype.setSelectionOnEvent=function(e){if(e instanceof t.GButton&&this._selectionMode!=t.ListSelectionMode.None){var i=!1,n=e,o=this.childIndexToItemIndex(this.getChildIndex(e));if(this._selectionMode==t.ListSelectionMode.Single)n.selected||(this.clearSelectionExcept(n),n.selected=!0);else if(t.GRoot.shiftKeyDown){if(!n.selected)if(-1!=this._lastSelectedIndex){var r,s=Math.min(this._lastSelectedIndex,o),a=Math.max(this._lastSelectedIndex,o);if(a=Math.min(a,this.numItems-1),this._virtual)for(r=s;r<=a;r++){var h=this._virtualItems[r];h.obj instanceof t.GButton&&(h.obj.selected=!0),h.selected=!0}else for(r=s;r<=a;r++){var l=this.getChildAt(r).asButton;null!=l&&(l.selected=!0)}i=!0}else n.selected=!0}else t.GRoot.ctrlKeyDown||this._selectionMode==t.ListSelectionMode.Multiple_SingleClick?n.selected=!n.selected:n.selected?this.clearSelectionExcept(n):(this.clearSelectionExcept(n),n.selected=!0);i||(this._lastSelectedIndex=o),n.selected&&this.updateSelectionController(o)}},n.prototype.resizeToFit=function(e,i){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===i&&(i=0),this.ensureBoundsCorrect();var n=this.numItems;if(e>n&&(e=n),this._virtual){var o=Math.ceil(e/this._curLineItemCount);this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal?this.viewHeight=o*this._itemSize.y+Math.max(0,o-1)*this._lineGap:this.viewWidth=o*this._itemSize.x+Math.max(0,o-1)*this._columnGap}else if(0==e)this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal?this.viewHeight=i:this.viewWidth=i;else{for(var r=e-1,s=null;r>=0&&(s=this.getChildAt(r),this.foldInvisibleItems&&!s.visible);)r--;if(r<0)this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal?this.viewHeight=i:this.viewWidth=i;else{var a=0;this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal?((a=s.y+s.height)e&&(e=n.width)}return e},n.prototype.handleSizeChanged=function(){e.prototype.handleSizeChanged.call(this),this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0)},n.prototype.handleControllerChanged=function(t){e.prototype.handleControllerChanged.call(this,t),this._selectionController==t&&(this.selectedIndex=t.selectedIndex)},n.prototype.updateSelectionController=function(t){if(null!=this._selectionController&&!this._selectionController.changing&&tthis._virtualItems[a].height/2&&athis._virtualItems[a].width/2&&athis._virtualItems[a].width/2&&a=this._virtualItems.length)throw"Invalid child index: "+e+">"+this._virtualItems.length;var o;this._loop&&(e=Math.floor(this._firstIndex/this._numItems)*this._numItems+e);var r,s=this._virtualItems[e],a=0;if(this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal){for(r=this._curLineItemCount-1;r0&&(e%=this._numItems),e},n.prototype.itemIndexToChildIndex=function(e){if(!this._virtual)return e;if(this._layout==t.ListLayoutType.Pagination)return this.getChildIndex(this._virtualItems[e].obj);if(this._loop&&this._numItems>0){var i=this._firstIndex%this._numItems;e>=i?e-=i:e=this._numItems-i+e}else e-=this._firstIndex;return e},n.prototype.setVirtual=function(){this._setVirtual(!1)},n.prototype.setVirtualAndLoop=function(){this._setVirtual(!0)},n.prototype._setVirtual=function(e){if(!this._virtual){if(null==this._scrollPane)throw"Virtual list must be scrollable!";if(e){if(this._layout==t.ListLayoutType.FlowHorizontal||this._layout==t.ListLayoutType.FlowVertical)throw"Loop list is not supported for FlowHorizontal or FlowVertical layout!";this._scrollPane.bouncebackEffect=!1}if(this._virtual=!0,this._loop=e,this._virtualItems=new Array,this.removeChildrenToPool(),null==this._itemSize){this._itemSize=new egret.Point;var i=this.getFromPool(null);if(null==i)throw"Virtual List must have a default list item resource.";this._itemSize.x=i.width,this._itemSize.y=i.height,this.returnToPool(i)}this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal?(this._scrollPane.scrollStep=this._itemSize.y,this._loop&&(this._scrollPane._loop=2)):(this._scrollPane.scrollStep=this._itemSize.x,this._loop&&(this._scrollPane._loop=1)),this._scrollPane.addEventListener(t.ScrollPane.SCROLL,this.__scrolled,this),this.setVirtualListChangedFlag(!0)}},Object.defineProperty(n.prototype,"numItems",{get:function(){return this._virtual?this._numItems:this._children.length},set:function(e){if(this._virtual){if(null==this.itemRenderer)throw"Set itemRenderer first!";this._numItems=e,this._loop?this._realNumItems=6*this._numItems:this._realNumItems=this._numItems;var n=this._virtualItems.length;if(this._realNumItems>n)for(s=n;sr)for(var s=r;s0?this._curLineItemCount=this._columnCount:(this._curLineItemCount=Math.floor((this._scrollPane.viewWidth+this._columnGap)/(this._itemSize.x+this._columnGap)),this._curLineItemCount<=0&&(this._curLineItemCount=1)):this._layout==t.ListLayoutType.FlowVertical?this._lineCount>0?this._curLineItemCount=this._lineCount:(this._curLineItemCount=Math.floor((this._scrollPane.viewHeight+this._lineGap)/(this._itemSize.y+this._lineGap)),this._curLineItemCount<=0&&(this._curLineItemCount=1)):(this._columnCount>0?this._curLineItemCount=this._columnCount:(this._curLineItemCount=Math.floor((this._scrollPane.viewWidth+this._columnGap)/(this._itemSize.x+this._columnGap)),this._curLineItemCount<=0&&(this._curLineItemCount=1)),this._lineCount>0?this._curLineItemCount2=this._lineCount:(this._curLineItemCount2=Math.floor((this._scrollPane.viewHeight+this._lineGap)/(this._itemSize.y+this._lineGap)),this._curLineItemCount2<=0&&(this._curLineItemCount2=1))));var i=0,n=0;if(this._realNumItems>0){var o,r=Math.ceil(this._realNumItems/this._curLineItemCount)*this._curLineItemCount,s=Math.min(this._curLineItemCount,this._realNumItems);if(this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal){for(o=0;o0&&(i-=this._lineGap),this._autoResizeItem)n=this._scrollPane.viewWidth;else{for(o=0;o0&&(n-=this._columnGap)}}else if(this._layout==t.ListLayoutType.SingleRow||this._layout==t.ListLayoutType.FlowVertical){for(o=0;o0&&(n-=this._columnGap),this._autoResizeItem)i=this._scrollPane.viewHeight;else{for(o=0;o0&&(i-=this._lineGap)}}else{n=Math.ceil(r/(this._curLineItemCount*this._curLineItemCount2))*this.viewWidth,i=this.viewHeight}}this.handleAlign(n,i),this._scrollPane.setContentSize(n,i),this._eventLocked=!1,this.handleScroll(!0)},n.prototype.__scrolled=function(t){this.handleScroll(!1)},n.prototype.getIndexOnPos1=function(t){if(this._realNumItems0&&!t){if((i=this.getChildAt(0).y)>n.pos_param){for(e=this._firstIndex-this._curLineItemCount;e>=0;e-=this._curLineItemCount)if((i-=this._virtualItems[e].height+this._lineGap)<=n.pos_param)return n.pos_param=i,e;return n.pos_param=0,0}for(e=this._firstIndex;en.pos_param)return n.pos_param=i,e;i=o}return n.pos_param=i,this._realNumItems-this._curLineItemCount}for(i=0,e=0;en.pos_param)return n.pos_param=i,e;i=o}return n.pos_param=i,this._realNumItems-this._curLineItemCount},n.prototype.getIndexOnPos2=function(t){if(this._realNumItems0&&!t){if((i=this.getChildAt(0).x)>n.pos_param){for(e=this._firstIndex-this._curLineItemCount;e>=0;e-=this._curLineItemCount)if((i-=this._virtualItems[e].width+this._columnGap)<=n.pos_param)return n.pos_param=i,e;return n.pos_param=0,0}for(e=this._firstIndex;en.pos_param)return n.pos_param=i,e;i=o}return n.pos_param=i,this._realNumItems-this._curLineItemCount}for(i=0,e=0;en.pos_param)return n.pos_param=i,e;i=o}return n.pos_param=i,this._realNumItems-this._curLineItemCount},n.prototype.getIndexOnPos3=function(t){if(this._realNumItemsn.pos_param)return n.pos_param=a,s+e;a=i}return n.pos_param=a,s+this._curLineItemCount-1},n.prototype.handleScroll=function(e){if(!this._eventLocked){if(this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal){for(var i=0;this.handleScroll1(e);)if(e=!1,++i>20){console.log("FairyGUI: list will never be filled as the item renderer function always returns a different size.");break}this.handleArchOrder1()}else if(this._layout==t.ListLayoutType.SingleRow||this._layout==t.ListLayoutType.FlowVertical){for(i=0;this.handleScroll2(e);)if(e=!1,++i>20){console.log("FairyGUI: list will never be filled as the item renderer function always returns a different size.");break}this.handleArchOrder2()}else this.handleScroll3(e);this._boundsChanged=!1}},n.prototype.handleScroll1=function(e){var i=this._scrollPane.scrollingPosY,o=i+this._scrollPane.viewHeight,r=o==this._scrollPane.contentHeight;n.pos_param=i;var s=this.getIndexOnPos1(e);if(i=n.pos_param,s==this._firstIndex&&!e)return!1;var a=this._firstIndex;this._firstIndex=s;var h,l,c,u,_,p=s,d=a>s,f=this.numChildren,g=a+f-1,y=d?g:a,m=0,b=i,v=0,w=0,C=this.defaultItem,S=(this._scrollPane.viewWidth-this._columnGap*(this._curLineItemCount-1))/this._curLineItemCount;for(this.itemInfoVer++;p=a;_--)if(null!=(c=this._virtualItems[_]).obj&&c.updateFlag!=this.itemInfoVer&&c.obj.resourceURL==C){c.obj instanceof t.GButton&&(c.selected=c.obj.selected),l.obj=c.obj,c.obj=null,_==y&&y--;break}}else for(_=y;_<=g;_++)if(null!=(c=this._virtualItems[_]).obj&&c.updateFlag!=this.itemInfoVer&&c.obj.resourceURL==C){c.obj instanceof t.GButton&&(c.selected=c.obj.selected),l.obj=c.obj,c.obj=null,_==y&&y++;break}null!=l.obj?this.setChildIndex(l.obj,d?p-s:this.numChildren):(l.obj=this._pool.getObject(C),d?this.addChildAt(l.obj,p-s):this.addChild(l.obj)),l.obj instanceof t.GButton&&(l.obj.selected=l.selected),h=!0}else h=e;h&&(this._autoResizeItem&&(this._layout==t.ListLayoutType.SingleColumn||this._columnCount>0)&&l.obj.setSize(S,l.obj.height,!0),this.itemRenderer.call(this.callbackThisObj,p%this._numItems,l.obj),p%this._curLineItemCount==0&&(v+=Math.ceil(l.obj.height)-l.height,p==s&&a>s&&(w=Math.ceil(l.obj.height)-l.height)),l.width=Math.ceil(l.obj.width),l.height=Math.ceil(l.obj.height)),l.updateFlag=this.itemInfoVer,l.obj.setXY(m,b),p==s&&(o+=l.height),m+=l.width+this._columnGap,p%this._curLineItemCount==this._curLineItemCount-1&&(m=0,b+=l.height+this._lineGap),p++}for(u=0;u0&&this.numChildren>0&&this._container.y<=0&&this.getChildAt(0).y>-this._container.y},n.prototype.handleScroll2=function(e){var i=this._scrollPane.scrollingPosX,o=i+this._scrollPane.viewWidth,r=i==this._scrollPane.contentWidth;n.pos_param=i;var s=this.getIndexOnPos2(e);if(i=n.pos_param,s==this._firstIndex&&!e)return!1;var a=this._firstIndex;this._firstIndex=s;var h,l,c,u,_,p=s,d=a>s,f=this.numChildren,g=a+f-1,y=d?g:a,m=i,b=0,v=0,w=0,C=this.defaultItem,S=(this._scrollPane.viewHeight-this._lineGap*(this._curLineItemCount-1))/this._curLineItemCount;for(this.itemInfoVer++;p=a;_--)if(null!=(c=this._virtualItems[_]).obj&&c.updateFlag!=this.itemInfoVer&&c.obj.resourceURL==C){c.obj instanceof t.GButton&&(c.selected=c.obj.selected),l.obj=c.obj,c.obj=null,_==y&&y--;break}}else for(_=y;_<=g;_++)if(null!=(c=this._virtualItems[_]).obj&&c.updateFlag!=this.itemInfoVer&&c.obj.resourceURL==C){c.obj instanceof t.GButton&&(c.selected=c.obj.selected),l.obj=c.obj,c.obj=null,_==y&&y++;break}null!=l.obj?this.setChildIndex(l.obj,d?p-s:this.numChildren):(l.obj=this._pool.getObject(C),d?this.addChildAt(l.obj,p-s):this.addChild(l.obj)),l.obj instanceof t.GButton&&(l.obj.selected=l.selected),h=!0}else h=e;h&&(this._autoResizeItem&&(this._layout==t.ListLayoutType.SingleRow||this._lineCount>0)&&l.obj.setSize(l.obj.width,S,!0),this.itemRenderer.call(this.callbackThisObj,p%this._numItems,l.obj),p%this._curLineItemCount==0&&(v+=Math.ceil(l.obj.width)-l.width,p==s&&a>s&&(w=Math.ceil(l.obj.width)-l.width)),l.width=Math.ceil(l.obj.width),l.height=Math.ceil(l.obj.height)),l.updateFlag=this.itemInfoVer,l.obj.setXY(m,b),p==s&&(o+=l.width),b+=l.height+this._lineGap,p%this._curLineItemCount==this._curLineItemCount-1&&(b=0,m+=l.width+this._columnGap),p++}for(u=0;u0&&this.numChildren>0&&this._container.x<=0&&this.getChildAt(0).x>-this._container.x},n.prototype.handleScroll3=function(e){var i=this._scrollPane.scrollingPosX;n.pos_param=i;var o=this.getIndexOnPos3(e);if(i=n.pos_param,o!=this._firstIndex||e){var r=this._firstIndex;this._firstIndex=o;var s,a,h,l,c,u=r,_=this._virtualItems.length,p=this._curLineItemCount*this._curLineItemCount2,d=o%this._curLineItemCount,f=this.viewWidth,g=Math.floor(o/p)*p,y=g+2*p,m=this._defaultItem,b=(this._scrollPane.viewWidth-this._columnGap*(this._curLineItemCount-1))/this._curLineItemCount,v=(this._scrollPane.viewHeight-this._lineGap*(this._curLineItemCount2-1))/this._curLineItemCount2;for(this.itemInfoVer++,a=g;a=this._realNumItems)){if(c=a%this._curLineItemCount,a-gd)continue;(h=this._virtualItems[a]).updateFlag=this.itemInfoVer}var w=null,C=0;for(a=g;a=this._realNumItems)&&(h=this._virtualItems[a]).updateFlag==this.itemInfoVer){if(null==h.obj){for(;u<_;){if(null!=(l=this._virtualItems[u]).obj&&l.updateFlag!=this.itemInfoVer){l.obj instanceof t.GButton&&(l.selected=l.obj.selected),h.obj=l.obj,l.obj=null;break}u++}-1==C&&(C=this.getChildIndex(w)+1),null==h.obj?(null!=this.itemProvider&&(null==(m=this.itemProvider.call(this.callbackThisObj,a%this._numItems))&&(m=this._defaultItem),m=t.UIPackage.normalizeURL(m)),h.obj=this._pool.getObject(m),this.addChildAt(h.obj,C)):C=this.setChildIndexBefore(h.obj,C),C++,h.obj instanceof t.GButton&&(h.obj.selected=h.selected),s=!0}else s=e,C=-1,w=h.obj;s&&(this._autoResizeItem&&(this._curLineItemCount==this._columnCount&&this._curLineItemCount2==this._lineCount?h.obj.setSize(b,v,!0):this._curLineItemCount==this._columnCount?h.obj.setSize(b,h.obj.height,!0):this._curLineItemCount2==this._lineCount&&h.obj.setSize(h.obj.width,v,!0)),this.itemRenderer.call(this.callbackThisObj,a%this._numItems,h.obj),h.width=Math.ceil(h.obj.width),h.height=Math.ceil(h.obj.height))}var S=g/p*f,x=S,T=0,P=0;for(a=g;a=this._realNumItems||((h=this._virtualItems[a]).updateFlag==this.itemInfoVer&&h.obj.setXY(x,T),h.height>P&&(P=h.height),a%this._curLineItemCount==this._curLineItemCount-1?(x=S,T+=P+this._lineGap,P=0,a==g+p-1&&(x=S+=f,T=0)):x+=h.width+this._columnGap);for(a=u;a<_;a++)(h=this._virtualItems[a]).updateFlag!=this.itemInfoVer&&null!=h.obj&&(h.obj instanceof t.GButton&&(h.selected=h.obj.selected),this.removeChildToPool(h.obj),h.obj=null)}},n.prototype.handleArchOrder1=function(){if(this._childrenRenderOrder==t.ChildrenRenderOrder.Arch){for(var e=this._scrollPane.posY+this.viewHeight/2,i=Number.POSITIVE_INFINITY,n=0,o=0,r=this.numChildren,s=0;sr&&(r=i.width));if((h=o)<=d&&this._autoResizeItem&&this._scrollPane&&this._scrollPane._displayInDemand&&this._scrollPane.vtScrollBar)for(p+=this._scrollPane.vtScrollBar.width,e=0;e<_;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(i.setSize(p,i.height,!0),i.width>r&&(r=i.width));a=Math.ceil(r)}else if(this._layout==t.ListLayoutType.SingleRow){for(e=0;e<_;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(0!=n&&(n+=this._columnGap),i.x=n,this._autoResizeItem&&i.setSize(i.width,d,!0),n+=Math.ceil(i.width),i.height>s&&(s=i.height));if((a=n)<=p&&this._autoResizeItem&&this._scrollPane&&this._scrollPane._displayInDemand&&this._scrollPane.hzScrollBar)for(d+=this._scrollPane.hzScrollBar.height,e=0;e<_;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(i.setSize(i.width,d,!0),i.height>s&&(s=i.height));h=Math.ceil(s)}else if(this._layout==t.ListLayoutType.FlowHorizontal)if(this._autoResizeItem&&this._columnCount>0){for(e=0;e<_;e++)if(i=this.getChildAt(e),(!this.foldInvisibleItems||i.visible)&&(f+=i.sourceWidth,++l==this._columnCount||e==_-1)){for(y=(p-f-(l-1)*this._columnGap)/f,n=0,l=g;l<=e;l++)i=this.getChildAt(l),this.foldInvisibleItems&&!i.visible||(i.setXY(n,o),ls&&(s=i.height));o+=Math.ceil(s)+this._lineGap,s=0,l=0,g=e+1,f=0}h=o+Math.ceil(s),a=p}else{for(e=0;e<_;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(0!=n&&(n+=this._columnGap),(0!=this._columnCount&&l>=this._columnCount||0==this._columnCount&&n+i.width>p&&0!=s)&&(n=0,o+=Math.ceil(s)+this._lineGap,s=0,l=0),i.setXY(n,o),(n+=Math.ceil(i.width))>r&&(r=n),i.height>s&&(s=i.height),l++);h=o+Math.ceil(s),a=Math.ceil(r)}else if(this._layout==t.ListLayoutType.FlowVertical)if(this._autoResizeItem&&this._lineCount>0){for(e=0;e<_;e++)if(i=this.getChildAt(e),(!this.foldInvisibleItems||i.visible)&&(f+=i.sourceHeight,++l==this._lineCount||e==_-1)){for(y=(d-f-(l-1)*this._lineGap)/f,o=0,l=g;l<=e;l++)i=this.getChildAt(l),this.foldInvisibleItems&&!i.visible||(i.setXY(n,o),lr&&(r=i.width));n+=Math.ceil(r)+this._columnGap,r=0,l=0,g=e+1,f=0}a=n+Math.ceil(r),h=d}else{for(e=0;e<_;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(0!=o&&(o+=this._lineGap),(0!=this._lineCount&&l>=this._lineCount||0==this._lineCount&&o+i.height>d&&0!=r)&&(o=0,n+=Math.ceil(r)+this._columnGap,r=0,l=0),i.setXY(n,o),(o+=Math.ceil(i.height))>s&&(s=o),i.width>r&&(r=i.width),l++);a=n+Math.ceil(r),h=Math.ceil(s)}else{var m;if(this._autoResizeItem&&this._lineCount>0&&(m=Math.floor((d-(this._lineCount-1)*this._lineGap)/this._lineCount)),this._autoResizeItem&&this._columnCount>0){for(e=0;e<_;e++)if(i=this.getChildAt(e),(!this.foldInvisibleItems||i.visible)&&(0==l&&(0!=this._lineCount&&u>=this._lineCount||0==this._lineCount&&o+(this._lineCount>0?m:i.height)>d)&&(c++,o=0,u=0),f+=i.sourceWidth,++l==this._columnCount||e==_-1)){for(y=(p-f-(l-1)*this._columnGap)/f,n=0,l=g;l<=e;l++)i=this.getChildAt(l),this.foldInvisibleItems&&!i.visible||(i.setXY(c*p+n,o),l0?m:i.height,!0),n+=Math.ceil(i.width)+this._columnGap):i.setSize(p-n,this._lineCount>0?m:i.height,!0),i.height>s&&(s=i.height));o+=Math.ceil(s)+this._lineGap,s=0,l=0,g=e+1,f=0,u++}}else for(e=0;e<_;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(0!=n&&(n+=this._columnGap),this._autoResizeItem&&this._lineCount>0&&i.setSize(i.width,m,!0),(0!=this._columnCount&&l>=this._columnCount||0==this._columnCount&&n+i.width>p&&0!=s)&&(n=0,o+=Math.ceil(s)+this._lineGap,s=0,l=0,u++,(0!=this._lineCount&&u>=this._lineCount||0==this._lineCount&&o+i.height>d&&0!=r)&&(c++,o=0,u=0)),i.setXY(c*p+n,o),(n+=Math.ceil(i.width))>r&&(r=n),i.height>s&&(s=i.height),l++);h=c>0?d:o+Math.ceil(s),a=(c+1)*p}this.handleAlign(a,h),this.setBounds(0,0,a,h)}},n.prototype.setup_beforeAdd=function(i,n){e.prototype.setup_beforeAdd.call(this,i,n),i.seek(n,5),this._layout=i.readByte(),this._selectionMode=i.readByte(),this._align=i.readByte(),this._verticalAlign=i.readByte(),this._lineGap=i.readShort(),this._columnGap=i.readShort(),this._lineCount=i.readShort(),this._columnCount=i.readShort(),this._autoResizeItem=i.readBool(),this._childrenRenderOrder=i.readByte(),this._apexIndex=i.readShort(),i.readBool()&&(this._margin.top=i.readInt(),this._margin.bottom=i.readInt(),this._margin.left=i.readInt(),this._margin.right=i.readInt());var o=i.readByte();if(o==t.OverflowType.Scroll){var r=i.position;i.seek(n,7),this.setupScroll(i),i.position=r}else this.setupOverflow(o);i.readBool()&&i.skip(8),i.version>=2&&(this.scrollItemToViewOnClick=i.readBool(),this.foldInvisibleItems=i.readBool()),i.seek(n,8),this._defaultItem=i.readS(),this.readItems(i)},n.prototype.readItems=function(t){var e,i,n,o;for(e=t.readShort(),i=0;i=2)for(o=e.readShort(),r=0;ro?n=o:o=n:this._fill==t.LoaderFillType.ScaleNoBorder&&(n>o?o=n:n=o),this._shrinkOnly&&(n>1&&(n=1),o>1&&(o=1)),this._contentWidth=this._contentSourceWidth*n,this._contentHeight=this._contentSourceHeight*o)),null!=this._content2?this._content2.setScale(n,o):(this._content.width=this._contentWidth,this._content.height=this._contentHeight),e=this._align==t.AlignType.Center?Math.floor((this.width-this._contentWidth)/2):this._align==t.AlignType.Right?this.width-this._contentWidth:0,i=this._verticalAlign==t.VertAlignType.Middle?Math.floor((this.height-this._contentHeight)/2):this._verticalAlign==t.VertAlignType.Bottom?this.height-this._contentHeight:0,null!=this._content2?this._content2.setXY(e,i):(this._content.x=e,this._content.y=i)}else this._autoSize&&(this._updatingLayout=!0,this.setSize(50,30),this._updatingLayout=!1)},i.prototype.clearContent=function(){this.clearErrorState(),null==this._contentItem&&null!=this._content.texture&&this.freeExternal(this._content.texture),this._content.texture=null,this._content.frames=null,null!=this._content2&&(this._container.removeChild(this._content2.displayObject),this._content2.dispose(),this._content2=null),this._contentItem=null},i.prototype.handleSizeChanged=function(){e.prototype.handleSizeChanged.call(this),this._updatingLayout||this.updateLayout()},i.prototype.getProp=function(i){switch(i){case t.ObjectPropID.Color:return this.color;case t.ObjectPropID.Playing:return this.playing;case t.ObjectPropID.Frame:return this.frame;case t.ObjectPropID.TimeScale:return this._content.timeScale;default:return e.prototype.getProp.call(this,i)}},i.prototype.setProp=function(i,n){switch(i){case t.ObjectPropID.Color:this.color=n;break;case t.ObjectPropID.Playing:this.playing=n;break;case t.ObjectPropID.Frame:this.frame=n;break;case t.ObjectPropID.TimeScale:this._content.timeScale=n;break;case t.ObjectPropID.DeltaTime:this._content.advance(n);break;default:e.prototype.setProp.call(this,i,n)}},i.prototype.setup_beforeAdd=function(t,i){e.prototype.setup_beforeAdd.call(this,t,i),t.seek(i,5),this._url=t.readS(),this._align=t.readByte(),this._verticalAlign=t.readByte(),this._fill=t.readByte(),this._shrinkOnly=t.readBool(),this._autoSize=t.readBool(),this._showErrorSign=t.readBool(),this._content.playing=t.readBool(),this._content.frame=t.readInt(),t.readBool()&&(this.color=t.readColor()),this._content.fillMethod=t.readByte(),0!=this._content.fillMethod&&(this._content.fillOrigin=t.readByte(),this._content.fillClockwise=t.readBool(),this._content.fillAmount=t.readFloat()),this._url&&this.loadContent()},i._errorSignPool=new t.GObjectPool,i}(t.GObject);t.GLoader=e}(fgui||(fgui={})),function(t){var e=function(e){function i(){return e.call(this)||this}return __extends(i,e),Object.defineProperty(i.prototype,"color",{get:function(){return this._content.color},set:function(t){this._content.color!=t&&(this._content.color=t,this.updateGear(4))},enumerable:!0,configurable:!0}),i.prototype.createDisplayObject=function(){this._content=new t.MovieClip,this._content.touchEnabled=!1,this.setDisplayObject(this._content)},Object.defineProperty(i.prototype,"playing",{get:function(){return this._content.playing},set:function(t){this._content.playing!=t&&(this._content.playing=t,this.updateGear(5))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"frame",{get:function(){return this._content.frame},set:function(t){this._content.frame!=t&&(this._content.frame=t,this.updateGear(5))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"timeScale",{get:function(){return this._content.timeScale},set:function(t){this._content.timeScale=t},enumerable:!0,configurable:!0}),i.prototype.rewind=function(){this._content.rewind()},i.prototype.syncStatus=function(t){this._content.syncStatus(t._content)},i.prototype.advance=function(t){this._content.advance(t)},i.prototype.setPlaySettings=function(t,e,i,n,o,r){void 0===t&&(t=0),void 0===e&&(e=-1),void 0===i&&(i=0),void 0===n&&(n=-1),void 0===o&&(o=null),void 0===r&&(r=null),this._content.setPlaySettings(t,e,i,n,o,r)},i.prototype.getProp=function(i){switch(i){case t.ObjectPropID.Color:return this.color;case t.ObjectPropID.Playing:return this.playing;case t.ObjectPropID.Frame:return this.frame;case t.ObjectPropID.TimeScale:return this.timeScale;default:return e.prototype.getProp.call(this,i)}},i.prototype.setProp=function(i,n){switch(i){case t.ObjectPropID.Color:this.color=n;break;case t.ObjectPropID.Playing:this.playing=n;break;case t.ObjectPropID.Frame:this.frame=n;break;case t.ObjectPropID.TimeScale:this.timeScale=n;break;case t.ObjectPropID.DeltaTime:this.advance(n);break;default:e.prototype.setProp.call(this,i,n)}},i.prototype.constructFromResource=function(){var t=this.packageItem.getBranch();this.sourceWidth=t.width,this.sourceHeight=t.height,this.initWidth=this.sourceWidth,this.initHeight=this.sourceHeight,this.setSize(this.sourceWidth,this.sourceHeight),(t=t.getHighResolution()).load(),this._content.interval=t.interval,this._content.swing=t.swing,this._content.repeatDelay=t.repeatDelay,this._content.frames=t.frames,this._content.smoothing=t.smoothing},i.prototype.setup_beforeAdd=function(t,i){e.prototype.setup_beforeAdd.call(this,t,i),t.seek(i,5),t.readBool()&&(this.color=t.readColor()),t.readByte(),this._content.frame=t.readInt(),this._content.playing=t.readBool()},i}(t.GObject);t.GMovieClip=e}(fgui||(fgui={})),function(t){var e=function(e){function i(){var i=e.call(this)||this;return i._min=0,i._max=0,i._value=0,i._barMaxWidth=0,i._barMaxHeight=0,i._barMaxWidthDelta=0,i._barMaxHeightDelta=0,i._barStartX=0,i._barStartY=0,i._titleType=t.ProgressTitleType.Percent,i._value=50,i._max=100,i}return __extends(i,e),Object.defineProperty(i.prototype,"titleType",{get:function(){return this._titleType},set:function(t){this._titleType!=t&&(this._titleType=t,this.update(this._value))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"min",{get:function(){return this._min},set:function(t){this._min!=t&&(this._min=t,this.update(this._value))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"max",{get:function(){return this._max},set:function(t){this._max!=t&&(this._max=t,this.update(this._value))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"value",{get:function(){return this._value},set:function(e){this._value!=e&&(t.GTween.kill(this,!1,this.update),this._value=e,this.update(e))},enumerable:!0,configurable:!0}),i.prototype.tweenValue=function(e,i){var n,o=t.GTween.getTween(this,this.update);return null!=o?(n=o.value.x,o.kill()):n=this._value,this._value=e,t.GTween.to(n,this._value,i).setTarget(this,this.update).setEase(t.EaseType.Linear)},i.prototype.update=function(e){var i=t.ToolSet.clamp01((e-this._min)/(this._max-this._min));if(this._titleObject)switch(this._titleType){case t.ProgressTitleType.Percent:this._titleObject.text=Math.floor(100*i)+"%";break;case t.ProgressTitleType.ValueAndMax:this._titleObject.text=Math.floor(e)+"/"+Math.floor(this._max);break;case t.ProgressTitleType.Value:this._titleObject.text=""+Math.floor(e);break;case t.ProgressTitleType.Max:this._titleObject.text=""+Math.floor(this._max)}var n=this.width-this._barMaxWidthDelta,o=this.height-this._barMaxHeightDelta;this._reverse?(this._barObjectH&&(this._barObjectH instanceof t.GImage&&this._barObjectH.fillMethod!=t.FillMethod.None?this._barObjectH.fillAmount=1-i:(this._barObjectH.width=Math.floor(n*i),this._barObjectH.x=this._barStartX+(n-this._barObjectH.width))),this._barObjectV&&(this._barObjectV instanceof t.GImage&&this._barObjectV.fillMethod!=t.FillMethod.None?this._barObjectV.fillAmount=1-i:(this._barObjectV.height=Math.floor(o*i),this._barObjectV.y=this._barStartY+(o-this._barObjectV.height)))):(this._barObjectH&&(this._barObjectH instanceof t.GImage&&this._barObjectH.fillMethod!=t.FillMethod.None?this._barObjectH.fillAmount=i:this._barObjectH.width=Math.floor(n*i)),this._barObjectV&&(this._barObjectV instanceof t.GImage&&this._barObjectV.fillMethod!=t.FillMethod.None?this._barObjectV.fillAmount=i:this._barObjectV.height=Math.floor(o*i))),this._aniObject&&this._aniObject.setProp(t.ObjectPropID.Frame,Math.floor(100*i))},i.prototype.constructExtension=function(t){t.seek(0,6),this._titleType=t.readByte(),this._reverse=t.readBool(),this._titleObject=this.getChild("title"),this._barObjectH=this.getChild("bar"),this._barObjectV=this.getChild("bar_v"),this._aniObject=this.getChild("ani"),this._barObjectH&&(this._barMaxWidth=this._barObjectH.width,this._barMaxWidthDelta=this.width-this._barMaxWidth,this._barStartX=this._barObjectH.x),this._barObjectV&&(this._barMaxHeight=this._barObjectV.height,this._barMaxHeightDelta=this.height-this._barMaxHeight,this._barStartY=this._barObjectV.y)},i.prototype.handleSizeChanged=function(){e.prototype.handleSizeChanged.call(this),this._barObjectH&&(this._barMaxWidth=this.width-this._barMaxWidthDelta),this._barObjectV&&(this._barMaxHeight=this.height-this._barMaxHeightDelta),this._underConstruct||this.update(this._value)},i.prototype.setup_afterAdd=function(t,i){e.prototype.setup_afterAdd.call(this,t,i),t.seek(i,6)&&t.readByte()==this.packageItem.objectType?(this._value=t.readInt(),this._max=t.readInt(),t.version>=2&&(this._min=t.readInt()),this.update(this._value)):this.update(this._value)},i}(t.GComponent);t.GProgressBar=e}(fgui||(fgui={})),function(t){var e=function(e){function n(){var i=e.call(this)||this;return i._fontSize=0,i._leading=0,i._letterSpacing=0,i._underline=!1,i._textWidth=0,i._textHeight=0,i._fontSize=12,i._align=t.AlignType.Left,i._verticalAlign=t.VertAlignType.Top,i._text="",i._leading=3,i._color=0,i._templateVars=null,i._autoSize=t.AutoSizeType.Both,i._widthAutoSize=!0,i._heightAutoSize=!0,i._bitmapPool=new Array,i}return __extends(n,e),n.prototype.createDisplayObject=function(){this._textField=new egret.TextField,this._textField.touchEnabled=!1,this.setDisplayObject(this._textField)},n.prototype.switchBitmapMode=function(t){t&&this.displayObject==this._textField?(null==this._bitmapContainer&&(this._bitmapContainer=new egret.Sprite),this.switchDisplayObject(this._bitmapContainer)):t||this.displayObject!=this._bitmapContainer||this.switchDisplayObject(this._textField)},n.prototype.dispose=function(){e.prototype.dispose.call(this),this._bitmapFont=null,this._requireRender=!1},Object.defineProperty(n.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t,null==this._text&&(this._text=""),this.updateGear(6),this.parent&&this.parent._underConstruct?this.renderNow():this.render()},enumerable:!0,configurable:!0}),n.prototype.updateTextFieldText=function(){var e=this._text;if(null!=this._templateVars&&(e=this.parseTemplate(e)),this._ubbEnabled){var i=n._htmlParser.parser(t.ToolSet.parseUBB(t.ToolSet.encodeHTML(e)));if(this._underline)for(var o=0;o0&&(this._textWidth+=4),this._textHeight=Math.ceil(this._textField.textHeight),this._textHeight>0&&(this._textHeight+=4);var e,i=0;this._widthAutoSize?(e=this._textWidth,this._textField.width=e):e=this.width,this._heightAutoSize?(i=this._textHeight,this._textField.height!=this._textHeight&&(this._textField.height=this._textHeight)):(i=this.height,this._textHeight>i&&(this._textHeight=i)),t&&(this._updatingSize=!0,this.setSize(e,i),this._updatingSize=!1)}else this.renderWithBitmapFont(t)},n.prototype.renderWithBitmapFont=function(e){this.switchBitmapMode(!0);for(var o=this._bitmapContainer.numChildren,r=0;r=65&&j<=90||j>=97&&j<=122?(0==g&&(y=u),g++):(g>0&&(m=u),g=0),32==j)d=Math.ceil(this._fontSize/2),f=this._fontSize;else{var k=this._bitmapFont.glyphs[O];k?(d=Math.ceil(k.advance*S),f=Math.ceil(k.lineHeight*S)):(d=0,f=0)}if(f>p&&(p=f),f>_&&(_=f),0!=u&&(u+=h),u+=d,!C||u<=c)v+=O;else{if((a=i.borrow()).height=_,a.textHeight=p,0==v.length)a.text=O;else if(g>0&&m>0){var L=(v+=O).length-g;a.text=t.ToolSet.trimRight(v.substr(0,L)),a.width=m,v=v.substr(L),u-=y}else a.text=v,a.width=u-(d+h),v=O,u=d,_=f,p=f;a.y=w,w+=a.height+l,a.width>this._textWidth&&(this._textWidth=a.width),g=0,y=0,m=0,this._lines.push(a)}}else v+=O,(a=i.borrow()).width=u,0==p&&(0==b&&(b=this._fontSize),0==_&&(_=b),p=_),a.height=_,b=_,a.textHeight=p,a.text=v,a.y=w,w+=a.height+l,a.width>this._textWidth&&(this._textWidth=a.width),this._lines.push(a),v="",u=0,_=0,p=0,g=0,y=0,m=0}v.length>0&&((a=i.borrow()).width=u,0==_&&(_=b),0==p&&(p=_),a.height=_,a.textHeight=p,a.text=v,a.y=w,a.width>this._textWidth&&(this._textWidth=a.width),this._lines.push(a)),this._textWidth>0&&(this._textWidth+=2*n.GUTTER_X),0==this._lines.length?this._textHeight=0:(a=this._lines[this._lines.length-1],this._textHeight=a.y+a.height+n.GUTTER_Y);var B,E=0;if(B=this._widthAutoSize?0==this._textWidth?0:this._textWidth:this.width,E=this._heightAutoSize?0==this._textHeight?0:this._textHeight:this.height,e&&(this._updatingSize=!0,this.setSize(B,E),this._updatingSize=!1),0!=B&&0!=E){var A=n.GUTTER_X,M=0,z=0;c=this.width-2*n.GUTTER_X;var F=this._lines.length;for(r=0;r0&&92==t.charCodeAt(e-1))s+=t.substring(r,e-1),s+="{",r=e+1;else{if(s+=t.substring(r,e),r=e,-1==(e=t.indexOf("}",r)))break;e!=r+1?(-1!=(i=(n=t.substring(r+1,e)).indexOf("="))?s+=null==(o=this._templateVars[n.substring(0,i)])?n.substring(i+1):o:null!=(o=this._templateVars[n])&&(s+=o),r=e+1):(s+=t.substr(r,2),r=e+1)}return rthis.width?t.x=this.width-t.width:t.x+t.width<0&&(t.x=0),t.y>this.height?t.y=this.height-t.height:t.y+t.height<0&&(t.y=0),this.adjustModalLayer()},i.prototype.hideWindow=function(t){t.hide()},i.prototype.hideWindowImmediately=function(t){t.parent==this&&this.removeChild(t),this.adjustModalLayer()},i.prototype.bringToFront=function(e){var i,n=this.numChildren;for(i=null==this._modalLayer.parent||e.modal?n-1:this.getChildIndex(this._modalLayer)-1;i>=0;i--){var o=this.getChildAt(i);if(o==e)return;if(o instanceof t.Window)break}i>=0&&this.setChildIndex(e,i)},i.prototype.showModalWait=function(e){void 0===e&&(e=null),null!=t.UIConfig.globalModalWaiting&&(null==this._modalWaitPane&&(this._modalWaitPane=t.UIPackage.createObjectFromURL(t.UIConfig.globalModalWaiting)),this._modalWaitPane.setSize(this.width,this.height),this._modalWaitPane.addRelation(this,t.RelationType.Size),this.addChild(this._modalWaitPane),this._modalWaitPane.text=e)},i.prototype.closeModalWait=function(){null!=this._modalWaitPane&&null!=this._modalWaitPane.parent&&this.removeChild(this._modalWaitPane)},i.prototype.closeAllExceptModals=function(){for(var e=this._children.slice(),i=e.length,n=0;n=0;e--){var i=this.getChildAt(e);if(i instanceof t.Window)return i}return null},Object.defineProperty(i.prototype,"modalLayer",{get:function(){return this._modalLayer},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"hasModalWindow",{get:function(){return null!=this._modalLayer.parent},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"modalWaiting",{get:function(){return this._modalWaitPane&&this._modalWaitPane.inContainer},enumerable:!0,configurable:!0}),i.prototype.showPopup=function(t,e,n){if(void 0===e&&(e=null),void 0===n&&(n=null),this._popupStack.length>0){var o=this._popupStack.indexOf(t);if(-1!=o)for(var r=this._popupStack.length-1;r>=o;r--)this.removeChild(this._popupStack.pop())}if(this._popupStack.push(t),null!=e)for(var s=e;null!=s;){if(s.parent==this){t.sortingOrderthis.width&&(h=h+c-t.width),l=a.y+u,(null==n&&l+t.height>this.height||0==n)&&(l=a.y-t.height-1)<0&&(l=0,h+=c/2),t.x=h,t.y=l},i.prototype.togglePopup=function(t,e,i){void 0===e&&(e=null),void 0===i&&(i=null),-1==this._justClosedPopups.indexOf(t)&&this.showPopup(t,e,i)},i.prototype.hidePopup=function(t){if(void 0===t&&(t=null),null!=t){var e=this._popupStack.indexOf(t);if(-1!=e)for(var i=this._popupStack.length-1;i>=e;i--)this.closePopup(this._popupStack.pop())}else{for(i=this._popupStack.length-1;i>=0;i--)this.closePopup(this._popupStack[i]);this._popupStack.length=0}},Object.defineProperty(i.prototype,"hasAnyPopup",{get:function(){return 0!=this._popupStack.length},enumerable:!0,configurable:!0}),i.prototype.closePopup=function(e){null!=e.parent&&(e instanceof t.Window?e.hide():this.removeChild(e))},i.prototype.showTooltips=function(e){if(null==this._defaultTooltipWin){var i=t.UIConfig.tooltipsWin;if(!i)return void console.error("UIConfig.tooltipsWin not defined");this._defaultTooltipWin=t.UIPackage.createObjectFromURL(i)}this._defaultTooltipWin.text=e,this.showTooltipsWin(this._defaultTooltipWin)},i.prototype.showTooltipsWin=function(t,e){void 0===e&&(e=null),this.hideTooltips(),this._tooltipWin=t;var n=0,o=0;null==e?(n=i.mouseX+10,o=i.mouseY+20):(n=e.x,o=e.y);var r=this.globalToLocal(n,o);n=r.x,o=r.y,n+this._tooltipWin.width>this.width&&(n=n-this._tooltipWin.width-1)<0&&(n=10),o+this._tooltipWin.height>this.height&&(o=o-this._tooltipWin.height-1,n-this._tooltipWin.width-1>0&&(n=n-this._tooltipWin.width-1),o<0&&(o=10)),this._tooltipWin.x=n,this._tooltipWin.y=o,this.addChild(this._tooltipWin)},i.prototype.hideTooltips=function(){null!=this._tooltipWin&&(this._tooltipWin.parent&&this.removeChild(this._tooltipWin),this._tooltipWin=null)},i.prototype.getObjectUnderPoint=function(e,i){var n=this._nativeStage.$hitTest(e,i);return n?t.ToolSet.displayObjectToGObject(n):null},Object.defineProperty(i.prototype,"focus",{get:function(){return this._focusedObject&&!this._focusedObject.onStage&&(this._focusedObject=null),this._focusedObject},set:function(t){if(t&&(!t.focusable||!t.onStage))throw"invalid focus target";this.setFocus(t)},enumerable:!0,configurable:!0}),i.prototype.setFocus=function(t){this._focusedObject!=t&&(this._focusedObject=t,this.dispatchEventWith(i.FOCUS_CHANGED))},Object.defineProperty(i.prototype,"volumeScale",{get:function(){return this._volumeScale},set:function(t){this._volumeScale=t},enumerable:!0,configurable:!0}),i.prototype.playOneShotSound=function(t,e){void 0===e&&(e=1);var i=this._volumeScale*e;t.play(0,1).volume=i},i.prototype.adjustModalLayer=function(){var e=this.numChildren;null!=this._modalWaitPane&&null!=this._modalWaitPane.parent&&this.setChildIndex(this._modalWaitPane,e-1);for(var i=e-1;i>=0;i--){var n=this.getChildAt(i);if(n instanceof t.Window&&n.modal)return void(null==this._modalLayer.parent?this.addChildAt(this._modalLayer,i):this.setChildIndexBefore(this._modalLayer,i))}null!=this._modalLayer.parent&&this.removeChild(this._modalLayer)},i.prototype.__addedToStage=function(e){this.displayObject.removeEventListener(egret.Event.ADDED_TO_STAGE,this.__addedToStage,this),this._nativeStage=this.displayObject.stage,this._nativeStage.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.__stageMouseDownCapture,this,!0),this._nativeStage.addEventListener(egret.TouchEvent.TOUCH_END,this.__stageMouseUpCapture,this,!0),this._nativeStage.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.__stageMouseMoveCapture,this,!0),this._modalLayer=new t.GGraph,this._modalLayer.setSize(this.width,this.height),this._modalLayer.drawRect(0,0,0,t.UIConfig.modalLayerColor,t.UIConfig.modalLayerAlpha),this._modalLayer.addRelation(this,t.RelationType.Size),this.displayObject.stage.addEventListener(egret.Event.RESIZE,this.__winResize,this),this.__winResize(null)},i.prototype.__stageMouseDownCapture=function(t){i.mouseX=t.stageX,i.mouseY=t.stageY,i.touchDown=!0;for(var e=t.target;e!=this.displayObject.stage&&null!=e;){if(e.$owner){var n=e.$owner;if(n.touchable&&n.focusable){this.setFocus(n);break}}e=e.parent}if(null!=this._tooltipWin&&this.hideTooltips(),this._justClosedPopups.length=0,this._popupStack.length>0){for(e=t.target;e!=this.displayObject.stage&&null!=e;){if(e.$owner){var o=this._popupStack.indexOf(e.$owner);if(-1!=o){for(var r=this._popupStack.length-1;r>o;r--){var s=this._popupStack.pop();this.closePopup(s),this._justClosedPopups.push(s)}return}}e=e.parent}for(r=this._popupStack.length-1;r>=0;r--)s=this._popupStack[r],this.closePopup(s),this._justClosedPopups.push(s);this._popupStack.length=0}},i.prototype.__stageMouseMoveCapture=function(t){i.mouseX=t.stageX,i.mouseY=t.stageY},i.prototype.__stageMouseUpCapture=function(t){i.touchDown=!1},i.prototype.__winResize=function(t){this.setSize(this._nativeStage.stageWidth,this._nativeStage.stageHeight)},i.prototype.updateContentScaleLevel=function(){i.contentScaleLevel=0},i.contentScaleLevel=0,i.contentScaleFactor=1,i.FOCUS_CHANGED="FocusChanged",i}(t.GComponent);t.GRoot=e}(fgui||(fgui={})),function(t){var e=function(t){function e(){var e=t.call(this)||this;return e._dragOffset=new egret.Point,e._scrollPerc=0,e}return __extends(e,t),e.prototype.setScrollPane=function(t,e){this._target=t,this._vertical=e},e.prototype.setDisplayPerc=function(t){this._vertical?(this._fixedGripSize||(this._grip.height=Math.floor(t*this._bar.height)),this._grip.y=this._bar.y+(this._bar.height-this._grip.height)*this._scrollPerc):(this._fixedGripSize||(this._grip.width=Math.floor(t*this._bar.width)),this._grip.x=this._bar.x+(this._bar.width-this._grip.width)*this._scrollPerc),this._grip.visible=0!=t&&1!=t},e.prototype.setScrollPerc=function(t){this._scrollPerc=t,this._vertical?this._grip.y=this._bar.y+(this._bar.height-this._grip.height)*this._scrollPerc:this._grip.x=this._bar.x+(this._bar.width-this._grip.width)*this._scrollPerc},Object.defineProperty(e.prototype,"minSize",{get:function(){return this._vertical?(null!=this._arrowButton1?this._arrowButton1.height:0)+(null!=this._arrowButton2?this._arrowButton2.height:0):(null!=this._arrowButton1?this._arrowButton1.width:0)+(null!=this._arrowButton2?this._arrowButton2.width:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gripDragging",{get:function(){return this._gripDragging},enumerable:!0,configurable:!0}),e.prototype.constructExtension=function(t){t.seek(0,6),this._fixedGripSize=t.readBool(),this._grip=this.getChild("grip"),this._grip?(this._bar=this.getChild("bar"),this._bar?(this._arrowButton1=this.getChild("arrow1"),this._arrowButton2=this.getChild("arrow2"),this._grip.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.__gripMouseDown,this),this._arrowButton1&&this._arrowButton1.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.__arrowButton1Click,this),this._arrowButton2&&this._arrowButton2.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.__arrowButton2Click,this),this.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.__barMouseDown,this)):console.error("需要定义bar")):console.error("需要定义grip")},e.prototype.__gripMouseDown=function(t){this._gripDragging=!0,this._target.updateScrollBarVisible(),t.stopPropagation(),this.globalToLocal(t.stageX,t.stageY,this._dragOffset),this._dragOffset.x-=this._grip.x,this._dragOffset.y-=this._grip.y,this._grip.displayObject.stage.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.__gripMouseMove,this),this._grip.displayObject.stage.addEventListener(egret.TouchEvent.TOUCH_END,this.__gripMouseUp,this)},e.prototype.__gripMouseMove=function(t){if(this.onStage){var i=this.globalToLocal(t.stageX,t.stageY,e.sScrollbarHelperPoint);if(this._vertical){var n=i.y-this._dragOffset.y;this._target.setPercY((n-this._bar.y)/(this._bar.height-this._grip.height),!1)}else{var o=i.x-this._dragOffset.x;this._target.setPercX((o-this._bar.x)/(this._bar.width-this._grip.width),!1)}}},e.prototype.__gripMouseUp=function(t){var e=t.currentTarget;e.removeEventListener(egret.TouchEvent.TOUCH_MOVE,this.__gripMouseMove,this),e.removeEventListener(egret.TouchEvent.TOUCH_END,this.__gripMouseUp,this),this.onStage||(this._gripDragging=!1,this._target.updateScrollBarVisible())},e.prototype.__arrowButton1Click=function(t){t.stopPropagation(),this._vertical?this._target.scrollUp():this._target.scrollLeft()},e.prototype.__arrowButton2Click=function(t){t.stopPropagation(),this._vertical?this._target.scrollDown():this._target.scrollRight()},e.prototype.__barMouseDown=function(t){var i=this._grip.globalToLocal(t.stageX,t.stageY,e.sScrollbarHelperPoint);this._vertical?i.y<0?this._target.scrollUp(4):this._target.scrollDown(4):i.x<0?this._target.scrollLeft(4):this._target.scrollRight(4)},e.sScrollbarHelperPoint=new egret.Point,e}(t.GComponent);t.GScrollBar=e}(fgui||(fgui={})),function(t){var e=function(e){function i(){var i=e.call(this)||this;return i._min=0,i._max=0,i._value=0,i._barMaxWidth=0,i._barMaxHeight=0,i._barMaxWidthDelta=0,i._barMaxHeightDelta=0,i._clickPercent=0,i._barStartX=0,i._barStartY=0,i.changeOnClick=!0,i.canDrag=!0,i._titleType=t.ProgressTitleType.Percent,i._value=50,i._max=100,i._clickPos=new egret.Point,i}return __extends(i,e),Object.defineProperty(i.prototype,"titleType",{get:function(){return this._titleType},set:function(t){this._titleType=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"wholeNumbers",{get:function(){return this._wholeNumbers},set:function(t){this._wholeNumbers!=t&&(this._wholeNumbers=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"min",{get:function(){return this._min},set:function(t){this._min!=t&&(this._min=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"max",{get:function(){return this._max},set:function(t){this._max!=t&&(this._max=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"value",{get:function(){return this._value},set:function(t){this._value!=t&&(this._value=t,this.update())},enumerable:!0,configurable:!0}),i.prototype.update=function(){this.updateWithPercent((this._value-this._min)/(this._max-this._min))},i.prototype.updateWithPercent=function(e,i){if(e=t.ToolSet.clamp01(e),i){var n=t.ToolSet.clamp(this._min+(this._max-this._min)*e,this._min,this._max);this._wholeNumbers&&(n=Math.round(n),e=t.ToolSet.clamp01((n-this._min)/(this._max-this._min))),n!=this._value&&(this._value=n,this.dispatchEvent(new t.StateChangeEvent(t.StateChangeEvent.CHANGED)))}if(this._titleObject)switch(this._titleType){case t.ProgressTitleType.Percent:this._titleObject.text=Math.floor(100*e)+"%";break;case t.ProgressTitleType.ValueAndMax:this._titleObject.text=this._value+"/"+this._max;break;case t.ProgressTitleType.Value:this._titleObject.text=""+this._value;break;case t.ProgressTitleType.Max:this._titleObject.text=""+this._max}var o=this.width-this._barMaxWidthDelta,r=this.height-this._barMaxHeightDelta;this._reverse?(this._barObjectH&&(this._barObjectH.width=Math.round(o*e),this._barObjectH.x=this._barStartX+(o-this._barObjectH.width)),this._barObjectV&&(this._barObjectV.height=Math.round(r*e),this._barObjectV.y=this._barStartY+(r-this._barObjectV.height))):(this._barObjectH&&(this._barObjectH.width=Math.round(o*e)),this._barObjectV&&(this._barObjectV.height=Math.round(r*e)))},i.prototype.constructExtension=function(t){t.seek(0,6),this._titleType=t.readByte(),this._reverse=t.readBool(),t.version>=2&&(this._wholeNumbers=t.readBool(),this.changeOnClick=t.readBool()),this._titleObject=this.getChild("title"),this._barObjectH=this.getChild("bar"),this._barObjectV=this.getChild("bar_v"),this._gripObject=this.getChild("grip"),this._barObjectH&&(this._barMaxWidth=this._barObjectH.width,this._barMaxWidthDelta=this.width-this._barMaxWidth,this._barStartX=this._barObjectH.x),this._barObjectV&&(this._barMaxHeight=this._barObjectV.height,this._barMaxHeightDelta=this.height-this._barMaxHeight,this._barStartY=this._barObjectV.y),this._gripObject&&this._gripObject.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.__gripMouseDown,this),this.displayObject.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.__barMouseDown,this)},i.prototype.handleSizeChanged=function(){e.prototype.handleSizeChanged.call(this),this._barObjectH&&(this._barMaxWidth=this.width-this._barMaxWidthDelta),this._barObjectV&&(this._barMaxHeight=this.height-this._barMaxHeightDelta),this._underConstruct||this.update()},i.prototype.setup_afterAdd=function(t,i){e.prototype.setup_afterAdd.call(this,t,i),t.seek(i,6)&&t.readByte()==this.packageItem.objectType?(this._value=t.readInt(),this._max=t.readInt(),t.version>=2&&(this._min=t.readInt()),this.update()):this.update()},i.prototype.__gripMouseDown=function(e){this.canDrag=!0,e.stopPropagation(),this._clickPos=this.globalToLocal(e.stageX,e.stageY),this._clickPercent=t.ToolSet.clamp01((this._value-this._min)/(this._max-this._min)),this._gripObject.displayObject.stage.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.__gripMouseMove,this),this._gripObject.displayObject.stage.addEventListener(egret.TouchEvent.TOUCH_END,this.__gripMouseUp,this)},i.prototype.__gripMouseMove=function(t){if(this.canDrag){var e,n=this.globalToLocal(t.stageX,t.stageY,i.sSilderHelperPoint),o=n.x-this._clickPos.x,r=n.y-this._clickPos.y;this._reverse&&(o=-o,r=-r),e=this._barObjectH?this._clickPercent+o/this._barMaxWidth:this._clickPercent+r/this._barMaxHeight,this.updateWithPercent(e,!0)}},i.prototype.__gripMouseUp=function(t){t.currentTarget.removeEventListener(egret.TouchEvent.TOUCH_MOVE,this.__gripMouseMove,this),t.currentTarget.removeEventListener(egret.TouchEvent.TOUCH_END,this.__gripMouseUp,this)},i.prototype.__barMouseDown=function(e){if(this.changeOnClick){var n,o=this._gripObject.globalToLocal(e.stageX,e.stageY,i.sSilderHelperPoint),r=t.ToolSet.clamp01((this._value-this._min)/(this._max-this._min));this._barObjectH&&(n=o.x/this._barMaxWidth),this._barObjectV&&(n=o.y/this._barMaxHeight),this._reverse?r-=n:r+=n,this.updateWithPercent(r,!0)}},i.sSilderHelperPoint=new egret.Point,i}(t.GComponent);t.GSlider=e}(fgui||(fgui={})),function(t){var e=function(e){function i(){var t=e.call(this)||this;return t._widthAutoSize=!1,t._heightAutoSize=!1,t.displayObject.touchChildren=!0,t._textField.type=egret.TextFieldType.INPUT,t._textField.addEventListener(egret.Event.CHANGE,t.__textChanged,t),t._textField.addEventListener(egret.FocusEvent.FOCUS_IN,t.__focusIn,t),t._textField.addEventListener(egret.FocusEvent.FOCUS_OUT,t.__focusOut,t),t}return __extends(i,e),i.prototype.dispose=function(){e.prototype.dispose.call(this)},Object.defineProperty(i.prototype,"editable",{get:function(){return this._textField.type==egret.TextFieldType.INPUT},set:function(t){this._textField.type=t?egret.TextFieldType.INPUT:egret.TextFieldType.DYNAMIC},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxLength",{get:function(){return this._textField.maxChars},set:function(t){this._textField.maxChars=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"promptText",{get:function(){return this._promptText},set:function(t){this._promptText=t,this.updateTextFieldText()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"restrict",{get:function(){return this._textField.restrict},set:function(t){this._textField.restrict=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"password",{get:function(){return this._password},set:function(t){this._password!=t&&(this._password=t,this._textField.displayAsPassword=this._password,this._textField.inputType=t?egret.TextFieldInputType.PASSWORD:egret.TextFieldInputType.TEXT,this.render())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"verticalAlign",{get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!=t&&(this._verticalAlign=t,this.updateVertAlign())},enumerable:!0,configurable:!0}),i.prototype.updateVertAlign=function(){switch(this._verticalAlign){case t.VertAlignType.Top:this._textField.verticalAlign=egret.VerticalAlign.TOP;break;case t.VertAlignType.Middle:this._textField.verticalAlign=egret.VerticalAlign.MIDDLE;break;case t.VertAlignType.Bottom:this._textField.verticalAlign=egret.VerticalAlign.BOTTOM}},i.prototype.updateTextFieldText=function(){!this._text&&this._promptText?(this._textField.displayAsPassword=!1,this._textField.textFlow=(new egret.HtmlTextParser).parser(t.ToolSet.parseUBB(this._promptText))):(this._textField.displayAsPassword=this._password,this._ubbEnabled?this._textField.textFlow=(new egret.HtmlTextParser).parser(t.ToolSet.parseUBB(t.ToolSet.encodeHTML(this._text))):this._textField.text=this._text)},i.prototype.handleSizeChanged=function(){this._updatingSize||(this._textField.width=Math.ceil(this.width),this._textField.height=Math.ceil(this.height))},i.prototype.setup_beforeAdd=function(t,i){e.prototype.setup_beforeAdd.call(this,t,i),t.seek(i,4);var n=t.readS();null!=n&&(this._promptText=n),null!=(n=t.readS())&&(this._textField.restrict=n);var o=t.readInt();0!=o&&(this._textField.maxChars=o),o=t.readInt(),t.readBool()&&(this.password=!0),this.updateVertAlign()},i.prototype.setup_afterAdd=function(i,n){e.prototype.setup_afterAdd.call(this,i,n),!this._text&&this._promptText&&(this._textField.displayAsPassword=!1,this._textField.textFlow=(new egret.HtmlTextParser).parser(t.ToolSet.parseUBB(t.ToolSet.encodeHTML(this._promptText))))},i.prototype.__textChanged=function(t){this._text=this._textField.text},i.prototype.__focusIn=function(t){!this._text&&this._promptText&&(this._textField.displayAsPassword=this._password,this._textField.text="")},i.prototype.__focusOut=function(e){this._text=this._textField.text,!this._text&&this._promptText&&(this._textField.displayAsPassword=!1,this._textField.textFlow=(new egret.HtmlTextParser).parser(t.ToolSet.parseUBB(t.ToolSet.encodeHTML(this._promptText))))},i}(t.GTextField);t.GTextInput=e}(fgui||(fgui={})),function(t){var e=function(e){function i(){var i=e.call(this)||this;return i._indent=15,i._rootNode=new t.GTreeNode(!0),i._rootNode._setTree(i),i._rootNode.expanded=!0,i}return __extends(i,e),Object.defineProperty(i.prototype,"rootNode",{get:function(){return this._rootNode},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"indent",{get:function(){return this._indent},set:function(t){this._indent=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"clickToExpand",{get:function(){return this._clickToExpand},set:function(t){this._clickToExpand=t},enumerable:!0,configurable:!0}),i.prototype.getSelectedNode=function(){return-1!=this.selectedIndex?this.getChildAt(this.selectedIndex)._treeNode:null},i.prototype.getSelectedNodes=function(t){t||(t=new Array),i.helperIntList.length=0,e.prototype.getSelection.call(this,i.helperIntList);for(var n=i.helperIntList.length,o=new Array,r=0;rl)a.addChild(c);else if(h=0&&e<=i){if(t._parent==this)this.setChildIndex(t,e);else t._parent&&t._parent.removeChild(t),e==this._children.length?this._children.push(t):this._children.splice(e,0,t),t._parent=this,t._level=this._level+1,t._setTree(this._tree),(null!=this._tree&&this==this._tree.rootNode||null!=this._cell&&null!=this._cell.parent&&this._expanded)&&this._tree._afterInserted(t);return t}throw new RangeError("Invalid child index")},t.prototype.removeChild=function(t){var e=this._children.indexOf(t);return-1!=e&&this.removeChildAt(e),t},t.prototype.removeChildAt=function(t){if(t>=0&&t=this.numChildren)&&(e=this.numChildren-1);for(var i=t;i<=e;++i)this.removeChildAt(t)},t.prototype.getChildAt=function(t){if(t>=0&&t=this._parent._children.length-1?null:this._parent._children[t+1]},t.prototype.setChildIndex=function(t,e){var i=this._children.indexOf(t);if(-1==i)throw"Not a child of this container";var n=this._children.length;e<0?e=0:e>n&&(e=n),i!=e&&(this._children.splice(i,1),this._children.splice(e,0,t),(null!=this._tree&&this==this._tree.rootNode||null!=this._cell&&null!=this._cell.parent&&this._expanded)&&this._tree._afterMoved(t))},t.prototype.swapChildren=function(t,e){var i=this._children.indexOf(t),n=this._children.indexOf(e);if(-1==i||-1==n)throw"Not a child of this container";this.swapChildrenAt(i,n)},t.prototype.swapChildrenAt=function(t,e){var i=this._children[t],n=this._children[e];this.setChildIndex(i,e),this.setChildIndex(n,t)},Object.defineProperty(t.prototype,"numChildren",{get:function(){return this._children.length},enumerable:!0,configurable:!0}),t.prototype.expandToRoot=function(){for(var t=this;t;)t.expanded=!0,t=t.parent},Object.defineProperty(t.prototype,"tree",{get:function(){return this._tree},enumerable:!0,configurable:!0}),t.prototype._setTree=function(t){if(this._tree=t,null!=this._tree&&this._tree.treeNodeWillExpand&&this._expanded&&this._tree.treeNodeWillExpand(this,!0),null!=this._children)for(var e=this._children.length,i=0;i=this._data.pixelWidth)return!1;var i=e*this._data.pixelWidth+t,n=Math.floor(i/8),o=i%8;return n>=0&&n>o&1)},t}();t.PixelHitTest=e;var i=function(){function t(){}return t.prototype.load=function(t){t.readInt(),this.pixelWidth=t.readInt(),this.scale=1/t.readByte();var e=t.readInt();this.pixels=[];for(var i=0;i0){var e=this.highResolution[t.GRoot.contentScaleLevel-1];if(e)return this.owner.getItemById(e)}return this},e.prototype.toString=function(){return this.name},e}();t.PackageItem=e}(fgui||(fgui={})),function(t){var e=function(){function e(e){if(void 0===e&&(e=null),!e&&!(e=t.UIConfig.popupMenu))throw"UIConfig.popupMenu not defined";this._contentPane=t.UIPackage.createObjectFromURL(e).asCom,this._contentPane.addEventListener(egret.Event.ADDED_TO_STAGE,this.__addedToStage,this),this._list=this._contentPane.getChild("list"),this._list.removeChildrenToPool(),this._list.addRelation(this._contentPane,t.RelationType.Width),this._list.removeRelation(this._contentPane,t.RelationType.Height),this._contentPane.addRelation(this._list,t.RelationType.Height),this._list.addEventListener(t.ItemEvent.CLICK,this.__clickItem,this)}return e.prototype.dispose=function(){this._contentPane.dispose()},e.prototype.addItem=function(t,e){void 0===e&&(e=null);var i=this._list.addItemFromPool().asButton;i.title=t,i.data=e,i.grayed=!1;var n=i.getController("checked");return null!=n&&(n.selectedIndex=0),i},e.prototype.addItemAt=function(t,e,i){void 0===i&&(i=null);var n=this._list.getFromPool().asButton;this._list.addChildAt(n,e),n.title=t,n.data=i,n.grayed=!1;var o=n.getController("checked");return null!=o&&(o.selectedIndex=0),n},e.prototype.addSeperator=function(){if(null==t.UIConfig.popupMenu_seperator)throw"UIConfig.popupMenu_seperator not defined";this.list.addItemFromPool(t.UIConfig.popupMenu_seperator)},e.prototype.getItemName=function(t){return this._list.getChildAt(t).name},e.prototype.setItemText=function(t,e){this._list.getChild(t).asButton.title=e},e.prototype.setItemVisible=function(t,e){var i=this._list.getChild(t).asButton;i.visible!=e&&(i.visible=e,this._list.setBoundsChangedFlag())},e.prototype.setItemGrayed=function(t,e){this._list.getChild(t).asButton.grayed=e},e.prototype.setItemCheckable=function(t,e){var i=this._list.getChild(t).asButton.getController("checked");null!=i&&(e?0==i.selectedIndex&&(i.selectedIndex=1):i.selectedIndex=0)},e.prototype.setItemChecked=function(t,e){var i=this._list.getChild(t).asButton.getController("checked");null!=i&&(i.selectedIndex=e?2:1)},e.prototype.isItemChecked=function(t){var e=this._list.getChild(t).asButton.getController("checked");return null!=e&&2==e.selectedIndex},e.prototype.removeItem=function(t){var e=this._list.getChild(t);if(null!=e){var i=this._list.getChildIndex(e);return this._list.removeChildToPoolAt(i),!0}return!1},e.prototype.clearItems=function(){this._list.removeChildrenToPool()},Object.defineProperty(e.prototype,"itemCount",{get:function(){return this._list.numChildren},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentPane",{get:function(){return this._contentPane},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return this._list},enumerable:!0,configurable:!0}),e.prototype.show=function(e,i){void 0===e&&(e=null),void 0===i&&(i=null),(null!=e?e.root:t.GRoot.inst).showPopup(this.contentPane,e instanceof t.GRoot?null:e,i)},e.prototype.__clickItem=function(e){t.GTimers.inst.add(100,1,this.__clickItem2,this,e)},e.prototype.__clickItem2=function(t){var e=t.itemObject.asButton;if(null!=e)if(e.grayed)this._list.selectedIndex=-1;else{var i=e.getController("checked");null!=i&&0!=i.selectedIndex&&(1==i.selectedIndex?i.selectedIndex=2:i.selectedIndex=1),this._contentPane.parent.hidePopup(this.contentPane),null!=e.data&&(1==e.data.length?e.data(t):e.data())}},e.prototype.__addedToStage=function(t){this._list.selectedIndex=-1,this._list.resizeToFit(1e5,10)},e}();t.PopupMenu=e}(fgui||(fgui={})),function(t){var e=function(){function e(t){this._owner=t,this._defs=new Array}return Object.defineProperty(e.prototype,"owner",{get:function(){return this._owner},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(t){this._target!=t&&(this._target&&this.releaseRefTarget(this._target),this._target=t,this._target&&this.addRefTarget(this._target))},enumerable:!0,configurable:!0}),e.prototype.add=function(e,i){if(e==t.RelationType.Size)return this.add(t.RelationType.Width,i),void this.add(t.RelationType.Height,i);for(var n=this._defs.length,o=0;o=t.RelationType.LeftExt_Left&&e<=t.RelationType.RightExt_Right?0:1,this._defs.push(o),(n||e==t.RelationType.Left_Center||e==t.RelationType.Center_Center||e==t.RelationType.Right_Center||e==t.RelationType.Top_Middle||e==t.RelationType.Middle_Middle||e==t.RelationType.Bottom_Middle)&&(this._owner.pixelSnapping=!0)},e.prototype.remove=function(e){if(void 0===e&&(e=0),e==t.RelationType.Size)return this.remove(t.RelationType.Width),void this.remove(t.RelationType.Height);for(var i=this._defs.length,n=0;n0)for(a=0;a0)for(s=0;s0)for(s=0;s.5*this._pageSize.x&&t++,t},set:function(t){this.setCurrentPageX(t,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"currentPageY",{get:function(){if(!this._pageMode)return 0;var t=Math.floor(this._yPos/this._pageSize.y);return this._yPos-t*this._pageSize.y>.5*this._pageSize.y&&t++,t},set:function(t){this.setCurrentPageY(t,!1)},enumerable:!0,configurable:!0}),i.prototype.setCurrentPageX=function(t,e){this._pageMode&&(this._owner.ensureBoundsCorrect(),this._overlapSize.x>0&&this.setPosX(t*this._pageSize.x,e))},i.prototype.setCurrentPageY=function(t,e){this._pageMode&&(this._owner.ensureBoundsCorrect(),this._overlapSize.y>0&&this.setPosY(t*this._pageSize.y,e))},Object.defineProperty(i.prototype,"isBottomMost",{get:function(){return this._yPos==this._overlapSize.y||0==this._overlapSize.y},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isRightMost",{get:function(){return this._xPos==this._overlapSize.x||0==this._overlapSize.x},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pageController",{get:function(){return this._pageController},set:function(t){this._pageController=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollingPosX",{get:function(){return t.ToolSet.clamp(-this._container.x,0,this._overlapSize.x)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollingPosY",{get:function(){return t.ToolSet.clamp(-this._container.y,0,this._overlapSize.y)},enumerable:!0,configurable:!0}),i.prototype.scrollTop=function(t){void 0===t&&(t=!1),this.setPercY(0,t)},i.prototype.scrollBottom=function(t){void 0===t&&(t=!1),this.setPercY(1,t)},i.prototype.scrollUp=function(t,e){void 0===t&&(t=1),void 0===e&&(e=!1),this._pageMode?this.setPosY(this._yPos-this._pageSize.y*t,e):this.setPosY(this._yPos-this._scrollStep*t,e)},i.prototype.scrollDown=function(t,e){void 0===t&&(t=1),void 0===e&&(e=!1),this._pageMode?this.setPosY(this._yPos+this._pageSize.y*t,e):this.setPosY(this._yPos+this._scrollStep*t,e)},i.prototype.scrollLeft=function(t,e){void 0===t&&(t=1),void 0===e&&(e=!1),this._pageMode?this.setPosX(this._xPos-this._pageSize.x*t,e):this.setPosX(this._xPos-this._scrollStep*t,e)},i.prototype.scrollRight=function(t,e){void 0===t&&(t=1),void 0===e&&(e=!1),this._pageMode?this.setPosX(this._xPos+this._pageSize.x*t,e):this.setPosX(this._xPos+this._scrollStep*t,e)},i.prototype.scrollToView=function(e,n,o){var r;if(void 0===n&&(n=!1),void 0===o&&(o=!1),this._owner.ensureBoundsCorrect(),this._needRefresh&&this.refresh(),e instanceof t.GObject?e.parent!=this._owner?(e.parent.localToGlobalRect(e.x,e.y,e.width,e.height,i.sHelperRect),r=this._owner.globalToLocalRect(i.sHelperRect.x,i.sHelperRect.y,i.sHelperRect.width,i.sHelperRect.height,i.sHelperRect)):(r=i.sHelperRect).setTo(e.x,e.y,e.width,e.height):r=e,this._overlapSize.y>0){var s=this._yPos+this._viewSize.y;o||r.y<=this._yPos||r.height>=this._viewSize.y?this._pageMode?this.setPosY(Math.floor(r.y/this._pageSize.y)*this._pageSize.y,n):this.setPosY(r.y,n):r.y+r.height>s&&(this._pageMode?this.setPosY(Math.floor(r.y/this._pageSize.y)*this._pageSize.y,n):r.height<=this._viewSize.y/2?this.setPosY(r.y+2*r.height-this._viewSize.y,n):this.setPosY(r.y+r.height-this._viewSize.y,n))}if(this._overlapSize.x>0){var a=this._xPos+this._viewSize.x;o||r.x<=this._xPos||r.width>=this._viewSize.x?this._pageMode?this.setPosX(Math.floor(r.x/this._pageSize.x)*this._pageSize.x,n):this.setPosX(r.x,n):r.x+r.width>a&&(this._pageMode?this.setPosX(Math.floor(r.x/this._pageSize.x)*this._pageSize.x,n):r.width<=this._viewSize.x/2?this.setPosX(r.x+2*r.width-this._viewSize.x,n):this.setPosX(r.x+r.width-this._viewSize.x,n))}!n&&this._needRefresh&&this.refresh()},i.prototype.isChildInView=function(t){if(this._overlapSize.y>0){var e=t.y+this._container.y;if(e<-t.height||e>this._viewSize.y)return!1}return!(this._overlapSize.x>0&&((e=t.x+this._container.x)<-t.width||e>this._viewSize.x))},i.prototype.cancelDragging=function(){this._owner.displayObject.removeEventListener(egret.TouchEvent.TOUCH_MOVE,this.__touchMove,this),this._owner.displayObject.removeEventListener(egret.TouchEvent.TOUCH_END,this.__touchEnd,this),this._owner.displayObject.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.__touchTap,this),i.draggingPane==this&&(i.draggingPane=null),i._gestureFlag=0,this._dragged=!1,this._maskContainer.touchChildren=!0},i.prototype.lockHeader=function(t){this._headerLockedSize!=t&&(this._headerLockedSize=t,!this._refreshEventDispatching&&this._container[this._refreshBarAxis]>=0&&(this._tweenStart.setTo(this._container.x,this._container.y),this._tweenChange.setTo(0,0),this._tweenChange[this._refreshBarAxis]=this._headerLockedSize-this._tweenStart[this._refreshBarAxis],this._tweenDuration.setTo(i.TWEEN_TIME_DEFAULT,i.TWEEN_TIME_DEFAULT),this.startTween(2)))},i.prototype.lockFooter=function(t){if(this._footerLockedSize!=t&&(this._footerLockedSize=t,!this._refreshEventDispatching&&this._container[this._refreshBarAxis]<=-this._overlapSize[this._refreshBarAxis])){this._tweenStart.setTo(this._container.x,this._container.y),this._tweenChange.setTo(0,0);var e=this._overlapSize[this._refreshBarAxis];0==e?e=Math.max(this._contentSize[this._refreshBarAxis]+this._footerLockedSize-this._viewSize[this._refreshBarAxis],0):e+=this._footerLockedSize,this._tweenChange[this._refreshBarAxis]=-e-this._tweenStart[this._refreshBarAxis],this._tweenDuration.setTo(i.TWEEN_TIME_DEFAULT,i.TWEEN_TIME_DEFAULT),this.startTween(2)}},i.prototype.onOwnerSizeChanged=function(){this.setSize(this._owner.width,this._owner.height),this.posChanged(!1)},i.prototype.handleControllerChanged=function(e){this._pageController==e&&(this._scrollType==t.ScrollType.Horizontal?this.setCurrentPageX(e.selectedIndex,!0):this.setCurrentPageY(e.selectedIndex,!0))},i.prototype.updatePageController=function(){var e;if(null!=this._pageController&&!this._pageController.changing&&(e=this._scrollType==t.ScrollType.Horizontal?this.currentPageX:this.currentPageY)0?t=-Math.floor(this._xPos):(0!=this._container.x&&(this._container.x=0),t=0),this._overlapSize.y>0?e=-Math.floor(this._yPos):(0!=this._container.y&&(this._container.y=0),e=0),t!=this._container.x||e!=this._container.y?(this._tweenDuration.setTo(i.TWEEN_TIME_GO,i.TWEEN_TIME_GO),this._tweenStart.setTo(this._container.x,this._container.y),this._tweenChange.setTo(t-this._tweenStart.x,e-this._tweenStart.y),this.startTween(1)):0!=this._tweening&&this.killTween());this._pageMode&&this.updatePageController()},i.prototype.__touchBegin=function(t){if(this._touchEffect){0!=this._tweening?(this.killTween(),this._dragged=!0):this._dragged=!1;var e=this._owner.globalToLocal(t.stageX,t.stageY,i.sHelperPoint);this._containerPos.setTo(this._container.x,this._container.y),this._beginTouchPos.setTo(e.x,e.y),this._lastTouchPos.setTo(e.x,e.y),this._lastTouchGlobalPos.setTo(t.stageX,t.stageY),this._isHoldAreaDone=!1,this._velocity.setTo(0,0),this._velocityScale=1,this._lastMoveTime=egret.getTimer()/1e3,this._owner.displayObject.stage.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.__touchMove,this),this._owner.displayObject.stage.addEventListener(egret.TouchEvent.TOUCH_END,this.__touchEnd,this),this._owner.displayObject.stage.addEventListener(egret.TouchEvent.TOUCH_TAP,this.__touchTap,this)}},i.prototype.__touchMove=function(e){if(null!=this._owner.displayObject.stage&&this._touchEffect&&(null==i.draggingPane||i.draggingPane==this)&&null==t.GObject.draggingObject){var n,o,r,s=this._owner.globalToLocal(e.stageX,e.stageY,i.sHelperPoint),a=t.UIConfig.touchScrollSensitivity;if(this._scrollType==t.ScrollType.Vertical){if(!this._isHoldAreaDone){if(i._gestureFlag|=1,(n=Math.abs(this._beginTouchPos.y-s.y))0?this._bouncebackEffect?null!=this._header&&0!=this._header.maxHeight?this._container.y=Math.floor(Math.min(.5*l,this._header.maxHeight)):this._container.y=Math.floor(Math.min(.5*l,this._viewSize.y*i.PULL_RATIO)):this._container.y=0:l<-this._overlapSize.y?this._bouncebackEffect?null!=this._footer&&this._footer.maxHeight>0?this._container.y=Math.floor(Math.max(.5*(l+this._overlapSize.y),-this._footer.maxHeight)-this._overlapSize.y):this._container.y=Math.floor(Math.max(.5*(l+this._overlapSize.y),-this._viewSize.y*i.PULL_RATIO)-this._overlapSize.y):this._container.y=-this._overlapSize.y:this._container.y=l),r&&(h>0?this._bouncebackEffect?null!=this._header&&0!=this._header.maxWidth?this._container.x=Math.floor(Math.min(.5*h,this._header.maxWidth)):this._container.x=Math.floor(Math.min(.5*h,this._viewSize.x*i.PULL_RATIO)):this._container.x=0:h<0-this._overlapSize.x?this._bouncebackEffect?null!=this._footer&&this._footer.maxWidth>0?this._container.x=Math.floor(Math.max(.5*(h+this._overlapSize.x),-this._footer.maxWidth)-this._overlapSize.x):this._container.x=Math.floor(Math.max(.5*(h+this._overlapSize.x),-this._viewSize.x*i.PULL_RATIO)-this._overlapSize.x):this._container.x=-this._overlapSize.x:this._container.x=h);var c=egret.getTimer()/1e3,u=Math.max(c-this._lastMoveTime,1/60),_=s.x-this._lastTouchPos.x,p=s.y-this._lastTouchPos.y;if(r||(_=0),o||(p=0),0!=u){var d=this._owner.displayObject.stage.frameRate,f=u*d-1;if(f>1){var g=Math.pow(.833,f);this._velocity.x=this._velocity.x*g,this._velocity.y=this._velocity.y*g}this._velocity.x=t.ToolSet.lerp(this._velocity.x,60*_/d/u,10*u),this._velocity.y=t.ToolSet.lerp(this._velocity.y,60*p/d/u,10*u)}var y=this._lastTouchGlobalPos.x-e.stageX,m=this._lastTouchGlobalPos.y-e.stageY;0!=_?this._velocityScale=Math.abs(y/_):0!=p&&(this._velocityScale=Math.abs(m/p)),this._lastTouchPos.setTo(s.x,s.y),this._lastTouchGlobalPos.setTo(e.stageX,e.stageY),this._lastMoveTime=c,this._overlapSize.x>0&&(this._xPos=t.ToolSet.clamp(-this._container.x,0,this._overlapSize.x)),this._overlapSize.y>0&&(this._yPos=t.ToolSet.clamp(-this._container.y,0,this._overlapSize.y)),0!=this._loop&&(h=this._container.x,l=this._container.y,this.loopCheckingCurrent()&&(this._containerPos.x+=this._container.x-h,this._containerPos.y+=this._container.y-l)),i.draggingPane=this,this._isHoldAreaDone=!0,this._dragged=!0,this._maskContainer.touchChildren=!1,this.updateScrollBarPos(),this.updateScrollBarVisible(),this._pageMode&&this.updatePageController(),this.dispatchEventWith(i.SCROLL)}},i.prototype.__touchEnd=function(e){if(e.currentTarget.removeEventListener(egret.TouchEvent.TOUCH_MOVE,this.__touchMove,this),e.currentTarget.removeEventListener(egret.TouchEvent.TOUCH_END,this.__touchEnd,this),e.currentTarget.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.__touchTap,this),i.draggingPane==this&&(i.draggingPane=null),i._gestureFlag=0,!this._dragged||!this._touchEffect||null==this._owner.displayObject.stage)return this._dragged=!1,void(this._maskContainer.touchChildren=!0);this._dragged=!1,this._maskContainer.touchChildren=!0,this._tweenStart.setTo(this._container.x,this._container.y),i.sEndPos.setTo(this._tweenStart.x,this._tweenStart.y);var n=!1;if(this._container.x>0?(i.sEndPos.x=0,n=!0):this._container.x<-this._overlapSize.x&&(i.sEndPos.x=-this._overlapSize.x,n=!0),this._container.y>0?(i.sEndPos.y=0,n=!0):this._container.y<-this._overlapSize.y&&(i.sEndPos.y=-this._overlapSize.y,n=!0),n){if(this._tweenChange.setTo(i.sEndPos.x-this._tweenStart.x,i.sEndPos.y-this._tweenStart.y),this._tweenChange.x<-t.UIConfig.touchDragSensitivity||this._tweenChange.y<-t.UIConfig.touchDragSensitivity?(this._refreshEventDispatching=!0,this.dispatchEventWith(i.PULL_DOWN_RELEASE),this._refreshEventDispatching=!1):(this._tweenChange.x>t.UIConfig.touchDragSensitivity||this._tweenChange.y>t.UIConfig.touchDragSensitivity)&&(this._refreshEventDispatching=!0,this.dispatchEventWith(i.PULL_UP_RELEASE),this._refreshEventDispatching=!1),this._headerLockedSize>0&&0==i.sEndPos[this._refreshBarAxis])i.sEndPos[this._refreshBarAxis]=this._headerLockedSize,this._tweenChange.x=i.sEndPos.x-this._tweenStart.x,this._tweenChange.y=i.sEndPos.y-this._tweenStart.y;else if(this._footerLockedSize>0&&i.sEndPos[this._refreshBarAxis]==-this._overlapSize[this._refreshBarAxis]){var o=this._overlapSize[this._refreshBarAxis];0==o?o=Math.max(this._contentSize[this._refreshBarAxis]+this._footerLockedSize-this._viewSize[this._refreshBarAxis],0):o+=this._footerLockedSize,i.sEndPos[this._refreshBarAxis]=-o,this._tweenChange.x=i.sEndPos.x-this._tweenStart.x,this._tweenChange.y=i.sEndPos.y-this._tweenStart.y}this._tweenDuration.setTo(i.TWEEN_TIME_DEFAULT,i.TWEEN_TIME_DEFAULT)}else{if(this._inertiaDisabled)this._tweenDuration.setTo(i.TWEEN_TIME_DEFAULT,i.TWEEN_TIME_DEFAULT);else{var r=this._owner.displayObject.stage.frameRate,s=(egret.getTimer()/1e3-this._lastMoveTime)*r-1;if(s>1){var a=Math.pow(.833,s);this._velocity.x=this._velocity.x*a,this._velocity.y=this._velocity.y*a}this.updateTargetAndDuration(this._tweenStart,i.sEndPos)}if(i.sOldChange.setTo(i.sEndPos.x-this._tweenStart.x,i.sEndPos.y-this._tweenStart.y),this.loopCheckingTarget(i.sEndPos),(this._pageMode||this._snapToItem)&&this.alignPosition(i.sEndPos,!0),this._tweenChange.x=i.sEndPos.x-this._tweenStart.x,this._tweenChange.y=i.sEndPos.y-this._tweenStart.y,0==this._tweenChange.x&&0==this._tweenChange.y)return void this.updateScrollBarVisible();(this._pageMode||this._snapToItem)&&(this.fixDuration("x",i.sOldChange.x),this.fixDuration("y",i.sOldChange.y))}this.startTween(2)},i.prototype.__touchTap=function(t){this._dragged=!1},i.prototype.updateScrollBarPos=function(){null!=this._vtScrollBar&&this._vtScrollBar.setScrollPerc(0==this._overlapSize.y?0:t.ToolSet.clamp(-this._container.y,0,this._overlapSize.y)/this._overlapSize.y),null!=this._hzScrollBar&&this._hzScrollBar.setScrollPerc(0==this._overlapSize.x?0:t.ToolSet.clamp(-this._container.x,0,this._overlapSize.x)/this._overlapSize.x),this.checkRefreshBar()},i.prototype.updateScrollBarVisible=function(){this._vtScrollBar&&(this._viewSize.y<=this._vtScrollBar.minSize||this._vScrollNone?this._vtScrollBar.displayObject.visible=!1:this.updateScrollBarVisible2(this._vtScrollBar)),this._hzScrollBar&&(this._viewSize.x<=this._hzScrollBar.minSize||this._hScrollNone?this._hzScrollBar.displayObject.visible=!1:this.updateScrollBarVisible2(this._hzScrollBar))},i.prototype.updateScrollBarVisible2=function(e){this._scrollBarDisplayAuto&&t.GTween.kill(e,!1,"alpha"),!this._scrollBarDisplayAuto||0!=this._tweening||this._dragged||e.gripDragging?(e.alpha=1,e.displayObject.visible=!0):e.displayObject.visible&&t.GTween.to(1,0,.5).setDelay(.5).onComplete(this.__barTweenComplete,this).setTarget(e,"alpha")},i.prototype.__barTweenComplete=function(t){var e=t.target;e.alpha=1,e.displayObject.visible=!1},i.prototype.getLoopPartSize=function(t,e){return(this._contentSize[e]+("x"==e?this._owner.columnGap:this._owner.lineGap))/t},i.prototype.loopCheckingCurrent=function(){var t=!1;return 1==this._loop&&this._overlapSize.x>0?this._xPos<.001?(this._xPos+=this.getLoopPartSize(2,"x"),t=!0):this._xPos>=this._overlapSize.x&&(this._xPos-=this.getLoopPartSize(2,"x"),t=!0):2==this._loop&&this._overlapSize.y>0&&(this._yPos<.001?(this._yPos+=this.getLoopPartSize(2,"y"),t=!0):this._yPos>=this._overlapSize.y&&(this._yPos-=this.getLoopPartSize(2,"y"),t=!0)),t&&(this._container.x=Math.floor(-this._xPos),this._container.y=Math.floor(-this._yPos)),t},i.prototype.loopCheckingTarget=function(t){1==this._loop&&this.loopCheckingTarget2(t,"x"),2==this._loop&&this.loopCheckingTarget2(t,"y")},i.prototype.loopCheckingTarget2=function(t,e){var i,n;t[e]>0?(i=this.getLoopPartSize(2,e),(n=this._tweenStart[e]-i)<=0&&n>=-this._overlapSize[e]&&(t[e]-=i,this._tweenStart[e]=n)):t[e]<-this._overlapSize[e]&&(i=this.getLoopPartSize(2,e),(n=this._tweenStart[e]+i)<=0&&n>=-this._overlapSize[e]&&(t[e]+=i,this._tweenStart[e]=n))},i.prototype.loopCheckingNewPos=function(e,i){if(0==this._overlapSize[i])return e;var n,o="x"==i?this._xPos:this._yPos,r=!1;return e<.001?(e+=this.getLoopPartSize(2,i))>o&&(n=this.getLoopPartSize(6,i),n=Math.ceil((e-o)/n)*n,o=t.ToolSet.clamp(o+n,0,this._overlapSize[i]),r=!0):e>=this._overlapSize[i]&&(e-=this.getLoopPartSize(2,i))-this._overlapSize.x&&(t.x=-n.x),t.y<0&&t.y>-this._overlapSize.y&&(t.y=-n.y)}},i.prototype.alignByPage=function(t,e,i){var n;if(t>0)n=0;else if(t<-this._overlapSize[e])n=Math.ceil(this._contentSize[e]/this._pageSize[e])-1;else{n=Math.floor(-t/this._pageSize[e]);var o=i?t-this._containerPos[e]:t-this._container[e],r=Math.min(this._pageSize[e],this._contentSize[e]-(n+1)*this._pageSize[e]),s=-t-n*this._pageSize[e];Math.abs(o)>this._pageSize[e]?s>.5*r&&n++:s>r*(o<0?.3:.7)&&n++,(t=-n*this._pageSize[e])<-this._overlapSize[e]&&(t=-this._overlapSize[e])}if(i){var a,h=this._tweenStart[e];a=h>0?0:h<-this._overlapSize[e]?Math.ceil(this._contentSize[e]/this._pageSize[e])-1:Math.floor(-h/this._pageSize[e]);var l=Math.floor(-this._containerPos[e]/this._pageSize[e]);Math.abs(n-l)>1&&Math.abs(a-l)<=1&&(t=-(n=n>l?l+1:l-1)*this._pageSize[e])}return t},i.prototype.updateTargetAndDuration=function(t,e){e.x=this.updateTargetAndDuration2(t.x,"x"),e.y=this.updateTargetAndDuration2(t.y,"y")},i.prototype.updateTargetAndDuration2=function(t,e){var n=this._velocity[e],o=0;if(t>0)t=0;else if(t<-this._overlapSize[e])t=-this._overlapSize[e];else{var r=egret.Capabilities.isMobile,s=Math.abs(n)*this._velocityScale;r&&(s*=1136/Math.max(this._owner.displayObject.stage.stageWidth,this._owner.displayObject.stage.stageHeight));var a=0;if(this._pageMode||!r?s>500&&(a=Math.pow((s-500)/500,2)):s>1e3&&(a=Math.pow((s-1e3)/1e3,2)),0!=a)a>1&&(a=1),s*=a,n*=a,this._velocity[e]=n,o=Math.log(60/s)/Math.log(this._decelerationRate)/60,t+=Math.floor(n*o*.4)}return o=Math.abs(e))){var n=Math.abs(this._tweenChange[t]/e)*this._tweenDuration[t];n0){null==this._header.displayObject.parent&&this._maskContainer.addChildAt(this._header.displayObject,0);var e=i.sHelperPoint;e.setTo(this._header.width,this._header.height),e[this._refreshBarAxis]=t,this._header.setSize(e.x,e.y)}else null!=this._header.displayObject.parent&&this._maskContainer.removeChild(this._header.displayObject);if(null!=this._footer){var n=this._overlapSize[this._refreshBarAxis];t<-n||0==n&&this._footerLockedSize>0?(null==this._footer.displayObject.parent&&this._maskContainer.addChildAt(this._footer.displayObject,0),(e=i.sHelperPoint).setTo(this._footer.x,this._footer.y),e[this._refreshBarAxis]=n>0?t+this._contentSize[this._refreshBarAxis]:Math.max(Math.min(t+this._viewSize[this._refreshBarAxis],this._viewSize[this._refreshBarAxis]-this._footerLockedSize),this._viewSize[this._refreshBarAxis]-this._contentSize[this._refreshBarAxis]),this._footer.setXY(e.x,e.y),e.setTo(this._footer.width,this._footer.height),e[this._refreshBarAxis]=n>0?-n-t:this._viewSize[this._refreshBarAxis]-this._footer[this._refreshBarAxis],this._footer.setSize(e.x,e.y)):null!=this._footer.displayObject.parent&&this._maskContainer.removeChild(this._footer.displayObject)}}},i.prototype.tweenUpdate=function(e){var n=this.runTween("x"),o=this.runTween("y");return this._container.x=n,this._container.y=o,2==this._tweening&&(this._overlapSize.x>0&&(this._xPos=t.ToolSet.clamp(-n,0,this._overlapSize.x)),this._overlapSize.y>0&&(this._yPos=t.ToolSet.clamp(-o,0,this._overlapSize.y)),this._pageMode&&this.updatePageController()),0==this._tweenChange.x&&0==this._tweenChange.y?(this._tweening=0,t.GTimers.inst.remove(this.tweenUpdate,this),this.loopCheckingCurrent(),this.updateScrollBarPos(),this.updateScrollBarVisible(),this.dispatchEventWith(i.SCROLL),this.dispatchEventWith(i.SCROLL_END)):(this.updateScrollBarPos(),this.dispatchEventWith(i.SCROLL)),!0},i.prototype.runTween=function(e){var n;if(0!=this._tweenChange[e]){if(this._tweenTime[e]+=t.GTimers.deltaTime/1e3,this._tweenTime[e]>=this._tweenDuration[e])n=this._tweenStart[e]+this._tweenChange[e],this._tweenChange[e]=0;else{var o=i.easeFunc(this._tweenTime[e],this._tweenDuration[e]);n=this._tweenStart[e]+Math.floor(this._tweenChange[e]*o)}var r=0,s=-this._overlapSize[e];if(this._headerLockedSize>0&&this._refreshBarAxis==e&&(r=this._headerLockedSize),this._footerLockedSize>0&&this._refreshBarAxis==e){var a=this._overlapSize[this._refreshBarAxis];0==a?a=Math.max(this._contentSize[this._refreshBarAxis]+this._footerLockedSize-this._viewSize[this._refreshBarAxis],0):a+=this._footerLockedSize,s=-a}2==this._tweening&&this._bouncebackEffect?n>20+r&&this._tweenChange[e]>0||n>r&&0==this._tweenChange[e]?(this._tweenTime[e]=0,this._tweenDuration[e]=i.TWEEN_TIME_DEFAULT,this._tweenChange[e]=-n+r,this._tweenStart[e]=n):(nr?(n=r,this._tweenChange[e]=0):n=0;d--){var f=this._items[d];if(f.type==i.Transition&&f.value.trans==p){f.value.stopTime=_.time-f.time;break}}d<0?_.value.stopTime=0:p=null}else _.value.stopTime=-1;_.value.trans=p}}0==s?this.onDelayedPlay():t.GTween.delayedCall(s).onComplete(this.onDelayedPlay,this)},e.prototype.stop=function(e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),this._playing){this._playing=!1,this._totalTasks=0,this._totalTimes=0;var n=this._onComplete,o=this._onCompleteParam,r=this._onCompleteCaller;this._onComplete=null,this._onCompleteParam=null,this._onCompleteCaller=null,t.GTween.kill(this);var s=this._items.length;if(this._reversed)for(var a=s-1;a>=0;a--){var h=this._items[a];null!=h.target&&this.stopItem(h,e)}else for(a=0;a1&&(o.playing=e[1]);break;case i.Visible:o.visible=e[0];break;case i.Sound:o.sound=e[0],e.length>1&&(o.volume=parseFloat(e[1]));break;case i.Transition:o.transName=e[0],e.length>1&&(o.playTimes=parseInt(e[1]));break;case i.Shake:o.amplitude=parseFloat(e[0]),e.length>1&&(o.duration=parseFloat(e[1]));break;case i.ColorFilter:o.f1=parseFloat(e[0]),o.f2=parseFloat(e[1]),o.f3=parseFloat(e[2]),o.f4=parseFloat(e[3]);break;case i.Text:case i.Icon:o.text=e[0]}}},e.prototype.setHook=function(t,e,i){for(var n=this._items.length,o=0;o0?o.target=this._owner.getChildById(o.targetId):o.target=this._owner:o.target=null)}},e.prototype.setDuration=function(t,e){for(var i=this._items.length,n=0;n0,this._playing){if(0!=(this._options&e.OPTION_IGNORE_DISPLAY_CONTROLLER))for(var t=this._items.length,i=0;i=0;e--)null!=(t=this._items[e]).target&&this.playItem(t);else for(e=0;e=0&&e.tweener.setBreakpoint(this._endTime-n),this._totalTasks++}}else e.type==i.Shake?(n=this._reversed?this._totalDuration-e.time-e.value.duration:e.time,e.value.offsetX=e.value.offsetY=0,e.value.lastOffsetX=e.value.lastOffsetY=0,e.tweener=t.GTween.shake(0,0,e.value.amplitude,e.value.duration).setDelay(n).setTimeScale(this._timeScale).setTarget(e).onUpdate(this.onTweenUpdate,this).onComplete(this.onTweenComplete,this),this._endTime>=0&&e.tweener.setBreakpoint(this._endTime-e.time),this._totalTasks++):(n=this._reversed?this._totalDuration-e.time:e.time)<=this._startTime?(this.applyValue(e),this.callHook(e,!1)):(-1==this._endTime||n<=this._endTime)&&(this._totalTasks++,e.tweener=t.GTween.delayedCall(n).setTimeScale(this._timeScale).setTarget(e).onComplete(this.onDelayedPlayItem,this));null!=e.tweener&&e.tweener.seek(this._startTime)},e.prototype.skipAnimations=function(){for(var e,n,o,r,s,a,h=this._items.length,l=0;lthis._startTime||(r=a.value).flag)){e=(s=a.target).getProp(t.ObjectPropID.Frame),n=s.getProp(t.ObjectPropID.Playing)?0:-1,o=0;for(var c=l;cthis._startTime||((r=a.value).flag=!0,-1!=r.frame?(e=r.frame,n=r.playing?a.time:-1,o=0):r.playing?n<0&&(n=a.time):(n>=0&&(o+=a.time-n),n=-1),this.callHook(a,!1));n>=0&&(o+=this._startTime-n),s.setProp(t.ObjectPropID.Playing,n>=0),s.setProp(t.ObjectPropID.Frame,e),o>0&&s.setProp(t.ObjectPropID.DeltaTime,1e3*o)}},e.prototype.onDelayedPlayItem=function(t){var e=t.target;e.tweener=null,this._totalTasks--,this.applyValue(e),this.callHook(e,!1),this.checkAllComplete()},e.prototype.onTweenStart=function(t){var e,n,o=t.target;o.type!=i.XY&&o.type!=i.Size||(this._reversed?(e=o.tweenConfig.endValue,n=o.tweenConfig.startValue):(e=o.tweenConfig.startValue,n=o.tweenConfig.endValue),o.type==i.XY?o.target!=this._owner?(e.b1?e.b3&&(t.startValue.x=e.f1*this._owner.width):t.startValue.x=o.target.x,e.b2?e.b3&&(t.startValue.y=e.f2*this._owner.height):t.startValue.y=o.target.y,n.b1?n.b3&&(t.endValue.x=n.f1*this._owner.width):t.endValue.x=t.startValue.x,n.b2?n.b3&&(t.endValue.y=n.f2*this._owner.height):t.endValue.y=t.startValue.y):(e.b1||(t.startValue.x=o.target.x-this._ownerBaseX),e.b2||(t.startValue.y=o.target.y-this._ownerBaseY),n.b1||(t.endValue.x=t.startValue.x),n.b2||(t.endValue.y=t.startValue.y)):(e.b1||(t.startValue.x=o.target.width),e.b2||(t.startValue.y=o.target.height),n.b1||(t.endValue.x=t.startValue.x),n.b2||(t.endValue.y=t.startValue.y)),o.tweenConfig.path&&(o.value.b1=o.value.b2=!0,t.setPath(o.tweenConfig.path)));this.callHook(o,!1)},e.prototype.onTweenUpdate=function(t){var e=t.target;switch(e.type){case i.XY:case i.Size:case i.Scale:case i.Skew:e.value.f1=t.value.x,e.value.f2=t.value.y,e.tweenConfig.path&&(e.value.f1+=t.startValue.x,e.value.f2+=t.startValue.y);break;case i.Alpha:case i.Rotation:e.value.f1=t.value.x;break;case i.Color:e.value.f1=t.value.color;break;case i.ColorFilter:e.value.f1=t.value.x,e.value.f2=t.value.y,e.value.f3=t.value.z,e.value.f4=t.value.w;break;case i.Shake:e.value.offsetX=t.deltaValue.x,e.value.offsetY=t.deltaValue.y}this.applyValue(e)},e.prototype.onTweenComplete=function(t){var e=t.target;e.tweener=null,this._totalTasks--,t.allCompleted&&this.callHook(e,!0),this.checkAllComplete()},e.prototype.onPlayTransCompleted=function(t){this._totalTasks--,this.checkAllComplete()},e.prototype.callHook=function(t,e){e?null!=t.tweenConfig&&null!=t.tweenConfig.endHook&&t.tweenConfig.endHook.call(t.tweenConfig.endHookCaller):t.time>=this._startTime&&null!=t.hook&&t.hook.call(t.hookCaller)},e.prototype.checkAllComplete=function(){if(this._playing&&0==this._totalTasks)if(this._totalTimes<0)this.internalPlay();else if(this._totalTimes--,this._totalTimes>0)this.internalPlay();else{this._playing=!1;for(var t=this._items.length,e=0;e=0&&e.target.setProp(t.ObjectPropID.Frame,n.frame),e.target.setProp(t.ObjectPropID.Playing,n.playing),e.target.setProp(t.ObjectPropID.TimeScale,this._timeScale);break;case i.Visible:e.target.visible=n.visible;break;case i.Transition:if(this._playing){var o=n.trans;if(null!=o){this._totalTasks++;var r=this._startTime>e.time?this._startTime-e.time:0,s=this._endTime>=0?this._endTime-e.time:-1;n.stopTime>=0&&(s<0||s>n.stopTime)&&(s=n.stopTime),o.timeScale=this._timeScale,o._play(this.onPlayTransCompleted,this,e,n.playTimes,0,r,s,this._reversed)}}break;case i.Sound:if(this._playing&&e.time>=this._startTime){if(null==n.audioClip){var a=t.UIPackage.getItemByURL(n.sound);a&&(n.audioClip=a.owner.getItemAsset(a))}n.audioClip&&t.GRoot.inst.playOneShotSound(n.audioClip,n.volume)}break;case i.Shake:e.target.setXY(e.target.x-n.lastOffsetX+n.offsetX,e.target.y-n.lastOffsetY+n.offsetY),n.lastOffsetX=n.offsetX,n.lastOffsetY=n.offsetY;break;case i.ColorFilter:t.ToolSet.setColorFilter(e.target.displayObject,[n.f1,n.f2,n.f3,n.f4]);break;case i.Text:e.target.text=n.text;break;case i.Icon:e.target.icon=n.text}e.target._gearLocked=!1},e.prototype.setup=function(e){this.name=e.readS(),this._options=e.readInt(),this._autoPlay=e.readBool(),this._autoPlayTimes=e.readInt(),this._autoPlayDelay=e.readFloat();for(var i=e.readShort(),r=0;rthis._totalDuration&&(this._totalDuration=h.time+h.tweenConfig.duration),h.tweenConfig.easeType=e.readByte(),h.tweenConfig.repeat=e.readInt(),h.tweenConfig.yoyo=e.readBool(),h.tweenConfig.endLabel=e.readS(),e.seek(a,2),this.decodeValue(h,e,h.tweenConfig.startValue),e.seek(a,3),this.decodeValue(h,e,h.tweenConfig.endValue),e.version>=2){var c=e.readInt();if(c>0){h.tweenConfig.path=new t.GPath;for(var u=new Array,_=0;_this._totalDuration&&(this._totalDuration=h.time),e.seek(a,2),this.decodeValue(h,e,h.value);e.position=a+s}},e.prototype.decodeValue=function(t,e,n){switch(t.type){case i.XY:case i.Size:case i.Pivot:case i.Skew:n.b1=e.readBool(),n.b2=e.readBool(),n.f1=e.readFloat(),n.f2=e.readFloat(),e.version>=2&&t.type==i.XY&&(n.b3=e.readBool());break;case i.Alpha:case i.Rotation:n.f1=e.readFloat();break;case i.Scale:n.f1=e.readFloat(),n.f2=e.readFloat();break;case i.Color:n.f1=e.readColor();break;case i.Animation:n.playing=e.readBool(),n.frame=e.readInt();break;case i.Visible:n.visible=e.readBool();break;case i.Sound:n.sound=e.readS(),n.volume=e.readFloat();break;case i.Transition:n.transName=e.readS(),n.playTimes=e.readInt();break;case i.Shake:n.amplitude=e.readFloat(),n.duration=e.readFloat();break;case i.ColorFilter:n.f1=e.readFloat(),n.f2=e.readFloat(),n.f3=e.readFloat(),n.f4=e.readFloat();break;case i.Text:case i.Icon:n.text=e.readS()}},e.OPTION_IGNORE_DISPLAY_CONTROLLER=1,e.OPTION_AUTO_STOP_DISABLED=2,e.OPTION_AUTO_STOP_AT_END=4,e}();t.Transition=e;var i=function(){function t(){}return t.XY=0,t.Size=1,t.Scale=2,t.Pivot=3,t.Alpha=4,t.Rotation=5,t.Color=6,t.Animation=7,t.Visible=8,t.Sound=9,t.Transition=10,t.Shake=11,t.ColorFilter=12,t.Skew=13,t.Text=14,t.Icon=15,t.Unknown=16,t}(),n=function(){return function(t){switch(this.type=t,t){case i.XY:case i.Size:case i.Scale:case i.Pivot:case i.Skew:case i.Alpha:case i.Rotation:case i.Color:case i.ColorFilter:this.value=new u;break;case i.Animation:this.value=new s;break;case i.Shake:this.value=new l;break;case i.Sound:this.value=new a;break;case i.Transition:this.value=new h;break;case i.Visible:this.value=new r;break;case i.Text:case i.Icon:this.value=new c}}}(),o=function(){return function(){this.duration=0,this.repeat=0,this.yoyo=!1,this.easeType=t.EaseType.QuadOut,this.startValue=new u,this.endValue=new u}}(),r=function(){return function(){}}(),s=function(){return function(){}}(),a=function(){return function(){}}(),h=function(){return function(){}}(),l=function(){return function(){}}(),c=function(){return function(){}}(),u=function(){return function(){this.f1=this.f2=this.f3=this.f4=0,this.b1=this.b2=!0}}()}(fgui||(fgui={})),function(t){var e=function(){function e(){}return e.loadFromXML=function(t){e.strings={};for(var i=egret.XML.parse(t).children,n=i.length,o=0;o0?r.children[0].text:"",h=s.indexOf("-");if(-1==h)continue;var l=s.substr(0,h),c=s.substr(h+1),u=e.strings[l];u||(u={},e.strings[l]=u),u[c]=a}}},e.translateComponent=function(i){if(null!=e.strings){var n=e.strings[i.owner.id+i.id];if(null!=n){var o,r,s,a,h,l,c,u,_,p=i.rawData;p.seek(0,2);var d=p.readShort();for(h=0;h=2){p.seek(u,4),p.skip(2),p.skip(4*p.readShort());for(var m=p.readShort(),b=0;b=2){p.skip(6),p.skip(4*p.readUnsignedShort());for(m=p.readUnsignedShort(),b=0;b0?1!=a.length?[3,3]:[4,RES.getResAsync(a[0])]:[3,6];case 2:return u.sent(),[3,5];case 3:return c="$UI_"+i,RES.createGroup(c,a,!0),[4,RES.loadGroup(c)];case 4:u.sent(),u.label=5;case 5:return e._instById[n.id]=n,e._instByName[n.name]=n,e._instById[n._resKey]=n,o(n),[3,7];case 6:o(n),u.label=7;case 7:return[2]}})})})]})})},e.addPackage=function(i,n){if(void 0===n&&(n=null),!n&&!(n=RES.getRes(i)))throw"Resource '"+i+"' not found, please check default.res.json!";var o=new e;return o._resKey=i,o.loadPackage(new t.ByteBuffer(n)),e._instById[o.id]=o,e._instByName[o.name]=o,e._instById[i]=o,o},e.removePackage=function(t){var i=e._instById[t];if(i||(i=e._instByName[t]),!i)throw new Error("unknown package: "+t);i.dispose(),delete e._instById[i.id],delete e._instByName[i.name],delete e._instById[i._resKey],null!=i._customId&&delete e._instById[i._customId]},e.createObject=function(t,i,n){void 0===n&&(n=null);var o=e.getByName(t);return o?o.createObject(i,n):null},e.createObjectFromURL=function(t,i){void 0===i&&(i=null);var n=e.getItemByURL(t);return n?n.owner.internalCreateObject(n,i):null},e.getItemURL=function(t,i){var n=e.getByName(t);if(!n)return null;var o=n._itemsByName[i];return o?"ui://"+n.id+o.id:null},e.getItemByURL=function(t){var i=t.indexOf("//");if(-1==i)return null;var n=t.indexOf("/",i+2);if(-1==n){if(t.length>13){var o=t.substr(5,8),r=e.getById(o);if(null!=r){var s=t.substr(13);return r.getItemById(s)}}}else{var a=t.substr(i+2,n-i-2);if(null!=(r=e.getByName(a))){var h=t.substr(n+1);return r.getItemByName(h)}}return null},e.normalizeURL=function(t){if(null==t)return null;var i=t.indexOf("//");if(-1==i)return null;var n=t.indexOf("/",i+2);if(-1==n)return t;var o=t.substr(i+2,n-i-2),r=t.substr(n+1);return e.getItemURL(o,r)},e.setStringsSource=function(e){t.TranslationHelper.loadFromXML(e)},e.prototype.loadPackage=function(n){if(1179080009!=n.readUnsignedInt())throw"FairyGUI: old package format found in '"+this._resKey+"'";n.version=n.readInt();var o=n.readBool();if(this._id=n.readUTF(),this._name=n.readUTF(),n.skip(20),o){var r=new Uint8Array(n.buffer,n.position,n.length-n.position),s=new Zlib.RawInflate(r),a=new t.ByteBuffer(s.decompress());a.version=n.version,n=a}var h,l,c,u,_,p=n.version>=2,d=n.position;n.seek(d,4),h=n.readInt();var f,g=new Array(h);for(g.reduceRight,l=0;l0&&(this._branches=n.readSArray(h),e._branch&&(this._branchIndex=this._branches.indexOf(e._branch))),_=h>0),n.seek(d,1);var y=this._resKey+"_";for(h=n.readShort(),l=0;l0?b:t.ObjectType.Component,f.rawData=n.readBuffer(),t.UIObjectFactory.resolvePackageItemExtension(f);break;case t.PackageItemType.Atlas:case t.PackageItemType.Sound:case t.PackageItemType.Misc:f.file=y+t.ToolSet.getFileName(f.file)}if(p){(u=n.readS())&&(f.name=u+"/"+f.name);var v=n.readUnsignedByte();v>0&&(_?f.branches=n.readSArray(v):this._itemsById[n.readS()]=f);var w=n.readUnsignedByte();w>0&&(f.highResolution=n.readSArray(w))}this._items.push(f),this._itemsById[f.id]=f,null!=f.name&&(this._itemsByName[f.name]=f),n.position=c}for(n.seek(d,2),h=n.readShort(),l=0;l0){this._loading=!1;for(var t=this._uiSources.length,e=0;e=.9999)return[0,0,i,0,i,n,0,n];var h;switch(o){case t.FillMethod.Horizontal:h=e.fillHorizontal(i,n,r,a);break;case t.FillMethod.Vertical:h=e.fillVertical(i,n,r,a);break;case t.FillMethod.Radial90:h=e.fillRadial90(i,n,r,s,a);break;case t.FillMethod.Radial180:h=e.fillRadial180(i,n,r,s,a);break;case t.FillMethod.Radial360:h=e.fillRadial360(i,n,r,s,a)}return h},e.fillHorizontal=function(e,i,n,o){var r=e*o;return n==t.FillOrigin.Left||n==t.FillOrigin.Top?[0,0,r,0,r,i,0,i]:[e,0,e,i,e-r,i,e-r,0]},e.fillVertical=function(e,i,n,o){var r=i*o;return n==t.FillOrigin.Left||n==t.FillOrigin.Top?[0,0,0,r,e,r,e,0]:[0,i,e,i,e,i-r,0,i-r]},e.fillRadial90=function(e,i,n,o,r){var s,a,h;switch((!o||n!=t.FillOrigin.TopRight&&n!=t.FillOrigin.BottomLeft)&&(o||n!=t.FillOrigin.TopLeft&&n!=t.FillOrigin.BottomRight)||(r=1-r),s=((a=e*Math.tan(Math.PI/2*r))-i)/a,n){case t.FillOrigin.TopLeft:h=o?a<=i?[0,0,e,a,e,0]:[0,0,e*(1-s),i,e,i,e,0]:a<=i?[0,0,e,a,e,i,0,i]:[0,0,e*(1-s),i,0,i];break;case t.FillOrigin.TopRight:h=o?a<=i?[e,0,0,a,0,i,e,i]:[e,0,e*s,i,e,i]:a<=i?[e,0,0,a,0,0]:[e,0,e*s,i,0,i,0,0];break;case t.FillOrigin.BottomLeft:h=o?a<=i?[0,i,e,i-a,e,0,0,0]:[0,i,e*(1-s),0,0,0]:a<=i?[0,i,e,i-a,e,i]:[0,i,e*(1-s),0,e,0,e,i];break;case t.FillOrigin.BottomRight:h=o?a<=i?[e,i,0,i-a,0,i]:[e,i,e*s,0,0,0,0,i]:a<=i?[e,i,0,i-a,0,0,e,0]:[e,i,e*s,0,e,0]}return h},e.movePoints=function(t,e,i){for(var n=t.length,o=0;othis._frameCount-1)&&(this._end=this._frameCount-1),(-1==this._endAt||this._endAt>this._frameCount-1)&&(this._endAt=this._frameCount-1),(this._frame<0||this._frame>this._frameCount-1)&&(this._frame=this._frameCount-1),this.drawFrame(),this._frameElapsed=0,this._repeatedCount=0,this._reversed=!1,this.checkTimer()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"frameCount",{get:function(){return this._frameCount},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"frame",{get:function(){return this._frame},set:function(t){this._frame!=t&&(null!=this._frames&&t>=this._frameCount&&(t=this._frameCount-1),this._frame=t,this._frameElapsed=0,this.drawFrame())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"playing",{get:function(){return this._playing},set:function(t){this._playing!=t&&(this._playing=t,this.checkTimer())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"smoothing",{get:function(){return this._smoothing},set:function(t){this._smoothing=t},enumerable:!0,configurable:!0}),i.prototype.rewind=function(){this._frame=0,this._frameElapsed=0,this._reversed=!1,this._repeatedCount=0,this.drawFrame()},i.prototype.syncStatus=function(t){this._frame=t._frame,this._frameElapsed=t._frameElapsed,this._reversed=t._reversed,this._repeatedCount=t._repeatedCount,this.drawFrame()},i.prototype.advance=function(t){for(var e=this._frame,i=this._reversed,n=t;;){var o=this.interval+this._frames[this._frame].addDelay;if(0==this._frame&&this._repeatedCount>0&&(o+=this.repeatDelay),tthis._frameCount-1&&(this._frame=Math.max(0,this._frameCount-2),this._repeatedCount++,this._reversed=!this._reversed)):(this._frame++,this._frame>this._frameCount-1&&(this._frame=0,this._repeatedCount++)),this._frame==e&&this._reversed==i){var r=n-t;t-=Math.floor(t/r)*r}}this.drawFrame()},i.prototype.setPlaySettings=function(t,e,i,n,o,r){void 0===t&&(t=0),void 0===e&&(e=-1),void 0===i&&(i=0),void 0===n&&(n=-1),void 0===o&&(o=null),void 0===r&&(r=null),this._start=t,this._end=e,(-1==this._end||this._end>this._frameCount-1)&&(this._end=this._frameCount-1),this._times=i,this._endAt=n,-1==this._endAt&&(this._endAt=this._end),this._status=0,this._callback=o,this._callbackObj=r,this.frame=t},i.prototype.update=function(){if(this._playing&&0!=this._frameCount&&3!=this._status){var e=t.GTimers.deltaTime;1!=this.timeScale&&(e*=this.timeScale),this._frameElapsed+=e;var i=this.interval+this._frames[this._frame].addDelay;if(0==this._frame&&this._repeatedCount>0&&(i+=this.repeatDelay),!(this._frameElapsedthis.interval&&(this._frameElapsed=this.interval),this.swing?this._reversed?(this._frame--,this._frame<=0&&(this._frame=0,this._repeatedCount++,this._reversed=!this._reversed)):(this._frame++,this._frame>this._frameCount-1&&(this._frame=Math.max(0,this._frameCount-2),this._repeatedCount++,this._reversed=!this._reversed)):(this._frame++,this._frame>this._frameCount-1&&(this._frame=0,this._repeatedCount++)),1==this._status)this._frame=this._start,this._frameElapsed=0,this._status=0;else if(2==this._status){if(this._frame=this._endAt,this._frameElapsed=0,this._status=3,null!=this._callback){var n=this._callback,o=this._callbackObj;this._callback=null,this._callbackObj=null,n.call(o)}}else this._frame==this._end&&(this._times>0?(this._times--,0==this._times?this._status=2:this._status=1):0!=this._start&&(this._status=1));this.drawFrame()}}},i.prototype.drawFrame=function(){if(this._frameCount>0&&this._frame0&&null!=this.stage?t.GTimers.inst.add(1,0,this.update,this):t.GTimers.inst.remove(this.update,this)},i.prototype.$onAddToStage=function(i,n){e.prototype.$onAddToStage.call(this,i,n),this._playing&&this._frameCount>0&&t.GTimers.inst.add(1,0,this.update,this)},i.prototype.$onRemoveFromStage=function(){e.prototype.$onRemoveFromStage.call(this),t.GTimers.inst.remove(this.update,this)},i}(t.Image);t.MovieClip=i}(fgui||(fgui={})),function(t){var e=function(t){function e(){var e=t.call(this)||this;return e.touchEnabled=!0,e.touchChildren=!0,e}return __extends(e,t),e.prototype.cacheHitArea=function(t){this._cachedHitArea=t,t&&(this._cachedMatrix||(this._cachedMatrix=new egret.Matrix),this._cachedMatrix.copyFrom(this.$getInvertedConcatenatedMatrix()))},Object.defineProperty(e.prototype,"hitArea",{get:function(){return this._hitArea},set:function(t){this._hitArea=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"opaque",{get:function(){return this._opaque},set:function(t){this._opaque=t},enumerable:!0,configurable:!0}),e.prototype.$hitTest=function(e,i){if(!this.$visible)return null;if(this._hitArea){if(!this.touchEnabled)return null;if(this._hitArea.$graphics){if(!this._hitArea.$graphics.$hitTest(e,i))return null}else{var n=(s=this._cachedHitArea?this._cachedMatrix:this.$getInvertedConcatenatedMatrix()).a*e+s.c*i+s.tx,o=s.b*e+s.d*i+s.ty;if(!this._hitArea.contains(n,o))return null}return this}var r=t.prototype.$hitTest.call(this,e,i);if(r==this&&!this.touchEnabled)return null;if(null==r&&this._opaque){var s;n=(s=this._cachedHitArea?this._cachedMatrix:this.$getInvertedConcatenatedMatrix()).a*e+s.c*i+s.tx,o=s.b*e+s.d*i+s.ty;return n>=0&&o>=0&&n<=this.$explicitWidth&&o<=this.$explicitHeight?this:null}return r!=this||this._opaque?r:null},e}(egret.DisplayObjectContainer);t.UIContainer=e}(fgui||(fgui={})),function(t){var e=function(t){function e(e,i,n,o){void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=-1);var r=t.call(this,e,!1)||this;return r.touchPointID=0,r.stageX=i,r.stageY=n,r.touchPointID=o,r}return __extends(e,t),e.prototype.preventDefault=function(){this._prevented=!0},e.prototype.isDefaultPrevented=function(){return this._prevented},e.DRAG_START="__dragStart",e.DRAG_END="__dragEnd",e.DRAG_MOVING="__dragMoving",e}(egret.Event);t.DragEvent=e}(fgui||(fgui={})),function(t){var e=function(t){function e(e,i){void 0===i&&(i=null);var n=t.call(this,e,!1)||this;return n.source=i,n}return __extends(e,t),e.DROP="__drop",e}(egret.Event);t.DropEvent=e}(fgui||(fgui={})),function(t){var e=function(t){function e(e,i,n,o){void 0===i&&(i=null),void 0===n&&(n=0),void 0===o&&(o=0);var r=t.call(this,e,!1)||this;return r.itemObject=i,r.stageX=n,r.stageY=o,r}return __extends(e,t),e.CLICK="___itemClick",e}(egret.Event);t.ItemEvent=e}(fgui||(fgui={})),function(t){var e=function(t){function e(e){return t.call(this,e,!1)||this}return __extends(e,t),e.CHANGED="___stateChanged",e}(egret.Event);t.StateChangeEvent=e}(fgui||(fgui={})),function(t){var e=function(){function e(t){this._owner=t}return e.create=function(i,n){return e.Classes||(e.Classes=[t.GearDisplay,t.GearXY,t.GearSize,t.GearLook,t.GearColor,t.GearAnimation,t.GearText,t.GearIcon,t.GearDisplay2,t.GearFontSize]),new e.Classes[n](i)},e.prototype.dispose=function(){null!=this._tweenConfig&&null!=this._tweenConfig._tweener&&(this._tweenConfig._tweener.kill(),this._tweenConfig._tweener=null)},Object.defineProperty(e.prototype,"controller",{get:function(){return this._controller},set:function(t){t!=this._controller&&(this._controller=t,this._controller&&this.init())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tweenConfig",{get:function(){return null==this._tweenConfig&&(this._tweenConfig=new i),this._tweenConfig},enumerable:!0,configurable:!0}),e.prototype.setup=function(e){var n,o;this._controller=this._owner.parent.getControllerAt(e.readShort()),this.init();var r=e.readShort();if(this instanceof t.GearDisplay)this.pages=e.readSArray(r);else if(this instanceof t.GearDisplay2)this.pages=e.readSArray(r);else{for(n=0;n=2)if(this instanceof t.GearXY){if(e.readBool()){for(this.positionsInPercent=!0,n=0;n0},enumerable:!0,configurable:!0}),e}(t.GearBase);t.GearDisplay=e}(fgui||(fgui={})),function(t){var e=function(t){function e(e){var i=t.call(this,e)||this;return i._visible=0,i}return __extends(e,t),e.prototype.init=function(){this.pages=null},e.prototype.apply=function(){null==this.pages||0==this.pages.length||-1!=this.pages.indexOf(this._controller.selectedPageId)?this._visible=1:this._visible=0},e.prototype.evaluate=function(t){var e=null==this._controller||this._visible>0;return e=0==this.condition?e&&t:e||t},e}(t.GearBase);t.GearDisplay2=e}(fgui||(fgui={})),function(t){var e=function(e){function i(t){var i=e.call(this,t)||this;return i._default=0,i}return __extends(i,e),i.prototype.init=function(){this._default=this._owner.getProp(t.ObjectPropID.FontSize),this._storage={}},i.prototype.addStatus=function(t,e){null==t?this._default=e.readInt():this._storage[t]=e.readInt()},i.prototype.apply=function(){this._owner._gearLocked=!0;var e=this._storage[this._controller.selectedPageId];null!=e?this._owner.setProp(t.ObjectPropID.FontSize,e):this._owner.setProp(t.ObjectPropID.FontSize,this._default),this._owner._gearLocked=!1},i.prototype.updateState=function(){this._storage[this._controller.selectedPageId]=this._owner.text},i}(t.GearBase);t.GearFontSize=e}(fgui||(fgui={})),function(t){var e=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.init=function(){this._default=this._owner.icon,this._storage={}},e.prototype.addStatus=function(t,e){null==t?this._default=e.readS():this._storage[t]=e.readS()},e.prototype.apply=function(){this._owner._gearLocked=!0;var t=this._storage[this._controller.selectedPageId];this._owner.icon=void 0!==t?t:this._default,this._owner._gearLocked=!1},e.prototype.updateState=function(){this._storage[this._controller.selectedPageId]=this._owner.icon},e}(t.GearBase);t.GearIcon=e}(fgui||(fgui={})),function(t){var e=function(e){function n(t){return e.call(this,t)||this}return __extends(n,e),n.prototype.init=function(){this._default=new i(this._owner.alpha,this._owner.rotation,this._owner.grayed,this._owner.touchable),this._storage={}},n.prototype.addStatus=function(t,e){var n;null==t?n=this._default:(n=new i,this._storage[t]=n),n.alpha=e.readFloat(),n.rotation=e.readFloat(),n.grayed=e.readBool(),n.touchable=e.readBool()},n.prototype.apply=function(){var e=this._storage[this._controller.selectedPageId];if(e||(e=this._default),this._tweenConfig&&this._tweenConfig.tween&&!t.UIPackage._constructing&&!t.GearBase.disableAllTweenEffect){if(this._owner._gearLocked=!0,this._owner.grayed=e.grayed,this._owner.touchable=e.touchable,this._owner._gearLocked=!1,null!=this._tweenConfig._tweener){if(this._tweenConfig._tweener.endValue.x==e.alpha&&this._tweenConfig._tweener.endValue.y==e.rotation)return;this._tweenConfig._tweener.kill(!0),this._tweenConfig._tweener=null}var i=e.alpha!=this._owner.alpha,n=e.rotation!=this._owner.rotation;(i||n)&&(this._owner.checkGearController(0,this._controller)&&(this._tweenConfig._displayLockToken=this._owner.addDisplayLock()),this._tweenConfig._tweener=t.GTween.to2(this._owner.alpha,this._owner.rotation,e.alpha,e.rotation,this._tweenConfig.duration).setDelay(this._tweenConfig.delay).setEase(this._tweenConfig.easeType).setUserData((i?1:0)+(n?2:0)).setTarget(this).onUpdate(this.__tweenUpdate,this).onComplete(this.__tweenComplete,this))}else this._owner._gearLocked=!0,this._owner.grayed=e.grayed,this._owner.touchable=e.touchable,this._owner.alpha=e.alpha,this._owner.rotation=e.rotation,this._owner._gearLocked=!1},n.prototype.__tweenUpdate=function(t){var e=t.userData;this._owner._gearLocked=!0,0!=(1&e)&&(this._owner.alpha=t.value.x),0!=(2&e)&&(this._owner.rotation=t.value.y),this._owner._gearLocked=!1},n.prototype.__tweenComplete=function(){0!=this._tweenConfig._displayLockToken&&(this._owner.releaseDisplayLock(this._tweenConfig._displayLockToken),this._tweenConfig._displayLockToken=0),this._tweenConfig._tweener=null},n.prototype.updateState=function(){var t=this._storage[this._controller.selectedPageId];t||(t=new i,this._storage[this._controller.selectedPageId]=t),t.alpha=this._owner.alpha,t.rotation=this._owner.rotation,t.grayed=this._owner.grayed,t.touchable=this._owner.touchable},n}(t.GearBase);t.GearLook=e;var i=function(){return function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=!1),void 0===n&&(n=!0),this.alpha=t,this.rotation=e,this.grayed=i,this.touchable=n}}()}(fgui||(fgui={})),function(t){var e=function(e){function n(t){return e.call(this,t)||this}return __extends(n,e),n.prototype.init=function(){this._default=new i(this._owner.width,this._owner.height,this._owner.scaleX,this._owner.scaleY),this._storage={}},n.prototype.addStatus=function(t,e){var n;null==t?n=this._default:(n=new i,this._storage[t]=n),n.width=e.readInt(),n.height=e.readInt(),n.scaleX=e.readFloat(),n.scaleY=e.readFloat()},n.prototype.apply=function(){var e=this._storage[this._controller.selectedPageId];if(e||(e=this._default),this._tweenConfig&&this._tweenConfig.tween&&!t.UIPackage._constructing&&!t.GearBase.disableAllTweenEffect){if(null!=this._tweenConfig._tweener){if(this._tweenConfig._tweener.endValue.x==e.width&&this._tweenConfig._tweener.endValue.y==e.height&&this._tweenConfig._tweener.endValue.z==e.scaleX&&this._tweenConfig._tweener.endValue.w==e.scaleY)return;this._tweenConfig._tweener.kill(!0),this._tweenConfig._tweener=null}var i=e.width!=this._owner.width||e.height!=this._owner.height,n=e.scaleX!=this._owner.scaleX||e.scaleY!=this._owner.scaleY;(i||n)&&(this._owner.checkGearController(0,this._controller)&&(this._tweenConfig._displayLockToken=this._owner.addDisplayLock()),this._tweenConfig._tweener=t.GTween.to4(this._owner.width,this._owner.height,this._owner.scaleX,this._owner.scaleY,e.width,e.height,e.scaleX,e.scaleY,this._tweenConfig.duration).setDelay(this._tweenConfig.delay).setEase(this._tweenConfig.easeType).setUserData((i?1:0)+(n?2:0)).setTarget(this).onUpdate(this.__tweenUpdate,this).onComplete(this.__tweenComplete,this))}else this._owner._gearLocked=!0,this._owner.setSize(e.width,e.height,this._owner.gearXY.controller==this._controller),this._owner.setScale(e.scaleX,e.scaleY),this._owner._gearLocked=!1},n.prototype.__tweenUpdate=function(t){var e=t.userData;this._owner._gearLocked=!0,0!=(1&e)&&this._owner.setSize(t.value.x,t.value.y,this._owner.checkGearController(1,this._controller)),0!=(2&e)&&this._owner.setScale(t.value.z,t.value.w),this._owner._gearLocked=!1},n.prototype.__tweenComplete=function(){0!=this._tweenConfig._displayLockToken&&(this._owner.releaseDisplayLock(this._tweenConfig._displayLockToken),this._tweenConfig._displayLockToken=0),this._tweenConfig._tweener=null},n.prototype.updateState=function(){var t=this._storage[this._controller.selectedPageId];t||(t=new i,this._storage[this._controller.selectedPageId]=t),t.width=this._owner.width,t.height=this._owner.height,t.scaleX=this._owner.scaleX,t.scaleY=this._owner.scaleY},n.prototype.updateFromRelations=function(t,e){if(null!=this._controller&&null!=this._storage){for(var i in this._storage){var n=this._storage[i];n.width+=t,n.height+=e}this._default.width+=t,this._default.height+=e,this.updateState()}},n}(t.GearBase);t.GearSize=e;var i=function(){return function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.width=t,this.height=e,this.scaleX=i,this.scaleY=n}}()}(fgui||(fgui={})),function(t){var e=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.init=function(){this._default=this._owner.text,this._storage={}},e.prototype.addStatus=function(t,e){null==t?this._default=e.readS():this._storage[t]=e.readS()},e.prototype.apply=function(){this._owner._gearLocked=!0;var t=this._storage[this._controller.selectedPageId];this._owner.text=void 0!==t?t:this._default,this._owner._gearLocked=!1},e.prototype.updateState=function(){this._storage[this._controller.selectedPageId]=this._owner.text},e}(t.GearBase);t.GearText=e}(fgui||(fgui={})),function(t){var e=function(e){function i(t){return e.call(this,t)||this}return __extends(i,e),i.prototype.init=function(){this._default={x:this._owner.x,y:this._owner.y,px:this._owner.x/this._owner.parent.width,py:this._owner.y/this._owner.parent.height},this._storage={}},i.prototype.addStatus=function(t,e){var i;null==t?i=this._default:(i={},this._storage[t]=i),i.x=e.readInt(),i.y=e.readInt()},i.prototype.addExtStatus=function(t,e){var i;(i=null==t?this._default:this._storage[t]).px=e.readFloat(),i.py=e.readFloat()},i.prototype.apply=function(){var e,i,n=this._storage[this._controller.selectedPageId];if(n||(n=this._default),this.positionsInPercent&&this._owner.parent?(e=n.px*this._owner.parent.width,i=n.py*this._owner.parent.height):(e=n.x,i=n.y),null==this._tweenConfig||!this._tweenConfig.tween||t.UIPackage._constructing||t.GearBase.disableAllTweenEffect)this._owner._gearLocked=!0,this._owner.setXY(e,i),this._owner._gearLocked=!1;else{if(null!=this._tweenConfig._tweener){if(this._tweenConfig._tweener.endValue.x==e&&this._tweenConfig._tweener.endValue.y==i)return;this._tweenConfig._tweener.kill(!0),this._tweenConfig._tweener=null}var o=this._owner.x,r=this._owner.y;o==e&&r==i||(this._owner.checkGearController(0,this._controller)&&(this._tweenConfig._displayLockToken=this._owner.addDisplayLock()),this._tweenConfig._tweener=t.GTween.to2(o,r,e,i,this._tweenConfig.duration).setDelay(this._tweenConfig.delay).setEase(this._tweenConfig.easeType).setTarget(this).onUpdate(this.__tweenUpdate,this).onComplete(this.__tweenComplete,this))}},i.prototype.__tweenUpdate=function(t){this._owner._gearLocked=!0,this._owner.setXY(t.value.x,t.value.y),this._owner._gearLocked=!1},i.prototype.__tweenComplete=function(){0!=this._tweenConfig._displayLockToken&&(this._owner.releaseDisplayLock(this._tweenConfig._displayLockToken),this._tweenConfig._displayLockToken=0),this._tweenConfig._tweener=null},i.prototype.updateState=function(){var t=this._storage[this._controller.selectedPageId];t||(t={},this._storage[this._controller.selectedPageId]=t),t.x=this._owner.x,t.y=this._owner.y,t.px=this._owner.x/this._owner.parent.width,t.py=this._owner.y/this._owner.parent.height},i.prototype.updateFromRelations=function(t,e){if(null!=this._controller&&null!=this._storage&&!this.positionsInPercent){for(var i in this._storage){var n=this._storage[i];n.x+=t,n.y+=e}this._default.x+=t,this._default.y+=e,this.updateState()}},i}(t.GearBase);t.GearXY=e}(fgui||(fgui={})),function(t){var e=function(){function e(){}return e.evaluate=function(n,o,r,s,a){switch(n){case t.EaseType.Linear:return o/r;case t.EaseType.SineIn:return 1-Math.cos(o/r*e._PiOver2);case t.EaseType.SineOut:return Math.sin(o/r*e._PiOver2);case t.EaseType.SineInOut:return-.5*(Math.cos(Math.PI*o/r)-1);case t.EaseType.QuadIn:return(o/=r)*o;case t.EaseType.QuadOut:return-(o/=r)*(o-2);case t.EaseType.QuadInOut:return(o/=.5*r)<1?.5*o*o:-.5*(--o*(o-2)-1);case t.EaseType.CubicIn:return(o/=r)*o*o;case t.EaseType.CubicOut:return(o=o/r-1)*o*o+1;case t.EaseType.CubicInOut:return(o/=.5*r)<1?.5*o*o*o:.5*((o-=2)*o*o+2);case t.EaseType.QuartIn:return(o/=r)*o*o*o;case t.EaseType.QuartOut:return-((o=o/r-1)*o*o*o-1);case t.EaseType.QuartInOut:return(o/=.5*r)<1?.5*o*o*o*o:-.5*((o-=2)*o*o*o-2);case t.EaseType.QuintIn:return(o/=r)*o*o*o*o;case t.EaseType.QuintOut:return(o=o/r-1)*o*o*o*o+1;case t.EaseType.QuintInOut:return(o/=.5*r)<1?.5*o*o*o*o*o:.5*((o-=2)*o*o*o*o+2);case t.EaseType.ExpoIn:return 0==o?0:Math.pow(2,10*(o/r-1));case t.EaseType.ExpoOut:return o==r?1:1-Math.pow(2,-10*o/r);case t.EaseType.ExpoInOut:return 0==o?0:o==r?1:(o/=.5*r)<1?.5*Math.pow(2,10*(o-1)):.5*(2-Math.pow(2,-10*--o));case t.EaseType.CircIn:return-(Math.sqrt(1-(o/=r)*o)-1);case t.EaseType.CircOut:return Math.sqrt(1-(o=o/r-1)*o);case t.EaseType.CircInOut:return(o/=.5*r)<1?-.5*(Math.sqrt(1-o*o)-1):.5*(Math.sqrt(1-(o-=2)*o)+1);case t.EaseType.ElasticIn:var h;return 0==o?0:1==(o/=r)?1:(0==a&&(a=.3*r),s<1?(s=1,h=a/4):h=a/e._TwoPi*Math.asin(1/s),-s*Math.pow(2,10*(o-=1))*Math.sin((o*r-h)*e._TwoPi/a));case t.EaseType.ElasticOut:var l;return 0==o?0:1==(o/=r)?1:(0==a&&(a=.3*r),s<1?(s=1,l=a/4):l=a/e._TwoPi*Math.asin(1/s),s*Math.pow(2,-10*o)*Math.sin((o*r-l)*e._TwoPi/a)+1);case t.EaseType.ElasticInOut:var c;return 0==o?0:2==(o/=.5*r)?1:(0==a&&(a=r*(.3*1.5)),s<1?(s=1,c=a/4):c=a/e._TwoPi*Math.asin(1/s),o<1?s*Math.pow(2,10*(o-=1))*Math.sin((o*r-c)*e._TwoPi/a)*-.5:s*Math.pow(2,-10*(o-=1))*Math.sin((o*r-c)*e._TwoPi/a)*.5+1);case t.EaseType.BackIn:return(o/=r)*o*((s+1)*o-s);case t.EaseType.BackOut:return(o=o/r-1)*o*((s+1)*o+s)+1;case t.EaseType.BackInOut:return(o/=.5*r)<1?o*o*((1+(s*=1.525))*o-s)*.5:.5*((o-=2)*o*((1+(s*=1.525))*o+s)+2);case t.EaseType.BounceIn:return i.easeIn(o,r);case t.EaseType.BounceOut:return i.easeOut(o,r);case t.EaseType.BounceInOut:return i.easeInOut(o,r);default:return-(o/=r)*(o-2)}},e._PiOver2=.5*Math.PI,e._TwoPi=2*Math.PI,e}();t.EaseManager=e;var i=function(){function t(){}return t.easeIn=function(e,i){return 1-t.easeOut(i-e,i)},t.easeOut=function(t,e){return(t/=e)<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},t.easeInOut=function(e,i){return e<.5*i?.5*t.easeIn(2*e,i):.5*t.easeOut(2*e-i,i)+.5},t}()}(fgui||(fgui={})),function(t){var e=function(){function t(){}return t.Linear=0,t.SineIn=1,t.SineOut=2,t.SineInOut=3,t.QuadIn=4,t.QuadOut=5,t.QuadInOut=6,t.CubicIn=7,t.CubicOut=8,t.CubicInOut=9,t.QuartIn=10,t.QuartOut=11,t.QuartInOut=12,t.QuintIn=13,t.QuintOut=14,t.QuintInOut=15,t.ExpoIn=16,t.ExpoOut=17,t.ExpoInOut=18,t.CircIn=19,t.CircOut=20,t.CircInOut=21,t.ElasticIn=22,t.ElasticOut=23,t.ElasticInOut=24,t.BackIn=25,t.BackOut=26,t.BackInOut=27,t.BounceIn=28,t.BounceOut=29,t.BounceInOut=30,t.Custom=31,t}();t.EaseType=e}(fgui||(fgui={})),function(t){var e=function(){function e(){this._segments=new Array,this._points=new Array}return Object.defineProperty(e.prototype,"length",{get:function(){return this._fullLength},enumerable:!0,configurable:!0}),e.prototype.create2=function(t,e,i,n){var o=new Array;o.push(t),o.push(e),i&&o.push(i),n&&o.push(n),this.create(o)},e.prototype.create=function(n){this._segments.length=0,this._points.length=0,this._fullLength=0;var o=n.length;if(0!=o){var r=e.helperPoints;r.length=0;var s=n[0];s.curveType==t.CurveType.CRSpline&&r.push(new egret.Point(s.x,s.y));for(var a=1;a0&&(r.push(new egret.Point(h.x,h.y)),this.createSplineSegment()):r.push(new egret.Point(h.x,h.y)),s=h}r.length>1&&this.createSplineSegment()}},e.prototype.createSplineSegment=function(){var n=e.helperPoints,o=n.length;n.splice(0,0,n[0]),n.push(n[o]),n.push(n[o]),o+=3;var r=new i;r.type=t.CurveType.CRSpline,r.ptStart=this._points.length,r.ptCount=o,this._points=this._points.concat(n),r.length=0;for(var s=1;si&&u=0?this._elapsedTime=this._delay+this._breakpoint:this._repeat>=0?this._elapsedTime=this._delay+this._duration*(this._repeat+1):this._elapsedTime=this._delay+2*this._duration,this.update()),this.callCompleteCallback()),this._killed=!0)},e.prototype._to=function(t,e,i){return this._valueSize=1,this._startValue.x=t,this._endValue.x=e,this._value.x=t,this._duration=i,this},e.prototype._to2=function(t,e,i,n,o){return this._valueSize=2,this._startValue.x=t,this._endValue.x=i,this._startValue.y=e,this._endValue.y=n,this._value.x=t,this._value.y=e,this._duration=o,this},e.prototype._to3=function(t,e,i,n,o,r,s){return this._valueSize=3,this._startValue.x=t,this._endValue.x=n,this._startValue.y=e,this._endValue.y=o,this._startValue.z=i,this._endValue.z=r,this._value.x=t,this._value.y=e,this._value.z=i,this._duration=s,this},e.prototype._to4=function(t,e,i,n,o,r,s,a,h){return this._valueSize=4,this._startValue.x=t,this._endValue.x=o,this._startValue.y=e,this._endValue.y=r,this._startValue.z=i,this._endValue.z=s,this._startValue.w=n,this._endValue.w=a,this._value.x=t,this._value.y=e,this._value.z=i,this._value.w=n,this._duration=h,this},e.prototype._toColor=function(t,e,i){return this._valueSize=4,this._startValue.color=t,this._endValue.color=e,this._value.color=t,this._duration=i,this},e.prototype._shake=function(t,e,i,n){return this._valueSize=5,this._startValue.x=t,this._startValue.y=e,this._startValue.w=i,this._duration=n,this},e.prototype._init=function(){this._delay=0,this._duration=0,this._breakpoint=-1,this._easeType=t.EaseType.QuadOut,this._timeScale=1,this._easePeriod=0,this._easeOvershootOrAmplitude=1.70158,this._snapping=!1,this._repeat=0,this._yoyo=!1,this._valueSize=0,this._started=!1,this._paused=!1,this._killed=!1,this._elapsedTime=0,this._normalizedTime=0,this._ended=0},e.prototype._reset=function(){this._target=null,this._propType=null,this._userData=null,this._path=null,this._onStart=this._onUpdate=this._onComplete=null,this._onStartCaller=this._onUpdateCaller=this._onCompleteCaller=null},e.prototype._update=function(t){if(1!=this._timeScale&&(t*=this._timeScale),0!=t){if(0!=this._ended)return this.callCompleteCallback(),void(this._killed=!0);this._elapsedTime+=t,this.update(),0!=this._ended&&(this._killed||(this.callCompleteCallback(),this._killed=!0))}},e.prototype.update=function(){if(this._ended=0,0!=this._valueSize){if(!this._started){if(this._elapsedTime=0&&n>=this._breakpoint&&(n=this._breakpoint,this._ended=2),0!=this._repeat){var o=Math.floor(n/this._duration);n-=this._duration*o,this._yoyo&&(i=o%2==1),this._repeat>0&&this._repeat-o<0&&(this._yoyo&&(i=this._repeat%2==1),n=this._duration,this._ended=1)}else n>=this._duration&&(n=this._duration,this._ended=1);if(this._normalizedTime=t.EaseManager.evaluate(this._easeType,i?this._duration-n:n,this._duration,this._easeOvershootOrAmplitude,this._easePeriod),this._value.setZero(),this._deltaValue.setZero(),5==this._valueSize)if(0==this._ended){var r=this._startValue.w*(1-this._normalizedTime),s=r*(Math.random()>.5?1:-1),a=r*(Math.random()>.5?1:-1);this._deltaValue.x=s,this._deltaValue.y=a,this._value.x=this._startValue.x+s,this._value.y=this._startValue.y+a}else this._value.x=this._startValue.x,this._value.y=this._startValue.y;else if(this._path){var h=e.helperPoint;this._path.getPointAt(this._normalizedTime,h),this._snapping&&(h.x=Math.round(h.x),h.y=Math.round(h.y)),this._deltaValue.x=h.x-this._value.x,this._deltaValue.y=h.y-this._value.y,this._value.x=h.x,this._value.y=h.y}else for(var l=0;l=this._delay+this._duration&&(this._ended=1)},e.prototype.callStartCallback=function(){if(null!=this._onStart)try{this._onStart.call(this._onStartCaller,this)}catch(t){console.log("FairyGUI: error in start callback > "+t)}},e.prototype.callUpdateCallback=function(){if(null!=this._onUpdate)try{this._onUpdate.call(this._onUpdateCaller,this)}catch(t){console.log("FairyGUI: error in update callback > "+t)}},e.prototype.callCompleteCallback=function(){if(null!=this._onComplete)try{this._onComplete.call(this._onCompleteCaller,this)}catch(t){console.log("FairyGUI: error in complete callback > "+t)}},e.helperPoint=new egret.Point,e}();t.GTweener=e}(fgui||(fgui={})),function(t){var e=function(){function e(){}return e.createTween=function(){var i;return e._inited||(egret.startTick(e.update,null),e._inited=!0,e._lastTime=egret.getTimer()),(i=e._tweenerPool.length>0?e._tweenerPool.pop():new t.GTweener)._init(),e._activeTweens[e._totalActiveTweens++]=i,e._totalActiveTweens==e._activeTweens.length&&(e._activeTweens.length=e._activeTweens.length+Math.ceil(.5*e._activeTweens.length)),i},e.isTweening=function(t,i){if(null==t)return!1;for(var n=null==i||null==i,o=0;o=0){if(e._totalActiveTweens!=o){var h=o;for(o=e._totalActiveTweens-o,s=0;s>16,this.y=(65280&t)>>8,this.z=255&t,this.w=(4278190080&t)>>24},enumerable:!0,configurable:!0}),t.prototype.getField=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("Index out of bounds: "+t)}},t.prototype.setField=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("Index out of bounds: "+t)}},t.prototype.setZero=function(){this.x=this.y=this.z=this.w=0},t}();t.TweenValue=e}(fgui||(fgui={})),function(t){var e=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.stringTable=null,n.version=0,n}return __extends(e,t),e.prototype.skip=function(t){this.position+=t},e.prototype.readBool=function(){return 1==this.readByte()},e.prototype.readS=function(){var t=this.readUnsignedShort();return 65534==t?null:65533==t?"":this.stringTable[t]},e.prototype.readSArray=function(t){for(var e=new Array(t),i=0;i0?(this.position=t+i,!0):(this.position=n,!1)):(this.position=n,!1)},e}(egret.ByteArray);t.ByteBuffer=e}(fgui||(fgui={})),function(t){var e=function(){function t(){this.matrix=new Array(t.LENGTH),this.reset()}return t.create=function(e,i,n,o){var r=new t;return r.adjustColor(e,i,n,o),r},t.getMatrix=function(e,i,n,o,r){r||(r=new Array(t.length));var s=t.helper;s.reset(),s.adjustColor(e,i,n,o);for(var a=t.LENGTH,h=0;h=this.delay&&(this.counter-=this.delay,this.counter>this.delay&&(this.counter=this.delay),this.repeat>0&&(this.repeat--,0==this.repeat&&(this.end=!0)),!0)},t.prototype.reset=function(){this.callback=null,this.thisObj=null,this.param=null},t}()}(fgui||(fgui={})),function(t){var e=function(){function t(){this._readPos=0,this.smallFontSize=12,this.normalFontSize=14,this.largeFontSize=16,this.defaultImgWidth=0,this.defaultImgHeight=0,this._handlers={},this._handlers.url=this.onTag_URL,this._handlers.img=this.onTag_IMG,this._handlers.b=this.onTag_Simple,this._handlers.i=this.onTag_Simple,this._handlers.u=this.onTag_Simple,this._handlers.sup=this.onTag_Simple,this._handlers.sub=this.onTag_Simple,this._handlers.color=this.onTag_COLOR,this._handlers.font=this.onTag_FONT,this._handlers.size=this.onTag_SIZE}return t.prototype.onTag_URL=function(t,e,i){return e?"":null!=i?'':''},t.prototype.onTag_IMG=function(t,e,i){if(e)return null;var n=this.getTagText(!0);return n?this.defaultImgWidth?'':'':null},t.prototype.onTag_Simple=function(t,e,i){return e?"":"<"+t+">"},t.prototype.onTag_COLOR=function(t,e,i){return e?"":''},t.prototype.onTag_FONT=function(t,e,i){return e?"":''},t.prototype.onTag_SIZE=function(t,e,i){return e?"":("normal"==i?i=""+this.normalFontSize:"small"==i?i=""+this.smallFontSize:"large"==i?i=""+this.largeFontSize:i.length&&"+"==i.charAt(0)?i=""+(this.smallFontSize+parseInt(i.substr(1))):i.length&&"-"==i.charAt(0)&&(i=""+(this.smallFontSize-parseInt(i.substr(1)))),'')},t.prototype.getTagText=function(t){void 0===t&&(t=!1);for(var e,i=this._readPos,n="";-1!=(e=this._text.indexOf("[",i));){if(92!=this._text.charCodeAt(e-1)){n+=this._text.substring(i,e);break}n+=this._text.substring(i,e-1),n+="[",i=e+1}return-1==e?null:(t&&(this._readPos=e),n)},t.prototype.parse=function(t,e){void 0===e&&(e=!1),this._text=t;for(var i,n,o,r,s,a,h,l=0,c="";-1!=(i=this._text.indexOf("[",l));)if(i>0&&92==this._text.charCodeAt(i-1))c+=this._text.substring(l,i-1),c+="[",l=i+1;else{if(c+=this._text.substring(l,i),l=i,-1==(i=this._text.indexOf("]",l)))break;o="/"==this._text.charAt(l+1),r=this._text.substring(o?l+2:l+1,i),this._readPos=i+1,s=null,a=null,-1!=(n=r.indexOf("="))&&(s=r.substring(n+1),r=r.substring(0,n)),r=r.toLowerCase(),null!=(h=this._handlers[r])?e||null!=(a=h.call(this,r,o,s))&&(c+=a):c+=this._text.substring(l,this._readPos),l=this._readPos}return l=0&&(" "==(e=t.charAt(i))||"\n"==e||"\r"==e);i--);return t.substring(0,i+1)},e.convertToHtmlColor=function(t,e){var i;void 0===e&&(e=!1),i=e?(t>>24&255).toString(16):"";var n=(t>>16&255).toString(16),o=(t>>8&255).toString(16),r=(255&t).toString(16);return 1==i.length&&(i="0"+i),1==n.length&&(n="0"+n),1==o.length&&(o="0"+o),1==r.length&&(r="0"+r),"#"+i+n+o+r},e.convertFromHtmlColor=function(t,e){return void 0===e&&(e=!1),t.length<1?0:("#"==t.charAt(0)&&(t=t.substr(1)),8==t.length?(parseInt(t.substr(0,2),16)<<24)+parseInt(t.substr(2),16):e?4278190080+parseInt(t,16):parseInt(t,16))},e.displayObjectToGObject=function(e){for(;null!=e&&!(e instanceof egret.Stage);){if(e.$owner)return t.GObject.cast(e);e=e.parent}return null},e.encodeHTML=function(t){return t?t.replace("&","&").replace("<","<").replace(">",">").replace("'","'"):""},e.parseUBB=function(t){return e.defaultUBBParser.parse(t)},e.clamp=function(t,e,i){return ti&&(t=i),t},e.clamp01=function(t){return t>1?t=1:t<0&&(t=0),t},e.lerp=function(t,e,i){return t+i*(e-t)},e.repeat=function(t,e){return t-Math.floor(t/e)*e},e.distance=function(t,e,i,n){return Math.sqrt(Math.pow(t-i,2)+Math.pow(e-n,2))},e.fillPath=function(t,e,i,n){var o=e.length;t.moveTo(e[0]+i,e[1]+n);for(var r=2;r>16&255)/255,h[6]=(n>>8&255)/255,h[12]=(255&n)/255}s.matrix=h}else if(a&&s){var u=a.indexOf(s);-1!=u&&(a.splice(u,1),a.length>0?i.filters=a:i.filters=null)}},e.defaultUBBParser=new t.UBBParser,e.grayScaleMatrix=[.3,.6,0,0,0,.3,.6,0,0,0,.3,.6,0,0,0,0,0,0,1,0],e}();t.ToolSet=e}(fgui||(fgui={}));