"use strict"; cc._RF.push(module, 'f4d6d/OdX5MDKXT8eAm+rsl', 'prompt_vo'); // Scripts/mod/prompt/prompt_vo.js "use strict"; var PromptTypeConst = require("prompt_type_const"); var PromptVo = cc.Class({ "extends": gcore.BaseEvent, ctor: function ctor() { this.list = []; this.type = arguments[0]; this.id = arguments[1]; this.auto_id = 0; this.name = ""; this.is_show_bubble = false; //是否弹出过气泡提示 }, update: function update(data) { this.auto_id = this.auto_id + 1; if (this.type == PromptTypeConst.BBS_message_reply) { var obj = this.getSridByData(data); var role_name = obj.role_name; // let rid, srv_id, role_name, _ ,bbs_id = var name = role_name || Utils.TI18N("名字"); this.name = name + Utils.TI18N("回复了你"); } else { this.name = Config.notice_data.data_get[this.type].name; } this.list.push({ id: this.auto_id, data: data, time: gcore.SmartSocket.getTime() }); this.fire(PromptVo.UPDATE_SELF_EVENT); }, getSridByData: function getSridByData(data) { var rid = 0, srv_id = "", role_name = ""; var bbs_id = 0; if (data && data.arg_uint32 && data.arg_uint32.length > 0) { for (var i = 0; i < data.arg_uint32.length; ++i) { var temp = data.arg_uint32[i]; if (temp) { if (temp.key == 1) { rid = temp.value; } else if (temp.key == 2) { bbs_id = temp.value; //留言板那边的..表示留言id } } } } var guild_name = ""; if (data && data.arg_str && data.arg_str.length > 0) { for (var _i = 0; _i < data.arg_str.length; ++_i) { var _temp = data.arg_str[_i]; if (_temp) { if (_temp.key == 1) { srv_id = _temp.value; } else if (_temp.key == 2) { role_name = _temp.value; } else if (_temp.key == 3) { guild_name = _temp.value; } } } } return { rid: rid, srv_id: srv_id, role_name: role_name, guild_name: guild_name, bbs_id: bbs_id }; }, removeDataById: function removeDataById(id) { for (var i = 0; i < this.list.length; ++i) { var v = this.list[i]; if (v.id == id) { this.list.splice(i, 1); } } }, getNum: function getNum() { return this.list.length; }, setShowBubbleStatus: function setShowBubbleStatus(status) { this.is_show_bubble = status; } }); PromptVo.UPDATE_SELF_EVENT = "PromptVo.UPDATE_SELF_EVENT"; module.exports = PromptVo; cc._RF.pop();