AlertManager.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. talent.getComponent('ShareDialog').showTalent();
  32. });
  33. };
  34. // 显示培养成功界面
  35. static showArtistTrainCompletion(data, zIndex = 0) {
  36. DWTool.loadResPrefab("./prefabs/artist_train_completion")
  37. .then((result) => {
  38. let alert = cc.instantiate(result);
  39. alert.zIndex = zIndex;
  40. let canvas = cc.find("Canvas");
  41. canvas.addChild(alert);
  42. alert.getComponent('ArtistTrainCompletion').init(data);
  43. });
  44. };
  45. // 艺人没有职业时弹窗提示
  46. static showArtistTrainNoJob(cb, zIndex = 0) {
  47. DWTool.loadResPrefab("./prefabs/artist_train_no_job")
  48. .then((result) => {
  49. let alert = cc.instantiate(result);
  50. alert.zIndex = zIndex;
  51. let canvas = cc.find("Canvas");
  52. canvas.addChild(alert);
  53. alert.getComponent('ArtistTrainNoJob').init(cb);
  54. });
  55. }
  56. // 显示选择驻场艺人
  57. static showArtistResident(buildingInfo, uid, isSelf) {
  58. DWTool.loadResPrefab("./prefabs/artist_resident")
  59. .then((result) => {
  60. let artistResident = cc.instantiate(result);
  61. let canvas = cc.find("Canvas");
  62. artistResident.getComponent('ArtistResident').init(buildingInfo, uid, isSelf);
  63. canvas.addChild(artistResident);
  64. });
  65. }
  66. static showNoticePopup() {
  67. DWTool.loadResPrefab("./prefabs/notice_popup")
  68. .then((result) => {
  69. let alert = cc.instantiate(result);
  70. let canvas = cc.find("Canvas");
  71. canvas.addChild(alert);
  72. });
  73. }
  74. // 显示亲密度不够的弹窗
  75. static showIntimacyBotEnough() {
  76. DWTool.loadResPrefab("./prefabs/intimacy_not_enough")
  77. .then((result) => {
  78. let alert = cc.instantiate(result);
  79. let canvas = cc.find("Canvas");
  80. canvas.addChild(alert);
  81. });
  82. }
  83. // 显示亲密度不够的弹窗
  84. static showArtistReportSuccess(coinCount) {
  85. DWTool.loadResPrefab("./prefabs/artist_report_success")
  86. .then((result) => {
  87. let alert = cc.instantiate(result);
  88. let canvas = cc.find("Canvas");
  89. canvas.addChild(alert);
  90. alert.getComponent('ArtistReportSuccess').init(coinCount);
  91. });
  92. }
  93. // 显示艺人操作弹窗
  94. static showArtistOperationAlert(buildingInfo, uid, isSelf, artistData) {
  95. DWTool.loadResPrefab("./prefabs/artist_operation_alert")
  96. .then((result) => {
  97. let alert = cc.instantiate(result);
  98. let canvas = cc.find("Canvas");
  99. canvas.addChild(alert);
  100. alert.getComponent('ArtistOperationAlert').init(buildingInfo, uid, isSelf, artistData);
  101. });
  102. }
  103. }
  104. module.exports = AlertManager;