// 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 AppPlatform from "../../FrameWork/Util/AppPlatform"; import Common5 from "../../Platform/th/Common5"; import GuWanManager from "./GuWanManager"; import GameBase from "../SCommon/GameBase"; import PrefabManage, { GameType } from "../PrefabManager/PrefabManage"; import Fangbeibao from "./Fangbeibao"; import Jianding from "./Jianding"; import UserManager from "../Manager/UserManager"; import GameReport from "../../FrameWork/Report/ZyZyReport"; const {ccclass, property} = cc._decorator; @ccclass export default class Wancheng extends GameBase { @property(cc.Node) layoutView: cc.Node = null; @property(cc.Node) videoBtn: cc.Node = null; // LIFE-CYCLE CALLBACKS: viewArray:{isBuy:boolean, goodId:number,jiandingChishu:number}[] = [] // onLoad () {} sprArray:string[]= [] parentNode:cc.Node = null // setParentData(node){ // this.parentNode = node // } onLoad () { super.onLoad() } onDestroy(){ super.onDestroy() } start(){ let callFunc = ()=>{ this.initView() } if(!Common5.guwanConfigs){ cc.loader.loadRes('Json/guwanConfig/guwanConfigs.json', function (err, gameconfig) { if (err) { return; } Common5.guwanConfigs = gameconfig.json; //console.log("古玩配置加载成功", Common5.guwanConfigs); callFunc() }); }else{ callFunc() } } initView () { let qipao = this.node.getChildByName('qipao') let lab = qipao.getChildByName('lab').getComponent(cc.Label) lab.string = '老王出品必属精品,这些古董可都是好货不要错过了' qipao.scale = 0.1 qipao.active = true cc.tween(qipao) .to(1.0, {scale:1},{easing:'backOut'}) .delay(5.0) .to(0.1, {scale:0.1}) .union() .repeatForever() .start() this.sprArray = ['真品','赝品','鉴定第二次','鉴定第一次','鉴定前'] let todayAntiqueIdList = User.getTodayAntiqueIdList() if(todayAntiqueIdList.length == 0){ //console.log('刷新数据1111111') this.refreshData() }else{ //console.log(todayAntiqueIdList,'刷新数据1111111') this.viewArray = todayAntiqueIdList this.refreshView() } for(let i =0; i{ PrefabManage.preloadPrefabByType(GameType.HuXinJianDing) },0.1) } videoBtnClick(){ //刷新数据 //Common5.playEffect("ui") console.log('videoBtnClick+++++++++++++===') //Common5.playEffect("sound/按键点击") let tab = { onClose: (finish)=>{ if(finish) { this.reportKey(()=>{ GameReport.ADReport('古玩市场刷新古董',1) }) Common5.ReportDY("inLevel", '古玩市场-AD-刷新古董'); //Common5.showTips_custom("开始抽奖"); Common5.guwanchengADNum++ this.refreshData() } else{ Common5.showTips_custom("广告未观看完"); this.reportKey(()=>{ GameReport.ADReport('古玩市场刷新古董',0) }) } },onFailed:()=>{ } } AppPlatform.playVideo_custom(tab) } refreshData(){ let tes1 = [] for(let i=0;i<17;i++){ tes1[i] = i } let xuqiuIndex = 5 // let xuqiuIndex2 = 0 let tes3 = [] tes1.sort(function(){ return 0.5 - Math.random() }) for(let i= 0;i=0){ // Common5.getPrefabFromBundle("subRes_Resources","Prefabs/UI/shangyejie/fangruBeibao",this.node.getChildByName("GameNode"),(fangruBeibao)=>{ // target['isRun'] = false // let beibao:Fangbeibao = fangruBeibao.getComponent('Fangbeibao') // beibao.setData(this.node, target) // }); PrefabManage.loadPrefabByType(GameType.HuXinGouMai, null, (fangruBeibao)=>{ target['isRun'] = false let beibao:Fangbeibao = fangruBeibao.getComponent('Fangbeibao') beibao.setData(this.node, target) }) }else{ PrefabManage.showTextTips('金币不足!',1) target['isRun'] = false } } jiandingLayerShow(targetNode){ targetNode.active = false let bagGoods:{goodId:number,jiandingChishu:number, zhenjiawupin:number, fenlei:number, goodNum:number,priceNum:number}= { goodId:0, jiandingChishu:0, zhenjiawupin:0,fenlei:0,goodNum:0,priceNum:0 } let todayAntiqueIdList = User.getTodayAntiqueIdList() let todayAntiqueIdIndex = targetNode['todayAntiqueIdIndex'] for(let i = 0; i{ // let jianding:Jianding = jiandingLayer.getComponent('Jianding') // jianding.refreshData(jiandingChishu, goodsConfig, bagGoods) // }); PrefabManage.loadPrefabByType(GameType.HuXinJianDing, null, (jiandingLayer)=>{ let jianding:Jianding = jiandingLayer.getComponent('Jianding') jianding.refreshData(jiandingChishu, goodsConfig, bagGoods) UserManager.subMoney(price) }) } fangruBeubao(targetNode){ //背包数据更新 FIX ME //更新背包数据 // 0,1,2 0假,1真,2没有鉴定,3已经鉴定,fenlei0,1,2 //bagGoodsList:{goodId:number,jiandingChishu:number, zhenjiawupin:0, fenlei:0, goodNum:number}[] = []; let bagGoods:{goodId:number,jiandingChishu:number, zhenjiawupin:number, fenlei:number, goodNum:number,priceNum:number}= { goodId:0, jiandingChishu:0, zhenjiawupin:0,fenlei:0,goodNum:0,priceNum:0 } targetNode.active = false let todayAntiqueIdList = User.getTodayAntiqueIdList() let todayAntiqueIdIndex = targetNode['todayAntiqueIdIndex'] for(let i = 0; i