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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
"use strict";
cc._RF.push(module, '84f120IHJdNBpd7CuG+jLbI', 'seerpalace_summon_Item');
// Scripts/mod/seerpalace/view/seerpalace_summon_Item.js
 
"use strict";
 
//---------------------------@ item
var SeerpalaceController = require("seerpalace_controller");
 
var SeerpalaceConst = require("seerpalace_const");
 
var SeerpalaceSummonItem = cc.Class({
  "extends": BasePanel,
  ctor: function ctor() {
    var self = this;
    this.ctrl = SeerpalaceController.getInstance();
    this.prefabPath = PathTool.getPrefabPath("seerpalace", "seerpalace_summon_item");
    self._is_select = false; //-- 是否选中了
 
    var data = arguments[0];
    this._clickCallBack = data.parent;
    this.index = data.index; // self.configUI()
  },
  initConfig: function initConfig() {},
  initPanel: function initPanel() {
    var self = this;
    self.effect_node = this.seekChild("effect_node");
    self.summon_layer = this.seekChild("summon_layer");
    self.check_layer = this.seekChild("check_layer");
 
    if (this.index) {
      this.setIndex();
    }
  },
  setIndex: function setIndex() {
    var index = this.index;
    var self = this;
    var group_id = SeerpalaceConst.Index_To_GroupId[index];
    var config = Config.recruit_high_data.data_seerpalace_data[group_id];
 
    if (config && config.item_once) {
      self.summon_cost = config.item_once; // 召唤所需道具id和数量
 
      self.group_id = group_id;
      var effect_id = SeerpalaceConst.Book_EffectId[group_id];
      var effect_pos = SeerpalaceConst.Effect_Pos[group_id];
 
      if (effect_id && effect_pos && effect_id != 0) {
        self.handleCardEffect(true, effect_id, effect_pos);
      }
    } // 引导需要
 
 
    self.summon_layer.name = "guide_card_" + index;
  },
  // 获取召唤所需道具id和数量
  getSummonCostItem: function getSummonCostItem() {
    return this.summon_cost;
  },
  // 获取先知殿配置的组id
  getSummonGroupId: function getSummonGroupId() {
    return this.group_id;
  },
  // -- 卡牌特效
  handleCardEffect: function handleCardEffect(status, effect_id, effect_pos) {
    var self = this;
 
    if (status == false) {
      if (self.card_effect) {
        this.card_effect.skeletonData = null;
        self.card_effect.clearTracks();
        self.card_effect.removeFromParent();
        self.card_effect = null;
      }
    } else {
      if (self.effect_node && !self.card_effect) {
        var effect = new cc.Node();
        effect.setAnchorPoint(0.5, 0.5);
        effect.addComponent(sp.Skeleton);
        self.effect_node.addChild(effect);
        self.card_effect = effect.getComponent(sp.Skeleton);
        var effectPath = PathTool.getSpinePath(Config.effect_data.data_effect_info[effect_id], "action");
        this.loadRes(effectPath, function (res_object) {
          this.card_effect.skeletonData = res_object;
          this.card_effect.setAnimation(0, "action1", true);
        }.bind(this)); // 设置位置
 
        self.effect_node.setPosition(effect_pos.x, effect_pos.y);
      }
    }
  },
  registerEvent: function registerEvent() {
    this.check_layer.on("touchend", this._onClickCheckLayer, this);
    this.summon_layer.on("touchend", this._onClickSummonLayer, this); // "guide_card_"
  },
  // -- 点击查看
  _onClickCheckLayer: function _onClickCheckLayer() {
    Utils.playButtonSound(1);
    var self = this;
 
    if (self.index) {
      this.ctrl.openSeerpalacePreviewWindow(true, self.index);
    }
  },
  // -- 点击选中
  _onClickSummonLayer: function _onClickSummonLayer() {
    Utils.playButtonSound(1);
    var self = this;
 
    if (self._is_select == false) {
      if (self._clickCallBack) {
        self._clickCallBack._onClickSummonCard(self);
      }
    }
  },
  setSelectStatus: function setSelectStatus(status) {
    var self = this;
 
    if (status == true) {
      // self.summon_layer.y = 30
      self.check_layer.y = -70;
      self.card_effect.setAnimation(0, "action2", true);
      self.card_effect.setToSetupPose();
    } else {
      // self.summon_layer.y = -100
      self.check_layer.y = -100;
      self.card_effect.setAnimation(0, "action1", true);
      self.card_effect.setToSetupPose();
    }
 
    self._is_select = status;
  } // function SeerpalaceSummonItem:DeleteMe(  )
  //     self:handleCardEffect(false)
  //     self.container:stopAllActions()
  //     self:removeAllChildren()
  //     self:removeFromParent()
  // end
 
});
module.exports = SeerpalaceSummonItem;
 
cc._RF.pop();