123 |
- var __reflect=this&&this.__reflect||function(t,e,n){t.__class__=e,n?n.push(e):n=[e],t.__types__=t.__types__?n.concat(t.__types__):n},__extends=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);n.prototype=e.prototype,t.prototype=new n},__awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(o,r){function s(t){try{c(i.next(t))}catch(e){r(e)}}function a(t){try{c(i["throw"](t))}catch(e){r(e)}}function c(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(s,a)}c((i=i.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){function n(t){return function(e){return i([t,e])}}function i(n){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,r&&(s=r[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(r,n[1])).done)return s;switch(r=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,r=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(s=c.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){c.label=n[1];break}if(6===n[0]&&c.label<s[1]){c.label=s[1],s=n;break}if(s&&c.label<s[2]){c.label=s[2],c.ops.push(n);break}s[2]&&c.ops.pop(),c.trys.pop();continue}n=e.call(t,c)}catch(i){n=[6,i],r=0}finally{o=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var o,r,s,a,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),"throw":n(1),"return":n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},UIBaseComponent=function(t){function e(){var e=t.call(this)||this;return e.addEventListener(eui.UIEvent.CREATION_COMPLETE,e.bindEvents,e),e.addEventListener(eui.UIEvent.CREATION_COMPLETE,e.onCreate,e),e}return __extends(e,t),e.prototype.createChildren=function(){t.prototype.createChildren.call(this)},e.prototype.bindEvents=function(){this.removeEventListener(eui.UIEvent.CREATION_COMPLETE,this.bindEvents,this),Lang.instance.addEventListener(SocketEvent.LANG_CHANGE,this.onLangChange,this)},e.prototype.onCreate=function(){GAME_ISMOBILE&&(this.currentState="h5",this.validateNow()),this.removeEventListener(eui.UIEvent.CREATION_COMPLETE,this.onCreate,this)},e.prototype.render=function(){},e.prototype.onLangChange=function(t){},e.prototype.onClose=function(){},e.prototype.close=function(){Lang.instance.removeEventListener(eui.UIEvent.CREATION_COMPLETE,this.onLangChange,this),UIController.instance.closeView(this)},e}(eui.Component);__reflect(UIBaseComponent.prototype,"UIBaseComponent");var UIBaseItemRenderer=function(t){function e(){var e=t.call(this)||this;return e.addEventListener(eui.UIEvent.CREATION_COMPLETE,e.onCreate,e),e.touchChildren=!0,e}return __extends(e,t),e.prototype.onCreate=function(){GAME_ISMOBILE&&(this.currentState="h5"),this.removeEventListener(eui.UIEvent.CREATION_COMPLETE,this.onCreate,this)},e}(eui.ItemRenderer);__reflect(UIBaseItemRenderer.prototype,"UIBaseItemRenderer");var UIBaseView=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.width=this.stage.stageWidth,this.height=this.stage.stageHeight},e}(UIBaseComponent);__reflect(UIBaseView.prototype,"UIBaseView");var UserMgr=function(){function t(){this.account=null,this.balance=0,this.gt=0,this.money=0}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),t.prototype.setAccount=function(t){this.account=t},t.prototype.getPlayer=function(){return this.account&&this.account.name},t.prototype.setCoin=function(t){void 0!==t.balance&&(this.balance=t.balance),void 0!==t.money&&(this.money=t.money),void 0!==t.gt&&(this.gt=t.gt),Userinfo.instance.renderUserData(t)},t.prototype.isLogin=function(){return this.account?!0:(EosMgr.instance.login(),!1)},t}();__reflect(UserMgr.prototype,"UserMgr");var Util=function(){function t(){}return t.getNowDate=function(){return this.dateFtt(new Date,"yyyy-MM-dd hh:mm:ss")},t.getWeekTime=function(){var e=new Date,n=e.getFullYear(),i=e.getMonth(),o=e.getDate(),r=e.getDay(),s=new Date(n,i,o-(r?r-1:6)),a=new Date(n,i,o+(r?8-r:1));return t.dateRange=[this.dateFtt(s),this.dateFtt(a)],t.dateRange},t.isInTimeRange=function(t){if(t){var e=new Date(t.replace(/-/g,"/")).getTime();return e>this.dateRange[0]&&e<this.dateRange[1]}return!1},t.transObj=function(t){var e={};return t.map(function(t){e[t.key]=t.value}),e},t.dateFtt=function(t,e){var n={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};e||(e="yyyy-MM-ddThh:mm:ss+00:00"),/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length)));for(var i in n)new RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?n[i]:("00"+n[i]).substr((""+n[i]).length)));return e},t.createSprite=function(t){var e=new egret.Sprite;if(t)for(var n in t)e[n]=t[n];return e},t.createBitmapByName=function(t,e){var n=new egret.Bitmap,i=RES.getRes(t);if(n.texture=i,e)for(var o in e)n[o]=e[o];return n},t.createText=function(t,e){var n=new egret.TextField;if(n.text=t,e)for(var i in e)n[i]=e[i];return n},t.createAvatar=function(t,e){return void 0===t&&(t=""),__awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(i){return[2,new Promise(function(i,o){t||o("无头像"),RES.getResByUrl(t,function(t){var n=t,o=new egret.Bitmap(n);if(e)for(var r in e)o[r]=e[r];i(o)},n,RES.ResourceItem.TYPE_IMAGE)})]})})},t.createLine=function(t,e,n){var i=new egret.Shape;if(e.beginFill&&i.graphics.beginFill(e.beginFill.color,e.beginFill.alpha),e.lineStyle&&i.graphics.lineStyle(e.lineStyle.thickness,e.lineStyle.color,e.lineStyle.alpha,e.lineStyle.pixelHinting,e.lineStyle.scaleMode,e.lineStyle.caps,e.lineStyle.joints,e.lineStyle.miterLimit),i.graphics.moveTo(t[0][0],t[0][1]),t.map(function(e,n){n>0&&i.graphics.lineTo(t[n][0],t[n][1])}),i.graphics.endFill(),n)for(var o in n)i[o]=n[o];return i},t.createRect=function(t,e,n){var i=new egret.Shape;if(e.beginFill&&i.graphics.beginFill(e.beginFill.color,e.beginFill.alpha),e.lineStyle&&i.graphics.lineStyle(e.lineStyle.thickness,e.lineStyle.color,e.lineStyle.alpha,e.lineStyle.pixelHinting,e.lineStyle.scaleMode,e.lineStyle.caps,e.lineStyle.joints,e.lineStyle.miterLimit),i.graphics.drawRect(t[0],t[1],t[2],t[3]),n)for(var o in n)i[o]=n[o];return i},t.createCircle=function(t,e,n){var i=new egret.Shape;if(e.beginFill&&i.graphics.beginFill(e.beginFill.color,e.beginFill.alpha),e.lineStyle&&i.graphics.lineStyle(e.lineStyle.thickness,e.lineStyle.color,e.lineStyle.alpha,e.lineStyle.pixelHinting,e.lineStyle.scaleMode,e.lineStyle.caps,e.lineStyle.joints,e.lineStyle.miterLimit),i.graphics.drawCircle(t[0],t[1],t[2]),n)for(var o in n)i[o]=n[o];return i},t.createArc=function(t,e,n){var i=new egret.Shape;if(e.beginFill&&i.graphics.beginFill(e.beginFill.color,e.beginFill.alpha),e.lineStyle&&i.graphics.lineStyle(e.lineStyle.thickness,e.lineStyle.color,e.lineStyle.alpha,e.lineStyle.pixelHinting,e.lineStyle.scaleMode,e.lineStyle.caps,e.lineStyle.joints,e.lineStyle.miterLimit),i.graphics.drawArc(t[0],t[1],t[2],t[3],t[4],t[5]),n)for(var o in n)i[o]=n[o];return i},t.createRoundRect=function(t,e,n){var i=new egret.Shape;if(e.beginFill&&i.graphics.beginFill(e.beginFill.color,e.beginFill.alpha),e.lineStyle&&i.graphics.lineStyle(e.lineStyle.thickness,e.lineStyle.color,e.lineStyle.alpha,e.lineStyle.pixelHinting,e.lineStyle.scaleMode,e.lineStyle.caps,e.lineStyle.joints,e.lineStyle.miterLimit),i.graphics.drawRoundRect(t[0],t[1],t[2],t[3],t[4],t[5]),n)for(var o in n)i[o]=n[o];return i},t.removeChild=function(t){t.parent&&t.parent.removeChild(t)},t.clearView=function(t,e){for(isNaN(e)&&(e=-1);t.$children.length>e+1;)t.removeChildAt(e+1);return!0},t.createCircleMask=function(e,n,i,o){void 0===n&&(n=0),void 0===i&&(i=0),void 0===o&&(o=0),n=n||e.x-e.anchorOffsetX+e.width/2,i=i||e.y-e.anchorOffsetY+e.height/2,o=o||e.width/2;var r=t.createCircle([n,i,o],{beginFill:{color:0,alpha:1}});e.parent.addChild(r),e.mask=r},t.createDragonBones=function(t,e){var n=RES.getRes(t+"_ske_json"),i=RES.getRes(t+"_tex_json"),o=RES.getRes(t+"_tex_png"),r=new dragonBones.EgretFactory;r.parseDragonBonesData(n),r.parseTextureAtlasData(i,o);var s=r.buildArmatureDisplay(e);return s},t.addFontShawdow=function(t){t.filters=[new egret.DropShadowFilter(3,135,0,.3,1,1)]},t.getChar=function(t,e){var n=new egret.ByteArray;if(n.writeUTFBytes(t),n.length<e)return t;n.position=0;var i=n.readUTFBytes(e);return i+"..."},t.getLanguage=function(){var t=navigator.language.toLowerCase(),e="zh";return e=t.indexOf("en")>-1?"en":"zh"},t.isDev=function(){return""!==window.location.port||/test|webdev/.test(location.host)},t.toPokerColour=function(t){return Math.ceil(t/13)},t.toPoker=function(t){return(t-1)%13+1},t.pointPoker=function(t){var e=this.toPoker(t);return e>10&&(e=10),e},t.getDistanceBetweenTwoPoint=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},t.dateRange=[],t}();__reflect(Util.prototype,"Util");var Api=function(){function t(){}return t.generatorDispatchEvent=function(t,e){var n=new SocketEvent(SocketEvent.PROTO_MSG);n.protoId=t,n.data=e,GameMgr.instance.dispatchEvent(n)},t.httpGet=function(t,e){var n=this;void 0===e&&(e={});var i=Object.keys(e).map(function(t){return e[t]&&t+"="+e[t]}).join("&");return t+=i?"?"+i:"",new Promise(function(e,i){var o=new egret.HttpRequest;o.responseType=egret.HttpResponseType.TEXT,o.open(t,egret.HttpMethod.GET),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(),o.addEventListener(egret.Event.COMPLETE,function(t){var n=t.currentTarget;e(JSON.parse(n.response))},n),o.addEventListener(egret.IOErrorEvent.IO_ERROR,i,n)})},t.getNewGame=function(t,e,n){var i=this,o={old:t,"new":e,player:n};this.getNewGameParam=o,this.httpGet(this.url+"/baccarat/gameResult",o).then(function(t){if(0==t.code)if(i.getNewGameParam===o){var e=t.data["new"],n=t.data.old;e.timeout;Rate.instance.pushRateHistory(n),Index.instance.renderLotteryInfo(n,e)}else console.warn("getNewGame warn:param not lastest");else console.error("getNewGame error:",t.msg)})},t.getGameInfo=function(t){this.httpGet(this.url+"/baccarat/gameInfo",{game_id:t}).then(function(t){if(0==t.code){var e=t.data,n=e.dig_rate,i=e.game,o=e.offers,r=e.winData,s=e.online;Bet.instance.setRate(n),Index.instance.renderGameInfo(i),Index.instance.renderOnlineNumber(s.total),Trade.instance.renderTradeList(o),o.forEach(function(t){return Index.instance.renderOfferItem(t)}),Rate.instance.renderRateHistory(r)}else console.error("getGameInfo error:",t.msg)})},t.url=Util.isDev()?"https://test-bptp.eosget.io":"//baccarat.eosget.io",t.getNewGameParam=null,t}();__reflect(Api.prototype,"Api");var Cookie=function(){function t(){}return t.setCookie=function(t,e){var n=7,i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),i.setTime(i.getTime()+6e4),"8080"==location.port?document.cookie=t+"="+decodeURI(e)+";expires="+i.toUTCString():document.cookie=t+"="+decodeURI(e)+";domain=.eosget.io;path=/;expires="+i.toUTCString()},t.getCookie=function(t){var e,n=new RegExp("(^| )"+t+"=([^;]*)(;|$)");return(e=document.cookie.match(n))?encodeURI(e[2]):null},t.delCookie=function(t){var e=t+"=;domain=.eosget.io;path=/",n=new Date(0).toUTCString();e+=";expires="+n,document.cookie=e;var e=t+"=;path=/",n=new Date(0).toUTCString();e+=";expires="+n,document.cookie=e},t}();__reflect(Cookie.prototype,"Cookie");var CricleProgress=function(){function t(t,e,n){void 0===n&&(n=!1),this._w=0,this._target=t,this._mask=new egret.Shape,this._mask.x=t.x,this._mask.y=t.y,t.parent.addChildAt(this._mask,t.parent.getChildIndex(this._target)+1),this._target.mask=this._mask,this._w=e,this.anticlockwise=n}return t.prototype.setProgress=function(t,e){if(this._mask){if(this._mask.graphics.clear(),t>=e)return this._mask.graphics.beginFill(0),this._mask.graphics.drawRect(0,0,this._w,this._w),void this._mask.graphics.endFill();var n=this._w/2,i=360*t/e;this._mask.x=this._target.x,this._mask.y=this._target.y,this._mask.graphics.beginFill(16711680),this._mask.graphics.moveTo(n,n),this._mask.graphics.lineTo(n,0),this.anticlockwise?this._mask.graphics.drawArc(n,n,n,-90*Math.PI/180,(-90+i)*Math.PI/180,!1):this._mask.graphics.drawArc(n,n,n,-90*Math.PI/180,(-90-i)*Math.PI/180,!0),this._mask.graphics.lineTo(n,n),this._mask.graphics.endFill()}},t}();__reflect(CricleProgress.prototype,"CricleProgress");var NP=function(){function t(){}return t.strip=function(t,e){return void 0===e&&(e=12),+parseFloat(t.toPrecision(e))},t.digitLength=function(t){var e=t.toString().split(/[eE]/),n=(e[0].split(".")[1]||"").length-+(e[1]||0);return n>0?n:0},t.float2Fixed=function(t){if(-1===t.toString().indexOf("e"))return Number(t.toString().replace(".",""));var e=this.digitLength(t);return e>0?this.strip(t*Math.pow(10,e)):t},t.checkBoundary=function(t){(t>Number.POSITIVE_INFINITY||t<Number.NEGATIVE_INFINITY)&&console.warn(t+" is beyond boundary when transfer to integer, the results may not be accurate")},t.times=function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(n.length>0)return this.times.apply(this,[this.times(t,e),n[0]].concat(n.slice(1)));var o=this.float2Fixed(t),r=this.float2Fixed(e),s=this.digitLength(t)+this.digitLength(e),a=o*r;return this.checkBoundary(a),a/Math.pow(10,s)},t.plus=function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(n.length>0)return this.plus.apply(this,[this.plus(t,e),n[0]].concat(n.slice(1)));var o=Math.pow(10,Math.max(this.digitLength(t),this.digitLength(e)));return(this.times(t,o)+this.times(e,o))/o},t.minus=function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(n.length>0)return this.minus.apply(this,[this.minus(t,e),n[0]].concat(n.slice(1)));var o=Math.pow(10,Math.max(this.digitLength(t),this.digitLength(e)));return(this.times(t,o)-this.times(e,o))/o},t.divide=function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(n.length>0)return this.divide.apply(this,[this.divide(t,e),n[0]].concat(n.slice(1)));var o=this.float2Fixed(t),r=this.float2Fixed(e);return this.checkBoundary(o),this.checkBoundary(r),this.times(o/r,Math.pow(10,this.digitLength(e)-this.digitLength(t)))},t.round=function(t,e){var n=Math.pow(10,e);return this.divide(Math.round(this.times(t,n)),n)},t}();__reflect(NP.prototype,"NP");var LANG_CN={Index:{online:"當前人數",beting:"下注",rewarding:"開獎中",playerWin:"閒贏",bankerWin:"莊贏",rateBtnText:"開獎歷史",tradeBtnText:"投注記錄"},Bet:{banker:"莊",player:"閒",tie:"和",bankerPair:"莊对",playerPair:"閒对",clear:"清除",confirmBet:"確認\n下注",autoBet:"自動\n下注",thisTime:"本次下注:",thisPhase:"本期下注:",getBetGtLangText:"获得:",gtTips1:"下注得GT幣",gtTips2:"1EOS 得 ?GT",moreBet:"最多可下注100",noBet:"你还没有进行下注",betSucc:"下注成功,请等候开奖"},Userinfo:{eosSurplus:"余额:",withdraw:"提现",fair:"公平"},Rate:{pcTitle:"近60期",h5Title:"近50期",banker:"莊",player:"閒",tie:"和",bankerPair:"莊对",playerPair:"閒对"},RateDetail:{di:"第",phase:"期",resultTitle:"開獎結果",bankerWin:"莊贏",playerWin:"閒贏",tie:"和",bankerPair:"莊對",playerPair:"閒對",fairTitle:"公平驗證",tabTypeTitle:"派牌",tabBlockNumTitle:"區塊號碼",tabBlockIdTitle:"區塊id"},Trade:{title:"投注記錄"},Auto:{title:"自動下注設置",titleDetail:"自動下注明細",detail:"明細",autoTips:"自動下注不消耗cpu資源,每天可退回3次,12小時內沒有下注行爲,自動退回EOS。",autoDetailTips:"顯示最近3個月交易記錄",add:"追加",back:"退回",backTipL:"(剩餘退回",backTipR:"次)",planEos:"計劃投入EOS",planRest:"餘額",planCount:"下注期數",planCont:"下注內容",betEos:"下注籌碼",period:"(1小时≈120期)",stopEos:"止損线",stopTipL:"(錢包",stopTipR:"低于止損線時,將停止下注及時止損)",winInTotal:"盈虧:",gained:"獲得:",reset:"剩餘",startBetting:"開始下注",atLeast:"起",oneBet:"每注",periodTxt:"期",multiChoice:"(可多選)"},Alert:{openText:"開獎區塊"}},LANG_EN={Index:{online:"online",beting:"bet",rewarding:"lotterying",playerWin:"player",bankerWin:"banker",rateBtnText:"history",tradeBtnText:"bet record"},Bet:{banker:"B",player:"P",tie:"tie",bankerPair:"banker pair",playerPair:"player pair",clear:"delete",confirmBet:"confirm\nbet",autoBet:"auto\nbet",thisTime:"Unconfirmed:",thisPhase:"This note:",getBetGtLangText:"get:",gtTips1:"Bet can get GT",gtTips2:"1EOS get ?GT",moreBet:"You can bet up to 100",noBet:"You haven't bet yet",betSucc:"Please wait for the prize draw"},Userinfo:{eosSurplus:"BALANCE:",withdraw:"Withdraw",fair:"fair"},Rate:{pcTitle:"Recent 60",h5Title:"Recent 50",banker:"B",player:"P",tie:"T",bankerPair:"BP",playerPair:"PP"},RateDetail:{di:"",phase:"phase",resultTitle:"result",bankerWin:"B WIN",playerWin:"P WIN",tie:"T",bankerPair:"BP",playerPair:"PP",fairTitle:"fair",tabTypeTitle:"type",tabBlockNumTitle:"block number",tabBlockIdTitle:"block id"},Trade:{title:"bet record"},Auto:{title:"Automatic Bet",titleDetail:"Details",detail:"View details",autoTips:"Automatic bet does not consume cpu resources, can be returned 3 times a day, no betting behavior within 12 hours, automatically returned to EOS.",autoDetailTips:"Transactions of Latest 3 months",add:"add",back:"back",backTipL:"(Left back",backTipR:")",planEos:"EOS plans to invest",planRest:"BALANCE",planCount:"Bet Period",planCont:"Content",betEos:"Chips",period:"(1 hour ≈ 120 bet periods)",stopEos:"Stop Loss Line ",stopTipL:"",stopTipR:"Below the stop loss line will automatically stop",winInTotal:"Win in total:",gained:"Gained:",reset:"Left:",startBetting:"Start Betting",atLeast:"at least",oneBet:"",periodTxt:"period",multiChoice:"(Multi-choice)"},Alert:{openText:"Blocked"}},Lang=function(){function t(){this.langTypes={zh:LANG_CN,en:LANG_EN},this.langEnum="zh",console.log(Cookie.getCookie("eosget_lang")),this.langEnum=Cookie.getCookie("eosget_lang")||Util.getLanguage(),this.eventDispatcher=new egret.EventDispatcher}return t.prototype.lang=function(){return this.langTypes[this.langEnum]},Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),t.prototype.register=function(){window.addEventListener("message",this.langChange.bind(this),!1)},t.prototype.langChange=function(t){t.data.lang&&(this.langEnum=t.data.lang,this.dispatchEvent(new egret.Event(SocketEvent.LANG_CHANGE,!1,!1)))},t.prototype.dispatchEvent=function(t){this.eventDispatcher.dispatchEvent(t)},t.prototype.addEventListener=function(t,e,n,i,o){this.eventDispatcher.addEventListener(t,e,n,i,o)},t.prototype.removeEventListener=function(t,e,n,i){this.eventDispatcher.removeEventListener(t,e,n,i)},t}();__reflect(Lang.prototype,"Lang");var Auto=function(){function t(){}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),t.prototype.openAutoView=function(){this.uiAuto?this.uiAuto.visible=!0:this.uiAuto=UIController.instance.popupView(UI_Auto)},t.prototype.closeAutoView=function(){this.uiAuto&&(this.uiAuto.visible=!1)},t.prototype.openAutoDetailView=function(){this.uiAutoDetail?this.uiAutoDetail.visible=!0:(this.uiAutoDetail=UIController.instance.createView(UI_AutoDetail),this.uiAuto.addChild(this.uiAutoDetail))},t.prototype.closeAutoDetailView=function(){this.uiAutoDetail&&(this.uiAutoDetail.visible=!1)},t}();__reflect(Auto.prototype,"Auto");var Bet=function(){function t(){this.gaming=!1,this.betHistory={},this.isBetSucc=!1,this._chipValue=0,this.chipPoolNodes={},this.rate=0}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"chipValue",{get:function(){return this._chipValue},set:function(t){this._chipValue=t},enumerable:!0,configurable:!0}),t.prototype.setRate=function(t){t&&(this.rate=NP.divide(parseInt(t),1e4),this.uiBet&&this.uiBet.updateRate())},t.prototype.addBetHistory=function(t,e){this.betHistory[t]=e},t.prototype.popBetHistory=function(t){var e=this.betHistory[t];return this.betHistory[t]=null,e},t.prototype.getBetView=function(){return this.uiBet=UIController.instance.createView(UI_Bet)},t.prototype.setChipNodes=function(t){var e=this;t.forEach(function(t){var n=""+t.chipValue+t.size;e.chipPoolNodes[n]||(e.chipPoolNodes[n]=[]),e.chipPoolNodes[n].push(t),void 0!==t.type&&Index.instance.removeChip(t.type,t.chipValue)})},t.prototype.getChipNodes=function(t,e){var n=""+t+e;return this.chipPoolNodes[n]||(this.chipPoolNodes[n]=[]),this.chipPoolNodes[n].length?this.chipPoolNodes[n].pop():new UI_ChipItem(t,e)},t.prototype.largeChipIn=function(t,e,n,i){var o=this.getChipNodes(this.chipValue,CHIPSIZE.LARGE);o.type=t,this.uiBet.largeChipIn(e,n,i,o)},t.prototype.largeChipIn2=function(t,e,n,i,o){var r=this.getChipNodes(e,CHIPSIZE.LARGE);r.type=t,Index.instance.addChip(t,e),this.uiBet.largeChipIn2(n,i,o,r)},t.prototype.smallChipIn=function(t,e,n,i){var o=this.getChipNodes(t,CHIPSIZE.SMALL);this.uiBet.smallChipIn(e,n,i,o)},t.prototype.renderGameStart=function(){this.gaming=!0,this.uiBet.renderGameStart()},t.prototype.renderLotteryInfo=function(){this.gaming=!1,this.uiBet.renderLotteryInfo()},t.prototype.betSucc=function(t){var e=Lang.instance.lang().Bet;AlertMgr.instance.showAlert(e.betSucc),Userinfo.instance.updateBalance(-t.amount),Userinfo.instance.updateGt(t.amount*this.rate),this.uiBet.transBetEosToPhase(),this.isBetSucc=!0,this.gaming&&(this.uiBet.allowBet(!0),Index.instance.allowBet(!0))},t.prototype.betFail=function(){this.gaming&&(this.uiBet.allowBet(!0),Index.instance.allowBet(!0))},t}();__reflect(Bet.prototype,"Bet");var BETAREA={PLAYER:0,BANKER:1,TIE:2,PLAYERPAIR:3,BANKERPAIR:4},Index=function(){function t(){this.betMountTotal=[0,0,0,0,0],this.openIndexView(),GameMgr.instance.addEventListener(SocketEvent.PROTO_MSG,this.onRecieved,this)}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),t.prototype.onRecieved=function(t){var e=t.protoId,n=t.data;if(e===Protocol.channelNewGame)Api.getNewGame(n.old,n["new"],UserMgr.instance.getPlayer()),EOS_VUE.$getNewGame();else if(e===Protocol.channelNewPoker)this.uiIndex.showChannelPoker(n);else if(e===Protocol.channelNewOffer)this.renderOfferItem(n);else if(e===Protocol.channelNewPlayer){var i=n.total;this.renderOnlineNumber(i)}},t.prototype.openIndexView=function(){this.uiIndex=UIController.instance.createView(UI_Index)},t.prototype.renderGameInfo=function(t){this.uiIndex.renderGameInfo(t)},t.prototype.renderOnlineNumber=function(t){this.uiIndex.setOnlineNumber(t)},t.prototype.renderLotteryInfo=function(t,e){this.uiIndex.renderLotteryInfo(t,e)},t.prototype.renderOfferItem=function(t){if(!Bet.instance.isBetSucc||t.player!==(UserMgr.instance.account&&UserMgr.instance.account.name)){var e=null,n=t.offertype.split("|"),i=t.offeramount.split("|");e=n.map(function(t,e){var n=[20,10,5,1,.5,.1],o=NP.divide(1*i[e],1e4),r=[],s=n.map(function(t){var e=Math.floor(o/t);return o>=t&&(o%=t),e});return s.forEach(function(t,e){t>0&&r.push({key:n[e],val:t})}),{type:1*t,counter:r}}),this.uiIndex.showOtherBet(e,t.player===(UserMgr.instance.account&&UserMgr.instance.account.name))}},t.prototype.refreshLotteryResult=function(){this.uiIndex.renderLotteryResult(this.betMountTotal)},t.prototype.addChip=function(t,e){this.betMountTotal[t]=NP.plus(this.betMountTotal[t],e),this.uiIndex.renderLotteryResult(this.betMountTotal)},t.prototype.removeChip=function(t,e){this.betMountTotal[t]=NP.minus(this.betMountTotal[t],e),this.uiIndex.renderLotteryResult(this.betMountTotal)},t.prototype.clearChip=function(){this.betMountTotal=[0,0,0,0,0],this.uiIndex.renderLotteryResult(this.betMountTotal)},t.prototype.allowBet=function(t){this.uiIndex.setBetGroupEnable(t)},t.prototype.setMusicToggle=function(t){this.uiIndex&&this.uiIndex.setMusicToggle(t)},t.prototype.release=function(){},t}();__reflect(Index.prototype,"Index");var Notice=function(){function t(){}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),t.prototype.getNoticeView=function(){return this.uiNotice=UIController.instance.createView(UI_Notification)},t}();__reflect(Notice.prototype,"Notice");var Rate=function(){function t(){this.type=[0,0,0,0,0]}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),t.prototype.openRateView=function(){this.uiRate?(this.uiRate.visible=!0,this.uiRate.renderHistory()):this.uiRate=UIController.instance.popupView(UI_Rate)},t.prototype.openRateDetailView=function(t){this.uiRateDetail?this.uiRateDetail.visible=!0:(this.uiRateDetail=UIController.instance.popupView(UI_RateDetail),this.uiRateDetail.x=(GameMgr.instance.main.stage.stageWidth-this.uiRateDetail.width)/2,this.uiRateDetail.y=GAME_ISMOBILE?160:26),this.uiRateDetail.renderDetail(t)},t.prototype.renderRateHistory=function(t){t.sort(function(t,e){return t.reveal_block_num-e.reveal_block_num}),GAME_ISMOBILE&&t.splice(0,t.length-50);var e=this.type;this.rateHistory={type:e,result:t},t.forEach(function(t){0===t.winner&&(e[1]+=1),1===t.winner&&(e[0]+=1),2===t.winner&&(e[2]+=1),t.banker_pair&&(e[3]+=1),t.player_pair&&(e[4]+=1)}),this.uiRate&&this.uiRate.renderHistory()},t.prototype.shiftRateHistory=function(t){var e=this.rateHistory.type;0===t.winner&&(e[1]-=1),1===t.winner&&(e[0]-=1),2===t.winner&&(e[2]-=1),t.banker_pair&&(e[3]-=1),t.player_pair&&(e[4]-=1)},t.prototype.pushRateHistory=function(t){var e=this,n=t.id,i=t.reveal_info,o={id:n,block_info:i.blockInfo,winner:i.win,banker_pair:i.bankerPair?1:0,player_pair:i.playerPair?1:0,reveal_block_num:i.revealBlockNum},r=this.rateHistory,s=r.type,a=r.result;0===o.winner&&(s[1]+=1),1===o.winner&&(s[0]+=1),2===o.winner&&(s[2]+=1),o.banker_pair&&(s[3]+=1),o.player_pair&&(s[4]+=1);var c=GAME_ISMOBILE?50:60;a.length>=c&&(GAME_ISMOBILE?this.shiftRateHistory(a.shift()):a.splice(0,6).forEach(function(t){return e.shiftRateHistory(t)})),a.push(o),this.uiRate&&this.uiRate.renderHistory()},t.prototype.closeRateView=function(){this.uiRate&&(this.uiRate.visible=!1)},t.prototype.getRateView=function(){return this.uiRate=UIController.instance.createView(UI_Rate)},t}();__reflect(Rate.prototype,"Rate");var Rule=function(){function t(){}return t}();__reflect(Rule.prototype,"Rule");var Trade=function(){function t(){this.tradeList=[],GameMgr.instance.addEventListener(SocketEvent.PROTO_MSG,this.onRecieved,this)}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),t.prototype.onRecieved=function(t){var e=t.protoId,n=t.data;e==Protocol.channelNewOffer&&this.renderTradeList([n])},t.prototype.renderTradeList=function(t){var e=this;t.forEach(function(t){var n=null,i=t.offertype.split("|"),o=t.offeramount.split("|");n=i.map(function(e,n){return{account:t.player,type:1*e,total:NP.divide(1*o[n],1e4)+" EOS"}}),(r=e.tradeList).push.apply(r,n);var r}),this.uiTrade&&this.uiTrade.renderTradeList()},t.prototype.renderGameId=function(t){this.uiTrade&&this.uiTrade.renderGameId(t)},t.prototype.emptyTradeList=function(){t.instance.tradeList=[],this.uiTrade&&this.uiTrade.emptyTradeView()},t.prototype.openTradeView=function(){this.uiTrade?(this.uiTrade.visible=!0,this.uiTrade.renderTradeList()):this.uiTrade=UIController.instance.popupView(UI_Trade)},t.prototype.closeTradeView=function(){this.uiTrade&&(this.uiTrade.visible=!1)},t.prototype.getTradeView=function(){return this.uiTrade=UIController.instance.createView(UI_Trade)},t}();__reflect(Trade.prototype,"Trade");var Userinfo=function(){function t(){this.balance=0,this.gt=0}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),t.prototype.getUserHeaderView=function(){return this.uiUserHeader=UIController.instance.createView(UI_UserHeader)},t.prototype.renderUserData=function(t){t.balance&&(this.balance=t.balance),t.gt&&(this.gt=t.gt),this.uiUserHeader&&(this.uiUserHeader.renderBalance(t.balance),this.uiUserHeader.renderMoney(t.money),this.uiUserHeader.renderGt(t.gt))},t.prototype.updateBalance=function(t){t=NP.times(t,1e4),this.balance=NP.plus(this.balance,t),this.uiUserHeader&&this.uiUserHeader.renderBalance(this.balance)},t.prototype.updateGt=function(t){this.gt=NP.plus(this.gt,t),this.uiUserHeader&&this.uiUserHeader.renderGt(this.gt)},t.prototype.addOffer=function(t){parseInt(t.win)&&(this.balance=NP.plus(this.balance,parseInt(t.win)),this.uiUserHeader&&this.uiUserHeader.renderBalance(this.balance))},t}();__reflect(Userinfo.prototype,"Userinfo");var AlertMgr=function(){function t(){this.alertMsg=[]}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),t.prototype.register=function(){},t.prototype.onReceived=function(t){},t.prototype.showAlert=function(t,e){var n=this;if(void 0===e&&(e=!1),this.uiAlert){if(this.uiAlert.visible)return}else this.uiAlert=UIController.instance.alertView(UI_Alert);this.uiAlert.visible=!0,this.uiAlert.showAlert(t),!e&&setTimeout(function(){n.hideAlert()},2e3)},t.prototype.hideAlert=function(){this.uiAlert&&(this.uiAlert.visible=!1)},t.prototype.showFairAlert=function(t,e){this.uiFairAlert||(this.uiFairAlert=UIController.instance.alertView(UI_FairAlert)),this.uiFairAlert.visible=!0,this.uiFairAlert.showAlert(t,e)},t.prototype.hideFairAlert=function(){this.uiFairAlert&&this.uiFairAlert.hideAlert()},t.prototype.release=function(){},t}();__reflect(AlertMgr.prototype,"AlertMgr");var AudiosMgr=function(){function t(){this.audiosRes={},this.firstBgm=!0,this.bgmAllow="false"!==localStorage.getItem("bgmAllow"),this.bgmPosition=0}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),t.prototype.getAudioSource=function(t){return this.audiosRes[t]=this.audiosRes[t]||RES.getRes(t),this.audiosRes[t]},t.prototype.playSound=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=1),this.getAudioSource(t).play(e,n)},t.prototype.setBgmAllow=function(t){this.bgmAllow=t,localStorage.setItem("bgmAllow",t.toString())},t.prototype.playBgm=function(){var t=this;this.bgmAllow&&(this.bgm||(this.bgm=this.playSound("bgm_mp3",this.bgmPosition,0),this.firstBgm&&setTimeout(function(){0==t.bgm.position&&t.stopBgm()},100),Index.instance.setMusicToggle(!0),this.firstBgm=!1))},t.prototype.stopBgm=function(){this.bgm&&(this.bgmPosition=this.bgm.position,this.bgm.stop(),this.bgm=null,Index.instance.setMusicToggle(!1),this.setBgmAllow(!1))},t.prototype.playButtonClick=function(){return t.instance.bgmAllow?this.playSound("button-click_mp3"):null},t.prototype.playNewRound=function(){return t.instance.bgmAllow?this.playSound("xindeyilun_mp3"):null},t.prototype.playWin=function(){return t.instance.bgmAllow?this.playSound("wintexiao_mp3"):null},t}();__reflect(AudiosMgr.prototype,"AudiosMgr");var EosMgr=function(){function t(){this.isTop=window==top,this.scatter=null,this.identity=null,this.eos=null}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),t.prototype.register=function(){this.isTop?(this.scatterLoad(),top.addEventListener("scatterLoaded",this.scatterLoad)):(EOS_VUE.$getEosInfo(),window.addEventListener("message",this.onMessage.bind(this),!1))},t.prototype.onMessage=function(t){if(t.data.login){var e=t.data.login;UserMgr.instance.setAccount(e),GameMgr.instance.createdGame&&SocketMgr.instance.closeSocket()}else t.data.logout?(UserMgr.instance.setAccount(null),UserMgr.instance.setCoin({balance:0,gt:0}),SocketMgr.instance.closeSocket()):t.data.coin?UserMgr.instance.setCoin(t.data.coin):t.data.doDeposit?Bet.instance.betSucc(t.data):t.data.doDepositFail&&Bet.instance.betFail()},t.prototype.login=function(){return __awaiter(this,void 0,void 0,function(){var t,e;
- return __generator(this,function(n){switch(n.label){case 0:return this.isTop?this.scatter?[4,this.scatter.getIdentity({accounts:[this.getNetwork()]})]:[2]:[3,2];case 1:return t=n.sent(),t&&(e=t.accounts.find(function(t){return"eos"===t.blockchain}),UserMgr.instance.setAccount(e),this.getEos(this.scatter)),[3,3];case 2:EOS_VUE.$scatterLogin(),n.label=3;case 3:return[2]}})})},t.prototype.scatterLoad=function(){return __awaiter(this,void 0,void 0,function(){var t,e;return __generator(this,function(n){switch(n.label){case 0:return top.scatter?(t=top.scatter,[4,this.getIdentity(t)]):[2];case 1:return n.sent(),this.identity&&(e=this.identity.accounts.find(function(t){return"eos"===t.blockchain}),UserMgr.instance.setAccount(e),this.getEos(t)),this.scatter=t,top.scatter=null,top.removeEventListener("scatterLoaded",this.scatterLoad),[2]}})})},t.prototype.getIdentity=function(t){return __awaiter(this,void 0,void 0,function(){var e,n;return __generator(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),e=this,[4,t.getIdentity({accounts:[this.getNetwork()]})];case 1:return e.identity=i.sent(),[3,3];case 2:return n=i.sent(),n.isError?[2]:[3,3];case 3:return[2]}})})},t.prototype.getEos=function(t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return this.eos=t.eos(this.getNetwork(),Eos,{}),[2]})})},t.prototype.getBalance=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return this.identity?[4,this.eos.getCurrencyBalance("eosio.token",this.identity.account.name,"EOS")]:[3,2];case 1:return[2,t.sent()];case 2:return[2,0]}})})},t.prototype.getNewPermissions=function(t){return __awaiter(this,void 0,void 0,function(){var e,n;return __generator(this,function(i){switch(i.label){case 0:return this.eos?[4,this.eos.getAccount(t)]:[2];case 1:return e=i.sent(),n=JSON.parse(JSON.stringify(e.permissions)),[2,n]}})})},t.prototype.getNetwork=function(){return/^test-|\.webdev2\./.test(location.host)||"0.0.0.0:8080"==location.host||location.host.indexOf("172.16.14")>=0?{protocol:"http",blockchain:"eos",port:"7777",host:"61.160.36.19",chainId:"cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f"}:{protocol:"https",blockchain:"eos",port:"443",host:"nodes.get-scatter.com",chainId:"aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906"}},t.prototype.transfer=function(t,e,n,i,o){var r=this;return new Promise(function(s,a){r.eos.transfer(t,e,n+" EOS",i,o).then(function(t){s(t)})["catch"](function(t){console.error("confirmBet error:",t),a(t)})})},t}();__reflect(EosMgr.prototype,"EosMgr");var SocketMgr=function(){function t(){this.debugUrl="test-ws-baccarat.eosget.io",this.releaseUrl="ws-baccarat.eosget.io",this.heartBeatTimes=0,this.connected=!1,this.reconnecting=!1,this.reconnectTimes=0,this.connectedCBs=[],this.reconnectCBs=[],this.errorCBs=[],this.needReconnect=!1,this.hideLoading=!0}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){var t=Util.isDev()?this.debugUrl:this.releaseUrl,e=UserMgr.instance.account;return""+t+(e?"?player="+e.name:"")},enumerable:!0,configurable:!0}),t.prototype.sendNoProtobufMsg=function(t){if(null!=this.socketClient){var e=null;t.constructor===Object&&(e=JSON.stringify(t)),this.socketClient.writeUTF(e)}},t.prototype.openSocket=function(){this.socketClient||(this.socketClient=new egret.WebSocket,this.socketClient.addEventListener(egret.ProgressEvent.SOCKET_DATA,this.onReceive,this),this.socketClient.addEventListener(egret.Event.CONNECT,this.onConnect,this),this.socketClient.addEventListener(egret.Event.CLOSE,this.onClose,this),this.socketClient.addEventListener(egret.IOErrorEvent.IO_ERROR,this.onError,this),this.socketClient.type=egret.WebSocket.TYPE_STRING,this.socketClient.connectByUrl("wss://"+this.url))},t.prototype.onConnect=function(){this.connected=!0,this.reconnectTimes=0,this.heartBeatTimer&&this.heartBeatTimer.stop(),this.heartBeatTimer=new egret.Timer(5e3,0),this.heartBeatTimer.addEventListener(egret.TimerEvent.TIMER,this.onHeartBeat,this),this.heartBeatTimer.start(),this.connectedCBs.forEach(function(t){t.callback.call(t.thisObj)}),GameMgr.instance.dispatchEvent(new SocketEvent(SocketEvent.RECONNECT_MSG)),this.reconnecting&&(this.reconnecting=!1)},t.prototype.onReceive=function(t){var e=this.socketClient.readUTF();if(e){var n=JSON.parse(e),i=new SocketEvent(SocketEvent.PROTO_MSG);i.protoId=n.channel,i.data=n.data,GameMgr.instance.dispatchEvent(i)}},t.prototype.closeSocket=function(){this.socketClient&&this.socketClient.close()},t.prototype.onClose=function(){this.connected&&(this.connected=!1,this.heartBeatTimer.stop(),this.heartBeatTimer=null),this.reconnect()},t.prototype.reconnect=function(){this.reconnectTimes++,this.reconnectTimes>=3||(this.connectedCBs=[],this.errorCBs=[],this.reconnecting=!0,this.socketClient&&(this.socketClient.removeEventListener(egret.ProgressEvent.SOCKET_DATA,this.onReceive,this),this.socketClient.removeEventListener(egret.Event.CONNECT,this.onConnect,this),this.socketClient.removeEventListener(egret.Event.CLOSE,this.onClose,this),this.socketClient.removeEventListener(egret.IOErrorEvent.IO_ERROR,this.onError,this),this.socketClient=null),this.openSocket())},t.prototype.onError=function(t){console.error("网络连接异常中断"),this.errorCBs.forEach(function(e){e.callback.call(e.thisObj,t.errMsg)}),this.onClose()},t.prototype.onHeartBeat=function(){var t={act:"alive"},e=UserMgr.instance.account;e&&(t.player=e.name),this.sendNoProtobufMsg(t)},t.prototype.addConnectListener=function(t,e){this.connectedCBs.push({callback:t,thisObj:e})},t.prototype.addErrorListener=function(t,e){this.errorCBs.push({callback:t,thisObj:e})},t}();__reflect(SocketMgr.prototype,"SocketMgr");var UIController=function(t){function e(){var e=t.call(this)||this;return egret.registerImplementation("eui.IAssetAdapter",new AssetAdapter),egret.registerImplementation("eui.IThemeAdapter",new ThemeAdapter),e._innerLayer=new eui.UILayer,e._innerLayer.touchChildren=!0,e._alertLayer=new eui.UILayer,e._alertLayer.touchThrough=!0,e._popupLayer=new eui.UILayer,e._popupLayer.touchThrough=!0,e._barLayer=new eui.UILayer,e._barLayer.touchThrough=!0,e._mainLayer=new eui.UILayer,e.addChild(e._innerLayer),e.addChild(e._mainLayer),e.addChild(e._barLayer),e.addChild(e._alertLayer),e.addChild(e._popupLayer),e}return __extends(e,t),Object.defineProperty(e,"instance",{get:function(){return this._instance||(this._instance=new e),this._instance},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"innerLayer",{get:function(){return this._innerLayer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alertLayer",{get:function(){return this._alertLayer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"popupLayer",{get:function(){return this._popupLayer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mainLayer",{get:function(){return this._mainLayer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"barLayer",{get:function(){return this._barLayer},enumerable:!0,configurable:!0}),e.prototype.createChildren=function(){t.prototype.createChildren.call(this)},e.prototype.createInnerView=function(t,e){var n=new t;return this._innerLayer.addChild(n),e&&e(n,this._innerLayer),n},e.prototype.createView=function(t,e){var n=new t;return this._mainLayer.addChild(n),e&&e(n,this._mainLayer),n},e.prototype.createBarView=function(t,e){var n=new t;return this._barLayer.addChild(n),e&&e(n,this._barLayer),n},e.prototype.alertView=function(t,e){var n=new t;return this.alertLayer.addChild(n),e&&e(n,this.alertLayer),n},e.prototype.popupView=function(t,e){var n=new t;return this.popupLayer.addChild(n),e&&e(n,this.popupLayer),n},e.prototype.closeView=function(t){t.onClose(),t.parent&&t.parent.removeChild(t)},e}(eui.UILayer);__reflect(UIController.prototype,"UIController");var EOS_VUE={postMessage:function(t,e){if(Util.isDev())top.postMessage({func:t,options:e},"*");else{var n=top.EOS_VUE[t];n&&n.apply(top.EOS_VUE,e)}},$showWallet:function(){EOS_VUE.postMessage("$showWallet")},$showRule:function(){EOS_VUE.postMessage("$showRule")},$showFair:function(){EOS_VUE.postMessage("$showFair")},$showValidate:function(t){EOS_VUE.postMessage("$showValidate",[t])},$showGt:function(){EOS_VUE.postMessage("$showGt")},$showCount:function(){EOS_VUE.postMessage("$showCount")},$getEosInfo:function(){EOS_VUE.postMessage("$getEosInfo")},$scatterLogin:function(){EOS_VUE.postMessage("$scatterLogin")},$getCoinData:function(){EOS_VUE.postMessage("$getCoinData")},$doDeposit:function(t,e,n){EOS_VUE.postMessage("$doDeposit",[t,e,n])},$getNewGame:function(){EOS_VUE.postMessage("$getNewGame")}},Main=function(t){function e(){var e=t.call(this)||this;return GameMgr.instance.setMain(e),e.addEventListener(egret.Event.ADDED_TO_STAGE,e.onAddToStage,e),e}return __extends(e,t),e.prototype.onAddToStage=function(t){mouse.enable(this.stage),mouse.setMouseMoveEnabled(!0),egret.lifecycle.addLifecycleListener(function(t){}),egret.lifecycle.onPause=function(){},egret.lifecycle.onResume=function(){},GameMgr.instance.runGame()["catch"](function(t){console.log(t)})},e.prototype.runGame=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){return[2]})})},e}(egret.DisplayObjectContainer);__reflect(Main.prototype,"Main");var AssetAdapter=function(){function t(){}return t.prototype.getAsset=function(t,e,n){function i(i){e.call(n,i,t)}if(RES.hasRes(t)){var o=RES.getRes(t);o?i(o):RES.getResAsync(t,i,this)}else RES.getResByUrl(t,i,this,RES.ResourceItem.TYPE_IMAGE)},t}();__reflect(AssetAdapter.prototype,"AssetAdapter",["eui.IAssetAdapter"]);var LoadingUI=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.total=this.progressTotal.width},e.prototype.onProgress=function(t,e){var n=Math.floor(t/e*100);this.progressText.text=n+"%",this.progressBar.width=Math.floor(t/e*this.total)},e.prototype.onClose=function(){t.prototype.onClose.call(this)},e}(UIBaseView);__reflect(LoadingUI.prototype,"LoadingUI",["RES.PromiseTaskReporter"]);var ThemeAdapter=function(){function t(){}return t.prototype.getTheme=function(t,e,n,i){function o(t){e.call(i,t)}function r(e){e.resItem.url==t&&(RES.removeEventListener(RES.ResourceEvent.ITEM_LOAD_ERROR,r,null),n.call(i))}var s=this;if("undefined"!=typeof generateEUI)egret.callLater(function(){e.call(i,generateEUI)},this);else if("undefined"!=typeof generateEUI2)RES.getResByUrl("resource/gameEui.json",function(t,n){window.JSONParseClass.setData(t),egret.callLater(function(){e.call(i,generateEUI2)},s)},this,RES.ResourceItem.TYPE_JSON);else if("undefined"!=typeof generateJSON)if(t.indexOf(".exml")>-1){var a=t.split("/");a.pop();var c=a.join("/")+"_EUI.json";generateJSON.paths[t]?egret.callLater(function(){e.call(i,generateJSON.paths[t])},this):RES.getResByUrl(c,function(n){window.JSONParseClass.setData(n),egret.callLater(function(){e.call(i,generateJSON.paths[t])},s)},this,RES.ResourceItem.TYPE_JSON)}else egret.callLater(function(){e.call(i,generateJSON)},this);else RES.addEventListener(RES.ResourceEvent.ITEM_LOAD_ERROR,r,null),RES.getResByUrl(t,o,this,RES.ResourceItem.TYPE_TEXT)},t}();__reflect(ThemeAdapter.prototype,"ThemeAdapter",["eui.IThemeAdapter"]);var GameMgr=function(){function t(){this.createdGame=!1,Lang.instance.register(),EosMgr.instance.register()}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"main",{get:function(){return this._main},enumerable:!0,configurable:!0}),t.prototype.setMain=function(t){this._main=t},Object.defineProperty(t.prototype,"uiController",{get:function(){return this._uiCtrl},enumerable:!0,configurable:!0}),t.prototype.runGame=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return this._uiCtrl=UIController.instance,this._main.stage.addChild(this._uiCtrl),[4,this.preload()];case 1:return t.sent(),[4,this.loadResource()];case 2:return t.sent(),[2]}})})},t.prototype.preload=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,RES.loadConfig("default.res.json?"+VersionController.currentVersion,"resource/")];case 1:return t.sent(),[4,RES.loadGroup("load")];case 2:return t.sent(),[4,this.loadTheme()];case 3:return t.sent(),this.loadingView=UIController.instance.createView(LoadingUI),this._main.stage.addChild(this.loadingView),[4,RES.loadGroup("preload",1,this.loadingView)];case 4:return t.sent(),[2]}})})},t.prototype.loadResource=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return RES.addEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR,this.onResourceLoadError,this),RES.addEventListener(RES.ResourceEvent.ITEM_LOAD_ERROR,this.onItemLoadError,this),[4,RES.setMaxLoadingThread(1)];case 1:return t.sent(),[4,RES.loadGroup("audio")];case 2:return t.sent(),[4,RES.setMaxLoadingThread(3)];case 3:return t.sent(),GAME_ISMOBILE?[4,RES.loadGroup("skin_h5")]:[3,5];case 4:return t.sent(),[3,7];case 5:return[4,RES.loadGroup("skin_pc")];case 6:t.sent(),t.label=7;case 7:return this.createGameScene(),[2]}})})},t.prototype.loadTheme=function(){var t=this;return new Promise(function(e,n){var i=new eui.Theme("resource/default.thm.json?"+VersionController.currentVersion,t._main.stage);i.addEventListener(eui.UIEvent.COMPLETE,function(){e()},t)})},t.prototype.onItemLoadError=function(t){console.warn("Url:"+t.resItem.url+" has failed to load")},t.prototype.onResourceLoadError=function(t){console.warn("Group:"+t.groupName+" has failed to load"),this.loadResource(),RES.removeEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR,this.onResourceLoadError,this),RES.removeEventListener(RES.ResourceEvent.ITEM_LOAD_ERROR,this.onItemLoadError,this)},t.prototype.createGameScene=function(){RES.removeEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR,this.onResourceLoadError,this),RES.removeEventListener(RES.ResourceEvent.ITEM_LOAD_ERROR,this.onItemLoadError,this),this.createdGame=!0,console.log("进入游戏场景"),this.loadingView&&(UIController.instance.closeView(this.loadingView),this.loadingView=void 0),SocketMgr.instance.openSocket(),Api.getGameInfo(),this.index=Index.instance,setTimeout(function(){AudiosMgr.instance.playBgm()},300)},t.prototype.addEventListener=function(t,e,n,i,o){return this._main.addEventListener(t,e,n,i,o)},t.prototype.removeEventListener=function(t,e,n,i){this._main.removeEventListener(t,e,n,i)},t.prototype.dispatchEvent=function(t){return this._main.dispatchEvent(t)},t.prototype.dispatchEventWith=function(t,e,n,i){return this._main.dispatchEventWith(t,e,n,i)},t}();__reflect(GameMgr.prototype,"GameMgr");var DebugPlatform=function(){function t(){}return t.prototype.getUserInfo=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){return[2,{nickName:"username"}]})})},t.prototype.login=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){return[2]})})},t}();__reflect(DebugPlatform.prototype,"DebugPlatform",["Platform"]),window.platform||(window.platform=new DebugPlatform);var VersionController=function(){function t(){this.resourceRoot="resource/",this.versionPath="assets/",this.versionConfigPath="resource/version.json",this.versionCacheWeb=function(){var e=egret.localStorage.getItem("resVersion");e!=t.currentVersion&&egret.localStorage.setItem("resVersion",t.currentVersion)}}return t.prototype.init=function(){var e=this;return new Promise(function(n,i){var o=new egret.HttpRequest;o.responseType=egret.HttpResponseType.TEXT,o.open(e.versionConfigPath+"?"+t.currentVersion,egret.HttpMethod.GET),o.send(),o.addEventListener(egret.Event.COMPLETE,function(t){var i=t.currentTarget;e.versionConfig=JSON.parse(i.response),egret.Capabilities.runtimeType==egret.RuntimeType.WEB&&e.versionCacheWeb(),n()},e),o.addEventListener(egret.IOErrorEvent.IO_ERROR,function(){egret.log("post error : "+event),i()},e)})},t.prototype.getRemoveList=function(t){var e=[],n="";for(var i in this.versionConfig)n+=this.versionConfig[i]+",";for(var o=t.length,r=0;o>r;++r){var s=t[r],a=s.slice(0,s.indexOf("."));-1==n.indexOf(a)&&e.push(s)}return e},t.prototype.getVirtualUrl=function(t){return this.getResUrlByVersion(t)},t.prototype.getResUrlByVersion=function(t){if(-1==t.indexOf(this.resourceRoot))return t;if(t=t.replace(this.resourceRoot,""),this.versionConfig){var e=t.indexOf("?v=");-1!=e&&(t=t.slice(0,e));var n=t.replace(this.versionPath,"");if(this.versionConfig&&this.versionConfig[n]){var i=this.versionConfig[n],o=t.slice(t.lastIndexOf("."));t=this.versionPath+i+o}}return t=this.resourceRoot+t},t.currentVersion="0.0.7",t}();__reflect(VersionController.prototype,"VersionController",["RES.IVersionController"]),RES.registerVersionController(new VersionController);var UI_Alert=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.bindEvents=function(){t.prototype.bindEvents.call(this)},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.x=(GameMgr.instance.main.stage.stageWidth-this.width)/2,this.y=(GameMgr.instance.main.stage.stageHeight-this.height)/3,this.render(),this.onLangChange()},e.prototype.render=function(){},e.prototype.onLangChange=function(t){Lang.instance.lang()},e.prototype.showAlert=function(t){this.alertMsg.text=t,this.visible=!0},e.prototype.hideAlert=function(){this.visible=!1},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_Alert.prototype,"UI_Alert");var UI_FairAlert=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.bindEvents=function(){t.prototype.bindEvents.call(this)},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.x=(GameMgr.instance.main.stage.stageWidth-this.width)/2,this.y=(GameMgr.instance.main.stage.stageHeight-this.height)/3,this.render(),this.onLangChange()},e.prototype.render=function(){},e.prototype.onLangChange=function(t){var e=Lang.instance.lang().Alert;this.openText.text=e.openText},e.prototype.showAlert=function(t,e){this.visible=!0,this.poker.source=e,this.tx||(this.tx=new egret.TextField,this.validateNow(),this.tx.y=(this.content.height-36)/2,this.content.addChild(this.tx));var n=t.blockId,i=t.poker,o=["a","b","c","d","e"],r=""+((i-1)%13+1);r=parseInt(r)>=10?o[parseInt(r)-10]:r;for(var s=""+Math.floor(i/13),a=n.length,c=0,l=[];a>=0;){var h=n.charAt(a);/[0-9a-e]/.test(h)!==!1?(0===c&&h===r?(l.push(a),c=1):1===c&&h===s&&(l.push(a),c=2,a=-1),a--):a--}var u=n,p=l.map(function(t){return n.charAt(t)}),d=["!","@"];l.forEach(function(t,e){u=u.slice(0,t)+d[e]+u.slice(t+1)});var f=GAME_ISMOBILE?20:26,g=u.length,y=u.slice(g-f),v="<font size=36>..."+y+"</font>";d.forEach(function(t,e){v=v.replace(t,"</font><font color=0xffa531 size=36>"+p[e]+"</font><font size=36>")}),this.tx.textFlow=(new egret.HtmlTextParser).parser(v)},e.prototype.hideAlert=function(){this.visible=!1},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_FairAlert.prototype,"UI_FairAlert");var UI_Auto=function(t){function e(){var e=t.call(this)||this;return e.checkBoxFlag=[!1,!1,!1,!1,!1],e}return __extends(e,t),e.prototype.bindEvents=function(){var e=this;t.prototype.bindEvents.call(this);var n=["bankerCBox","playerCBox","tieCBox","bankerPairCBox","playerPairCBox"],i=["btnClose","btnEosComfirm","btnAdd","btnBack","btnDetail","btnComfirm"].concat(n);i.forEach(function(t){mouse.setButtonMode(e[t],!0)}),n.forEach(function(t,n){e[t].addEventListener(eui.UIEvent.CHANGE,e["onCheckbox"+n],e)}),this.btnClose.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnClose,this),this.btnEosComfirm.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnEosComfirm,this),this.btnAdd.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnAdd,this),this.btnBack.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnBack,this),this.btnDetail.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnDetail,this),this.btnComfirm.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnComfirm,this)},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.render(),this.onLangChange()},e.prototype.onBtnClose=function(){AudiosMgr.instance.playButtonClick(),Auto.instance.closeAutoView()},e.prototype.onBtnEosComfirm=function(){AudiosMgr.instance.playButtonClick(),this.planEosGroup.visible=!1,this.eosGroup.visible=!0},e.prototype.onBtnAdd=function(){AudiosMgr.instance.playButtonClick()},e.prototype.onBtnBack=function(){AudiosMgr.instance.playButtonClick(),this.planEosGroup.visible=!0,this.eosGroup.visible=!1},e.prototype.onBtnDetail=function(){AudiosMgr.instance.playButtonClick(),Auto.instance.openAutoDetailView()},e.prototype.onBtnComfirm=function(){AudiosMgr.instance.playButtonClick(),Auto.instance.closeAutoView()},e.prototype.onCheckbox0=function(t){AudiosMgr.instance.playButtonClick(),this.checkBoxFlag[0]=t.target.selected},e.prototype.onCheckbox1=function(t){AudiosMgr.instance.playButtonClick(),this.checkBoxFlag[1]=t.target.selected},e.prototype.onCheckbox2=function(t){AudiosMgr.instance.playButtonClick(),this.checkBoxFlag[2]=t.target.selected},e.prototype.onCheckbox3=function(t){AudiosMgr.instance.playButtonClick(),this.checkBoxFlag[3]=t.target.selected},e.prototype.onCheckbox4=function(t){AudiosMgr.instance.playButtonClick(),this.checkBoxFlag[4]=t.target.selected},e.prototype.initFormData=function(){this.inputPlanEos.text=0..toString(),this.inputEos.text=0..toString(),this.inputCount.text=10..toString(),this.inputNomal.text=.5.toString(),this.inputRare.text=.1.toString(),this.inputStop.text=1..toString()},e.prototype.render=function(){this.initFormData()},e.prototype.onLangChange=function(t){var e=this,n=Lang.instance.lang(),i=n.Bet,o=n.Auto,r="zh"==Lang.instance.langEnum,s=1,a=["title","autoTips","planEos","planRest","planCount","planCont","stopEos","winInTotal","gained","reset","detail","period","periodTxt","stopTipL","stopTipR","multiChoice","backTipL"],c=["banker","player","tie","bankerPair","playerPair"];a.forEach(function(t){e[t].text=o[t]}),c.forEach(function(t){e[t+"CBox"].label=i[t].toUpperCase().replace(" ","\n"),e[t+"CBox"].labelDisplay.size=r?"30":"18"}),this.backTipR.text=s+" "+o.backTipR,this.atLeastL1.text=o.oneBet+"0.5",this.atLeastR1.text=o.atLeast,this.atLeastL2.text=o.oneBet+"0.1",this.atLeastR2.text=o.atLeast,this.btnAdd.label=o.add,this.btnBack.label=o.back,this.btnComfirm.label=o.startBetting,this.betEos1.text=this.betEos2.text=o.betEos},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_Auto.prototype,"UI_Auto");var UI_AutoDetail=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.bindEvents=function(){t.prototype.bindEvents.call(this),mouse.setButtonMode(this.btnClose,!0),this.btnClose.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnClose,this)},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.render(),this.onLangChange()},e.prototype.onBtnClose=function(){Auto.instance.closeAutoDetailView()},e.prototype.render=function(){this.horizontalCenter="0",this.verticalCenter="0",this.detailScroller.verticalScrollBar.thumb.source="pc_json.pc_board10",this.detailList.itemRenderer=UI_AutoDetailItem,this.detailList.dataProvider=new eui.ArrayCollection},e.prototype.onLangChange=function(t){var e=Lang.instance.lang().Auto;this.titleDetail.text=e.titleDetail,this.autoDetailTips.text=e.autoDetailTips;for(var n=[],i=0;50>i;i++){var o=[];n.push(o)}this.detailList.dataProvider.source=n},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_AutoDetail.prototype,"UI_AutoDetail");var UI_AutoDetailItem=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.onCreate=function(){t.prototype.onCreate.call(this)},e.prototype.dataChanged=function(){},e}(UIBaseItemRenderer);__reflect(UI_AutoDetailItem.prototype,"UI_AutoDetailItem");var chipConfig=[{value:.1,color:9637902,bg:"chip_r_t"},{value:.5,color:1207012,bg:"chip_b_t"},{value:1,color:7745702,bg:"chip_p_t"},{value:5,color:1665841,bg:"chip_b_t"},{value:10,color:8353819,bg:"chip_y_t"},{value:20,color:7095070,bg:"chip_o_t"}],CHIPSIZE={SMALL:1,LARGE:2},UI_Bet=function(t){function e(){var e=t.call(this)||this;return e.chipElements=[],e.betEosCount=0,e.thisPhaseBetEosCount=0,e.getBetGtCount=0,e.succChipNodePool=[],e.chipNodePool=[],e.otherChipNodePool=[],e}return __extends(e,t),e.prototype.bindEvents=function(){t.prototype.bindEvents.call(this),mouse.setButtonMode(this.gtTipsBtn,!0),mouse.setButtonMode(this.clearBtn,!0),mouse.setButtonMode(this.confirmBtn,!0),mouse.setButtonMode(this.autoConfirmBtn,!0),this.clearBtn.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onClearBtn,this),this.confirmBtn.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onConfirmBtn,this),this.autoConfirmBtn.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onAutoConfirmBtn,this),this.gtTipsBtn.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onGtTipsBtn,this)},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.render(),this.onLangChange()},e.prototype.render=function(){this.autoConfirmBtn.visible=!1,this.initRadioButtonWithGroup(),this.renderBetEosText(0),this.renderPhaseBetEosText(0),this.renderGetBetGtText(0)},e.prototype.renderBetEosText=function(t){this.betEosCount=t,this.betEosText.text=t.toString()},e.prototype.renderPhaseBetEosText=function(t){this.thisPhaseBetEosCount=t,this.thisPhaseBetEosText.text=t.toString()},e.prototype.transBetEosToPhase=function(){this.succChipNodePool=this.succChipNodePool.concat(this.chipNodePool),this.chipNodePool=[],this.renderPhaseBetEosText(NP.plus(this.thisPhaseBetEosCount,this.betEosCount)),this.renderGetBetGtText(NP.plus(this.getBetGtCount,NP.times(Bet.instance.rate,this.betEosCount))),this.renderBetEosText(0)},e.prototype.renderGetBetGtText=function(t){this.getBetGtCount=t,this.getBetGtText.text=this.getBetGtText0.text=t.toString()},e.prototype.onGtTipsBtn=function(t){AudiosMgr.instance.playButtonClick(),EOS_VUE.$showGt()},e.prototype.onClearBtn=function(t){AudiosMgr.instance.playButtonClick(),this.clearChip()},e.prototype.clearSuccChip=function(){this.succChipNodePool.forEach(function(t){t.parent.removeChild(t)}),Bet.instance.setChipNodes(this.succChipNodePool),this.succChipNodePool=[]},e.prototype.clearOtherChip=function(){this.otherChipNodePool.forEach(function(t){t.parent.removeChild(t)}),Bet.instance.setChipNodes(this.otherChipNodePool),this.otherChipNodePool=[]},e.prototype.clearChip=function(){this.chipNodePool.forEach(function(t){t.parent.removeChild(t)}),Bet.instance.setChipNodes(this.chipNodePool),this.chipNodePool=[],this.renderBetEosText(0)},e.prototype.getChipMemo=function(){var t=[],e=[],n="",i={};return this.chipNodePool.forEach(function(n){var o=n.type;e[o]||(e[o]=0,t[o]={type:o,account:UserMgr.instance.account.name,counter:[],total:"0.0000 EOS"},i[o]={}),i[o][n.chipValue]||(i[o][n.chipValue]=0),i[o][n.chipValue]++,e[o]=NP.plus(e[o],n.chipValue),t[o].total=e[o].toFixed(4)+" EOS"}),Object.keys(i).forEach(function(e){var n=i[e];Object.keys(n).forEach(function(i){t[e].counter.push({key:NP.times(Number(i),100),val:n[i]})})}),e.forEach(function(t,e){n+="|"+e+"|"+NP.times(t,1e4)}),n},e.prototype.allowBet=function(t){this.confirmBtn.enabled=t},e.prototype.onConfirmBtn=function(t){AudiosMgr.instance.playButtonClick();var e=Lang.instance.lang().Bet;if(UserMgr.instance.isLogin())if(this.betEosCount>0){if(this.betEosCount>100)return void AlertMgr.instance.showAlert(e.moreBet);var n=this.getChipMemo();EOS_VUE.$doDeposit(Index.instance.gameInfo.id,this.betEosCount,n),this.allowBet(!1),Index.instance.allowBet(!1)}else AlertMgr.instance.showAlert(e.noBet)},e.prototype.onAutoConfirmBtn=function(t){AudiosMgr.instance.playButtonClick(),UserMgr.instance.isLogin()&&Auto.instance.openAutoView()},e.prototype.initRadioButtonWithGroup=function(){var t=this;this.radioGroup=new eui.RadioButtonGroup,this.radioGroup.addEventListener(eui.UIEvent.CHANGE,this.radioChangeHandler,this),chipConfig.forEach(function(e,n){var i=new eui.RadioButton;i.skinName=chipItem,i.label=e.value.toString(),i.labelDisplay.textColor=e.color,i.chipItemImage.source=e.bg,i.value=e.value,i.selected=1===e.value,i.y=1===e.value?-40:0,mouse.setButtonMode(i,!0),i.group=t.radioGroup,i.x=10+i.width*n,t.chipElements.push(i),t.chipGroup.addChild(i)}),Bet.instance.chipValue=1},e.prototype.radioChangeHandler=function(t){AudiosMgr.instance.playButtonClick();var e=t.target;this.chipElements.forEach(function(t){if(egret.Tween.removeTweens(t),t==e.selection){if(-40==t.y)return;egret.Tween.get(t).to({y:-40},250,egret.Ease.sineIn)}else{if(0==t.y)return;egret.Tween.get(t).to({y:0},250,egret.Ease.sineIn)}}),Bet.instance.chipValue=e.selectedValue},e.prototype.resetChipElements=function(){this.chipElements.forEach(function(t){egret.Tween.removeTweens(t),0!=t.y&&egret.Tween.get(t).to({y:0},250,egret.Ease.sineIn)}),this.radioGroup.selectedValue=null},e.prototype.getLocalPoint=function(t){for(var e=t.width/2,n=t.height/2;t!=this;)e+=t.x,n+=t.y,t=t.parent;return new egret.Point(e,n)},e.prototype.getRadioButton=function(t){var e=this.chipElements.filter(function(e){return e.value==t});return e&&e[0]},e.prototype.largeChipIn=function(t,e,n,i){var o=this.radioGroup.selection||this.getRadioButton(i.chipValue);this.validateNow();var r=o.localToGlobal(0,0),s=new egret.Point(e,n);t.addChild(i),this.chipNodePool.push(i),i.x=r.x,i.y=r.y,egret.Tween.get(i).to({x:s.x,y:s.y},300,egret.Ease.sineIn),this.renderBetEosText(NP.plus(this.betEosCount,i.chipValue))},e.prototype.largeChipIn2=function(t,e,n,i){var o=this.radioGroup.selection||this.getRadioButton(i.chipValue);this.validateNow();var r=o.localToGlobal(0,0),s=new egret.Point(e,n);t.addChild(i),this.succChipNodePool.push(i),i.x=r.x,i.y=r.y,egret.Tween.get(i).to({x:s.x,y:s.y},300,egret.Ease.sineIn),this.renderBetEosText(NP.plus(this.betEosCount,i.chipValue))},e.prototype.smallChipIn=function(t,e,n,i){var o=this.getRadioButton(i.chipValue);if(null!=o){var r=o.localToGlobal(0,0),s=new egret.Point(e,n);t.addChild(i),this.otherChipNodePool.push(i),i.x=r.x,i.y=r.y,egret.Tween.get(i).to({x:s.x,y:s.y},300,egret.Ease.sineIn)}},e.prototype.renderGameStart=function(){this.confirmBtn.enabled=!0,this.clearOtherChip(),this.clearSuccChip(),this.clearChip(),this.renderBetEosText(0),this.renderPhaseBetEosText(0),this.renderGetBetGtText(0)},e.prototype.renderLotteryInfo=function(){this.clearChip(),this.confirmBtn.enabled=!1},e.prototype.updateRate=function(){var t=Lang.instance.lang().Bet.gtTips2;this.gtTips2.text=t.replace(/\?/g,""+Bet.instance.rate),this.rateLabel.text="x"+Bet.instance.rate},e.prototype.onLangChange=function(t){var e=Lang.instance.lang().Bet,n=e.clear,i=e.confirmBet,o=e.autoBet,r=e.thisTime,s=e.thisPhase,a=e.getBetGtLangText,c=e.gtTips1,l=e.gtTips2;this.clearBtn.label=n,this.confirmBtn.label=i,this.autoConfirmBtn.label=o,this.thisTimeBet.text=r,this.thisPhaseBet.text=s,this.getBetGtLangText.text=this.getBetGtLangText0.text=a,this.gtTips1.text=c,this.gtTips2.text=l.replace(/\?/g,""+Bet.instance.rate),this.rateLabel.text="x"+Bet.instance.rate},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_Bet.prototype,"UI_Bet");var UI_ChipItem=function(t){function e(e,n){var i=t.call(this)||this;return i.chipValue=e,i.size=n,i}return __extends(e,t),e.prototype.bindEvents=function(){t.prototype.bindEvents.call(this)},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.render(),this.onLangChange()},e.prototype.render=function(){var t=this;this.anchorOffsetX=this.width/2,this.anchorOffsetY=this.height/2;var e=chipConfig.filter(function(e){return e.value==t.chipValue}).pop();this.chipItemImage.source=e.bg,this.chipItemImage.scaleX=this.size==CHIPSIZE.LARGE?1:.7,this.chipItemImage.scaleY=this.chipItemImage.scaleX,this.labelDisplay.size=18*this.chipItemImage.scaleX,this.labelDisplay.text=e.value.toString(),this.labelDisplay.textColor=e.color
- },e.prototype.onLangChange=function(t){},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_ChipItem.prototype,"UI_ChipItem");var UI_Index=function(t){function e(){var e=t.call(this)||this;return e.gaming=!1,e.betArr=[],e.myCardArr=[],e.dealerCardArr=[],e.winArr=[],e.resultArr=[],e.online=0,e.totalPokerLength=0,e.showingPoker=!1,e.showedPokerQueen=[],e.showingPokerQueen=[],e}return __extends(e,t),e.prototype.bindEvents=function(){t.prototype.bindEvents.call(this),mouse.setButtonMode(this.betMyWinGroup,!0),mouse.setButtonMode(this.betDealerWinGroup,!0),mouse.setButtonMode(this.betMyDoubleGroup,!0),mouse.setButtonMode(this.betDrawGroup,!0),mouse.setButtonMode(this.betDealerDoubleGroup,!0),mouse.setButtonMode(this.musicToggle,!0),this.betDealerWinGroup.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onChipBtn(1),this),this.betMyWinGroup.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onChipBtn(0),this),this.betDrawGroup.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onChipBtn(2),this),this.betDealerDoubleGroup.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onChipBtn(4),this),this.betMyDoubleGroup.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onChipBtn(3),this),this.musicToggle.addEventListener(eui.UIEvent.CHANGE,this.onMusicToggle,this),this.tradeBtn&&this.tradeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onTradeBtn,this),this.rateBtn&&this.rateBtn.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onRateBtn,this),this.chipComponent.touchEnabled=!1,this.chipComponent.touchChildren=!1},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.betArr.push(this.betMyWinGroup,this.betDealerWinGroup,this.betDrawGroup,this.betMyDoubleGroup,this.betDealerDoubleGroup),this.winArr.push(this.betMyWinImg,this.betDrawWinImg,this.betDealerWinImg,this.betDealerDoubleWinImg,this.betMyDoubleWinImg),this.resultArr.push(this.myWinResult,this.dealerWinResult,this.drawWinResult,this.myDoubleWinResult,this.dealerDoubleWinResult),this.myCardArr.push(this.myCard1,this.myCard2,this.myCard3),this.dealerCardArr.push(this.dealerCard1,this.dealerCard2,this.dealerCard3),this.addComponent(this.betComponent,Bet.instance.getBetView()),this.addComponent(this.notificationComponent,Notice.instance.getNoticeView()),this.addComponent(this.userHeaderComponent,Userinfo.instance.getUserHeaderView()),GAME_ISMOBILE||(this.addComponent(this.rateComponent,Rate.instance.getRateView()),this.addComponent(this.tradeComponent,Trade.instance.getTradeView())),this.render(),this.onLangChange(),this.rateComponent.touchThrough=!0,this.tradeComponent.touchThrough=!0,this.betMyWinText.touchEnabled=!1,this.betDealerWinText.touchEnabled=!1},e.prototype.render=function(){this.myCountText.text=this.dealerCountText.text="",this.setWinGroupVisible(!1),this.setCardGroupVisible(!1),this.setBetGroupEnable(!1),this.musicToggle.selected=AudiosMgr.instance.bgmAllow},e.prototype.setOnlineNumber=function(t){this.online=t;var e=Lang.instance.lang().Index;this.onlineNumber.text=e.online+":"+this.online},e.prototype.renderGameInfo=function(t){Index.instance.gameInfo=t,this.renderGameStart(t)},e.prototype.renderGameStart=function(t){var e=this;this.gaming=!0,this.totalPokerLength=0,this.showedPokerQueen=[],this.showingPokerQueen=[],AlertMgr.instance.hideAlert(),AlertMgr.instance.hideFairAlert(),AlertMgr.instance.showAlert("游戏开始"),AudiosMgr.instance.playNewRound(),Bet.instance.renderGameStart(),Trade.instance.emptyTradeList(),Trade.instance.renderGameId(t.id),Index.instance.clearChip(),this.setBetGroupEnable(!0),this.setWinGroupVisible(!1),this.setCardGroupVisible(!1),this.myCountText.text=this.dealerCountText.text=" ";Lang.instance.lang().Index.beting;this.clockLotterying.visible=!1,this.clockBeting.visible=this.clockText.visible=!0;var n=t.timeout;return n=Math.max(0,n),this.clockText.text=n.toString(),clearInterval(this.clockTimer),0===n?void this.beforeLottery():void(this.clockTimer=setInterval(function(){n--,e.clockText.text=n.toString(),0>=n&&e.beforeLottery()},1e3))},e.prototype.beforeLottery=function(){this.gaming=!1,this.setBetGroupEnable(!1),clearInterval(this.clockTimer);var t=Lang.instance.lang().Index.rewarding;AlertMgr.instance.showAlert(t,!0),this.clockLotterying.visible=!0,this.clockBeting.visible=this.clockText.visible=!1},e.prototype.renderLotteryInfo=function(t,e){return __awaiter(this,void 0,void 0,function(){var n,i,o,r,s,a,c,l,h,o,r,u,p=this;return __generator(this,function(d){switch(d.label){case 0:return 0!==this.showedPokerQueen.length||this.showingPoker?[3,2]:(AlertMgr.instance.hideAlert(),n=t.offer,i=t.reveal_info,o=i.player,r=i.banker,s=i.win,a=i.playerPair,c=i.bankerPair,l=i.blockInfo,Bet.instance.renderLotteryInfo(),[4,this.showLotteryPoker(o,r,l)]);case 1:return d.sent(),this.showLotteryResult(s,c,a),n&&Userinfo.instance.addOffer(n),setTimeout(function(){e.timeout-=3,p.renderGameInfo(e)},3e3),[3,3];case 2:h=t.reveal_info,o=h.player,r=h.banker,this.totalPokerLength=o.length+r.length,u=Date.now(),this.totalPokerShowedCb=function(){var n=t.offer,i=t.reveal_info,o=i.win,r=i.playerPair,s=i.bankerPair;i.blockInfo;p.showLotteryResult(o,s,r),n&&Userinfo.instance.addOffer(n),setTimeout(function(){var t=Date.now(),n=Math.round((t-u)/1e3);e.timeout-=n,p.renderGameInfo(e)},3e3)},this.showedPokerQueen.length===this.totalPokerLength&&this.totalPokerShowedCb(),d.label=3;case 3:return[2]}})})},e.prototype.renderLotteryResult=function(t){var e=this;this.resultArr.forEach(function(t){t.visible=!1});var n=Lang.instance.lang(),i=n.Index,o=n.Bet;t.forEach(function(t,n){0==n?t>0&&e.showResult(e.myWinResult,i.playerWin.toUpperCase()+" "+t+" EOS"):1==n?t>0&&e.showResult(e.dealerWinResult,i.bankerWin.toUpperCase()+" "+t+" EOS"):2==n?t>0&&e.showResult(e.drawWinResult,o.tie.toUpperCase()+" "+t+" EOS"):3==n?t>0&&e.showResult(e.myDoubleWinResult,o.playerPair.toUpperCase()+" "+t+" EOS"):4==n&&t>0&&e.showResult(e.dealerDoubleWinResult,o.bankerPair.toUpperCase()+" "+t+" EOS")})},e.prototype.setBetGroupEnable=function(t){this.betArr.forEach(function(e){e.touchEnabled=e.touchChildren=t})},e.prototype.setCardGroupVisible=function(t){this.myCardArr.forEach(function(e){e.visible=t,e.source="poker_json.poker_back"}),this.dealerCardArr.forEach(function(e){e.visible=t,e.source="poker_json.poker_back"})},e.prototype.setWinGroupVisible=function(t){this.winArr.forEach(function(e){e.visible=t}),this.resultArr.forEach(function(t){t.visible=!1})},e.prototype.showResult=function(t,e){var n=t.getChildAt(1);n.text=e,t.width=n.width+10,t.visible=!0},e.prototype.showChannelPoker=function(t){return __awaiter(this,void 0,void 0,function(){var e,n,i,o,r;return __generator(this,function(s){switch(s.label){case 0:return this.showingPoker?(this.showingPokerQueen.push(t),[2]):(AlertMgr.instance.hideAlert(),e=this.showedPokerQueen.filter(function(e){return e.type===t.type}),n=e.length,i=this.showedPokerQueen.filter(function(e){return e.block_num===t.block_num}).length,0!==i?[3,2]:(o="player"===t.type?this.myCardArr:this.dealerCardArr,this.showingPoker=!0,[4,this.showPoker(o[n],t.poker,{poker:t.poker,blockId:t.block_id},n)]));case 1:s.sent(),this.showingPoker=!1,r="player"===t.type?this.myCountText:this.dealerCountText,r.text=([].concat(e,[t]).reduce(function(t,e){return t+Util.pointPoker(e.poker)},0)%10).toString(),this.showedPokerQueen.push(t),0!==this.totalPokerLength&&this.totalPokerLength===this.showedPokerQueen.length&&this.totalPokerShowedCb&&this.totalPokerShowedCb(),s.label=2;case 2:return this.showNextChannelPoker(),[2]}})})},e.prototype.showNextChannelPoker=function(){this.showingPokerQueen.length&&this.showChannelPoker(this.showingPokerQueen.shift())},e.prototype.showLotteryPoker=function(t,e,n){return __awaiter(this,void 0,void 0,function(){var i,o,r,s;return __generator(this,function(a){switch(a.label){case 0:i=n.player,o=n.banker,r=0,s=Math.max(t.length,e.length),a.label=1;case 1:return s>r?[4,this.showPoker(this.myCardArr[r],t[r],i[r],r)]:[3,5];case 2:return a.sent(),this.myCountText.text=(t.slice(0,r+1).reduce(function(t,e){return t+Util.pointPoker(e)},0)%10).toString(),[4,this.showPoker(this.dealerCardArr[r],e[r],o[r],r)];case 3:a.sent(),this.dealerCountText.text=(e.slice(0,r+1).reduce(function(t,e){return t+Util.pointPoker(e)},0)%10).toString(),a.label=4;case 4:return r++,[3,1];case 5:return[2]}})})},e.prototype.showLotteryResult=function(t,e,n){AlertMgr.instance.hideFairAlert(),this.betDealerDoubleWinImg.visible=e,this.betMyDoubleWinImg.visible=n,this.betMyWinImg.visible=0===t,this.betDrawWinImg.visible=2===t,this.betDealerWinImg.visible=1===t,AudiosMgr.instance.playWin()},e.prototype.showPoker=function(t,e,n,i){return e?new Promise(function(o,r){t.visible=!0;var s={y:t.y};t.y=-200;var a=2==i?{scaleY:0}:{scaleX:0},c=2==i?{scaleY:1}:{scaleX:1},l="poker_"+Util.toPoker(e)+"_"+Util.toPokerColour(e);egret.Tween.get(t).wait(2===i?500:0).to(s,300,egret.Ease.backOut).to(a,250).call(function(){t.source=l,AlertMgr.instance.showFairAlert(n,l)}).to(c,250).wait(100).call(o)}):null},e.prototype.setMusicToggle=function(t){this.musicToggle.selected=t},e.prototype.onMusicToggle=function(t){AudiosMgr.instance.setBgmAllow(this.musicToggle.selected),this.musicToggle.selected?AudiosMgr.instance.playBgm():AudiosMgr.instance.stopBgm()},e.prototype.onTradeBtn=function(t){AudiosMgr.instance.playButtonClick(),Trade.instance.openTradeView()},e.prototype.onRateBtn=function(t){AudiosMgr.instance.playButtonClick(),Rate.instance.openRateView()},e.prototype.onLangChange=function(t){var e=this,n=Lang.instance.lang(),i=n.Index,o=n.Bet;this.onlineNumber.text=i.online+":"+this.online,this.dealerIdentityText.text=o.banker.toUpperCase(),this.myIdentityText.text=o.player.toUpperCase(),this.betMyWinText.text=i.playerWin.toUpperCase()+"\n2x",this.betDealerWinText.text=i.bankerWin.toUpperCase()+"\n1.95x",this.betMyDoubleText.text=o.playerPair.toUpperCase()+"\n12x",this.betDrawText.text=o.tie.toUpperCase()+"\n9x",this.betDealerDoubleText.text=o.bankerPair.toUpperCase()+"\n12x",this.clockBeting.text=i.beting,this.clockLotterying.text=i.rewarding,setTimeout(function(){e.refreshLotteryResult()},0),GAME_ISMOBILE&&(this.rateBtn.label=i.rateBtnText,this.tradeBtn.label=i.tradeBtnText)},e.prototype.refreshLotteryResult=function(){Index.instance.refreshLotteryResult()},e.prototype.addComponent=function(t,e){t.addChild(e)},e.prototype.onChipBtn=function(t){return function(e){if(AudiosMgr.instance.playButtonClick(),0!=Bet.instance.chipValue&&UserMgr.instance.isLogin()){var n=e.currentTarget,i={x:960,y:-450},o={x:-208,y:-450},r=900,s=e.localX,a=e.localY,c=e.stageX,l=e.stageY;if(!GAME_ISMOBILE&&1>=t){var h=0===t?i:o,u={x:s,y:a},p=Util.getDistanceBetweenTwoPoint(h,u);if(p>r){var d=void 0,f=void 0;d=0===t?(3*Math.random()+5)/10:(3*Math.random()+2)/10,f=(6*Math.random()+2)/10;var g=n.width*d,y=n.height*f;c+=g-s,s=g,l+=y-a,a=y}}47>s?c+=47-s:n.width-s<47&&(c-=s-n.width+47),47>a?l+=47-a:n.height-a<47&&(l-=a-n.height+47),Index.instance.addChip(t,Bet.instance.chipValue),Bet.instance.largeChipIn(t,this.chipComponent,c,l)}}},e.prototype.showOtherBet=function(t,e){var n=this;void 0===e&&(e=!1),t.forEach(function(t){var i=t.type,o=t.counter,r=n.betArr[i],s=r.width,a=r.height;o.forEach(function(t){for(var o=t.key,c=t.val;c>0;){var l=void 0,h=void 0;l=GAME_ISMOBILE||r!==n.betMyWinGroup?GAME_ISMOBILE||r!==n.betDealerWinGroup?(6*Math.random()+2)/10:(3*Math.random()+2)/10:(3*Math.random()+5)/10,h=(6*Math.random()+2)/10;var u=s*l,p=a*h,d=r.localToGlobal(u,p);e?Bet.instance.largeChipIn2(i,Number(o),n.chipComponent,d.x,d.y):Bet.instance.smallChipIn(Number(o),n.chipComponent,d.x,d.y),c--}})})},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_Index.prototype,"UI_Index");var UI_Notification=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.bindEvents=function(){t.prototype.bindEvents.call(this)},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.render(),this.onLangChange()},e.prototype.render=function(){this.visible=!1},e.prototype.onLangChange=function(t){},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_Notification.prototype,"UI_Notification");var UI_Rate=function(t){function e(){var e=t.call(this)||this;return e.scrolling=!1,e.isOpen=!0,e}return __extends(e,t),e.prototype.bindEvents=function(){t.prototype.bindEvents.call(this),mouse.setButtonMode(this.btnClose,!0),mouse.setButtonMode(this.btnOpen,!0),this.btnClose.addEventListener(egret.TouchEvent.TOUCH_TAP,this.changeViewStatus,this),this.btnOpen.addEventListener(egret.TouchEvent.TOUCH_TAP,this.changeViewStatus,this),this.sbtnClose.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onSbtnClose,this),this.rateScroller.addEventListener(eui.UIEvent.CHANGE_START,this.onScroll,this),this.rateScroller.addEventListener(eui.UIEvent.CHANGE_END,this.onScrollEnd,this)},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.render(),this.onLangChange()},e.prototype.onScroll=function(t){this.scrolling=!0},e.prototype.onScrollEnd=function(t){this.scrolling=!1},e.prototype.changeViewStatus=function(){AudiosMgr.instance.playButtonClick(),this.isOpen=!this.isOpen,this.bgOpen.visible=this.isOpen,this.rateScroller.visible=this.isOpen,this.btnClose.visible=this.isOpen,this.bgClose.visible=!this.isOpen,this.btnOpen.visible=!this.isOpen},e.prototype.onSbtnClose=function(){AudiosMgr.instance.playButtonClick(),Rate.instance.closeRateView()},e.prototype.renderHistory=function(){if(!Rate.instance.rateHistory)return void(this.typeGroup.dataProvider.source=[0,0,0,0,0]);var t=Rate.instance.rateHistory,e=t.type,n=t.result;this.typeGroup.dataProvider.source=e,this.rateList.dataProvider.source=n,this.validateNow(),this.scrolling===!1&&(this.rateScroller.viewport.scrollH=this.rateScroller.viewport.contentWidth-this.rateScroller.width)},e.prototype.render=function(){this.typeGroup.itemRenderer=UI_RateTypeItem,this.typeGroup.dataProvider=new eui.ArrayCollection,this.rateScroller.horizontalScrollBar.thumb.source="pc_json.pc_board10",this.rateList.itemRenderer=UI_RateItem,this.rateList.dataProvider=new eui.ArrayCollection},e.prototype.onLangChange=function(t){var e=Lang.instance.lang().Rate,n=e.pcTitle,i=e.h5Title;this.rateTitle.text=GAME_ISMOBILE?i:n,this.renderHistory()},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_Rate.prototype,"UI_Rate");var UI_RateDetail=function(t){function e(){var e=t.call(this)||this;return e.myCardArr=[],e.dealerCardArr=[],e.index=null,e}return __extends(e,t),e.prototype.bindEvents=function(){t.prototype.bindEvents.call(this),mouse.setButtonMode(this.closeBtn,!0),mouse.setButtonMode(this.fairBtn,!0),this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onCloseBtn,this),this.fairBtn.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnFair,this)},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.myCardArr.push(this.myCard1,this.myCard2,this.myCard3),this.dealerCardArr.push(this.dealerCard1,this.dealerCard2,this.dealerCard3),this.render(),this.onLangChange()},e.prototype.render=function(){this.fairList.itemRenderer=UI_RateDetailItem,this.fairList.dataProvider=new eui.ArrayCollection},e.prototype.onLangChange=function(t){null!==this.index&&this.renderDetail(this.index)},e.prototype.renderDetail=function(t){var e=this;this.index=t;var n=Lang.instance.lang().RateDetail,i=(n.di,n.phase,n.resultTitle),o=n.bankerWin,r=n.playerWin,s=n.tie,a=n.bankerPair,c=n.playerPair,l=n.fairTitle,h=n.tabTypeTitle,u=n.tabBlockNumTitle,p=n.tabBlockIdTitle,d=Lang.instance.lang().Rate,f=d.player,g=d.banker,y=Rate.instance.rateHistory.result[t],v=y.banker_pair,m=y.block_info,b=y.id,_=y.player_pair,C=y.winner,E=y.reveal_block_num;this.title.text=""+b,this.resultTilte.text=i,this.fairTitle.text=l,this.tabTypeTitle.text=h,this.tabBlockIdTitle.text=p,this.tabBlockNumTitle.text=u,this.myIdentityText.text=f.toUpperCase(),this.dealerIdentityText.text=g.toUpperCase(),this.myCardArr.forEach(function(t){return t.visible=!1}),this.dealerCardArr.forEach(function(t){return t.visible=!1}),m.player.forEach(function(t,n){var i=t.poker,o="poker_"+Util.toPoker(i)+"_"+Util.toPokerColour(i);e.myCardArr[n].source=o,e.myCardArr[n].visible=!0}),m.banker.forEach(function(t,n){var i=t.poker,o="poker_"+Util.toPoker(i)+"_"+Util.toPokerColour(i);e.dealerCardArr[n].source=o,e.dealerCardArr[n].visible=!0});var T=m.player.map(function(t){return t.poker}),w=m.banker.map(function(t){return t.poker});this.myCountText.text=(T.reduce(function(t,e){return t+Util.pointPoker(e)},0)%10).toString(),this.dealerCountText.text=(w.reduce(function(t,e){return t+Util.pointPoker(e)},0)%10).toString();var I=[r,o,s];this.resultContent.text=""+I[C]+(v?" "+a:"")+(_?" "+c:"");for(var B=[],L=0,k=Math.max(T.length,w.length);k>L;L++){if(void 0!==T[L]){var x=m.player[L];x.index=L+1,x.state=0,x.blockNum=E++,B.push(x)}if(void 0!==w[L]){var A=m.banker[L];A.index=L+1,A.state=1,A.blockNum=E++,B.push(A)}}this.fairList.dataProvider.source=B,this.fairList.dataProvider.refresh()},e.prototype.onCloseBtn=function(t){AudiosMgr.instance.playButtonClick(),this.visible=!1,this.index=null},e.prototype.onBtnFair=function(t){AudiosMgr.instance.playButtonClick(),EOS_VUE.$showFair()},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_RateDetail.prototype,"UI_RateDetail");var UI_RateDetailItem=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.onCreate=function(){t.prototype.onCreate.call(this),mouse.setButtonMode(this.tabBlockIdTitle,!0),mouse.setButtonMode(this.tabBlockNumTitle,!0),this.tabBlockIdTitle.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBlockTap,this),this.tabBlockNumTitle.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBlockTap,this)},e.prototype.onBlockTap=function(t){var e=this.data;e&&window.open("https://eospark.com/block/"+e.blockNum)},e.prototype.dataChanged=function(){var t=Lang.instance.lang(),e=t.Bet,n=e.player,i=e.banker,o=this.data;if(void 0===o)return void(this.visible=!1);this.tx||(this.tx=new egret.TextField,this.validateNow(),this.tx.y=(this.tabBlockIdTitle.height-24)/2,this.tabBlockIdTitle.addChild(this.tx));var r=o.index,s=o.state,a=o.blockId,c=o.blockNum,l=o.poker;this.tabTypeTitle.text=(0===s?n:i)+" "+r,this.tabBlockNumTitle.text=c;var h=["a","b","c","d","e"],u=""+((l-1)%13+1);u=parseInt(u)>=10?h[parseInt(u)-10]:u;for(var p=""+Math.floor(l/13),d=a.length,f=0,g=[];d>=0;){var y=a.charAt(d);/[0-9a-e]/.test(y)!==!1?(0===f&&y===u?(g.push(d),f=1):1===f&&y===p&&(g.push(d),f=2,d=-1),d--):d--}var v=a,m=g.map(function(t){return a.charAt(t)}),b=["!","@"];g.forEach(function(t,e){v=v.slice(0,t)+b[e]+v.slice(t+1)});var _=GAME_ISMOBILE?26:36,C=v.length,E=v.slice(C-_),T="<font size=24>..."+E+"</font>";b.forEach(function(t,e){T=T.replace(t,"</font><font color=0xffa531 size=24>"+m[e]+"</font><font size=24>")}),this.tx.textFlow=(new egret.HtmlTextParser).parser(T)},e}(UIBaseItemRenderer);__reflect(UI_RateDetailItem.prototype,"UI_RateDetailItem");var UI_RateItem=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.onCreate=function(){t.prototype.onCreate.call(this),mouse.setButtonMode(this.fullGroup,!0),this.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onTap,this)},e.prototype.onTap=function(t){AudiosMgr.instance.playButtonClick();var e=this.getValidateData(this.itemIndex);EOS_VUE.$showValidate(e)},e.prototype.getValidateData=function(t){var e=Rate.instance.rateHistory.result[t],n=e.block_info.player.map(function(t){return t.poker}),i=e.block_info.banker.map(function(t){return t.poker}),o=(n.reduce(function(t,e){return t+Util.pointPoker(e)},0)%10).toString(),r=(i.reduce(function(t,e){return t+Util.pointPoker(e)},0)%10).toString(),s={game_id:e.id,reveal_info:{playerPoint:o,bankerPoint:r,win:e.winner,playerPair:1===e.player_pair?!0:!1,bankerPair:1===e.banker_pair?!0:!1,blockInfo:e.block_info,revealBlockNum:e.reveal_block_num,player:n,banker:i}};return s},e.prototype.dataChanged=function(){var t=Lang.instance.lang(),e=this.data,n=0===e.winner,i=1===e.winner,o=2===e.winner,r=1===e.player_pair,s=1===e.banker_pair;n&&(this.winText.text=t.Rate.player),i&&(this.winText.text=t.Rate.banker),o&&(this.winText.text=t.Rate.tie),this.winR.visible=i,this.winB.visible=n,this.winG.visible=o,this.winRl.visible=s,this.winBr.visible=r},e}(UIBaseItemRenderer);__reflect(UI_RateItem.prototype,"UI_RateItem");var UI_RateTypeItem=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.onCreate=function(){t.prototype.onCreate.call(this)},e.prototype.dataChanged=function(){var t=this,e=Lang.instance.lang(),n=["winR","winB","winG","winRl","winBr"],i=["banker","player","tie","bankerPair","playerPair"],o=e.Rate[i[this.itemIndex]];n.forEach(function(e){t[e].visible=!1}),this.winText.text=o,this.winText.visible=0==this.itemIndex||1==this.itemIndex||2==this.itemIndex,this[n[this.itemIndex]].visible=!0,this.typeCount.text=o+"\n"+this.data},e}(UIBaseItemRenderer);__reflect(UI_RateTypeItem.prototype,"UI_RateTypeItem");var UI_Trade=function(t){function e(){var e=t.call(this)||this;return e.isOpen=!0,e}return __extends(e,t),e.prototype.bindEvents=function(){t.prototype.bindEvents.call(this),mouse.setButtonMode(this.btnClose,!0),mouse.setButtonMode(this.btnOpen,!0),this.btnClose.addEventListener(egret.TouchEvent.TOUCH_TAP,this.changeViewStatus,this),this.btnOpen.addEventListener(egret.TouchEvent.TOUCH_TAP,this.changeViewStatus,this),this.sbtnClose.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onSbtnClose,this)},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.render(),this.onLangChange()},e.prototype.changeViewStatus=function(){AudiosMgr.instance.playButtonClick(),this.isOpen=!this.isOpen,this.btnOpen.visible=!this.isOpen,this.btnClose.visible=this.isOpen,this.groudOpen.visible=this.isOpen},e.prototype.onSbtnClose=function(){AudiosMgr.instance.playButtonClick(),Trade.instance.closeTradeView()},e.prototype.renderTradeList=function(){Trade.instance.tradeList&&(this.tradeList.dataProvider.source=Trade.instance.tradeList)},e.prototype.emptyTradeView=function(){this.tradeList.dataProvider.source=[]},e.prototype.render=function(){this.tradeScroller.verticalScrollBar.thumb.source="pc_json.pc_board10",this.tradeList.itemRenderer=UI_TradeItem,this.tradeList.dataProvider=new eui.ArrayCollection,this.renderTradeList()},e.prototype.onLangChange=function(t){var e=Lang.instance.lang();this.tradeTitle1.text=e.Trade.title,this.btnOpen.label=e.Trade.title},e.prototype.renderGameId=function(t){this.tradeId.text=""+t},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_Trade.prototype,"UI_Trade");var UI_TradeItem=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.onCreate=function(){t.prototype.onCreate.call(this)},e.prototype.dataChanged=function(){var t=Lang.instance.lang(),e=this.data,n=e.type,i=e.account,o=e.total,r=["player","banker","tie"];this.winB.visible=0==n,this.winR.visible=1==n,this.winG.visible=2==n,this.winBr.visible=3==n,this.winRl.visible=4==n,this.winText.text=t.Rate[r[n]],this.winBg.visible=2>=n,this.winBg.visible=n>2,this.tradeName.text=i,this.tradeEos.text=GAME_ISMOBILE?o.replace(" EOS",""):o},e}(UIBaseItemRenderer);__reflect(UI_TradeItem.prototype,"UI_TradeItem");var UI_UserHeader=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.bindEvents=function(){t.prototype.bindEvents.call(this),mouse.setButtonMode(this.btnWithdraw,!0),mouse.setButtonMode(this.btnFair,!0),mouse.setButtonMode(this.btnGtQuestion,!0),mouse.setButtonMode(this.btnEosQuestion,!0),this.btnWithdraw.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnWithdraw,this),this.btnFair.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnFair,this),this.btnGtQuestion.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnGtQuestion,this),this.btnEosQuestion.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onBtnEosQuestion,this)},e.prototype.onCreate=function(){t.prototype.onCreate.call(this),this.render(),this.onLangChange()},e.prototype.render=function(){this.group.removeChild(this.eosSurplusLangText),this.group.removeChild(this.eosSurplusImg),this.group.removeChild(this.eosSurplusText),this.group.removeChild(this.btnEosQuestion),this.group.removeChild(this.btnWithdraw),this.renderBalance(UserMgr.instance.balance),this.renderGt(UserMgr.instance.gt),this.renderMoney(UserMgr.instance.money),EOS_VUE.$getCoinData()},e.prototype.onLangChange=function(t){var e=Lang.instance.lang();this.eosSurplusLangText.text=e.Userinfo.eosSurplus,this.btnWithdraw.label=e.Userinfo.withdraw,this.btnFair.label=e.Userinfo.fair,this.btnWithdraw.width=(GAME_ISMOBILE?40:23)+this.btnWithdraw.labelDisplay.width},e.prototype.renderBalance=function(t){null!=t&&(this.eosText.text=(t/1e4).toString())},e.prototype.renderGt=function(t){null!=t&&(this.gtText.text=t.toString())},e.prototype.renderMoney=function(t){null!=t&&(this.eosSurplusText.text=t.toString())},e.prototype.onBtnWithdraw=function(t){AudiosMgr.instance.playButtonClick(),UserMgr.instance.isLogin()&&EOS_VUE.$showWallet()},e.prototype.onBtnFair=function(t){AudiosMgr.instance.playButtonClick(),EOS_VUE.$showFair()},e.prototype.onBtnGtQuestion=function(t){AudiosMgr.instance.playButtonClick(),EOS_VUE.$showGt()},e.prototype.onBtnEosQuestion=function(t){AudiosMgr.instance.playButtonClick(),EOS_VUE.$showCount()},e.prototype.onClose=function(){},e}(UIBaseComponent);__reflect(UI_UserHeader.prototype,"UI_UserHeader");var Protocol=function(){function t(){}return t.channelNewGame="baccarat:new_game",t.channelNewPoker="baccarat:new_poker",t.channelNewPlayer="baccarat:new_player",t.channelNewOffer="baccarat:new_offer",t}();__reflect(Protocol.prototype,"Protocol");var SocketEvent=function(t){function e(e,n,i){void 0===n&&(n=!1),void 0===i&&(i=!1);var o=t.call(this,e,n,i)||this;return o.protoId=0,o.length=0,o}return __extends(e,t),e.PROTO_MSG="PROTO_MSG",e.RECONNECT_MSG="RECONNECT_MSG",e.LANG_CHANGE="LANG_CHANGE",e}(egret.Event);__reflect(SocketEvent.prototype,"SocketEvent");
|