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
"use strict";
cc._RF.push(module, 'a61d57TENZIULlk4bQyWy8q', 'head_circle_tips');
// Scripts/mod/tips/view/head_circle_tips.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: shiraho@syg.com(必填, 创建模块的人员)
// @description:
//      普通物品的tips,区分背包中和其他
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var TipsConst = require("tips_const");
 
var StringUtil = require("string_util");
 
var TimeTool = require("timetool");
 
var HeadCircleTips = cc.Class({
  "extends": BaseView,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("tips", "headcircle_tips");
    this.viewTag = SCENE_TAG.dialogue;
    this.win_type = WinType.Tips;
  },
  initConfig: function initConfig() {
    this.tips_controller = require("tips_controller").getInstance();
  },
  openCallBack: function openCallBack() {
    this.background = this.seekChild("background");
    this.main_panel = this.seekChild("main_panel");
    this.time_label = this.seekChild(this.main_panel, "time_label", cc.Label);
    this.desc = this.seekChild(this.main_panel, "desc", cc.RichText);
    this.name = this.seekChild(this.main_panel, "name", cc.Label);
    this.icon = this.seekChild(this.main_panel, "icon", cc.Sprite);
  },
  registerEvent: function registerEvent() {
    this.background.on(cc.Node.EventType.TOUCH_START, function (event) {
      this.tips_controller.closeTIpsByType(TipsConst.type.HEAD_CIRCLE);
    }.bind(this));
  },
  openRootWnd: function openRootWnd(data) {
    var config = Config.avatar_data.data_avatar[data.bid];
    this.loadRes(PathTool.getHeadcircle(config.res_id), function (resObject) {
      this.icon.spriteFrame = resObject;
    }.bind(this));
    this.name.string = config.name;
    this.desc.string = Utils.TI18N("激活条件:") + config.desc;
 
    if (config.expire_time > 0) {
      this.time_label.string = Utils.TI18N("使用期限:") + TimeTool.getTimeFormatDay(config.expire_time * 60);
    } else {
      this.time_label.string = Utils.TI18N("使用期限:永久");
    }
  },
  closeCallBack: function closeCallBack() {
    this.tips_controller.closeTIpsByType(TipsConst.type.HEAD_CIRCLE);
  }
});
 
cc._RF.pop();