/****************************************************************** * * BUG反馈界面 * ******************************************************************/ const BridgeWindow = require( "bridge.window" ); const MIN_WORDS = 20; // 问题类型 const ReportTypes = { Question: 1, // 提问 Suggestion: 2, // 游戏建议 Bug: 3, // bug反馈 Append: 4, // 追问 }; cc.Class( { extends: BridgeWindow, properties: { edtTitle: { default: null, type: cc.EditBox }, edtDetail: { default: null, type: cc.EditBox }, nodTypes: { default: null, type: cc.Node }, }, // 显示 onEnable: function() { this.onTogType( ReportTypes.Bug ); }, // 关闭 onDisable: function() { }, // 类型切换 onTogType: function( _key ) { this.ctype = parseInt( _key ) || 1; let chds = this.nodTypes.children; for( let i = 0; i < chds.length; ++i ) { let tp = chds[ i ]; let on = ( tp.name == ( "t" + this.ctype ) ); nx.gui.setActive( tp, "icon/on", on ); nx.gui.setActive( tp, "icon/off", !on ); } }, // 点击提交 onTouchCommit: function() { let title = this.edtTitle.string; let detail = this.edtDetail.string; if( nx.dt.strBytes( title ) < MIN_WORDS || nx.dt.strBytes( detail ) < MIN_WORDS ) { nx.tbox( "BugReportTooShort" ); return; } nx.bridge.game.reqCommitIssue( this.ctype, title, detail, ( _ret, _data ) => { this.close(); } ); }, } );