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.
717 lines
27 KiB
717 lines
27 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 { ryw_Event } from "../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../FrameWork/Event/EventMgr";
|
|
import User from "../../FrameWork/User/User";
|
|
import Common5 from "../../Platform/th/Common5";
|
|
|
|
import UserManager from "../Manager/UserManager";
|
|
import AppPlatform from "../../FrameWork/Util/AppPlatform";
|
|
import PrefabManage from "../PrefabManager/PrefabManage";
|
|
import BagManager, { GoodsLocalProperty } from "../Manager/BagManager";
|
|
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
|
|
import GuWanManager from "./GuWanManager";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class Jianding extends cc.Component {
|
|
|
|
@property(cc.Label)
|
|
goodsName: cc.Label = null;
|
|
|
|
@property(cc.Label)
|
|
priceLab: cc.Label = null;
|
|
|
|
@property(cc.Node)
|
|
iconNode: cc.Node = null;
|
|
@property(cc.Node)
|
|
mabuSpine: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
jiandingBtn: cc.Node = null;
|
|
@property(cc.Node)
|
|
jiandingVideoBtn: cc.Node = null;
|
|
@property(cc.Label)
|
|
jiandingBtnChiShu: cc.Label = null;
|
|
|
|
@property(cc.Node)
|
|
doubleMaichuBtn: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
qipaoNode: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
maichuTiQianBtn: cc.Node = null;
|
|
|
|
fangRuBeiBaoBtn: cc.Node = null;
|
|
maichuBtn: cc.Node = null;
|
|
arrayNode: cc.Node[] = [];
|
|
zhenPin: cc.Node = null;
|
|
yanpin: cc.Node = null;
|
|
dierci: cc.Node = null;
|
|
diyici: cc.Node = null;
|
|
jiandingqian: cc.Node = null;
|
|
kuangwu: cc.Node = null;
|
|
jiandingChishu = null
|
|
goodsConfig = null
|
|
// LIFE-CYCLE CALLBACKS:
|
|
curPrice: number = 0
|
|
recoverPosi = null
|
|
resultGoodId: number = 0
|
|
bagItemConfig: { goodId: number, jiandingChishu: number, zhenjiawupin: number, fenlei: number, goodNum: number, priceNum: number } = null;
|
|
onLoad() {
|
|
this.zhenPin = this.iconNode.getChildByName('zhenpin')
|
|
this.yanpin = this.iconNode.getChildByName('yanpin')
|
|
this.kuangwu = this.iconNode.getChildByName('kuangwu')
|
|
this.dierci = this.iconNode.getChildByName('dierci')
|
|
this.diyici = this.iconNode.getChildByName('diyici')
|
|
this.jiandingqian = this.iconNode.getChildByName('jiandingqian')
|
|
this.recoverPosi = this.mabuSpine.getPosition()
|
|
}
|
|
|
|
start() {
|
|
this.maichuBtn = this.node.getChildByName('maichuBtn')
|
|
this.fangRuBeiBaoBtn = this.node.getChildByName('fangRuBeiBaoBtn')
|
|
let appraisalIndex = User.getAppraisalIndex()
|
|
if (appraisalIndex > 0) {
|
|
this.jiandingVideoBtn.active = false
|
|
this.jiandingBtn.active = true
|
|
this.jiandingBtnChiShu.string = appraisalIndex + ''
|
|
} else {
|
|
this.jiandingVideoBtn.active = true
|
|
this.jiandingBtn.active = false
|
|
}
|
|
|
|
this.maichuBtn.active = false
|
|
this.fangRuBeiBaoBtn.active = false
|
|
EventMgr.onceEvent_custom(ryw_Event.subBack, () => {
|
|
|
|
|
|
}, this)
|
|
|
|
}
|
|
|
|
refreshData(jiandingChishu, goodsConfig, bagItemConfig) {
|
|
this.jiandingChishu = jiandingChishu
|
|
this.bagItemConfig = bagItemConfig
|
|
this.goodsName.string = '古玩'
|
|
this.goodsConfig = goodsConfig
|
|
console.log(jiandingChishu, 'jiandingChishu++====')
|
|
console.log(this.goodsConfig, 'this.goodsConfig++====')
|
|
if (jiandingChishu > 3) {
|
|
//
|
|
//console.log('jiandingChishu++=大于3===')
|
|
} else {
|
|
|
|
}
|
|
let price = this.goodsConfig.buyPrice
|
|
let aaa = Common5.getNumberChangeHanzi(price, '1')
|
|
aaa = aaa as string
|
|
this.curPrice = price
|
|
this.priceLab.string = aaa
|
|
|
|
let spr = goodsConfig.spriteArray + '/鉴定前'
|
|
Common5.getSpriteFrameFromBundle("huxingongyuan", goodsConfig.spriteArray + '/鉴定前', this.jiandingqian.getComponent(cc.Sprite));
|
|
|
|
this.scheduleOnce(() => {
|
|
Common5.getSpriteFrameFromBundle("huxingongyuan", goodsConfig.spriteArray + '/鉴定第一次', this.diyici.getComponent(cc.Sprite));
|
|
}, 0.08)
|
|
|
|
this.scheduleOnce(() => {
|
|
Common5.getSpriteFrameFromBundle("huxingongyuan", goodsConfig.spriteArray + '/鉴定第二次', this.dierci.getComponent(cc.Sprite));
|
|
}, 0.12)
|
|
|
|
this.scheduleOnce(() => {
|
|
Common5.getSpriteFrameFromBundle("huxingongyuan", goodsConfig.spriteArray + '/赝品', this.yanpin.getComponent(cc.Sprite));
|
|
}, 0.14)
|
|
|
|
this.scheduleOnce(() => {
|
|
Common5.getSpriteFrameFromBundle("huxingongyuan", goodsConfig.spriteArray + '/真品', this.zhenPin.getComponent(cc.Sprite));
|
|
}, 0.16)
|
|
|
|
this.arrayNode = [this.jiandingqian, this.diyici, this.dierci]
|
|
this.scheduleOnce(() => {
|
|
if (jiandingChishu != null) {
|
|
if (jiandingChishu == 0) {
|
|
this.jiandingqian.active = true
|
|
this.dierci.active = true
|
|
this.diyici.active = true
|
|
} else if (jiandingChishu == 1) {
|
|
this.jiandingqian.active = false
|
|
this.dierci.active = true
|
|
this.diyici.active = true
|
|
} else if (jiandingChishu == 2) {
|
|
this.jiandingqian.active = false
|
|
this.diyici.active = false
|
|
this.dierci.active = true
|
|
}
|
|
}
|
|
}, 0.1)
|
|
|
|
}
|
|
|
|
getIsZhongjiang() {
|
|
|
|
let GuWanShiChang = [50, 50]//Common5.GameProbabillityConfig.GuWanShiChang.common
|
|
let index_ = Common5.getProbabilityResultIndex(GuWanShiChang)
|
|
//console.log( index_, 'index_+++11==')
|
|
if (index_ == 0) {
|
|
//中奖
|
|
return true
|
|
} else if (index_ == 1) {
|
|
//没有中奖
|
|
return false
|
|
}
|
|
}
|
|
|
|
getIsZhongjiang2(zhongjianggai) {
|
|
|
|
|
|
let index_ = Common5.getProbabilityResultIndex([zhongjianggai, 100 - zhongjianggai])
|
|
//console.log( index_, 'index_+++==')
|
|
|
|
|
|
//console.log( index_, 'index_+++22==')
|
|
if (index_ == 1) {
|
|
//没有中奖
|
|
return false
|
|
} else if (index_ == 0) {
|
|
//中奖
|
|
return true
|
|
}
|
|
}
|
|
|
|
jiandingClick(event) {
|
|
let target = event.target
|
|
|
|
////Common5.playEffect("ui")
|
|
Common5.playEffect("CommonRes/sound/按键点击")
|
|
|
|
|
|
if (this.jiandingBtn['isAun']) {
|
|
return
|
|
}
|
|
// Common5.ReportDY("inLevel", '古玩市场-免费鉴定');
|
|
if (!this.jiandingBtn['isAun']) {
|
|
this.jiandingBtn['isAun'] = true
|
|
}
|
|
|
|
let jiandingChishu = this.jiandingChishu
|
|
if (jiandingChishu == 3) {
|
|
PrefabManage.showTextTips('当前物品不需要鉴定', 1)
|
|
return
|
|
}
|
|
|
|
|
|
|
|
|
|
this.jiandingChishu = this.jiandingChishu + 1
|
|
|
|
//每天抹布次数建-
|
|
let appraisalIndex = User.getAppraisalIndex()
|
|
appraisalIndex = appraisalIndex - 1
|
|
User.setAppraisalIndex(appraisalIndex)
|
|
this.jiandingBtnChiShu.string = appraisalIndex + ''
|
|
if (appraisalIndex == 0) {
|
|
this.jiandingBtn.active = false
|
|
this.jiandingVideoBtn.active = true
|
|
this.doubleMaichuBtn.active = false
|
|
if (this.jiandingChishu >= 3) {
|
|
this.jiandingVideoBtn.active = false
|
|
}
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
jiandingChishu = this.jiandingChishu
|
|
let goodId = this.goodsConfig.id
|
|
//播放动画
|
|
let posiData = this.goodsConfig.chachuPosiArray[jiandingChishu - 1]
|
|
let posi = cc.v2(posiData[0], posiData[1])
|
|
|
|
let realTingProbability = this.goodsConfig.realTingProbability //概率
|
|
let isSpine = this.goodsConfig.isSpine
|
|
this.mabuSpine.setPosition(posi)
|
|
this.mabuSpine.getComponent(sp.Skeleton).setAnimation(0, "ma", false)
|
|
this.mabuSpine.getComponent(sp.Skeleton).setCompleteListener(() => {
|
|
let miaoshu = this.goodsConfig.saleTalk[jiandingChishu - 1]
|
|
// this.qipaoNode.scale = 0.01
|
|
// this.qipaoNode.active = true
|
|
// let label_ = this.qipaoNode.getChildByName('qipaoLab').getComponent(cc.Label)
|
|
// label_.string = ''
|
|
// cc.tween(this.qipaoNode )
|
|
// .to(0.3,{scale:1})
|
|
// .call(()=>{
|
|
// label_.string = miaoshu
|
|
// })
|
|
// .start()
|
|
this.mabuSpine.setPosition(this.recoverPosi)
|
|
let node_ = this.arrayNode[jiandingChishu - 1]
|
|
this.jiandingBtn['isAun'] = false
|
|
node_.active = false
|
|
if (jiandingChishu == 1) {
|
|
this.node.getChildByName('suixie1').active = true
|
|
}
|
|
if (jiandingChishu == 2) {
|
|
this.node.getChildByName('suixie2').active = true
|
|
}
|
|
if (jiandingChishu == 3) {
|
|
this.node.getChildByName('suixie3').active = true
|
|
// this.scheduleOnce(()=>{
|
|
// this.qipaoNode.active = false
|
|
// },2)
|
|
}
|
|
|
|
this.curPrice = this.goodsConfig.salePrices[jiandingChishu - 1]
|
|
|
|
this.bagItemConfig.jiandingChishu = this.jiandingChishu
|
|
if (jiandingChishu == 2) {
|
|
this.maichuTiQianBtn.active = true
|
|
} else {
|
|
this.maichuTiQianBtn.active = false
|
|
}
|
|
|
|
if (jiandingChishu >= 3) {
|
|
//检验真伪
|
|
|
|
this.jiandingBtn.active = false
|
|
// this.maichuBtn.active = true
|
|
// this.doubleMaichuBtn.active = true
|
|
this.fangRuBeiBaoBtn.active = true
|
|
|
|
|
|
|
|
let zhenPrice = this.goodsConfig.salePrices[2]
|
|
let jiaPrice = this.goodsConfig.jiahuoPrice
|
|
if (realTingProbability == 50) {
|
|
let iszhong = this.getIsZhongjiang()
|
|
for (let i = 0; i < this.arrayNode.length; i++) {
|
|
let node_ = this.arrayNode[i]
|
|
node_.active = false
|
|
}
|
|
if (iszhong) {
|
|
|
|
this.bagItemConfig.zhenjiawupin = 1
|
|
this.curPrice = zhenPrice
|
|
this.resultGoodId = this.goodsConfig.zhenGoodId
|
|
this.yanpin.active = false
|
|
this.zhenPin.active = true
|
|
miaoshu = this.goodsConfig.saleTalk[jiandingChishu - 1]
|
|
this.goodsName.string = this.goodsConfig.goodName
|
|
|
|
} else {
|
|
this.goodsName.string = "假" + this.goodsConfig.goodName
|
|
this.bagItemConfig.zhenjiawupin = 0
|
|
this.curPrice = jiaPrice
|
|
this.resultGoodId = this.goodsConfig.jiaGoodId
|
|
this.yanpin.active = true
|
|
this.zhenPin.active = false
|
|
miaoshu = this.goodsConfig.saleTalk[3]
|
|
}
|
|
} else {
|
|
let iszhong = this.getIsZhongjiang2(realTingProbability)
|
|
if (iszhong) {
|
|
this.goodsName.string = this.goodsConfig.goodName
|
|
this.bagItemConfig.zhenjiawupin = 1
|
|
this.curPrice = zhenPrice
|
|
this.resultGoodId = this.goodsConfig.zhenGoodId
|
|
this.yanpin.active = false
|
|
this.zhenPin.active = true
|
|
miaoshu = this.goodsConfig.saleTalk[jiandingChishu - 1]
|
|
// if(isSpine){
|
|
// this.yanpin.active = false
|
|
// this.zhenPin.active = false
|
|
// this.kuangwu.active = true
|
|
// }
|
|
} else {
|
|
this.goodsName.string = "假" + this.goodsConfig.goodName
|
|
this.bagItemConfig.zhenjiawupin = 0
|
|
this.curPrice = jiaPrice
|
|
this.resultGoodId = this.goodsConfig.jiaGoodId
|
|
this.yanpin.active = true
|
|
this.zhenPin.active = false
|
|
miaoshu = this.goodsConfig.saleTalk[3]
|
|
}
|
|
|
|
}
|
|
//背包数据更新 FIX ME
|
|
|
|
} else {
|
|
this.bagItemConfig.zhenjiawupin = 3
|
|
}
|
|
//补丁(菜谱鉴定一次必出)
|
|
// if ((goodId == 18 || GuWanManager.getIsVideo()) && jiandingChishu == 1) {
|
|
if (goodId > 17 && jiandingChishu == 1) {
|
|
// if (jiandingChishu == 1) {
|
|
// let index = Math.floor(Math.random() * Common5.caiPuConfigs.length)
|
|
// let config = Common5.caiPuConfigs[index]
|
|
// this.curPrice = config.priceNum
|
|
// this.jiandingBtn.active = false
|
|
// this.jiandingVideoBtn.active = false
|
|
// this.fangRuBeiBaoBtn.active = true
|
|
// this.resultGoodId = config.goodId
|
|
// this.goodsName.string = config.goodName
|
|
// Common5.getSpriteFrameFromBundle("GoodIcon", 'icon/' + config.goodId, this.diyici.getComponent(cc.Sprite));
|
|
this.checkTask(jiandingChishu)
|
|
}
|
|
|
|
|
|
|
|
this.bagItemConfig.priceNum = this.curPrice
|
|
// User.updataBagGoodsList(this.bagItemConfig)
|
|
|
|
console.log(this.curPrice)
|
|
let aaa = Common5.getNumberChangeHanzi(this.curPrice, '1', 1)
|
|
aaa = aaa as string
|
|
this.priceLab.string = aaa
|
|
|
|
})
|
|
}
|
|
|
|
checkTask(jiandingChishu) {
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
let configData = TaskManager.getTaskConfigById(mainId)
|
|
let GMGoodIdArray = configData.GMGoodIdArray
|
|
let taskCaiGouDan = configData.taskCaiGouDan
|
|
if (taskCaiGouDan && taskCaiGouDan.length > 0) {
|
|
// let index = Math.floor(Math.random() * Common5.caiPuConfigs.length)
|
|
// let config = Common5.caiPuConfigs[index]
|
|
let goodArray = [{ goodId: this.goodsConfig.id, goodNum: 1 }]//this.getTaskGoods()
|
|
// if (goodArray[0].goodId == 0) {
|
|
// return
|
|
// }
|
|
let config = BagManager.getGoodsProperty(goodArray[0].goodId)
|
|
this.curPrice = config.priceNum
|
|
this.jiandingBtn.active = false
|
|
this.jiandingVideoBtn.active = false
|
|
this.fangRuBeiBaoBtn.active = true
|
|
this.resultGoodId = config.goodId
|
|
this.goodsName.string = config.goodName
|
|
Common5.getSpriteFrameFromBundle("GoodIcon", 'icon/' + config.goodId, this.diyici.getComponent(cc.Sprite));
|
|
Common5.setRemoteSpriteFrame(this.diyici.getComponent(cc.Sprite), 'GoodIcon/' + config.goodId)
|
|
for (let i = 0; i < this.arrayNode.length; i++) {
|
|
let node_ = this.arrayNode[i]
|
|
node_.active = false
|
|
}
|
|
this.diyici.active = true
|
|
}
|
|
}
|
|
|
|
getTaskGoods() {
|
|
//获得物品..
|
|
let goodArray = [{ goodId: 0, goodNum: 1 }]
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
let configData = TaskManager.getTaskConfigById(mainId)
|
|
let GMGoodIdArray = configData.GMGoodIdArray
|
|
let taskCaiGouDan = configData.taskCaiGouDan
|
|
if (taskCaiGouDan && taskCaiGouDan.length > 0) {
|
|
if (GuWanManager.getIsVideo()) {//当前已经看过广告
|
|
for (let i = 0; i < GMGoodIdArray.length; i++) {
|
|
if (BagManager.getBagGoodNums(GMGoodIdArray[i]) <= 0) {
|
|
goodArray = [{ goodId: GMGoodIdArray[i], goodNum: 1 }]
|
|
GuWanManager.setIsVideo(false)
|
|
break
|
|
}
|
|
}
|
|
if (goodArray[0].goodId == 0) {
|
|
for (let i = 0; i < taskCaiGouDan.length; i++) {
|
|
if (BagManager.getBagGoodNums(taskCaiGouDan[i]) <= 0 && GMGoodIdArray.indexOf(taskCaiGouDan[i]) == -1) {
|
|
goodArray = [{ goodId: taskCaiGouDan[i], goodNum: 1 }]
|
|
break
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
for (let i = 0; i < taskCaiGouDan.length; i++) {
|
|
if (BagManager.getBagGoodNums(taskCaiGouDan[i]) <= 0 && GMGoodIdArray.indexOf(taskCaiGouDan[i]) == -1) {
|
|
goodArray = [{ goodId: taskCaiGouDan[i], goodNum: 1 }]
|
|
break
|
|
}
|
|
}
|
|
}
|
|
return goodArray
|
|
}
|
|
|
|
}
|
|
|
|
maichuClick(event) {
|
|
Common5.playEffect("CommonRes/sound/按键点击")
|
|
let target = event.target
|
|
////Common5.playEffect("ui")
|
|
UserManager.addMoney(this.curPrice, target)
|
|
this.node.removeFromParent()
|
|
}
|
|
|
|
|
|
tiqianMaichuVDClick(event) {
|
|
Common5.playEffect("CommonRes/sound/按键点击")
|
|
let target = event.target
|
|
////Common5.playEffect("ui")
|
|
|
|
|
|
Common5.playEffect("CommonRes/sound/按键点击")
|
|
let tab = {
|
|
onClose: (finish) => {
|
|
if (finish) {
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
Common5.ReportDY("inLevel", `任务${mainId}-AD-古玩市场提前卖出`);
|
|
|
|
UserManager.addMoney(this.curPrice, target)
|
|
this.node.removeFromParent()
|
|
} else {
|
|
Common5.showTips_custom("广告未观看完");
|
|
}
|
|
}, onFailed: () => {
|
|
|
|
}
|
|
}
|
|
AppPlatform.playVideo_custom(tab)
|
|
|
|
}
|
|
|
|
|
|
doubleMaichuClick(event) {
|
|
let target = event.target
|
|
////Common5.playEffect("ui")
|
|
Common5.playEffect("CommonRes/sound/按键点击")
|
|
let tab = {
|
|
onClose: (finish) => {
|
|
if (finish) {
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
Common5.ReportDY("inLevel", `任务${mainId}-AD-古玩市场翻倍卖出`);
|
|
|
|
UserManager.addMoney(this.curPrice * 2, target)
|
|
this.node.removeFromParent()
|
|
} else {
|
|
Common5.showTips_custom("广告未观看完");
|
|
}
|
|
}, onFailed: () => {
|
|
|
|
}
|
|
}
|
|
AppPlatform.playVideo_custom(tab)
|
|
|
|
}
|
|
onBtnFangRuBeiBaoClick() {
|
|
Common5.playEffect("CommonRes/sound/按键点击")
|
|
|
|
let bagConfig: GoodsLocalProperty = {
|
|
goodId: this.resultGoodId,
|
|
goodNum: 1,
|
|
}
|
|
BagManager.addBagList(bagConfig)
|
|
//检测任务完成
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
let configData = TaskManager.getTaskConfigById(mainId)
|
|
let GMGoodIdArray = configData.GMGoodIdArray
|
|
let taskCaiGouDan = configData.taskCaiGouDan
|
|
let isHave = true
|
|
for (let i = 0; i < taskCaiGouDan.length; i++) {
|
|
if (BagManager.getBagGoodNums(taskCaiGouDan[i]) <= 0) {
|
|
isHave = false
|
|
break
|
|
}
|
|
}
|
|
if (isHave) {
|
|
if (mainId == MainTaskIdEnum.MainTask_1202) {
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1202)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1203)
|
|
User.setRoomBtnIndex(1)
|
|
} else if (mainId == MainTaskIdEnum.MainTask_2002) {
|
|
BagManager.addBagList({ goodId: 3733, goodNum: 1 })
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_2002)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2003)
|
|
} else if (mainId == MainTaskIdEnum.MainTask_2304) {
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_2304)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2305)
|
|
} else if (mainId == MainTaskIdEnum.MainTask_2604) {
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_2604)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_2701)
|
|
}
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
}
|
|
|
|
this.node.removeFromParent()
|
|
}
|
|
VideoClick() {
|
|
Common5.playEffect("CommonRes/sound/按键点击")
|
|
////Common5.playEffect("ui")
|
|
if (this.jiandingVideoBtn['isAun']) {
|
|
return
|
|
}
|
|
if (!this.jiandingVideoBtn['isAun']) {
|
|
this.jiandingVideoBtn['isAun'] = true
|
|
}
|
|
|
|
let tab = {
|
|
onClose: (finish) => {
|
|
if (finish) {
|
|
//Common5.showTips_custom("开始抽奖");
|
|
//this.mabuChachu()
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
Common5.ReportDY("inLevel", `任务${mainId}-AD-古玩市场获取次数`);
|
|
|
|
User.setAppraisalIndex(5)
|
|
let appraisalIndex = User.getAppraisalIndex()
|
|
if (appraisalIndex > 0) {
|
|
this.jiandingVideoBtn.active = false
|
|
this.jiandingBtn.active = true
|
|
this.jiandingBtnChiShu.string = appraisalIndex + ''
|
|
} else {
|
|
this.jiandingVideoBtn.active = true
|
|
this.jiandingBtn.active = false
|
|
|
|
}
|
|
}
|
|
else {
|
|
this.jiandingVideoBtn['isAun'] = false
|
|
Common5.showTips_custom("广告未观看完");
|
|
}
|
|
}, onFailed: () => {
|
|
|
|
}
|
|
}
|
|
AppPlatform.playVideo_custom(tab)
|
|
}
|
|
|
|
mabuChachu() {
|
|
|
|
if (this.jiandingChishu == 3) {
|
|
PrefabManage.showTextTips('当前物品不需要鉴定', 1)
|
|
return
|
|
}
|
|
|
|
this.jiandingChishu = this.jiandingChishu + 1
|
|
|
|
let jiandingChishu = this.jiandingChishu
|
|
//播放动画
|
|
let posiData = this.goodsConfig.chachuPosiArray[jiandingChishu - 1]
|
|
let posi = cc.v2(posiData[0], posiData[1])
|
|
|
|
let realTingProbability = this.goodsConfig.realTingProbability //概率
|
|
// let refreshData
|
|
this.mabuSpine.setPosition(posi)
|
|
this.mabuSpine.getComponent(sp.Skeleton).setAnimation(0, "ma", false)
|
|
this.mabuSpine.getComponent(sp.Skeleton).setCompleteListener(() => {
|
|
|
|
|
|
let miaoshu = this.goodsConfig.saleTalk[jiandingChishu - 1]
|
|
// this.qipaoNode.scale = 0.01
|
|
// this.qipaoNode.active = true
|
|
// let label_ = this.qipaoNode.getChildByName('qipaoLab').getComponent(cc.Label)
|
|
// label_.string = ''
|
|
// cc.tween(this.qipaoNode )
|
|
// .to(0.3,{scale:1})
|
|
// .call(()=>{
|
|
// label_.string = miaoshu
|
|
// })
|
|
// .start()
|
|
this.mabuSpine.setPosition(this.recoverPosi)
|
|
let node_ = this.arrayNode[jiandingChishu - 1]
|
|
this.jiandingVideoBtn['isAun'] = false
|
|
node_.active = false
|
|
if (jiandingChishu == 1) {
|
|
this.node.getChildByName('suixie1').active = true
|
|
}
|
|
if (jiandingChishu == 2) {
|
|
this.node.getChildByName('suixie2').active = true
|
|
}
|
|
if (jiandingChishu == 3) {
|
|
this.node.getChildByName('suixie3').active = true
|
|
this.scheduleOnce(() => {
|
|
this.qipaoNode.active = false
|
|
}, 2)
|
|
}
|
|
|
|
this.curPrice = this.goodsConfig.salePrices[jiandingChishu - 1]
|
|
this.bagItemConfig.jiandingChishu = this.jiandingChishu
|
|
if (jiandingChishu == 2) {
|
|
this.maichuTiQianBtn.active = true
|
|
} else {
|
|
this.maichuTiQianBtn.active = false
|
|
}
|
|
if (jiandingChishu >= 3) {
|
|
//检验真伪
|
|
|
|
let goodId = this.goodsConfig.id
|
|
let zhenPrice = this.goodsConfig.salePrices[2]
|
|
let jiaPrice = this.goodsConfig.jiahuoPrice
|
|
if (realTingProbability == 50) {
|
|
let iszhong = this.getIsZhongjiang()
|
|
for (let i = 0; i < this.arrayNode.length; i++) {
|
|
let node_ = this.arrayNode[i]
|
|
node_.active = false
|
|
}
|
|
if (iszhong) {
|
|
|
|
this.curPrice = zhenPrice
|
|
this.resultGoodId = this.goodsConfig.zhenGoodId
|
|
this.bagItemConfig.zhenjiawupin = 1
|
|
this.yanpin.active = false
|
|
this.zhenPin.active = true
|
|
miaoshu = this.goodsConfig.saleTalk[jiandingChishu - 1]
|
|
this.goodsName.string = this.goodsConfig.goodName
|
|
} else {
|
|
|
|
this.goodsName.string = "假" + this.goodsConfig.goodName
|
|
this.curPrice = jiaPrice
|
|
this.resultGoodId = this.goodsConfig.jiaGoodId
|
|
this.yanpin.active = true
|
|
this.zhenPin.active = false
|
|
this.bagItemConfig.zhenjiawupin = 0
|
|
miaoshu = this.goodsConfig.saleTalk[3]
|
|
}
|
|
} else {
|
|
let iszhong = this.getIsZhongjiang2(realTingProbability)
|
|
//console.log('chufa+++===')
|
|
if (iszhong) {
|
|
this.bagItemConfig.zhenjiawupin = 1
|
|
this.curPrice = zhenPrice
|
|
this.resultGoodId = this.goodsConfig.zhenGoodId
|
|
this.yanpin.active = false
|
|
this.zhenPin.active = true
|
|
miaoshu = this.goodsConfig.saleTalk[jiandingChishu - 1]
|
|
this.goodsName.string = this.goodsConfig.goodName
|
|
} else {
|
|
this.goodsName.string = "假" + this.goodsConfig.goodName
|
|
this.bagItemConfig.zhenjiawupin = 0
|
|
this.curPrice = jiaPrice
|
|
this.resultGoodId = this.goodsConfig.jiaGoodId
|
|
this.yanpin.active = true
|
|
this.zhenPin.active = false
|
|
miaoshu = this.goodsConfig.saleTalk[3]
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
this.bagItemConfig.zhenjiawupin = 3
|
|
}
|
|
|
|
this.bagItemConfig.priceNum = this.curPrice
|
|
|
|
let aaa = Common5.getNumberChangeHanzi(this.curPrice, '1')
|
|
aaa = aaa as string
|
|
this.priceLab.string = aaa
|
|
|
|
})
|
|
}
|
|
|
|
|
|
// update (dt) {}
|
|
}
|
|
|