UIUtils.ts
2.44 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
import { DeepReadonly } from "simba-utils";
import { DailyQuestType } from "../../avg/EditorEnums";
import { GameTextData } from "../../common/gameplay/gamedata/GameTextData";
import { UIManager } from "../../common/gameplay/managers/UIManager";
import { StringUtils } from "../../common/utils/StringUtils";
import { IItemConfig } from "../../config/ItemConfig";
import { CommonLocation, ExposureType, ShowLocationType, ShowType } from "../Enums";
import GameDotMgr from "../GameDotMgr";
import { GameModelManager } from "../model/GameModelManager";
import AlertDialogViewPresenter from "./presenter/AlertDialogViewPresenter";
import { AlertDialogViewProps } from "./view/type/AlertDialogView";
export namespace UIUtils {
// export function showAddEnergy(itemConfig: DeepReadonly<IItemConfig>, itemCount?: number) {
// return new Promise<boolean>((resolve) => {
// itemCount = itemCount === undefined ? 0 : itemCount;
// let isAd = itemCount <= 0;
// let txt = "";
// if (isAd) {
// txt = StringUtils.format(GameModelManager.getLanguageTxt(GameTextData.GAME_TEXT_MAIN_ENERGY_PLAYAD_VALUE));
// } else {
// txt = StringUtils.format(GameModelManager.getLanguageTxt(GameTextData.GAME_TEXT_MAIN_ENERGY_USEDRINKS_VALUE), itemConfig.energy_recover, itemCount);
// }
// let temp: AlertDialogViewProps =
// {
// dataptr: {},
// titlecontent: GameModelManager.getLanguageTxt(GameTextData.GAME_TEXT_MAIN_ENERGY_NOTENOUGH_VALUE),
// content: txt,
// ishasad: isAd,
// istwobtn: true,
// adconfig: "inject_fruit",
// location: CommonLocation.Energy,
// hasBanner: !isAd,
// callback: (type, ret) => {
// if (ret && !isAd) {
// let player = GameModelManager.getPlayerData();
// player.addProps(itemConfig.id, -1);
// }
// if (ret && type === "video") {
// GameModelManager.addDailyTasks(DailyQuestType.Dq_AdsWatch, 1);
// }
// resolve(ret);
// }
// };
// UIManager.pushPresenter(AlertDialogViewPresenter, temp);
// GameDotMgr.getInstance().dotExposure(ExposureType.Energy);
// })
// };
}