DebugViewPresenter.ts
3.53 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import { SDK } from "simba-sdk";
import { GameRecord, PlotManager } from "../../../avg/AVG";
import { Presenter } from "../../../common/classbase/PresenterBase";
import { UIManager } from "../../../common/gameplay/managers/UIManager";
import { BedRoomCatModelManager } from "../../model/BedRoomCatModelManager";
import UnlockSpecialPlotEventManager from "../../model/UnlockSpecialPlotEventManager";
import { UnlockSpecialPlotModelManager } from "../../model/UnlockSpecialPlotModelManager";
import { RegPresenter } from "../PresenterCCViewFactory";
import { DebugView, DebugViewProps, DebugViewType } from "../view/type/DebugView";
@RegPresenter(DebugViewType)
export default class DebugViewPresenter extends Presenter<undefined, DebugView>{
static uuid = "DebugViewPresenter";
private _viewProps: DebugViewProps;
constructor() {
super();
this._viewProps = {
playerID: SDK.getLoginInfo()?.playerId + "",
onCopyIdBtnClickCallback: this.onCopyIdBtnClickCallback,
onClearRecordBtnClickCallback: this.onClearRecordBtnClickCallback,
onCopyRecordBtnClickCallback: this.onCopyRecordBtnClickCallback,
onYouHuaBtnClickCallback: this.onYouHuaBtnClickCallback,
onShouBiaoBtnClickCallback: this.onShouBiaoBtnClickCallback,
onCatFoodBtnClickCallback: this.onCatFoodBtnClickCallback,
onCannedBtnClickCallback: this.onCannedBtnClickCallback,
onClearSuitShareRecordBtnClickCallback: this.onClearSuitShareRecordBtnClickCallback,
};
}
onOpen() {
super.onOpen(undefined);
this.view.setProps(this._viewProps);
}
onCopyIdBtnClickCallback = async () => {
try {
await SDK.setClipboardData(this._viewProps.playerID);
UIManager.showToast("复制ID成功!");
} catch (error) {
console.error(error);
}
}
onClearRecordBtnClickCallback = () => {
try {
PlotManager.stop();
GameRecord.emptyRecords();
UIManager.showToast("清除成功,1秒后退出游戏!");
setTimeout(() => {
SDK.exit();
}, 1000);
} catch (error) {
console.error(error);
}
}
onCopyRecordBtnClickCallback = async () => {
try {
await SDK.setClipboardData(GameRecord.getRecordAsString());
UIManager.showToast("复制存档成功!");
} catch (error) {
console.error(error);
}
}
onYouHuaBtnClickCallback = () => {
UnlockSpecialPlotEventManager.getInstance().cdKeyUnlockSpecialPlot(1, 1);
UIManager.showSceneToast("解锁了新的番外,记得去卧室查看哦~");
}
onShouBiaoBtnClickCallback = () => {
UnlockSpecialPlotModelManager.saveUnlockedSpecialPlotIdByItemIdToGameRecord(4);
UIManager.showSceneToast("解锁了新的番外,记得去卧室查看哦~");
}
onCatFoodBtnClickCallback = (foodNumber: number) => {
BedRoomCatModelManager.setCatFoodNumberByFoodId(1, foodNumber);
UIManager.showSceneToast("修改成功");
}
onCannedBtnClickCallback = (foodNumber: number) => {
BedRoomCatModelManager.setCatFoodNumberByFoodId(2, foodNumber);
UIManager.showSceneToast("修改成功");
}
onClearSuitShareRecordBtnClickCallback = () => {
BedRoomCatModelManager.clearSuitShareRecord();
UIManager.showSceneToast("清除成功");
}
}