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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
"use strict";
cc._RF.push(module, '5c24ew9BclME7NqSzhzS5RV', 'pathtool');
// Scripts/util/pathtool.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: shiraho@syg.com(必填, 创建模块的人员)
// @description:
//      获取资源路径的接口
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
window.PathTool = {
  getPrefabPath: function getPrefabPath(module_name, file_name) {
    return "prefab/" + module_name + "/" + file_name + ".prefab"; // + ".prefab";
  },
  // 获取动态资源
  getIconPath: function getIconPath(module_name, file_name, type) {
    var suffix = "png";
    if (type) suffix = type;
    return "res/" + module_name + "/" + file_name + "." + suffix;
  },
  // 获取动态资源
  getUIIconPath: function getUIIconPath(module_name, file_name, type) {
    var suffix = "png";
    if (type) suffix = type;
    return "ui_res/" + module_name + "/" + file_name + "." + suffix;
  },
  // 已经废弃
  getResFrame: function getResFrame(packageName, resName) {
    // cc.error(null, "不再使用加载合图的方式加载资源 faild--->" + resName);
    // return
    resName = resName || packageName;
    return "res/" + packageName + "/" + resName + ".plist";
  },
  // 已经废弃
  getPlistPath: function getPlistPath(module_name, file_name) {
    // cc.error(null, "不再使用加载合图的方式加载资源 faild--->" + file_name);
    // return
    return "res/" + module_name + "/" + file_name + ".plist";
  },
  getHeadRes: function getHeadRes(res_id) {
    return "res/headicon/" + res_id + ".png";
  },
  getHeadcircle: function getHeadcircle(res_id) {
    return "res/headcircle/txt_cn_headcircle_" + res_id + ".png";
  },
  getHonorRes: function getHonorRes(res_id) {
    return "res/honor/txt_cn_honor_" + res_id + ".png";
  },
  getWelfareBannerRes: function getWelfareBannerRes(res_id) {
    return "res/welfare/welfare_banner/" + res_id + ".png";
  },
  getBigBuffRes: function getBigBuffRes(res_id) {
    return "res/bigbufficon/" + res_id + ".png";
  },
  // COMMON   = "common",
  // SCENE    = "scene",
  // BATTLE   = "battle",
  // DUBBING  = "dubbing",
  // Recruit  = "recruit",
  // Drama    = "drama",
  getSoundRes: function getSoundRes(res_type, res_name) {
    if (!res_type || !res_name) return; // return "sound/common/" + res_id + ".mp3";
    // var res_path = null;
 
    return cc.js.formatStr("sound/%s/%s.mp3", res_type, res_name);
  },
  // 获取大图 
  getBigBg: function getBigBg(res_id, bgType, module_name) {
    if (module_name) {
      module_name += "/";
    } else {
      module_name = "";
    }
 
    return "ui_res/bigbg/" + module_name + res_id + "." + (bgType || "png");
  },
  getCommonIcomPath: function getCommonIcomPath(icon_name) {
    return "ui_res/common/" + icon_name + ".png";
  },
  // 获取物品图标
  getItemRes: function getItemRes(res_id) {
    return "res/item/" + res_id + ".png";
  },
  // 获取单战斗场景的资源
  getBattleSingleBg: function getBattleSingleBg(res_id) {
    return "ui_res/bigbg/battle_bg/" + res_id + "/b_bg.jpg";
  },
  // 用于从cdn下载战斗资源的接口
  getBattleSceneRes: function getBattleSceneRes(resName, is_jpg) {
    if (is_jpg == true) {
      return "ui_res/bigbg/battle_bg/" + resName + ".jpg";
    } else {
      return "ui_res/bigbg/battle_bg/" + resName + ".png";
    }
  },
  // 获取buff资源路径
  getBuffRes: function getBuffRes(res_id) {
    return "res/bufficon/" + res_id + ".png";
  },
  //获取游戏图标的接口
  getFunctionRes: function getFunctionRes(res_id) {
    return "res/functionicon/" + res_id + ".png";
  },
  // 获取剧情副本的战斗背景
  getBattleDrameBg: function getBattleDrameBg(res_id) {
    var bg_path = "ui_res/bigbg/battle_bg/" + res_id;
    return {
      s: bg_path + "/map_bg.png",
      f: bg_path + "/m_bg.png"
    };
  },
  getActivityBig: function getActivityBig(res_id) {
    return "res/activity/activity_big/" + res_id + ".png";
  },
 
  /**
   * 获取spine路径
   */
  getSpinePath: function getSpinePath(res_id, res_name) {
    if (res_name == null) {
      res_name = PlayerAction.action;
    }
 
    return "spine/" + res_id + "/" + res_name + ".atlas";
  },
  // 获取战斗中的阵法图标
  getBattleFormIcon: function getBattleFormIcon(res_id) {
    return "res/battleformicon/battle_form_icon_" + res_id + ".png";
  },
  // 获取战斗中的阵营图标
  getBattleCampIcon: function getBattleCampIcon(res_id) {
    return "res/battlecamp/battlecamp_" + res_id + ".png";
  },
  // 获取战斗中的阵营图标
  getBattleCampIconByType: function getBattleCampIconByType(camp_type) {
    if (camp_type == null) {
      camp_type = 1;
    }
 
    var HeroConst = require("hero_const");
 
    if (camp_type == HeroConst.CampType.eWater) {
      return "res/battlecamp/battlecamp_1001.png";
    } else if (camp_type == HeroConst.CampType.eFire) {
      return "res/battlecamp/battlecamp_1002.png";
    } else if (camp_type == HeroConst.CampType.eWind) {
      return "res/battlecamp/battlecamp_1003.png";
    } else if (camp_type == HeroConst.CampType.eLight) {
      return "res/battlecamp/battlecamp_1004.png";
    } else if (camp_type == HeroConst.CampType.eDark) {
      return "res/battlecamp/battlecamp_1005.png";
    } else {
      return "res/battlecamp/battlecamp_1000.png";
    }
  },
  // 获取品质框背景(圆形的)
  getRoundQualityBg: function getRoundQualityBg(quality) {
    var quality = quality || 1;
 
    if (quality > 5) {
      quality = 5;
    }
 
    quality = 2000 + quality;
    var res_id = "mainui_" + quality;
    return PathTool.getUIIconPath("mainui", res_id);
  },
  //获取配置表中的effect资源id吧
  getEffectRes: function getEffectRes(id) {
    return gdata("effect_data", "data_effect_info", [id]) || "E88888";
  },
  // 根据物品品质色获取指定的图集ia
  getItemQualityBG: function getItemQualityBG(quality) {
    if (quality == null) {
      quality = 0;
    } else if (quality > 5) {
      quality = 5;
    }
 
    if (quality == 0) {
      return "common_1005";
    } else if (quality == 1) {
      return "common_1006";
    } else if (quality == 2) {
      return "common_1007";
    } else if (quality == 3) {
      return "common_1008";
    } else if (quality == 4) {
      return "common_1009";
    } else {
      return "common_1010";
    }
  },
  // 获取阵营资源
  getHeroCampRes: function getHeroCampRes(camp) {
    if (camp == null) {
      camp = 1;
    } else if (camp > 6) {
      camp = 1;
    }
 
    if (camp == 1) {
      // 水
      return "common_90067";
    } else if (camp == 2) {
      // 火
      return "common_90068";
    } else if (camp == 3) {
      // 风
      return "common_90069";
    } else if (camp == 4) {
      // 光
      return "common_90070";
    } else if (camp == 5) {
      // 暗
      return "common_90071";
    } else if (camp == 6) {
      //光和暗
      return "common_90079";
    }
  },
  // 获取属性图标
  getAttrIconByStr: function getAttrIconByStr(str) {
    if (str == "atk" || str == "atk_per") {
      return "common_90021";
    } else if (str == "hp" || str == "hp_max" || str == "hp_max_per") {
      return "common_90022";
    } else if (str == "def" || str == "def_per") {
      return "common_90023";
    } else if (str == "speed") {
      return "common_90038";
    } else if (str == "crit_rate") {
      return "common_90043";
    } else if (str == "crit_ratio") {
      return "common_90039";
    } else if (str == "hit_magic") {
      return "common_90040";
    } else if (str == "dodge_magic") {
      return "common_90037";
    } else if (str == "tenacity") {
      return "common_90021_1";
    } else if (str == "hit_rate") {
      return "common_90021_2";
    } else if (str == "res") {
      return "common_90021_3";
    } else if (str == "dodge_rate") {
      return "common_90021_4";
    } else if (str == "cure") {
      return "common_90021_5";
    } else if (str == "be_cure") {
      return "common_90021_6";
    } else if (str == "dam") {
      return "common_90021_7";
    } else {
      return "common_90037";
    }
  },
  // 获取阵营图标
  getHeroCampTypeIcon: function getHeroCampTypeIcon(camp_type) {
    if (camp_type == null) {
      camp_type = 1;
    }
 
    var HeroConst = require("hero_const");
 
    if (camp_type == HeroConst.CampType.eWater) {
      return "common_90067";
    } else if (camp_type == HeroConst.CampType.eFire) {
      return "common_90068";
    } else if (camp_type == HeroConst.CampType.eWind) {
      return "common_90069";
    } else if (camp_type == HeroConst.CampType.eLight) {
      return "common_90070";
    } else if (camp_type == HeroConst.CampType.eLingtDark) {
      return "common_90079";
    } else {
      return "common_90071";
    }
  },
  //这类单位是没有show动作的,所以要特殊处理
  specialBSModel: function specialBSModel(id) {
    return id == 37300 || id == 37301 || id == 37302;
  },
  //获取伙伴类型的,坦克法师这些
  getPartnerTypeIcon: function getPartnerTypeIcon(_type) {
    _type = _type || 1;
 
    var _index = 45 + _type;
 
    return this.getCommonIcomPath("common_900" + _index);
  },
  //获取伙伴半身像资源
  getPartnerBustRes: function getPartnerBustRes(bust_id) {
    bust_id = bust_id || 10000;
    return this.getIconPath("partner", bust_id);
  },
  getLogoRes: function getLogoRes() {
    // var logo_res = cc.js.formatStr("ui_res/login/%s/txt_cn_logo.png", "app")
    return "ui_res/login/txt_cn_logo.png";
  },
  //获取选中背景,通用
  getSelectBg: function getSelectBg() {
    return this.getUIIconPath("common", "common_90019");
  }
};
module.exports = PathTool;
 
cc._RF.pop();