123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- const DWTool = require("./DWTool");
- class AlertManager {
-
- static showTrainAlert(targetUid, zIndex = 0) {
- DWTool.loadResPrefab("./prefabs/artist_train")
- .then((result) => {
- let artistTrain = cc.instantiate(result);
- artistTrain.zIndex = zIndex;
- artistTrain.getComponent('ArtistTrain').init(targetUid);
- let canvas = cc.find("Canvas");
- canvas.addChild(artistTrain);
- });
- };
-
- static showRechargeAlert(zIndex = 0) {
- DWTool.loadResPrefab("./prefabs/artist_train_alert")
- .then((result) => {
- let alert = cc.instantiate(result);
- alert.zIndex = zIndex;
- let canvas = cc.find("Canvas");
- canvas.addChild(alert);
- });
- };
-
- static showTalentAlert() {
- cc.loader.loadRes('/prefabs/talent_mission', cc.Prefab, (error, prefab) => {
- if (error === null) {
- let mission = cc.instantiate(prefab);
- mission = mission.getComponent('TalentMission');
- mission.init();
- } else {
- console.log(JSON.stringify(error));
- }
- });
- };
-
- static showArtistTrainCompletion(data, zIndex = 0) {
- DWTool.loadResPrefab("./prefabs/artist_train_completion")
- .then((result) => {
- let alert = cc.instantiate(result);
- alert.zIndex = zIndex;
- let canvas = cc.find("Canvas");
- canvas.addChild(alert);
- alert.getComponent('ArtistTrainCompletion').init(data);
- });
- };
-
- static showArtistTrainNoJob(cb, zIndex = 0) {
- DWTool.loadResPrefab("./prefabs/artist_train_no_job")
- .then((result) => {
- let alert = cc.instantiate(result);
- alert.zIndex = zIndex;
- let canvas = cc.find("Canvas");
- canvas.addChild(alert);
- alert.getComponent('ArtistTrainNoJob').init(cb);
- });
- }
-
- static showArtistResident(buildingInfo, uid, isSelf) {
- DWTool.loadResPrefab("./prefabs/artist_resident")
- .then((result) => {
- let artistResident = cc.instantiate(result);
- let canvas = cc.find("Canvas");
- artistResident.getComponent('ArtistResident').init(buildingInfo, uid, isSelf);
- canvas.addChild(artistResident);
- });
- }
-
- static showNoticePopup() {
- DWTool.loadResPrefab("./prefabs/notice_popup")
- .then((result) => {
- let alert = cc.instantiate(result);
- let canvas = cc.find("Canvas");
- canvas.addChild(alert);
- });
- }
-
- static showQuestPopup() {
- DWTool.loadResPrefab("./prefabs/quest_popup")
- .then((result) => {
- let alert = cc.instantiate(result);
- let canvas = cc.find("Canvas");
- canvas.addChild(alert);
- });
- }
-
- static showIntimacyBotEnough() {
- DWTool.loadResPrefab("./prefabs/intimacy_not_enough")
- .then((result) => {
- let alert = cc.instantiate(result);
- let canvas = cc.find("Canvas");
- canvas.addChild(alert);
- });
- }
-
- static showArtistReportSuccess(coinCount) {
- DWTool.loadResPrefab("./prefabs/artist_report_success")
- .then((result) => {
- let alert = cc.instantiate(result);
- let canvas = cc.find("Canvas");
- canvas.addChild(alert);
- alert.getComponent('ArtistReportSuccess').init(coinCount);
- });
- }
-
- static showArtistOperationAlert(buildingInfo, uid, isSelf, artistData) {
- DWTool.loadResPrefab("./prefabs/artist_operation_alert")
- .then((result) => {
- let alert = cc.instantiate(result);
- let canvas = cc.find("Canvas");
- canvas.addChild(alert);
- alert.getComponent('ArtistOperationAlert').init(buildingInfo, uid, isSelf, artistData);
- });
- }
- static showOfflineGrossIncome(grossIncome) {
- DWTool.loadResPrefab("./prefabs/offline_grossIncome")
- .then((result) => {
- let alert = cc.instantiate(result);
- let canvas = cc.find("Canvas");
- canvas.addChild(alert);
- alert.getComponent('OfflineGrossIncome').init(grossIncome);
- });
- }
- static showRankPage() {
- DWTool.loadResPrefab('./prefabs/rank_page')
- .then((result) => {
- let alert = cc.instantiate(result);
- let canvas = cc.find('Canvas');
- canvas.addChild(alert);
- });
- }
- }
- module.exports = AlertManager;
|