ArtistManager.js 878 B

123456789101112131415161718192021222324252627282930313233
  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. module.exports = ThemeManager;