import { DailyRedType, OpenType, RedDotType, RedUtilType, TeamChallengeType } from "../const/TypeConst";
import { UserRed, UserRedPram } from "../../common/Xyc";

import EventMng from "../../manager/EventMng";
import GameDataCenter from "../GameDataCenter";
import { GameEvent } from "../const/EventConst";
import IDataModel from "../../frameWork/model/IDataModel";
import { RedUtil } from "../../frameWork/fgui/RedUtil";
import { SevBack } from "../../common/Xys";

// 红点模块
export default class RedDotModel extends IDataModel {
	constructor() {
		super("reddot");
		GameDataCenter.setRspModel("actRed", this);
		RedUtil.clear();
		//洞天
		// RedUtil.registerBaseRed(RedUtilType.dongtian_dt, GameDataCenter.mine.checkDtUnlock, GameDataCenter.mine);
		// RedUtil.registerBaseRed(RedUtilType.dongtian_dtxl, GameDataCenter.mine.CheckRedDtCanXl, GameDataCenter.mine);
		// RedUtil.registerBaseRed(RedUtilType.dongtian_tq_shop, GameDataCenter.mine.CheckTqShopRed, GameDataCenter.mine);
		// RedUtil.registerUpperRed(RedUtilType.dongtian_tq_enter, [RedUtilType.dongtian_tq_shop]);

	}
	loginRedInfo: { [key: string]: number } = {};
	doSevback(result: SevBack): void { }
	doEvent(result: SevBack): void { }

	// // 每日首次打开界面的红点设置
	// setDailyRed(type: DailyRedType) {
	// 	this.Set(`dailyRed_${type}_${GameDataCenter.user.uuid}`, GameDataCenter.time.sevTime);
	// 	this.Save();
	// 	EventMng.emit(GameEvent.UP_RED_DOT);
	// }
	// // 检测每日首次打卡界面的红点,返回是否展示
	// checkDailyRed(type: DailyRedType): boolean {
	// 	return this.Query(`dailyRed_${type}_${GameDataCenter.user.uuid}`, 0) < GameDataCenter.sevBack.other.new0;
	// }

	// // 每日登录的红点设置
	// setLoginRed(type: OpenType) {
	// 	if (this.loginRedInfo[type] != null && this.loginRedInfo[type] == 0) {
	// 		return;
	// 	}
	// 	this.loginRedInfo[type] = 0;
	// 	EventMng.emit(GameEvent.UP_RED_DOT);
	// }
	// // 检测每日登录的红点,返回是否展示
	// checkLoginRed(type: OpenType): boolean {
	// 	if (GameDataCenter.page.checkOpen(type)) {
	// 		return this.loginRedInfo[type] == null || this.loginRedInfo[type] == 1;
	// 	}
	// 	return false;
	// }

	// // 设置红点等级
	// sendSetRedLevel(key: string, val: number) {
	// 	let param: UserRedPram = { key: key, val: val };
	// 	this.send(UserRed.url, param);
	// }
	// // 获取红点显示等级 0-不显示 1-完全显示 2-轻度显示
	// getRedLevel(key: RedDotType) {
	// 	if (GameDataCenter.sevBack.actRed?.[key] == null) {
	// 		return 1;
	// 	} else {
	// 		return GameDataCenter.sevBack.actRed[key];
	// 	}
	// }
}
