You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
4.0 KiB
101 lines
4.0 KiB
// Learn TypeScript:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
|
|
// Learn Attribute:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
|
|
// Learn life-cycle callbacks:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
import User from "../../FrameWork/User/User";
|
|
import Common5 from "../../Platform/th/Common5";
|
|
import BagManager from "./BagManager";
|
|
import InterfaceManager from "./InterfaceManager";
|
|
import UserManager from "./UserManager";
|
|
|
|
let Config = [
|
|
{ configId: 0, icon: 'res/连点器', isNeedAd: false, descLab: '加入侧边栏', miaoshu: '自动点击*1' },
|
|
{ configId: 1, icon: 'res/点击收益', isNeedAd: false, descLab: '在线3分钟', miaoshu: '点击收益提升1级', needTime: 3 * 60 },
|
|
{ configId: 2, icon: 'res/连点器', isNeedAd: false, descLab: '在线10分钟', miaoshu: '自动点击*1', needTime: 10 * 60 },
|
|
{ configId: 3, icon: 'res/免广告券', isNeedAd: false, descLab: '在线30分钟', miaoshu: '无广卷*1', needTime: 30 * 60 },
|
|
{ configId: 4, icon: 'res/连点器', isNeedAd: false, descLab: '连续登录两天', miaoshu: '自动点击*1', needDayNum: 2 },
|
|
{ configId: 5, icon: 'res/免广告券', isNeedAd: false, descLab: '连续登录三天', miaoshu: '无广卷*1', needDayNum: 3 },
|
|
{ configId: 6, icon: 'res/免广告券', isNeedAd: false, descLab: '观看10次广告', miaoshu: '无广卷*1', needADNum: 10 },
|
|
{ configId: 7, icon: 'res/免广告券', isNeedAd: false, descLab: '观看20次广告', miaoshu: '无广卷*2', needADNum: 20 },
|
|
{ configId: 8, icon: 'res/免广告券', isNeedAd: false, descLab: '连续登录七天', miaoshu: '无广卷*2', needDayNum: 7 },
|
|
]
|
|
|
|
export default class ChengJiuManager {
|
|
|
|
public static getManagerConfigs() {
|
|
return Config
|
|
}
|
|
|
|
public static getManagerConfigById(id) {
|
|
let config
|
|
for (let i = 0; i < Config.length; i++) {
|
|
if (Config[i].configId == id) {
|
|
config = Config[i]
|
|
break
|
|
}
|
|
}
|
|
return config
|
|
}
|
|
|
|
public static isHaveRedPoint(): boolean {
|
|
let isHave = false
|
|
let ChengJiuReward = User.getChengJiuReward()
|
|
for (let i = 0; i < Config.length; i++) {
|
|
if (ChengJiuReward[i] == 1) {
|
|
continue
|
|
}
|
|
|
|
if (Config[i].configId == 0) {
|
|
isHave = this.checkIsShowJiangLiBtn()
|
|
} else if (Config[i].configId >= 1 && Config[i].configId <= 3) {
|
|
let timeLimit = Config[i].needTime
|
|
let isNeedAd = Config[i].isNeedAd
|
|
console.log(UserManager.onlineTime)
|
|
if (UserManager.onlineTime >= timeLimit) {
|
|
isHave = true
|
|
}
|
|
} else if (Config[i].configId >= 4 && Config[i].configId <= 5) {
|
|
let num = User.getDengLuDayNum()
|
|
let needDayNum = Config[i].needDayNum
|
|
if (num >= needDayNum) {
|
|
isHave = true
|
|
}
|
|
} else if (Config[i].configId >= 6 && Config[i].configId <= 7) {
|
|
let adnum = User.getShowAdNum()
|
|
let needADNum = Config[i].needADNum
|
|
if (adnum >= needADNum) {
|
|
isHave = true
|
|
}
|
|
} else if (Config[i].configId == 8) {
|
|
let num = User.getDengLuDayNum()
|
|
let needDayNum = Config[i].needDayNum
|
|
if (num >= needDayNum) {
|
|
isHave = true
|
|
}
|
|
}
|
|
|
|
if (isHave) {
|
|
break
|
|
}
|
|
}
|
|
|
|
return isHave
|
|
}
|
|
|
|
public static checkIsShowJiangLiBtn() {
|
|
//是否已经领取过奖励
|
|
|
|
let isGetAward = User.getFinishCeBianLanAward()
|
|
|
|
// console.log(isGetAward, 'isGetAward')
|
|
// console.log(Common5.isCeBianLanEnter, 'isCeBianLanEnter')
|
|
if (Common5.isCeBianLanEnter && !isGetAward) {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
|