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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
"use strict";
cc._RF.push(module, 'fcd99XLX8JEgr4UvA0PKKRE', 'redbag_open_window');
// Scripts/mod/redbag/view/redbag_open_window.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: shiraho@syg.com(必填, 创建模块的人员)
// @description:
//      公会boss主窗体
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var RedbagController = require("redbag_controller");
 
var RedBagOpenView = cc.Class({
  "extends": BaseView,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("redbag", "redbg_open_view");
    this.win_type = WinType.Mini;
    this.viewTag = SCENE_TAG.dialogue;
    this.ctrl = RedbagController.getInstance();
    this.model = this.ctrl.getModel();
  },
  openCallBack: function openCallBack() {
    this.background = this.seekChild("background");
    this.background.scale = FIT_SCALE;
    this.main_panel = this.seekChild("main_container");
    this.after_effect = this.seekChild("after_effect", sp.Skeleton);
    this.begin_effect = this.seekChild("begin_effect", sp.Skeleton);
    this.red_bg_sp = this.seekChild("red_bg", cc.Sprite);
  },
  registerEvent: function registerEvent() {
    this.background.on(cc.Node.EventType.TOUCH_END, function () {
      this.ctrl.openRegBagWindow(false);
    }.bind(this));
  },
  openRootWnd: function openRootWnd(data) {
    this.data = data;
    if (data) this.showAfterEffect();
  },
  showAfterEffect: function showAfterEffect() {
    if (this.red_bg_sp) {
      var config = Config.guild_data.data_guild_red_bag[this.data.type];
 
      if (config) {
        var res = PathTool.getUIIconPath("redbag", config.res_name);
        this.loadRes(res, function (sp) {
          this.red_bg_sp.spriteFrame = sp;
        }.bind(this));
        this.red_bg_sp.node.opacity = 0;
        this.red_bg_sp.node.scale = 0.8;
        this.red_bg_sp.node.runAction(cc.fadeIn(0.5));
      }
    }
 
    if (this.after_effect) {
      this.after_effect.setToSetupPose();
      this.after_effect.clearTracks();
    }
 
    if (this.after_effect) {
      var res = cc.js.formatStr("spine/%s/action.atlas", PathTool.getEffectRes(261));
      this.loadRes(res, function (res_object) {
        this.after_effect.skeletonData = res_object;
        this.after_effect.setAnimation(1, PlayerAction.action_1, false);
      }.bind(this));
    }
 
    this.timer = gcore.Timer.set(function () {
      if (this.data) {
        var assets = Config.guild_data.data_guild_red_bag[this.data.type].assets;
        var list = [{
          bid: Config.item_data.data_assets_label2id[assets],
          num: this.data.val
        }];
 
        require("mainui_controller").getInstance().openGetItemView(true, list, null, {
          is_backpack: true,
          is_red_bag: true,
          info_data: this.data
        });
 
        this.ctrl.openRegBagWindow(false);
      }
    }.bind(this), 1000, 1);
 
    if (this.begin_effect) {
      this.begin_effect.setToSetupPose();
      this.begin_effect.clearTracks();
    }
 
    if (this.begin_effect) {
      var res = cc.js.formatStr("spine/%s/action.atlas", PathTool.getEffectRes(261));
      this.loadRes(res, function (res_object) {
        this.begin_effect.skeletonData = res_object;
        this.begin_effect.setAnimation(1, PlayerAction.action_2, false);
      }.bind(this));
    }
  },
  closeCallBack: function closeCallBack() {
    if (this.after_effect) {
      this.after_effect.setToSetupPose();
      this.after_effect.clearTracks();
    }
 
    if (this.begin_effect) {
      this.begin_effect.setToSetupPose();
      this.begin_effect.clearTracks();
    }
 
    this.ctrl.openRegBagWindow(false);
  }
});
module.exports = RedBagOpenView;
 
cc._RF.pop();