"use strict"; cc._RF.push(module, '5b4a7ei8b9DFIKoI1gNeiUU', 'cmp.friend.report'); // Scripts/mod/friend/cmp/cmp.friend.report.js "use strict"; /****************************************************************** * * BUG反馈界面 * ******************************************************************/ var BridgeWindow = require("bridge.window"); var RoleController = require("role_controller"); var RoleEvent = require("role_event"); var MIN_WORDS = 20; // 问题类型 var ReportTypes = { Question: 1, // 提问 Suggestion: 2, // 游戏建议 Bug: 3, // bug反馈 Append: 4 // 追问 }; cc.Class({ "extends": BridgeWindow, properties: { nodName: { "default": null, type: cc.Node, displayName: "被舉報的玩家名字顯示" }, edtTitle: { "default": null, type: cc.EditBox }, edtDetail: { "default": null, type: cc.EditBox }, nodTypes: { "default": null, type: cc.Node }, nodOther: { "default": null, type: cc.Node }, nodEvidence: { "default": null, type: cc.Node } }, // 显示 onEnable: function onEnable() { // this.onTogType( ReportTypes.Bug ); }, // 关闭 onDisable: function onDisable() {}, onLoad: function onLoad() { this.bindGEvent(RoleEvent.ROLE_REPORTED_EVENT, this.freshMsgInfo.bind(this)); }, onOpenConfigs: function onOpenConfigs(_info) { this.uid = _info.rid; var name = _info.showname; this.srv_id = _info.srv_id; var showDesc = nx.text.format("FriendReportNUID", name, this.uid); nx.gui.setString(this.nodName, "name", showDesc); nx.gui.setActive(this.nodOther, "", true); this.roleCtl = RoleController.getInstance(); if (this.roleCtl) { this.roleCtl.send12771(this.uid, this.srv_id); } }, showOther: function showOther(_nod) { // let cmp = _nod.getComponent( cc.Toggle ); // if( cmp ){ // nx.gui.setActive( this.nodOther, "", cmp.isChecked ); // } }, freshMsgInfo: function freshMsgInfo(_msg) { nx.gui.hideAllChildren(this.nodEvidence); if (!_msg) { return; } var info = _msg.history; if (nx.dt.arrNEmpty(info)) { nx.gui.gocChildren(this.nodEvidence, "", info.length); var chd = this.nodEvidence.children; for (var i = 0; i < chd.length; i++) { var nod = chd[i]; var data = info[i]; nx.gui.setString(nod, "tip", data.msg); } } }, // // 类型切换 // 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 onTouchCommit() { var _this = this; var type = 0; var chd = this.nodTypes.children; for (var i = 0; i < chd.length; i++) { var nod = chd[i]; var cmp = nx.gui.getComponent(nod, "", cc.Toggle); if (cmp) { type = cmp.isChecked ? i + 1 : type; } } var msgcmp = nx.gui.getComponent(this.nodOther, "edt", cc.EditBox); var msg = ""; if (msgcmp) { msg = msgcmp.string; } var histroy = []; var evidencechd = this.nodEvidence.children; for (var _i = 0; _i < evidencechd.length; _i++) { var _nod2 = evidencechd[_i]; var _cmp = nx.gui.getComponent(_nod2, "", cc.Toggle); if (_cmp) { if (_cmp.isChecked) { var data = { id: _i + 1 }; histroy.push(data); } } // nx.gui.setString( nod, "tip", data.msg ); } // 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; // } this.roleCtl.send12770(this.uid, this.srv_id, type, msg, histroy, function (_ret, _data) { if (!_ret) { return; } _this.close(); }); } }); cc._RF.pop();