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.
738 lines
27 KiB
738 lines
27 KiB
import User from "../../FrameWork/User/User";
|
|
import Common5 from "../../Platform/th/Common5";
|
|
import DustbinManager from "./DustbinManager";
|
|
|
|
import ProbabilityManager from "./ProbabilityManager";
|
|
import ShouLieManager from "./ShouLieManager";
|
|
|
|
import TaoFenManager from "./TaoFenManager";
|
|
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
|
|
import BagManager, { BagGoodsConfig, GoodsLocalProperty } from "./BagManager";
|
|
import DiaoYuConfigManage from "../diaoyu/DiaoYuConfigManage";
|
|
|
|
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
|
|
import GMManager from "./GMManager";
|
|
import AppPlatform from "../../FrameWork/Util/AppPlatform";
|
|
import CommonDefine from "../../Platform/th/CommonDefine";
|
|
import UserManager from "./UserManager";
|
|
|
|
|
|
import QinWangLingManager from "./QinWangLingManager";
|
|
|
|
|
|
import TanWeiManager from "./TanWeiManager";
|
|
import ShipuManager from "./ShipuManager";
|
|
import MiShuManager from "./MiShuManager";
|
|
import ChaChangManager from "./ChaChangManager";
|
|
import XiuXianNongZhuangManager from "./XiuXianNongZhuangManager";
|
|
import BaiCaoJiManager from "./BaiCaoJiManager";
|
|
import BuyShopManager from "./BuyShopManager";
|
|
import ZaoCanManager from "./ZaoCanManager";
|
|
|
|
|
|
export default class InterfaceManager {
|
|
static isChange504 = false;
|
|
public static initManager() {
|
|
TanWeiManager.initManager()
|
|
ShipuManager.initManager()
|
|
MiShuManager.initManager()
|
|
ZaoCanManager.initManager()
|
|
|
|
|
|
InterfaceManager.loadAllJson()
|
|
}
|
|
|
|
|
|
public static loadAllJson() {
|
|
let DiaoYuConfigCallFunc = (callFunc) => {
|
|
DiaoYuConfigManage.loadAllJson(callFunc);
|
|
}
|
|
|
|
let DustbinConfigCallFunc = (callFunc) => {
|
|
DustbinManager.initManager(callFunc)
|
|
}
|
|
|
|
|
|
let ShouLieConfigCallFunc = (callFunc) => {
|
|
ShouLieManager.initManager(callFunc)
|
|
}
|
|
let TaoFenConfigCallFunc = (callFunc) => {
|
|
TaoFenManager.initManager(callFunc)
|
|
}
|
|
|
|
let QinWangLingConfigCallFunc = (callFunc) => {
|
|
QinWangLingManager.initManager(callFunc)
|
|
}
|
|
|
|
let ChaChangConfigCallFunc = (callFunc) => {
|
|
ChaChangManager.initManager(callFunc)
|
|
}
|
|
|
|
let XiuXianNongChangConfigCallFunc = (callFunc) => {
|
|
XiuXianNongZhuangManager.initManager(callFunc)
|
|
}
|
|
|
|
let baicaijiConfigCallFunc = (callFunc) => {
|
|
BaiCaoJiManager.initManager(callFunc)
|
|
}
|
|
|
|
let BuyShopConfigCallFunc = (callFunc) => {
|
|
BuyShopManager.initManager(callFunc)
|
|
}
|
|
|
|
|
|
//这里用递归的方式加载json,处理同时加载多个json情况
|
|
let loadJsonArr = [
|
|
DiaoYuConfigCallFunc, DustbinConfigCallFunc, ShouLieConfigCallFunc, TaoFenConfigCallFunc, QinWangLingConfigCallFunc, ChaChangConfigCallFunc, XiuXianNongChangConfigCallFunc,
|
|
baicaijiConfigCallFunc,BuyShopConfigCallFunc
|
|
]
|
|
|
|
let loadIndex = 0
|
|
let loadCallFunc = (index) => {
|
|
if (index >= loadJsonArr.length) {
|
|
return
|
|
}
|
|
|
|
console.log('mainScene页loadAllJson_', index)
|
|
let callFunc = () => {
|
|
console.log('mainScene页单个json加载完毕,加载下一个')
|
|
loadCallFunc(++loadIndex)
|
|
}
|
|
loadJsonArr[index](callFunc)
|
|
}
|
|
loadCallFunc(loadIndex)
|
|
}
|
|
|
|
|
|
public static getAllEarnMoneyInterface() {
|
|
return 100
|
|
}
|
|
|
|
|
|
|
|
public static getHaveKaiye(gameType) {
|
|
|
|
let list = User.getCanInterGameList()
|
|
for (let i = 0; i < list.length; i++) {
|
|
if (gameType == list[i]) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
let Gm = GMManager.getToggleStatus_AllGameOpen()
|
|
if (Gm) {
|
|
return true
|
|
}
|
|
|
|
let num = UserManager.getDisTaskNumByGameType(gameType)
|
|
if (num < 0) {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
// public static canInterGameList = []
|
|
public static getDaoyeTaskList() {
|
|
//任务倒爷
|
|
let subTaskInfo: any = TaskManager.getCurUnLockSubTaskInfo()
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
let daohuoList = []
|
|
console.log(subTaskInfo.Id, 'subTaskInfo.Id ++++====')
|
|
|
|
return daohuoList
|
|
}
|
|
|
|
public static setDaoyeList(gameType) {
|
|
User.setDaoyeListName(gameType)
|
|
let daohuoList = []
|
|
|
|
for (let i = 0; i < BagGoodsConfig.length; i++) {
|
|
if (gameType == BagGoodsConfig[i].gameType) {
|
|
let obj = {
|
|
goodId: BagGoodsConfig[i].goodId,
|
|
buyNum: BagGoodsConfig[i].buyNum,
|
|
buyPercent: 10,
|
|
gameType: BagGoodsConfig[i].gameType
|
|
}
|
|
daohuoList.push(obj)
|
|
}
|
|
}
|
|
User.setDaoyeGoodList(daohuoList)
|
|
}
|
|
public static getDaoyeList() {
|
|
return User.getDaoyeGoodList()
|
|
}
|
|
|
|
|
|
|
|
public static getGoodInGameE(goodsId) {
|
|
if (goodsId >= 1000 && goodsId <= 1099) {
|
|
return 'NiFengKuaidi'
|
|
} else if (goodsId >= 1200 && goodsId <= 1299) {
|
|
return 'ShouLie'
|
|
} else if (goodsId >= 1300 && goodsId <= 1399) {
|
|
return 'Diaoyu'
|
|
} else if (goodsId >= 1400 && goodsId <= 1499) {
|
|
return 'XiaoMaibu'
|
|
} else if (goodsId >= 1500 && goodsId <= 1599) {
|
|
return 'IceWorld'
|
|
} else if (goodsId >= 1100 && goodsId <= 1199) {
|
|
return 'Dustbin'
|
|
} else if (goodsId >= 1600 && goodsId <= 1699) {
|
|
return 'TaoFen'
|
|
} else if (goodsId == 1711) {
|
|
return 'Diaoyu'
|
|
}
|
|
}
|
|
|
|
public static DiTanSaleGoods(price) {
|
|
//let num = 1
|
|
User.setDitanSaleGoodsIndex(price)
|
|
|
|
}
|
|
|
|
public static changeList(gameType, goodArray, isCanchangeList, isAD) {
|
|
// let config = BagManager.getJuQingGoodConfig()
|
|
|
|
//保底生效,出GM物品
|
|
if (isCanchangeList) {
|
|
let goodIdTemp = 0
|
|
let gameTypeCompare = '-999'
|
|
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
let configData = null
|
|
|
|
//优先任务Gm
|
|
let isHaveTaskGm = false
|
|
if (mainId != MainTaskIdEnum.MainTask_None && mainId) {
|
|
configData = TaskManager.getTaskConfigById(mainId)
|
|
//console.log(configData, 'config++++++++++++==')
|
|
if (configData.GMGoodIdArray && (configData.GMGameType == gameType)) {
|
|
isHaveTaskGm = true
|
|
// goodIdTemp = configData.GMGoodIdArray[0]
|
|
for (let i = 0; i < configData.GMGoodIdArray.length; i++) {
|
|
let goodId = configData.GMGoodIdArray[i]
|
|
if (BagManager.getBagGoodNums(goodId) <= 0) {
|
|
goodIdTemp = goodId
|
|
break
|
|
}
|
|
}
|
|
//goodIdTemp = configData.GMGoodIdArray[0]
|
|
gameTypeCompare = configData.GMGameType
|
|
}
|
|
}
|
|
if (!isHaveTaskGm) {
|
|
let daoYeList = InterfaceManager.getDaoyeList()
|
|
if (daoYeList.length > 0) {
|
|
// goodIdTemp = daoYeList[0].goodId
|
|
let config = BagManager.getJuQingGoodConfig(daoYeList[0].goodId)
|
|
gameTypeCompare = config.GMGameType
|
|
for (let i = 0; i < daoYeList.length; i++) {
|
|
let goodId = daoYeList[i].goodId
|
|
if (BagManager.getBagGoodNums(goodId) <= 0) {
|
|
goodIdTemp = goodId
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
console.log(goodIdTemp, gameTypeCompare, 'gameTypeCompare+++++++++++=====')
|
|
if (gameTypeCompare == gameType) {
|
|
console.log('正是这个玩法')
|
|
|
|
|
|
let goodId = goodIdTemp
|
|
let goodsNum = BagManager.getBagGoodNums(goodId)
|
|
if (goodsNum <= 0) {
|
|
|
|
let isHave = false
|
|
for (let i = 0; i < goodArray.length; i++) {
|
|
if (goodArray[i].goodId == goodIdTemp || goodIdTemp == 0) {
|
|
isHave = true
|
|
break
|
|
}
|
|
}
|
|
|
|
if (isHave) {
|
|
console.log('列表有任务物品不需要变换')
|
|
return goodArray
|
|
} else {
|
|
//商人收购单某些物品不能免费刷出,只能广告刷出
|
|
|
|
let juQingGoodConfig = BagManager.getJuQingGoodConfig(goodId)
|
|
let isCanOut = true
|
|
if (!isAD) {
|
|
if (juQingGoodConfig && !juQingGoodConfig.isCanFreeOut) {
|
|
isCanOut = false
|
|
}
|
|
}
|
|
if (isCanOut) {
|
|
for (let i = 0; i < goodArray.length; i++) {
|
|
goodArray[i].goodId = goodId
|
|
break
|
|
}
|
|
}
|
|
console.log('商人收购单某些物品不能免费刷出,只能广告刷出', goodId, isCanOut)
|
|
console.log('背包没有任务物品,变换完成')
|
|
return goodArray
|
|
}
|
|
|
|
} else {
|
|
console.log('背包有任务物品不需要变换')
|
|
return goodArray
|
|
}
|
|
|
|
} else if (gameTypeCompare == '-999') {
|
|
console.log('不是这个玩法')
|
|
let daoyeGoodList = User.getDaoyeGoodList()
|
|
//判断倒爷的道具是这个玩法的并且数量不足的情况
|
|
//console.log(daoyeGoodList, 'daoyeGoodList+++判断倒爷的道具是这个玩法的并且数量不足的情况++++++++=====')
|
|
let daoyeJiaohuo = User.getDaoyeJiaoHuo()
|
|
if (daoyeJiaohuo) {
|
|
//
|
|
console.log(goodArray, '倒爷已经提交货单了')
|
|
return goodArray
|
|
} else {
|
|
let tempList = []
|
|
for (let i = 0; i < daoyeGoodList.length; i++) {
|
|
let gameTypeGet = this.getGoodInGameE(daoyeGoodList[i].goodId)
|
|
if (gameTypeGet == gameType) {
|
|
tempList[tempList.length] = BagManager.getGoodsProperty(daoyeGoodList[i].goodId)
|
|
}
|
|
}
|
|
if (tempList.length == 0) {
|
|
//console.log(goodArray,'提货单没有这个玩法的道具')
|
|
return goodArray
|
|
} else {
|
|
|
|
let goodIdTemp = 0
|
|
for (let i = 0; i < tempList.length; i++) {
|
|
let buyNum = tempList[i].buyNum || 0
|
|
let haveNum = BagManager.getBagGoodNums(tempList[i].goodId)
|
|
if (haveNum < buyNum) {
|
|
goodIdTemp = tempList[i].goodId
|
|
break
|
|
}
|
|
}
|
|
console.log(goodIdTemp, '替换这个道具')
|
|
// 开始改变list
|
|
let isHave = false
|
|
for (let i = 0; i < goodArray.length; i++) {
|
|
if (goodArray[i].goodId == goodIdTemp || goodIdTemp == 0) {
|
|
isHave = true
|
|
break
|
|
}
|
|
}
|
|
|
|
if (isHave) {
|
|
console.log(goodIdTemp, '正准备给了这个道具')
|
|
return goodArray
|
|
} else {
|
|
if (goodIdTemp == 0) {
|
|
console.log(goodArray, '没有匹配的goodId')
|
|
return goodArray
|
|
} else {
|
|
for (let i = 0; i < goodArray.length; i++) {
|
|
goodArray[i].goodId = goodIdTemp
|
|
break
|
|
}
|
|
|
|
console.log(goodIdTemp, '切换道具')
|
|
return goodArray
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
} else {
|
|
//
|
|
console.log('不需要变换')
|
|
return goodArray
|
|
}
|
|
|
|
} else {
|
|
return goodArray
|
|
}
|
|
}
|
|
|
|
public static getMangheGoodsListByType(gameType, goodsNum = 1, isAD = false, probabilityType = 'common') {
|
|
//根据游戏类型和是否广告获取配置的概率
|
|
let pro = ProbabilityManager.getMangHeProbability(gameType, goodsNum, isAD, probabilityType)
|
|
console.log(pro, 'pro+++++++++===')
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
console.log('getMangheGoodsListByType==', gameType, goodsNum, isAD, probabilityType)
|
|
//根据保底逻辑判断是否GM保底生效
|
|
let isCanchangeList = ProbabilityManager.getCanChangeList(gameType)
|
|
if (gameType == 'Dustbin') {
|
|
let goodArray = []
|
|
let list_ = DustbinManager.getCurGoodList()
|
|
for (let i = 0; i < goodsNum; i++) {
|
|
let index_ = Common5.getProbabilityResultIndex(pro)
|
|
console.log(index_, 'goodIndex+++++++')
|
|
let goods = list_[index_]
|
|
let data_ = { goodId: 0, goodNum: 1, goodIndex: 0 }
|
|
data_.goodId = goods.goodId
|
|
data_.goodIndex = index_
|
|
|
|
|
|
let isHaveData = false
|
|
for (let value of goodArray) {
|
|
if (value.goodId == data_.goodId && value.goodIndex == data_.goodIndex) {
|
|
isHaveData = true
|
|
value.goodNum++
|
|
break
|
|
}
|
|
}
|
|
|
|
if (!isHaveData) {
|
|
goodArray.push(data_)
|
|
}
|
|
}
|
|
|
|
// console.log(goodArray, 'goodArray111++')
|
|
|
|
let goodArrayNew = this.changeList(gameType, goodArray, isCanchangeList, isAD)
|
|
return goodArrayNew
|
|
|
|
} else if (gameType == 'Diaoyu') {
|
|
let goodArray = []
|
|
let list_ = DiaoYuConfigManage.getCurGoodList()
|
|
for (let i = 0; i < goodsNum; i++) {
|
|
let index_ = Common5.getProbabilityResultIndex(pro)
|
|
console.log(index_, 'goodIndex+++++++')
|
|
let goods = list_[index_]
|
|
let data_ = { goodId: 0, goodNum: 1, goodIndex: 0 }
|
|
data_.goodId = goods.goodId
|
|
data_.goodIndex = index_
|
|
let isHaveData = false
|
|
|
|
// if(mainId == MainTaskIdEnum.MainTask_506){
|
|
// let tempId = 1706
|
|
// if(BagManager.getBagGoodNums(tempId) <= 0){
|
|
// data_.goodId = tempId
|
|
// }
|
|
// }
|
|
|
|
for (let value of goodArray) {
|
|
if (value.goodId == data_.goodId && value.goodIndex == data_.goodIndex) {
|
|
isHaveData = true
|
|
value.goodNum++
|
|
break
|
|
}
|
|
}
|
|
|
|
if (!isHaveData) {
|
|
goodArray.push(data_)
|
|
}
|
|
}
|
|
|
|
// console.log(goodArray, 'goodArray111++')
|
|
|
|
let goodArrayNew = this.changeList(gameType, goodArray, isCanchangeList, isAD)
|
|
return goodArrayNew
|
|
|
|
} else if (gameType == 'IceWorld') {
|
|
|
|
} else if (gameType == 'NiFengKuaidi') {
|
|
|
|
} else if (gameType == 'ShouLie') {
|
|
let goodArray = []
|
|
let list_ = ShouLieManager.getCurGoodList()
|
|
//console.log('狩猎list=====',list_)
|
|
//console.log(list_, 'list_+++++++++++++++==')
|
|
for (let i = 0; i < goodsNum; i++) {
|
|
let index_ = Common5.getProbabilityResultIndex(pro)
|
|
let goods = list_[index_]
|
|
console.log(index_, 'index_+++++++')
|
|
let data_ = { goodId: 0, goodNum: 1, goodIndex: 0 }
|
|
data_.goodId = goods.goodId
|
|
data_.goodIndex = index_
|
|
|
|
let isHaveData = false
|
|
for (let value of goodArray) {
|
|
if (value.goodId == data_.goodId && value.goodIndex == data_.goodIndex) {
|
|
isHaveData = true
|
|
value.goodNum++
|
|
break
|
|
}
|
|
}
|
|
if (!isHaveData) {
|
|
goodArray.push(data_)
|
|
}
|
|
}
|
|
let goodArrayNew = this.changeList(gameType, goodArray, isCanchangeList, isAD)
|
|
return goodArrayNew
|
|
} else if (gameType == 'TaoFen') {
|
|
let goodArray = []
|
|
let list_ = TaoFenManager.getCurGoodList()
|
|
for (let i = 0; i < goodsNum; i++) {
|
|
let index_ = Common5.getProbabilityResultIndex(pro)
|
|
let goods = list_[index_]
|
|
console.log(index_, 'index_+++++++')
|
|
let data_ = { goodId: 0, goodNum: 1, goodIndex: 0 }
|
|
data_.goodId = goods.goodId
|
|
data_.goodIndex = index_
|
|
let isHaveData = false
|
|
for (let value of goodArray) {
|
|
if (value.goodId == data_.goodId && value.goodIndex == data_.goodIndex) {
|
|
isHaveData = true
|
|
value.goodNum++
|
|
break
|
|
}
|
|
}
|
|
if (!isHaveData) {
|
|
goodArray.push(data_)
|
|
}
|
|
}
|
|
let goodArrayNew = this.changeList(gameType, goodArray, isCanchangeList, isAD)
|
|
return goodArrayNew
|
|
|
|
} else if (gameType == 'MoTuoChe') {
|
|
|
|
} else if (gameType == 'ChaoFanLin') {
|
|
let goodArray = []
|
|
let list_ = QinWangLingManager.getCurGoodList()
|
|
|
|
for (let i = 0; i < goodsNum; i++) {
|
|
let index_ = Common5.getProbabilityResultIndex(pro)
|
|
let goods = list_[index_]
|
|
console.log(index_, 'index_+++++++')
|
|
let data_ = { goodId: 0, goodNum: 1, goodIndex: 0 }
|
|
data_.goodId = goods.goodId
|
|
data_.goodIndex = index_
|
|
|
|
let isHaveData = false
|
|
for (let value of goodArray) {
|
|
if (value.goodId == data_.goodId && value.goodIndex == data_.goodIndex) {
|
|
isHaveData = true
|
|
value.goodNum++
|
|
break
|
|
}
|
|
}
|
|
if (!isHaveData) {
|
|
goodArray.push(data_)
|
|
}
|
|
}
|
|
let goodArrayNew = this.changeList(gameType, goodArray, isCanchangeList, isAD)
|
|
return goodArrayNew
|
|
} else if (gameType == 'ChaChang') {
|
|
let list_ = ChaChangManager.getCurGoodList()
|
|
let goodArray = []
|
|
let goodIndex = []
|
|
while (goodArray.length < goodsNum) {
|
|
let index_ = Common5.getProbabilityResultIndex(pro)
|
|
let goods = list_[index_]
|
|
if (goodIndex.indexOf(index_) >= 0) {
|
|
|
|
} else {
|
|
goodIndex[goodIndex.length] = index_
|
|
let objData = {
|
|
goodId: goods.goodId,
|
|
goodNum: 1
|
|
}
|
|
goodArray[goodArray.length] = objData
|
|
}
|
|
}
|
|
console.log(goodArray, '茶场goodArray++++=====')
|
|
|
|
let goodArrayNew = this.changeList(gameType, goodArray, isCanchangeList, isAD)
|
|
return goodArrayNew
|
|
} else if (gameType == 'XiuXianNongZhuang') {
|
|
let list_ = XiuXianNongZhuangManager.getCurGoodList()
|
|
let goodArray = []
|
|
let goodIndex = []
|
|
while (goodArray.length < goodsNum) {
|
|
let index_ = Common5.getProbabilityResultIndex(pro)
|
|
let goods = list_[index_]
|
|
if (goodIndex.indexOf(index_) >= 0) {
|
|
|
|
} else {
|
|
goodIndex[goodIndex.length] = index_
|
|
let objData = {
|
|
goodId: goods.goodId,
|
|
goodNum: 1
|
|
}
|
|
goodArray[goodArray.length] = objData
|
|
}
|
|
}
|
|
console.log(goodArray, '休闲农庄goodArray++++=====')
|
|
|
|
let goodArrayNew = this.changeList(gameType, goodArray, isCanchangeList, isAD)
|
|
return goodArrayNew
|
|
} else if (gameType == 'BaiCaoJi') {
|
|
let list_ = BaiCaoJiManager.getCurGoodList()
|
|
let goodArray = []
|
|
let goodIndex = []
|
|
while (goodArray.length < goodsNum) {
|
|
let index_ = Common5.getProbabilityResultIndex(pro)
|
|
let goods = list_[index_]
|
|
if (goodIndex.indexOf(index_) >= 0) {
|
|
|
|
} else {
|
|
goodIndex[goodIndex.length] = index_
|
|
let objData = {
|
|
goodId: goods.goodId,
|
|
goodNum: 1
|
|
}
|
|
goodArray[goodArray.length] = objData
|
|
}
|
|
}
|
|
console.log(goodArray, '佰草集goodArray++++=====')
|
|
|
|
let goodArrayNew = this.changeList(gameType, goodArray, isCanchangeList, isAD)
|
|
return goodArrayNew
|
|
} else if (gameType == 'GuShu') {
|
|
let list_ = BaiCaoJiManager.getGuShuCurGoodList()
|
|
let goodArray = []
|
|
let goodIndex = []
|
|
while (goodArray.length < goodsNum) {
|
|
let index_ = Common5.getProbabilityResultIndex(pro)
|
|
let goods = list_[index_]
|
|
if (goodIndex.indexOf(index_) >= 0) {
|
|
|
|
} else {
|
|
goodIndex[goodIndex.length] = index_
|
|
let objData = {
|
|
goodId: goods.goodId,
|
|
goodNum: 1
|
|
}
|
|
goodArray[goodArray.length] = objData
|
|
}
|
|
}
|
|
console.log(goodArray, '古树goodArray++++=====')
|
|
|
|
let goodArrayNew = this.changeList(gameType, goodArray, isCanchangeList, isAD)
|
|
return goodArrayNew
|
|
} else if (gameType == 'BaiCaoJi') {
|
|
|
|
} else if (gameType == 'GuShu') {
|
|
|
|
} else if (gameType == 'ShouHuoJi') {
|
|
let list_ = BuyShopManager.getCurGoodList()
|
|
let goodArray = []
|
|
let goodIndex = []
|
|
while (goodArray.length < goodsNum) {
|
|
let index_ = Common5.getProbabilityResultIndex(pro)
|
|
let goods = list_[index_]
|
|
console.log('sy123==list_=', list_, index_, goods)
|
|
if (goodIndex.indexOf(index_) >= 0) {
|
|
|
|
} else {
|
|
goodIndex[goodIndex.length] = index_
|
|
let objData = {
|
|
"saveNum": 15,
|
|
"buyNum": 14,
|
|
"goodId": 1401,
|
|
"descStr": "鸡蛋",
|
|
"goodName": "鸡蛋",
|
|
"priceNum": 2
|
|
}
|
|
objData.saveNum = goods.saveNum
|
|
objData.buyNum = goods.buyNum
|
|
objData.goodId = goods.goodId
|
|
objData.descStr = goods.descStr
|
|
objData.goodName = goods.goodName
|
|
objData.priceNum = goods.priceNum
|
|
goodArray[goodArray.length] = objData
|
|
}
|
|
}
|
|
console.log(goodArray, '售货机goodArray++++=====')
|
|
|
|
// let goodArrayNew = this.changeList(gameType, goodArray, isCanchangeList, isAD)
|
|
// goodArrayNew.sort(function () {
|
|
// return 0.5 - Math.random()
|
|
// })
|
|
return goodArray //goodArrayNew
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// public static saveData(isShow=false){
|
|
// if(!AppPlatform.is_TT_GAME_custom()){
|
|
// if(Common5.saveTime == 0){
|
|
// Common5.saveTime = 30
|
|
// console.log('保存数据')
|
|
// let sendData = UserManager.sendDataToUrl()
|
|
// if(isShow){
|
|
// PrefabManage.showTextTips('保存数据成功')
|
|
// }
|
|
|
|
// }else{
|
|
// console.log('保存数据过于频繁请稍后再试')
|
|
|
|
// if(isShow){
|
|
// PrefabManage.showTextTips('保存数据过于频繁')
|
|
// }
|
|
// }
|
|
// }else{
|
|
|
|
// if(Common5.saveTime == 0){
|
|
// let sendData = UserManager.sendDataToUrl()
|
|
// Common5.saveTime = 30
|
|
// CommonDefine.setServerData(sendData, ()=>{
|
|
|
|
// console.log('保存数据成功')
|
|
// if(isShow){
|
|
// PrefabManage.showTextTips('保存数据成功')
|
|
// }
|
|
|
|
// }, ()=>{
|
|
// console.log('保存数据失败')
|
|
// })
|
|
// }else{
|
|
// //PrefabManage.showTextTips('保存数据过于频繁请稍后再试')
|
|
// console.log('保存数据过于频繁')
|
|
// }
|
|
|
|
// }
|
|
// }
|
|
|
|
|
|
public static taskTipBox(goodArray, taskDesc, success?, cancle?) {
|
|
let isHave = BagManager.isHaveAllGood(goodArray)
|
|
if (isHave) {
|
|
setTimeout(() => {
|
|
PrefabManage.loadPrefabByType(GameType.BoxTanChuang, null, (prefab) => {
|
|
prefab.getComponent('BoxTanChuang').setViewData(2, taskDesc, () => {
|
|
success()
|
|
})
|
|
prefab.getComponent('BoxTanChuang').setTitle(2)
|
|
})
|
|
}, 500);
|
|
|
|
}
|
|
}
|
|
|
|
public static taskTipBox2(taskDesc, success?, cancle?) {
|
|
let isHave = true
|
|
if (isHave) {
|
|
setTimeout(() => {
|
|
PrefabManage.loadPrefabByType(GameType.BoxTanChuang, null, (prefab) => {
|
|
prefab.getComponent('BoxTanChuang').setViewData(2, taskDesc, () => {
|
|
success()
|
|
})
|
|
prefab.getComponent('BoxTanChuang').setTitle(2)
|
|
})
|
|
}, 500);
|
|
|
|
}
|
|
}
|
|
|
|
public static getFixGoodListByIndex() {
|
|
let goodList = BuyShopManager.getCurGoodList()
|
|
return goodList
|
|
}
|
|
|
|
}
|
|
|