ArtistManager.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const DWTool = require("./DWTool");
  2. class ThemeManager {
  3. /**
  4. * 从res中加载对应的艺人骨骼动画
  5. * @param {*} isBigMan
  6. * @param {*} gender
  7. * @param {*} jobId 1: 主持, 2: 舞者, 3: 歌手, 4: 演员, 5: 电竞明星
  8. */
  9. static loadArtist(isBigMan = false, gender = 1, jobId) {
  10. //处理性别为0时未知性别
  11. if (gender === 0) {
  12. gender = 1;
  13. }
  14. let p = new Promise((resolve, reject) => {
  15. let name = `4${isBigMan ? 1 : 2}${gender}0${jobId}`;
  16. cc.loader.loadRes(`./people_spines/${name}`, sp.SkeletonData, (err, skeletonData,) => {
  17. if (err) {
  18. reject(err);
  19. } else {
  20. resolve(skeletonData);
  21. }
  22. });
  23. });
  24. return p;
  25. }
  26. //因骨骼动画未全部完成,顾加入静态职业人物
  27. static loadArtistImage(gender = 1, jobId) {
  28. //处理性别为0时未知性别
  29. if (gender === 0) {
  30. gender = 1;
  31. }
  32. let p = new Promise((resolve, reject) => {
  33. let name = `41${gender}0${jobId}`;
  34. cc.loader.loadRes(`people_figure/${name}`, cc.SpriteFrame, (err, spriteFrame) => {
  35. if (err) {
  36. reject(err);
  37. } else {
  38. resolve(spriteFrame);
  39. }
  40. });
  41. });
  42. return p;
  43. }
  44. }
  45. module.exports = ThemeManager;