觉醒时刻
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.
 
 
 

764 lines
34 KiB

import { ryw_Event } from "../../../FrameWork/Event/EventEnum";
import EventMgr from "../../../FrameWork/Event/EventMgr";
import User from "../../../FrameWork/User/User";
import AppPlatform from "../../../FrameWork/Util/AppPlatform";
import Common5 from "../../../Platform/th/Common5";
import TaskManager, { MainTaskIdEnum } from "../../JuQingChat/TaskManager";
import BagManager, { GOODS_NUMBER, GoodsLocalProperty } from "../../Manager/BagManager";
import UserManager from "../../Manager/UserManager";
import PrefabManage from "../../PrefabManager/PrefabManage";
const { ccclass, property } = cc._decorator;
export let PaimaichangConfig = [
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3401, descStr: '白搭费力手表', goodName: '白搭费力手表', priceNum: 400000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3402, descStr: '仿青铜器', goodName: '仿青铜器', priceNum: 60000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3403, descStr: '翡翠金丝龙凤镯', goodName: '翡翠金丝龙凤镯', priceNum: 800000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3404, descStr: '冠军奖杯', goodName: '冠军奖杯', priceNum: 1000000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3405, descStr: '捞力事手表', goodName: '捞力事手表', priceNum: 2000000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3406, descStr: '猫眼翡翠', goodName: '猫眼翡翠', priceNum: 4000000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3407, descStr: '女王面具', goodName: '女王面具', priceNum: 6000000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3408, descStr: '女王手镯', goodName: '女王手镯', priceNum: 8000000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3409, descStr: '深海王珍珠', goodName: '深海王珍珠', priceNum: 10000000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3410, descStr: '天然化石', goodName: '天然化石', priceNum: 12000000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3411, descStr: '天然夜明灯', goodName: '天然夜明灯', priceNum: 14000000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3052, descStr: '中药材', goodName: '中药材', priceNum: 50000, isTaskGood: true, gamePro: true },
{ gameType: '', isCanFreeOut: false, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3053, descStr: '医药材料', goodName: '医药材料', priceNum: 100000, isTaskGood: true, gamePro: true },
{ gameType: '', isCanFreeOut: false, GMGameType: 'Paimaichang', buyNum: 0, saveNum: 1, goodId: 3054, descStr: '影视剧本', goodName: '影视剧本', priceNum: 200000, isTaskGood: true, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'PaiMaiHang', buyNum: 0, saveNum: 1, goodId: 3065, descStr: '技术资料1', goodName: '技术资料1', priceNum: 1000000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'PaiMaiHang', buyNum: 0, saveNum: 1, goodId: 3066, descStr: '技术资料2', goodName: '技术资料2', priceNum: 1000000, gamePro: true },
{ gameType: '', isCanFreeOut: true, GMGameType: 'PaiMaiHang', buyNum: 0, saveNum: 1, goodId: 3067, descStr: '技术资料3', goodName: '技术资料3', priceNum: 1000000, gamePro: true },
{ gameType: '', isCanFreeOut: false, GMGameType: 'PaiMaiHang', buyNum: 0, saveNum: 1, goodId: 3068, descStr: '技术资料4', goodName: '技术资料4', priceNum: 1000000, gamePro: true },
]
/**
* 物品在本地的配置
*/
export interface PaimaichangSaveStruct {
goodId: GOODS_NUMBER,
goodNum: number,
selled: boolean
}
@ccclass
export default class Paimaichang extends cc.Component {
@property(cc.Node)
goodItem: cc.Node = null;
@property(cc.Node)
goodList: cc.Node = null;
@property(cc.Node)
layer2: cc.Node = null;
@property(cc.Node)
qipaoNode: cc.Node = null;
@property(cc.Label)
priceLabel: cc.Label = null;
@property(cc.Node)
npcHand1: cc.Node = null;
@property(cc.Node)
npcHand2: cc.Node = null;
@property(cc.Node)
npcHand3: cc.Node = null;
@property(cc.Node)
djsNode: cc.Node = null;
@property(cc.Node)
ykjNode: cc.Node = null;
@property(cc.Node)
ykjVideoNode: cc.Node = null;
@property(cc.Node)
chujiaNode: cc.Node = null;
@property(cc.Node)
zichanbuzuNode: cc.Node = null;
@property(cc.Node)
luopaiNode: cc.Node = null;
@property(cc.Node)
trueNode: cc.Node = null;
@property(cc.Node)
falseNode: cc.Node = null;
@property(sp.Skeleton)
paimainNv: sp.Skeleton = null;
@property(cc.Label)
truePrice: cc.Label = null;
@property(cc.Label)
trueSellPrice: cc.Label = null;
@property(cc.Label)
falsePrice: cc.Label = null;
@property(cc.Label)
falseSellPrice: cc.Label = null;
@property(cc.Sprite)
truegoodItem: cc.Sprite = null;
@property(cc.Sprite)
falsegoodItem: cc.Sprite = null;
// LIFE-CYCLE CALLBACKS:
paimaiIndex = -1;
// onLoad () {}
goodSavedList = null;
handArr = []
oldHandIndex = -1;
lunci = 0;
priceMul = 1;
turnPaiMai = "";
cancelUpdatetm = false;
djsTime = 5;
clickIndex = -1;
curPaimaiGoodIndex = -1;
isCaiDan: boolean = false
taskGoodTab = [3052, 3053, 3054, 3065, 3066]
// pmCishu = 5;
start() {
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_CeShi)
// this.pmCishu = User.getPMCFreeNum();
this.qipaoNode.active = false;
this.initGoodList(false);
this.layer2.active = false;
this.initNPCHand();
this.handArr.push(this.npcHand1);
this.handArr.push(this.npcHand2);
this.handArr.push(this.npcHand3);
this.checkCaiDanStatus()
EventMgr.onEvent_custom(ryw_Event.NormalTouchEndCheck, (data_) => {
this.normalTouchCallback(data_.targetNode);
}, this);
}
checkCaiDanStatus() {
let status = User.getCaiDanStatus(2)
//未使用彩蛋
if (status == 0) {
this.node.getChildByName('zhuoBuTouchArea').active = true
//使用完了
} else {
this.node.getChildByName('zhuoBuTouchArea').active = false
}
}
normalTouchCallback(targetNode) {
switch (targetNode.name) {
case "彩蛋":
this.isCaiDan = true
this.layer2.getChildByName('btnLayout').getChildByName('一口价').active = false
this.paimaiIndex = -1
let spr = this.goodItem.getComponent(cc.Sprite);
Common5.getSpriteFrameFromBundle("Paimaihang", "texture/星星吉他", spr);
Common5.getSpriteFrameFromBundle("Paimaihang", "texture/星星吉他", this.truegoodItem);
Common5.getSpriteFrameFromBundle("Paimaihang", "texture/星星吉他", this.falsegoodItem);
this.layer2.active = true;
this.paimaiSay("现在开始拍卖星星吉他" + "\r\n起拍价为:" + Common5.getNumberChangeHanzi(100, '1', 1), 3);
this.priceLabel.string = "当前价格:" + Common5.getNumberChangeHanzi(100, '1', 1)
this.setChujiaText(Common5.getNumberChangeHanzi(100, '1', 1) + '');
this.ykjNode.getChildByName("label").getComponent(cc.Label).string = Common5.getNumberChangeHanzi(100, '1', 1) + ''
this.updateDjsTime();
// this.scheduleOnce(()=>{
// this.npcPai();
// },2)
break;
default:
break;
}
}
initNPCHand() {
this.npcHand1.active = false;
this.npcHand2.active = false;
this.npcHand3.active = false;
}
setChujiaText(str) {
this.chujiaNode.getChildByName("label").getComponent(cc.Label).string = str;
}
initGoodList(force) {
let taskCaiGouDan = [];
let taskInfo: any = TaskManager.getCurUnLockMainTaskInfo();
if (taskInfo && taskInfo.Id != MainTaskIdEnum.MainTask_None) {
let config = TaskManager.getTaskConfigById(taskInfo.Id);
if (config && config.taskCaiGouDan) {
taskCaiGouDan = config.taskCaiGouDan;
}
}
this.goodSavedList = this.checkSavedGoodList();
if (this.goodSavedList.length <= 0 || force) {
this.goodSavedList.length = 0
let arr = Common5.getRandomNumArr_custom(0, PaimaichangConfig.length - 8, 6);
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if (mainId == MainTaskIdEnum.MainTask_1104) {
if (BagManager.getBagGoodNums(3052) <= 0) {
arr[0] = 11
} else if (BagManager.getBagGoodNums(3053) <= 0) {
arr[0] = 12
} else if (BagManager.getBagGoodNums(3054) <= 0) {
arr[0] = 13
}
} else if (mainId == MainTaskIdEnum.MainTask_1306) {
if (BagManager.getBagGoodNums(3065) <= 0) {
arr[0] = 14
}
if (BagManager.getBagGoodNums(3066) <= 0) {
arr[1] = 15
}
// if (BagManager.getBagGoodNums(3067) <= 0) {
// arr[2] = 16
// }
// if (BagManager.getBagGoodNums(3068) <= 0 && force) {
// arr[3] = 17
// }
}
for (let i = 0; i < this.goodList.childrenCount; i++) {
this.goodList.children[i].getChildByName("show").active = true;
let spr = this.goodList.children[i].getChildByName("show").getChildByName("icon").getComponent(cc.Sprite);
Common5.getSpriteFrameFromBundle("Paimaihang", "texture/" + PaimaichangConfig[arr[i]].goodName, spr);
this.goodList.children[i].getChildByName("show").getChildByName("jiageLab").getComponent(cc.Label).string = Common5.getNumberChangeHanzi(PaimaichangConfig[arr[i]].priceNum, '1', 1) + ''
this.goodList.children[i].getChildByName("show").getChildByName("nameStr").getComponent(cc.Label).string = PaimaichangConfig[arr[i]].goodName + ''
console.log(PaimaichangConfig[arr[i]].goodName)
this.goodList.children[i].getChildByName("show").getChildByName("气泡感叹号").active = false;
if (taskCaiGouDan.indexOf(PaimaichangConfig[arr[i]].goodId) >= 0) {
if (BagManager.getBagGoodNums(PaimaichangConfig[arr[i]].goodId) <= 0) {
this.goodList.children[i].getChildByName("show").getChildByName("气泡感叹号").active = true;
//直接用远程资源
Common5.setRemoteSpriteFrame(spr, 'GoodIcon/' + PaimaichangConfig[arr[i]].goodId)
}
}
}
for (let i = 0; i < arr.length; i++) {
this.goodSavedList.push({ id: arr[i], isFinish: false })
}
// this.goodSavedList = arr;
User.setPaimaiList(this.goodSavedList);
}
else {
for (let i = 0; i < this.goodList.childrenCount; i++) {
// if (this.goodSavedList[i] < 0){
// this.goodList.children[i].getChildByName("show").active = false;
// continue;
// }
// else {
// this.goodList.children[i].getChildByName("show").active = true;
// }
if (this.goodSavedList[i].isFinish) {
this.goodList.children[i].getChildByName("show").active = false;
continue
} else {
this.goodList.children[i].getChildByName("show").active = true;
}
let spr = this.goodList.children[i].getChildByName("show").getChildByName("icon").getComponent(cc.Sprite);
Common5.getSpriteFrameFromBundle("Paimaihang", "texture/" + PaimaichangConfig[this.goodSavedList[i].id].goodName, spr);
this.goodList.children[i].getChildByName("show").getChildByName("jiageLab").getComponent(cc.Label).string = Common5.getNumberChangeHanzi(PaimaichangConfig[this.goodSavedList[i].id].priceNum, '1', 1) + ''
this.goodList.children[i].getChildByName("show").getChildByName("nameStr").getComponent(cc.Label).string = PaimaichangConfig[this.goodSavedList[i].id].goodName + ''
console.log(PaimaichangConfig[this.goodSavedList[i].id].goodName)
this.goodList.children[i].getChildByName("show").getChildByName("气泡感叹号").active = false;
if (taskCaiGouDan.indexOf(PaimaichangConfig[this.goodSavedList[i].id].goodId) >= 0) {
if (BagManager.getBagGoodNums(PaimaichangConfig[this.goodSavedList[i].id].goodId) <= 0) {
this.goodList.children[i].getChildByName("show").getChildByName("气泡感叹号").active = true;
//直接用远程资源
Common5.setRemoteSpriteFrame(spr, 'GoodIcon/' + PaimaichangConfig[this.goodSavedList[i].id].goodId)
}
}
}
}
console.log('this.goodSavedList==', this.goodSavedList)
}
updateDjsTime() {
this.unschedule(this.refDjsTime);
this.djsTime = 5;
this.djsNode.getComponent(cc.Label).string = "倒计时:" + this.djsTime;
this.djsNode.active = true;
this.cancelUpdatetm = false;
this.schedule(this.refDjsTime, 1, 5)
}
refDjsTime() {
this.djsTime = this.djsTime - 1;
if (this.djsTime < 0 || this.cancelUpdatetm) {
this.djsNode.active = false;
this.unschedule(this.refDjsTime)
}
else {
this.djsNode.getComponent(cc.Label).string = "倒计时:" + this.djsTime;
}
if (this.djsTime < 0) {
this.finishPaimai();
}
}
checkSavedGoodList() {
let goodSavedList = User.getPaimainList();
// if (goodSavedList.length == 0){
// return null;
// }
// else {
// for (let i = 0; i < goodSavedList.length; i++){
// if (goodSavedList[i] >= 0){
// return goodSavedList;
// }
// }
// }
// return null;
return goodSavedList
}
refGoodlist() {
let tab = {
onClose: (finish) => {
if (finish) {
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
Common5.ReportDY("inLevel", `任务${mainId}-AD-拍卖行刷新`);
this.initGoodList(true);
} else {
Common5.showTips_custom("广告未观看完");
}
}, onFailed: () => {
Common5.showTips_custom("广告观看失败");
}
}
AppPlatform.playVideo_custom(tab)
}
clickItem(event, index) {
this.lunci = 0
this.isCaiDan = false
this.layer2.getChildByName('btnLayout').getChildByName('一口价').active = true
console.log(index)
if (this.checkMoney(index)) {
let spr = this.goodItem.getComponent(cc.Sprite);
Common5.getSpriteFrameFromBundle("Paimaihang", "texture/" + PaimaichangConfig[this.goodSavedList[index].id].goodName, spr);
Common5.getSpriteFrameFromBundle("Paimaihang", "texture/" + PaimaichangConfig[this.goodSavedList[index].id].goodName, this.truegoodItem);
Common5.getSpriteFrameFromBundle("Paimaihang", "texture/" + PaimaichangConfig[this.goodSavedList[index].id].goodName, this.falsegoodItem);
// 任务道具直接用远程资源
let taskCaiGouDan = [];
let taskInfo: any = TaskManager.getCurUnLockMainTaskInfo();
if (taskInfo && taskInfo.Id != MainTaskIdEnum.MainTask_None) {
let config = TaskManager.getTaskConfigById(taskInfo.Id);
if (config && config.taskCaiGouDan) {
taskCaiGouDan = config.taskCaiGouDan;
}
}
if (taskCaiGouDan.indexOf(PaimaichangConfig[this.goodSavedList[index].id].goodId) >= 0) {
//直接用远程资源
Common5.setRemoteSpriteFrame(spr, 'GoodIcon/' + PaimaichangConfig[this.goodSavedList[index].id].goodId)
Common5.setRemoteSpriteFrame(this.truegoodItem, 'GoodIcon/' + PaimaichangConfig[this.goodSavedList[index].id].goodId)
Common5.setRemoteSpriteFrame(this.falsegoodItem, 'GoodIcon/' + PaimaichangConfig[this.goodSavedList[index].id].goodId)
}
this.layer2.active = true;
this.curPaimaiGoodIndex = this.goodSavedList[this.paimaiIndex].id;
this.paimaiSay("现在开始拍卖" + PaimaichangConfig[this.curPaimaiGoodIndex].goodName + "\r\n起拍价为:" + Common5.getNumberChangeHanzi(PaimaichangConfig[this.curPaimaiGoodIndex].priceNum, '1', 1), 3);
this.priceLabel.string = "当前价格:" + Common5.getNumberChangeHanzi(PaimaichangConfig[this.curPaimaiGoodIndex].priceNum, '1', 1)
this.setChujiaText(Common5.getNumberChangeHanzi(PaimaichangConfig[this.curPaimaiGoodIndex].priceNum, '1', 1) + '');
this.ykjNode.getChildByName("label").getComponent(cc.Label).string = Common5.getNumberChangeHanzi(this.calPrice(2.8), '1', 1) + ''
this.scheduleOnce(() => {
this.npcPai();
}, 2)
}
else {
this.curPaimaiGoodIndex = this.goodSavedList[this.paimaiIndex].id;
// PrefabManage.showTextTips("您的资产暂时不能参与拍卖,再去赚点钱吧!");
this.zichanbuzuNode.active = true;
this.clickIndex = index;
}
}
finishPaimai() {
if (this.isCaiDan) {
this.paimainNv.setAnimation(0, "敲槌", false);
this.scheduleOnce(() => {
PrefabManage.showTextTips("恭喜您竞拍成功!");
UserManager.subMoney(100);
this.truePrice.string = Common5.getNumberChangeHanzi(100, '1', 1) + ''
this.trueSellPrice.string = Common5.getNumberChangeHanzi(300000000, '1', 1) + ''
this.trueNode.active = true;
this.paimainNv.setAnimation(0, "待机", true);
}, 1.5)
return
}
if (this.turnPaiMai == "NPC") {
this.paimainNv.setAnimation(0, "敲槌", false);
this.scheduleOnce(() => {
PrefabManage.showTextTips("恭喜您竞拍成功!");
UserManager.addMoney(-this.calPrice(this.priceMul));
let randIndex = Common5.getRandomNum(0, 10)
// let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
let goodId = PaimaichangConfig[this.curPaimaiGoodIndex].goodId
if (this.taskGoodTab.indexOf(goodId) >= 0) {
randIndex = 0
this.trueNode.getChildByName('卖出').active = false
this.trueNode.getChildByName('双倍卖出').active = false
this.trueNode.getChildByName('放入背包').active = true
} else {
this.trueNode.getChildByName('卖出').active = true
this.trueNode.getChildByName('双倍卖出').active = true
this.trueNode.getChildByName('放入背包').active = false
}
if (randIndex < 5) {
this.truePrice.string = Common5.getNumberChangeHanzi(this.calPrice(this.priceMul), '1', 1) + ''
this.trueSellPrice.string = Common5.getNumberChangeHanzi(this.calPrice(this.priceMul) * 1.25, '1', 1) + ''
this.trueNode.active = true;
}
else {
this.falsePrice.string = Common5.getNumberChangeHanzi(this.calPrice(this.priceMul), '1', 1) + ''
this.falseSellPrice.string = Common5.getNumberChangeHanzi(this.calPrice(this.priceMul) * 0.6, '1', 1) + ''
this.falseNode.active = true;
}
this.paimainNv.setAnimation(0, "待机", true);
}, 1.5)
}
else {
// PrefabManage.showTextTips("真可惜,您落拍了!");
this.luopaiNode.active = true;
}
this.goodSavedList[this.paimaiIndex].isFinish = true;
User.setPaimaiList(this.goodSavedList);
this.initGoodList(false);
// this.scheduleOnce(()=>{
// this.layer2.active = false;
// },1)
}
calPrice(mulPrice) {
return Math.floor(PaimaichangConfig[this.curPaimaiGoodIndex].priceNum * mulPrice / 10) * 10
}
npcPai() {
if (this.turnPaiMai == "WANJIA") {
console.log('npcPai=========1111111')
return;
}
if (this.lunci > 3) {
console.log('npcPai=========2222222')
return;
}
if (this.lunci == 3) {
if (Common5.getRandomNum(0, 9) <= 7) {
console.log('npcPai=========3333333')
return;
}
}
if (this.lunci == 2) {
if (Common5.getRandomNum(0, 9) <= 1) {
console.log('npcPai=========4444444')
return;
}
}
console.log('npcPai=========AAAAAAAAAA')
this.turnPaiMai = "WANJIA";
this.lunci++;
this.priceMul += Common5.getRandomNum(40, 61) / 100;
this.priceLabel.string = "当前价格:" + Common5.getNumberChangeHanzi(this.calPrice(this.priceMul), '1', 1)
this.priceLabel.node.stopAllActions()
cc.tween(this.priceLabel.node)
.to(0.2, { scale: 1.6 })
.to(0.2, { scale: 1 })
.start()
this.setChujiaText(Common5.getNumberChangeHanzi(this.calPrice(this.priceMul + 0.4), '1', 1) + '')
let num = Common5.getRandomNum(0, 3);
while (num == this.oldHandIndex) {
num = Common5.getRandomNum(0, 3);
}
this.oldHandIndex = num;
this.handArr[num].active = true;
this.scheduleOnce(() => {
this.handArr[num].active = false;
this.updateDjsTime();
}, 1)
}
checkMoney(index) {
this.paimaiIndex = index;
if (PaimaichangConfig[this.goodSavedList[index].id].priceNum > User.getMoney()) {
return false;
}
else {
return true;
}
}
paimaiSay(str, disappearTime) {
this.qipaoNode.getChildByName("label").getComponent(cc.Label).string = str;
this.qipaoNode.active = true;
this.scheduleOnce(() => {
this.qipaoNode.active = false;
}, disappearTime)
}
clickChujia() {
if (this.isCaiDan) {
this.updateDjsTime();
// this.lunci = 4;
// this.unschedule(this.refDjsTime);
// UserManager.subMoney(100)
// this.truePrice.string = Common5.getNumberChangeHanzi(100,'1',1)+''
// this.trueSellPrice.string = Common5.getNumberChangeHanzi(300000000,'1',1)+''
// this.trueNode.active = true;
return
}
if (this.turnPaiMai == "NPC") {
// PrefabManage.showTextTips("您已出价,请耐心等待!");
this.paimaiSay("您已出价,请耐心等待!", 1.5);
return;
}
let tmpPriceMul = 1;
if (this.priceMul > 1) {
tmpPriceMul = this.priceMul + 0.4;
}
if (User.getMoney() < this.calPrice(this.priceMul)) {
PrefabManage.showTextTips("您的资产不足,不能出价!", User.getMoney(),);
return;
}
this.priceMul += 0.4;
this.priceLabel.string = "当前价格:" + Common5.getNumberChangeHanzi(this.calPrice(this.priceMul), '1', 1)
this.priceLabel.node.stopAllActions()
cc.tween(this.priceLabel.node)
.to(0.2, { scale: 1.6 })
.to(0.2, { scale: 1 })
.start()
this.turnPaiMai = "NPC";
this.updateDjsTime();
this.scheduleOnce(() => {
this.npcPai();
}, Common5.getRandomNum(1, 4));
}
zichanbuzuVideoClick() {
}
zichanbuzuCheckClick() {
this.zichanbuzuNode.active = false;
}
luopaiCheckClick() {
this.luopaiNode.active = false;
this.scheduleOnce(() => {
this.layer2.active = false;
}, 1)
}
checkIsFinishTask() {
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
// if(mainId == MainTaskIdEnum.MainTask_626){
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_626)
// }
}
fangRuBeiBao() {
let goodId = PaimaichangConfig[this.curPaimaiGoodIndex].goodId
let bagConfig: GoodsLocalProperty = {
goodId: goodId,
goodNum: 1,
}
BagManager.addBagList(bagConfig)
this.trueNode.active = false;
this.layer2.active = false;
this.initGoodList(false);
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
let configData = TaskManager.getTaskConfigById(mainId)
let taskCaiGouDan = configData.taskCaiGouDan
if (mainId == MainTaskIdEnum.MainTask_1104) {
let isHaveAll = true
for (let i = 0; i < taskCaiGouDan.length; i++) {
if (BagManager.getBagGoodNums(taskCaiGouDan[i]) <= 0) {
isHaveAll = false
break
}
}
if (isHaveAll) {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1104)
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1105)
}
} else if (mainId == MainTaskIdEnum.MainTask_1306) {
let isHaveAll = true
for (let i = 0; i < taskCaiGouDan.length; i++) {
if (BagManager.getBagGoodNums(taskCaiGouDan[i]) <= 0) {
isHaveAll = false
break
}
}
if (isHaveAll) {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1306)
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1307)
}
}
}
trueSell() {
if (this.isCaiDan) {
UserManager.addMoney(300000000)
this.trueNode.active = false;
this.layer2.active = false;
User.setCaiDanStatus(2, 1)
return
}
UserManager.addMoney(Math.floor(this.calPrice(this.priceMul) * 1.25))
this.trueNode.active = false;
this.layer2.active = false;
this.initGoodList(false);
this.checkIsFinishTask()
}
falseSell() {
UserManager.addMoney(Math.floor(this.calPrice(this.priceMul) * 0.6))
this.falseNode.active = false;
this.layer2.active = false;
this.initGoodList(false);
this.checkIsFinishTask()
}
trueDoubleSell() {
let tab = {
onClose: (finish) => {
if (finish) {
if (this.isCaiDan) {
UserManager.addMoney(600000000)
this.trueNode.active = false;
this.layer2.active = false;
User.setCaiDanStatus(2, 1)
return
}
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
Common5.ReportDY("inLevel", `任务${mainId}-AD-拍卖行双倍卖出`);
console.log("true", this.priceMul, Math.floor(this.calPrice(this.priceMul) * 1.25 * 2))
UserManager.addMoney(Math.floor(this.calPrice(this.priceMul) * 1.25 * 2))
this.trueNode.active = false;
this.layer2.active = false;
this.initGoodList(false);
this.checkIsFinishTask()
} else {
Common5.showTips_custom("广告未观看完");
}
}, onFailed: () => {
Common5.showTips_custom("广告观看失败");
}
}
AppPlatform.playVideo_custom(tab)
}
falseDoubleSell() {
let tab = {
onClose: (finish) => {
if (finish) {
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
Common5.ReportDY("inLevel", `任务${mainId}-AD-拍卖行双倍卖出`);
console.log("false", this.priceMul, Math.floor(this.calPrice(this.priceMul) * 0.6 * 2))
UserManager.addMoney(Math.floor(this.calPrice(this.priceMul) * 0.6 * 2))
this.falseNode.active = false;
this.layer2.active = false;
this.initGoodList(false);
this.checkIsFinishTask()
} else {
Common5.showTips_custom("广告未观看完");
}
}, onFailed: () => {
Common5.showTips_custom("广告观看失败");
}
}
AppPlatform.playVideo_custom(tab)
}
ykjVideoClick() {
let tab = {
onClose: (finish) => {
if (finish) {
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
Common5.ReportDY("inLevel", `任务${mainId}-AD-拍卖行一口价`);
this.priceMul = 2.8;
this.goodSavedList[this.paimaiIndex].isFinish = true;
let randIndex = Common5.getRandomNum(0, 10)
// let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
let goodId = PaimaichangConfig[this.curPaimaiGoodIndex].goodId
if (this.taskGoodTab.indexOf(goodId) >= 0) {
// if(mainId == MainTaskIdEnum.MainTask_2206) {
randIndex = 0
this.trueNode.getChildByName('卖出').active = false
this.trueNode.getChildByName('双倍卖出').active = false
this.trueNode.getChildByName('放入背包').active = true
} else {
this.trueNode.getChildByName('卖出').active = true
this.trueNode.getChildByName('双倍卖出').active = true
this.trueNode.getChildByName('放入背包').active = false
}
if (randIndex < 5) {
this.truePrice.string = Common5.getNumberChangeHanzi(this.calPrice(2.8), '1', 1) + ''
this.trueSellPrice.string = Common5.getNumberChangeHanzi(this.calPrice(2.8) * 1.25, '1', 1) + ''
this.trueNode.active = true;
}
else {
this.falsePrice.string = Common5.getNumberChangeHanzi(this.calPrice(2.8), '1', 1) + ''
this.falseSellPrice.string = Common5.getNumberChangeHanzi(this.calPrice(2.8) * 0.6, '1', 1) + ''
this.falseNode.active = true;
}
this.zichanbuzuNode.active = false;
} else {
Common5.showTips_custom("广告未观看完");
}
}, onFailed: () => {
Common5.showTips_custom("广告观看失败");
}
}
AppPlatform.playVideo_custom(tab)
}
ykjClick() {
if (User.getMoney() < this.calPrice(2.8)) {
PrefabManage.showTextTips("您的资产不足,不能一口价买入!", User.getMoney(),);
return;
}
if (this.priceMul > 2.8) {
PrefabManage.showTextTips("当前出价已超过一口价价格,不能一口价买入!");
return;
}
this.lunci = 4;
this.goodSavedList[this.paimaiIndex].isFinish = true;
this.unschedule(this.refDjsTime);
UserManager.addMoney(-this.calPrice(2.8));
this.priceMul = 2.8;
let randIndex = Common5.getRandomNum(0, 10)
// let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
// let mainId = mainTaskInfo.Id
let goodId = PaimaichangConfig[this.curPaimaiGoodIndex].goodId
if (this.taskGoodTab.indexOf(goodId) >= 0) {
// if(mainId == MainTaskIdEnum.MainTask_2206) {
randIndex = 0
this.trueNode.getChildByName('卖出').active = false
this.trueNode.getChildByName('双倍卖出').active = false
this.trueNode.getChildByName('放入背包').active = true
} else {
this.trueNode.getChildByName('卖出').active = true
this.trueNode.getChildByName('双倍卖出').active = true
this.trueNode.getChildByName('放入背包').active = false
}
if (randIndex < 5) {
this.truePrice.string = Common5.getNumberChangeHanzi(this.calPrice(2.8), '1', 1) + ''
this.trueSellPrice.string = Common5.getNumberChangeHanzi(this.calPrice(2.8) * 1.25, '1', 1) + ''
this.trueNode.active = true;
}
else {
this.falsePrice.string = Common5.getNumberChangeHanzi(this.calPrice(2.8), '1', 1) + ''
this.falseSellPrice.string = Common5.getNumberChangeHanzi(this.calPrice(2.8) * 0.6, '1', 1) + ''
this.falseNode.active = true;
}
//买完以后干嘛?
}
// update (dt) {}
}