f18980ee-d5fe-4d82-9f98-28123d91ab2d.js
3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"use strict";
cc._RF.push(module, 'f1898Du1f5Ngp+YKBI9kast', 'UnlockSpecialPlotEventManager');
// script/game/model/UnlockSpecialPlotEventManager.ts
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const UIManager_1 = require("../../common/gameplay/managers/UIManager");
const GameModelManager_1 = require("./GameModelManager");
const UnlockItemModelManager_1 = require("./UnlockItemModelManager");
const UnlockSpecialPlotModelManager_1 = require("./UnlockSpecialPlotModelManager");
class UnlockSpecialPlotEventManager {
/**创建单例 */
static getInstance() {
if (!UnlockSpecialPlotEventManager._instance) {
UnlockSpecialPlotEventManager._instance = new UnlockSpecialPlotEventManager();
}
return UnlockSpecialPlotEventManager._instance;
}
/**
* 兑换码解锁番外
* @param specialPlotId 要解锁的番外Id
* @param itemId 要解锁的和物品相关的Id,可为空
*/
cdKeyUnlockSpecialPlot(specialPlotId, itemId) {
UnlockSpecialPlotModelManager_1.UnlockSpecialPlotModelManager.saveUnlockedSpecialPlotIdByItemIdToGameRecord(specialPlotId);
if (itemId) {
UnlockItemModelManager_1.UnlockItemModelManager.saveItemIdToGameRecord(itemId);
UnlockItemModelManager_1.UnlockItemModelManager.saveUnlockedIntroductionItemIdToGameRecord(itemId);
}
UIManager_1.UIManager.showToast("兑换成功,请前往卧室查看呦~~");
}
/**
* 次日登陆解锁番外
* @param specialPlotId 要解锁的番外Id
*/
nextDayUnlockedSpecialPlot(specialPlotId) {
//检测手表番外2次日是否需要解锁,手表番外2的番外剧情Id是4
let needUnlock = false;
if (!UnlockSpecialPlotModelManager_1.UnlockSpecialPlotModelManager.checkSpecialPlotIdIsUnlocked(specialPlotId)) {
needUnlock = true;
}
//获取第一次登陆的时间
UnlockSpecialPlotModelManager_1.UnlockSpecialPlotModelManager.saveFirstDayTime();
let firstDayTime = UnlockSpecialPlotModelManager_1.UnlockSpecialPlotModelManager.getFirstDayTime();
if (needUnlock && firstDayTime) {
let canUnlock = GameModelManager_1.GameModelManager.checkOverdue(firstDayTime);
if (canUnlock) {
UnlockSpecialPlotModelManager_1.UnlockSpecialPlotModelManager.saveUnlockedSpecialPlotIdByItemIdToGameRecord(specialPlotId);
UIManager_1.UIManager.showSceneToast("解锁了新的番外,记得去卧室查看哦~");
}
}
}
isShowBedRoomRedDotStatus(itemId) {
let allSpecialPlotId = UnlockSpecialPlotModelManager_1.UnlockSpecialPlotModelManager.allSpecialPlotIdByItemId(itemId);
//判断是否有未解锁的番外
let unlockedSpecialPlotId = UnlockSpecialPlotModelManager_1.UnlockSpecialPlotModelManager.unlockedSpecialPlotIdByItemId(itemId);
if (unlockedSpecialPlotId.length !== allSpecialPlotId.length) {
return true;
}
//判断是否有未观看的番外
let clickedSpecialPlotId = UnlockSpecialPlotModelManager_1.UnlockSpecialPlotModelManager.clickedSpecialPlotIdByItemId(itemId);
if (clickedSpecialPlotId.length !== allSpecialPlotId.length) {
return true;
}
return false;
}
}
exports.default = UnlockSpecialPlotEventManager;
cc._RF.pop();