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.
112 lines
4.1 KiB
112 lines
4.1 KiB
1 week ago
|
import Common5 from "../../Platform/th/Common5";
|
||
|
|
||
|
//冰雪世界
|
||
|
const {ccclass, property} = cc._decorator;
|
||
|
|
||
|
let CaiShangConfigs = [
|
||
|
|
||
|
{ id:6, pName:'刘抢东西',GongSiName:'井洞科技', menkanMoney:100000000, smallestDrop:-10, biggestDrop:-20, smallestGains:10, biggestGains:20},
|
||
|
{ id:5, pName:'李彦轰隆', GongSiName:'摆渡科技',menkanMoney:200000000, smallestDrop:-10, biggestDrop:-20, smallestGains:10, biggestGains:20},
|
||
|
{ id:4, pName:'王兴发', GongSiName:'丑团科技',menkanMoney:300000000, smallestDrop:-10, biggestDrop:-20, smallestGains:10, biggestGains:20},
|
||
|
{ id:3, pName:'玛云朵',GongSiName:'阿离麻麻', menkanMoney:400000000, smallestDrop:-10, biggestDrop:-20, smallestGains:10, biggestGains:20},
|
||
|
{ id:2, pName:'马化疼你',GongSiName:'疼顺科技', menkanMoney:500000000, smallestDrop:-10, biggestDrop:-20, smallestGains:10, biggestGains:20},
|
||
|
{ id:1, pName:'马斯二虎', GongSiName:'特能拉科技', menkanMoney:600000000,smallestDrop:-10, biggestDrop:-20, smallestGains:10, biggestGains:20},
|
||
|
{ id:0, pName:'皮尔盖子',GongSiName:'喂软科技', menkanMoney:700000000, smallestDrop:-10, biggestDrop:-20, smallestGains:10, biggestGains:20},
|
||
|
|
||
|
]
|
||
|
|
||
|
let GuPiaoConfig = [
|
||
|
5000,6800,8000,10000,12000,18000,24000,36000,40000,48000,51000,64000,75000,82000,94000,100000
|
||
|
]
|
||
|
|
||
|
let Proportion = 0.2
|
||
|
|
||
|
@ccclass
|
||
|
export default class CaiShangManager{
|
||
|
static nextList: any[] = [];
|
||
|
static fixList: any[] = [];
|
||
|
static gupiaoNum = 0;
|
||
|
|
||
|
public static getManagerConfigs(){
|
||
|
return CaiShangConfigs
|
||
|
}
|
||
|
public static initManager(){
|
||
|
this.fixList = []
|
||
|
this.nextList = []
|
||
|
}
|
||
|
|
||
|
public static getCurCaiShangList(){
|
||
|
// let list_ = []
|
||
|
// let valueDate = ChengHaoManager.getChenghaoMangheConfig()
|
||
|
// let allMoney = Math.floor(valueDate.BonusbaseNum*Proportion)
|
||
|
// allMoney = Math.floor(allMoney)
|
||
|
// for(let value of CaiShangConfigs){
|
||
|
// let copydemo = Common5.deepClone(value)
|
||
|
// copydemo.menkanMoney = Math.floor(allMoney*copydemo.multiplicationIndex)
|
||
|
// list_.push(copydemo)
|
||
|
// }
|
||
|
return Common5.deepClone(CaiShangConfigs)
|
||
|
}
|
||
|
|
||
|
public static getGupiaoNum(){
|
||
|
let index_ = Common5.getRandomNum(0, GuPiaoConfig.length)
|
||
|
let nums = GuPiaoConfig[index_]
|
||
|
// this.gupiaoNum = nums
|
||
|
return nums
|
||
|
}
|
||
|
|
||
|
public static getOneGupiaoMoney(menkanMoney,gupiaoNum){
|
||
|
// return Math.floor(menkanMoney/this.gupiaoNum)
|
||
|
return Math.floor(menkanMoney/gupiaoNum)
|
||
|
}
|
||
|
|
||
|
public static getMinMenkan(){
|
||
|
let list_ = CaiShangManager.getCurCaiShangList()
|
||
|
let min = -1
|
||
|
for(let value of list_){
|
||
|
if(min == -1){
|
||
|
min = value.menkanMoney
|
||
|
}
|
||
|
if(value.menkanMoney <= min ){
|
||
|
min = value.menkanMoney
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return min
|
||
|
}
|
||
|
//生成涨跌幅比率
|
||
|
public static createDropOrGainsRate(config,startFixPrice,curPrice,leftRiseTimes){
|
||
|
let randomRate = 0
|
||
|
//随机涨或跌
|
||
|
let riseval = 50
|
||
|
if (curPrice > 2*startFixPrice){
|
||
|
//涨的概率降低
|
||
|
riseval = 30
|
||
|
}
|
||
|
else if (curPrice < 0.5*startFixPrice){
|
||
|
if (curPrice <= 0.1*startFixPrice){
|
||
|
riseval = 100
|
||
|
}
|
||
|
else{
|
||
|
//涨的概率提升
|
||
|
riseval = 70//+= (50 * ((config.startFixPrice*0.8-curPrice)/(config.startFixPrice*0.8))) * 1.2
|
||
|
}
|
||
|
}
|
||
|
//连涨次数
|
||
|
if(leftRiseTimes > 0){
|
||
|
riseval = 100
|
||
|
}
|
||
|
let bGains = Common5.getRandomNum(0,100)
|
||
|
if (bGains <= riseval){
|
||
|
//涨
|
||
|
randomRate = Common5.getRandomNum(config.smallestGains*10,config.biggestGains*10)
|
||
|
}
|
||
|
else{
|
||
|
//跌
|
||
|
randomRate = Common5.getRandomNum(config.smallestDrop*10,config.biggestDrop*10)
|
||
|
}
|
||
|
let trueRate = (randomRate/10).toFixed(1)
|
||
|
//console.log("trueRate=",trueRate)
|
||
|
return trueRate
|
||
|
}
|
||
|
}
|