difenduandada
2024-12-31 34abe6963b344c882358274957f4b992456fee40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
"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();