觉醒时刻
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.
 
 
 
juexingshike/assets/Scripts/GuShiCaoPan/CaiShangLevel1.ts

130 lines
3.4 KiB

import User from "../../FrameWork/User/User";
import AppPlatform from "../../FrameWork/Util/AppPlatform";
import Common5 from "../../Platform/th/Common5";
import TaskManager from "../JuQingChat/TaskManager";
import CaiShangItem from "./CaiShangItem";
import CaiShangManager from "./CaiShangManager";
const {ccclass, property} = cc._decorator;
@ccclass
export default class CaiShangLevel1 extends cc.Component {
@property(cc.Label)
leftLabel: cc.Label = null;
@property(cc.Label)
minLabel: cc.Label = null;
@property(cc.Node)
contentNode: cc.Node = null;
@property(cc.Node)
itemNode: cc.Node = null;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
this.refreshView()
this.qipaoAnim()
this.refreshChallengeTime()
}
qipaoAnim(){
let qipao = this.node.getChildByName('duihua')
let lab = qipao.getChildByName('lab').getComponent(cc.Label)
qipao.scale = 0.1
qipao.active = true
cc.tween(qipao)
.call(()=>{
//this.refreshChallengeTime()
let strArray = ['哟老板你又来了,今天要买哪支股呢?', '近期股市行情大好,快快下手先到先得噢~']
let randomRate = Common5.getRandomNum(0,strArray.length)
let str = strArray[randomRate]
lab.string = str
})
.to(1.0, {scale:1},{easing:'backOut'})
.delay(5.0)
.to(0.1, {scale:0.1})
.union()
.repeatForever()
.start()
}
refreshChallengeTime(){
let times = User.getCaiShangChallengeNum()
this.leftLabel.string = times+'次'
}
refreshView(){
let list_ = CaiShangManager.getCurCaiShangList()
for(let value of list_){
let itemNode = cc.instantiate(this.itemNode)
this.contentNode.addChild(itemNode)
itemNode.setPosition(cc.v2(0,0))
let scr_:CaiShangItem = itemNode.getComponent('CaiShangItem')
scr_.refreshView(this.node, value)
}
let menkan = CaiShangManager.getMinMenkan()
this.minLabel.string = Common5.getNumberChangeHanzi(menkan)+''
}
onBtnCloseClick(){
// Common5.playEffect("CommonRes/sound/按键点击")
this.node.removeFromParent()
}
getChallengeTimeClickEvent(event){
// let times = User.getCaiShangChallengeVD()
// if(times>=1){
// Common5.showTips_customTime('今日没有刷新次数了', 1)
// return
// }
// let target = event.target
// Common5.playEffect("CommonRes/sound/按键点击")
let tab = {
onClose: (finish)=>{
if (finish) {
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
Common5.ReportDY("inLevel", `任务${mainId}-AD-股市操盘获取次数`);
let times = 3
User.setCaiShangChallengeNum(times)
// let vdTime = 1
// User.setCaiShangChallengeVD(vdTime)
this.refreshChallengeTime()
}else{
Common5.showTips_custom("广告未观看完");
}
},onFailed:()=>{
}
}
AppPlatform.playVideo_custom(tab)
}
// update (dt) {}
}