AlertManager.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. const DWTool = require("./DWTool");
  2. class AlertManager {
  3. // 显示培养弹窗
  4. static showTrainAlert(targetUid, zIndex = 0) {
  5. DWTool.loadResPrefab("./prefabs/artist_train")
  6. .then((result) => {
  7. let artistTrain = cc.instantiate(result);
  8. artistTrain.zIndex = zIndex;
  9. artistTrain.getComponent('ArtistTrain').init(targetUid);
  10. let canvas = cc.find("Canvas");
  11. canvas.addChild(artistTrain);
  12. });
  13. };
  14. // 显示充值弹窗
  15. static showRechargeAlert(zIndex = 0) {
  16. DWTool.loadResPrefab("./prefabs/artist_train_alert")
  17. .then((result) => {
  18. let alert = cc.instantiate(result);
  19. alert.zIndex = zIndex;
  20. let canvas = cc.find("Canvas");
  21. canvas.addChild(alert);
  22. });
  23. };
  24. // 显示星探界面
  25. static showTalentAlert() {
  26. DWTool.loadResPrefab("./prefabs/share_dialog")
  27. .then((result) => {
  28. let talent = cc.instantiate(result);
  29. let canvas = cc.find("Canvas");
  30. canvas.addChild(talent);
  31. });
  32. };
  33. // 显示培养成功界面
  34. static showArtistTrainCompletion(data, zIndex = 0) {
  35. DWTool.loadResPrefab("./prefabs/artist_train_completion")
  36. .then((result) => {
  37. let alert = cc.instantiate(result);
  38. alert.zIndex = zIndex;
  39. let canvas = cc.find("Canvas");
  40. canvas.addChild(alert);
  41. alert.getComponent('ArtistTrainCompletion').init(data);
  42. });
  43. };
  44. // 艺人没有职业时弹窗提示
  45. static showArtistTrainNoJob(cb, zIndex = 0) {
  46. DWTool.loadResPrefab("./prefabs/artist_train_no_job")
  47. .then((result) => {
  48. let alert = cc.instantiate(result);
  49. alert.zIndex = zIndex;
  50. let canvas = cc.find("Canvas");
  51. canvas.addChild(alert);
  52. alert.getComponent('ArtistTrainNoJob').init(cb);
  53. });
  54. }
  55. // 召回艺人/举报艺人
  56. static showArtistOperationAlert() {
  57. DWTool.loadResPrefab("./prefabs/artist_operation_alert")
  58. .then((result) => {
  59. let alert = cc.instantiate(result);
  60. let canvas = cc.find("Canvas");
  61. canvas.addChild(alert);
  62. });
  63. }
  64. // 显示选择驻场艺人
  65. static showArtistResident() {
  66. DWTool.loadResPrefab("./prefabs/artist_resident")
  67. .then((result) => {
  68. let artistResident = cc.instantiate(result);
  69. let canvas = cc.find("Canvas");
  70. canvas.addChild(artistResident);
  71. });
  72. }
  73. static showNoticePopup() {
  74. DWTool.loadResPrefab("./prefabs/notice_popup")
  75. .then((result) => {
  76. let alert = cc.instantiate(result);
  77. let canvas = cc.find("Canvas");
  78. canvas.addChild(alert);
  79. });
  80. }
  81. }
  82. module.exports = AlertManager;