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.
1971 lines
74 KiB
1971 lines
74 KiB
import User from "../../FrameWork/User/User";
|
|
import Common5 from "../../Platform/th/Common5";
|
|
export let skinConfig = [
|
|
{id:0, nameStr:'敦煌彩',targetNum:500},
|
|
{id:1, nameStr:'樱花粉',targetNum:480},
|
|
{id:2, nameStr:'葡萄紫',targetNum:460},
|
|
{id:3, nameStr:'青草绿',targetNum:450},
|
|
{id:4, nameStr:'柑橘红',targetNum:450},
|
|
{id:5, nameStr:'天空蓝',targetNum:450},
|
|
{id:6, nameStr:'青瓷绿',targetNum:420},
|
|
{id:7, nameStr:'柠檬黄',targetNum:420},
|
|
{id:8, nameStr:'丁香紫',targetNum:420},
|
|
{id:9, nameStr:'灰磁盘',targetNum:400},
|
|
{id:10, nameStr:'火热红',targetNum:400},
|
|
{id:11, nameStr:'复古棕',targetNum:400},
|
|
{id:12, nameStr:'深邃蓝',targetNum:400},
|
|
{id:13, nameStr:'净白瓷',targetNum:400},
|
|
{id:14, nameStr:'深海蓝',targetNum:300},
|
|
{id:15, nameStr:'雾霾蓝',targetNum:300},
|
|
{id:16, nameStr:'玫瑰紫',targetNum:300},
|
|
{id:17, nameStr:'祖母绿',targetNum:300},
|
|
{id:18, nameStr:'咖啡棕',targetNum:300},
|
|
{id:19, nameStr:'香芋紫',targetNum:200},
|
|
{id:20, nameStr:'鲜活橙',targetNum:200},
|
|
{id:21, nameStr:'青柠绿',targetNum:200},
|
|
{id:22, nameStr:'石榴红',targetNum:180},
|
|
{id:23, nameStr:'芭比粉',targetNum:180},
|
|
{id:24, nameStr:'子鼠',targetNum:1},
|
|
{id:25, nameStr:'丑牛',targetNum:1},
|
|
{id:26, nameStr:'寅虎',targetNum:1},
|
|
{id:27, nameStr:'卯兔',targetNum:1},
|
|
{id:28, nameStr:'辰龙',targetNum:1},
|
|
{id:29, nameStr:'巳蛇',targetNum:1},
|
|
{id:30, nameStr:'午马',targetNum:1},
|
|
{id:31, nameStr:'未羊',targetNum:1},
|
|
{id:32, nameStr:'申猴',targetNum:1},
|
|
{id:33, nameStr:'酉鸡',targetNum:1},
|
|
{id:34, nameStr:'戌狗',targetNum:1},
|
|
{id:35, nameStr:'亥猪',targetNum:1},
|
|
]
|
|
|
|
//needPZNum 累计达成的数量
|
|
let tabChenghao = [
|
|
{name:'萌新菜鸟', chenghaoId:0, reward:0, needPZNum:0, maxPZ:50000},
|
|
{name:'入门选手', chenghaoId:1, reward:200, needPZNum:500, maxPZ:50000},
|
|
{name:'种子选手', chenghaoId:2, reward:400, needPZNum:1000, maxPZ:50000},
|
|
{name:'麻将新星', chenghaoId:3, reward:600, needPZNum:2000, maxPZ:50000},
|
|
{name:'麻将能手', chenghaoId:4, reward:800, needPZNum:5000, maxPZ:50000},
|
|
{name:'麻将怪才', chenghaoId:5, reward:1000, needPZNum:10000, maxPZ:50000},
|
|
{name:'麻将精英', chenghaoId:6, reward:1200, needPZNum:15000, maxPZ:50000},
|
|
{name:'麻将大师', chenghaoId:7, reward:1500, needPZNum:20000, maxPZ:50000},
|
|
{name:'麻将高手', chenghaoId:8, reward:1800, needPZNum:25000, maxPZ:50000},
|
|
{name:'麻将大佬', chenghaoId:9, reward:2000, needPZNum:30000, maxPZ:50000},
|
|
{name:'麻将王子', chenghaoId:10, reward:2200, needPZNum:35000, maxPZ:50000},
|
|
{name:'麻将之王', chenghaoId:11, reward:2300, needPZNum:40000, maxPZ:50000},
|
|
{name:'麻将祖师', chenghaoId:12, reward:2400, needPZNum:45000, maxPZ:50000},
|
|
{name:'雀神', chenghaoId:13, reward:2600, needPZNum:50000, maxPZ:50000},
|
|
]
|
|
|
|
let AllChuShiKuCun = [
|
|
{kaCao:3, ChuShiKuCun:600},
|
|
{kaCao:4, ChuShiKuCun:600},
|
|
{kaCao:5, ChuShiKuCun:600},
|
|
{kaCao:6, ChuShiKuCun:600},
|
|
{kaCao:7, ChuShiKuCun:600},
|
|
{kaCao:8, ChuShiKuCun:600},
|
|
{kaCao:9, ChuShiKuCun:600},
|
|
{kaCao:10, ChuShiKuCun:600},
|
|
{kaCao:11, ChuShiKuCun:600},
|
|
{kaCao:12, ChuShiKuCun:600},
|
|
{kaCao:13, ChuShiKuCun:600},
|
|
]
|
|
export enum GameLevel{
|
|
FirstLevel,//第一关
|
|
SecondLevel,//第二关
|
|
}
|
|
export interface GameProgressDataProperty_xmj {
|
|
unlock_cell:number,
|
|
curTargetMinNumber:number,
|
|
curTargetNumber:number,
|
|
cell_data:any,
|
|
unlock_ads9:boolean,
|
|
unlock_ads10:boolean,
|
|
unlock_ads11:boolean,
|
|
jieSuoTuJianId:number,
|
|
|
|
curXiWanChiLevel?:number[],
|
|
unlock_adsXiWanChi2?:boolean,
|
|
leftPanZiNum?:number,
|
|
curGuanQiaNum?:number,
|
|
curGuanQiaFinishNum?:number,
|
|
ads9LeftTimer?:number,
|
|
ads10LeftTimer?:number,
|
|
ads11LeftTimer?:number,
|
|
unlock_ads13?:boolean,
|
|
yiXiaoChuNum?:number,
|
|
yiXiaoChuAllNum:number,
|
|
jieSuoColorNum?:number,
|
|
gameTime?:number,
|
|
xiaoChuColorNumTab?:any,
|
|
isAutoBuPanTimer?:boolean,
|
|
autoBuPanTimeNum?:number,
|
|
curJieSuoShengXiaoId?:number,
|
|
// xiWanChi_data?:any,
|
|
}
|
|
//空格数获取发牌数
|
|
let FaPaiShu_KongGeShu_config = {
|
|
KG_10:[{faPaiShu:1,rate:0},{faPaiShu:2,rate:0},{faPaiShu:3,rate:0},{faPaiShu:4,rate:40},{faPaiShu:5,rate:40},{faPaiShu:6,rate:20}],
|
|
KG_9:[{faPaiShu:1,rate:0},{faPaiShu:2,rate:0},{faPaiShu:3,rate:0},{faPaiShu:4,rate:45},{faPaiShu:5,rate:35},{faPaiShu:6,rate:20}],
|
|
KG_8:[{faPaiShu:1,rate:0},{faPaiShu:2,rate:0},{faPaiShu:3,rate:20},{faPaiShu:4,rate:40},{faPaiShu:5,rate:30},{faPaiShu:6,rate:10}],
|
|
KG_7:[{faPaiShu:1,rate:0},{faPaiShu:2,rate:0},{faPaiShu:3,rate:40},{faPaiShu:4,rate:40},{faPaiShu:5,rate:20},{faPaiShu:6,rate:0}],
|
|
KG_6:[{faPaiShu:1,rate:0},{faPaiShu:2,rate:0},{faPaiShu:3,rate:45},{faPaiShu:4,rate:45},{faPaiShu:5,rate:10},{faPaiShu:6,rate:0}],
|
|
KG_5:[{faPaiShu:1,rate:0},{faPaiShu:2,rate:10},{faPaiShu:3,rate:40},{faPaiShu:4,rate:40},{faPaiShu:5,rate:10},{faPaiShu:6,rate:0}],
|
|
KG_4:[{faPaiShu:1,rate:0},{faPaiShu:2,rate:30},{faPaiShu:3,rate:35},{faPaiShu:4,rate:35},{faPaiShu:5,rate:0},{faPaiShu:6,rate:0}],
|
|
KG_3:[{faPaiShu:1,rate:0},{faPaiShu:2,rate:30},{faPaiShu:3,rate:70},{faPaiShu:4,rate:0},{faPaiShu:5,rate:0},{faPaiShu:6,rate:0}],
|
|
KG_2:[{faPaiShu:1,rate:0},{faPaiShu:2,rate:100},{faPaiShu:3,rate:0},{faPaiShu:4,rate:0},{faPaiShu:5,rate:0},{faPaiShu:6,rate:0}],
|
|
KG_1:[{faPaiShu:1,rate:100},{faPaiShu:2,rate:0},{faPaiShu:3,rate:0},{faPaiShu:4,rate:0},{faPaiShu:5,rate:0},{faPaiShu:6,rate:0}]
|
|
}
|
|
|
|
//牌数获取种类数
|
|
let FaPaiShu_ZhongLei = {
|
|
PS_1:[{typeNum:1,rate:100},{typeNum:2,rate:0},{typeNum:3,rate:0},{typeNum:4,rate:0}],
|
|
PS_2:[{typeNum:1,rate:60},{typeNum:2,rate:40},{typeNum:3,rate:0},{typeNum:4,rate:0}],
|
|
PS_3:[{typeNum:1,rate:50},{typeNum:2,rate:50},{typeNum:3,rate:0},{typeNum:4,rate:0}],
|
|
PS_4:[{typeNum:1,rate:45},{typeNum:2,rate:45},{typeNum:3,rate:10},{typeNum:4,rate:0}],
|
|
PS_5:[{typeNum:1,rate:20},{typeNum:2,rate:60},{typeNum:3,rate:20},{typeNum:4,rate:0}],
|
|
PS_6:[{typeNum:1,rate:10},{typeNum:2,rate:40},{typeNum:3,rate:40},{typeNum:4,rate:10}]
|
|
// PS_1:[{typeNum:1,rate:100},{typeNum:2,rate:0},{typeNum:3,rate:0},{typeNum:4,rate:0}],
|
|
// PS_2:[{typeNum:1,rate:100},{typeNum:2,rate:0},{typeNum:3,rate:0},{typeNum:4,rate:0}],
|
|
// PS_3:[{typeNum:1,rate:100},{typeNum:2,rate:0},{typeNum:3,rate:0},{typeNum:4,rate:0}],
|
|
// PS_4:[{typeNum:1,rate:100},{typeNum:2,rate:0},{typeNum:3,rate:0},{typeNum:4,rate:0}],
|
|
// PS_5:[{typeNum:1,rate:100},{typeNum:2,rate:0},{typeNum:3,rate:0},{typeNum:4,rate:0}],
|
|
// PS_6:[{typeNum:1,rate:100},{typeNum:2,rate:0},{typeNum:3,rate:0},{typeNum:4,rate:0}]
|
|
}
|
|
//牌数获取特定种类
|
|
let FaPaiShu_TeDingZhongLei = {
|
|
PS_1:{numTabType_1:[[1]]},
|
|
PS_2:{numTabType_1:[[2]],numTabType_2:[[1,1]]},
|
|
PS_3:{numTabType_1:[[3]],numTabType_2:[[1,2],[2,1]]},
|
|
PS_4:{numTabType_1:[[4]],numTabType_2:[[2,2],[1,3],[3,1]],numTabType_3:[[1,1,2],[2,1,1],[1,2,1]]},
|
|
PS_5:{numTabType_1:[[5]],numTabType_2:[[1,4],[4,1],[2,3],[3,2]],numTabType_3:[[1,2,2],[2,1,2],[2,2,1],[3,1,1],[1,3,1],[1,1,3]]},
|
|
PS_6:{numTabType_1:[[6]],numTabType_2:[[1,5],[5,1],[2,4],[4,2],[3,3]],numTabType_3:[[1,1,4],[1,4,1],[4,1,1],[2,2,2],[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]],
|
|
numTabType_4:[[1,1,1,3],[1,1,3,1],[1,3,1,1],[3,1,1,1],[1,1,2,2],[1,2,2,1],[2,2,1,1],[2,1,1,2],[2,1,2,1],[1,2,1,2]]},
|
|
}
|
|
|
|
//卡槽解锁
|
|
let KaCaoJieSuo_CoinConfig = {
|
|
G_1:{
|
|
KaCao_0:0,
|
|
KaCao_1:0,
|
|
KaCao_2:200,
|
|
KaCao_3:-9999,
|
|
KaCao_4:2500,
|
|
KaCao_5:-9999,
|
|
KaCao_6:3000,
|
|
KaCao_7:-9999,
|
|
KaCao_8:3500,
|
|
KaCao_9:0,
|
|
KaCao_10:0,
|
|
KaCao_11:0},
|
|
G_2:{
|
|
KaCao_0:0,
|
|
KaCao_1:0,
|
|
KaCao_2:3500,
|
|
KaCao_3:-9999,
|
|
KaCao_4:2500,
|
|
KaCao_5:-9999,
|
|
KaCao_6:3000,
|
|
KaCao_7:-9999,
|
|
KaCao_8:3500,
|
|
KaCao_9:0,
|
|
KaCao_10:0,
|
|
KaCao_11:0},
|
|
G_3:{
|
|
KaCao_0:0,
|
|
KaCao_1:0,
|
|
KaCao_2:3500,
|
|
KaCao_3:-9999,
|
|
KaCao_4:2500,
|
|
KaCao_5:-9999,
|
|
KaCao_6:3000,
|
|
KaCao_7:-9999,
|
|
KaCao_8:3500,
|
|
KaCao_9:0,
|
|
KaCao_10:0,
|
|
KaCao_11:0}
|
|
}
|
|
|
|
//洗碗池等级
|
|
let XiWanChiLevelConfig = {
|
|
Level_1:10,
|
|
Level_2:30,
|
|
Level_3:40,
|
|
Level_4:50,
|
|
Level_5:50,
|
|
Level_6:60,
|
|
Level_7:70,
|
|
Level_8:80,
|
|
}
|
|
//关卡数据配置(关卡目标,奖励数量)
|
|
let GuanQiaDataConfig = {
|
|
G_1:{targetNum:50000,awardNum:0,chuShiKuCun:600,time:600,addtime:180,targetColor:12},
|
|
G_2:{targetNum:4000,awardNum:0,chuShiKuCun:600,time:2400,addtime:600,targetColor:21},
|
|
G_3:{targetNum:8000,awardNum:0,chuShiKuCun:600,time:4200,addtime:900,targetColor:35},
|
|
G_4:{targetNum:1000000,awardNum:0,chuShiKuCun:600,time:7200,addtime:1200,targetColor:100},
|
|
}
|
|
|
|
//根据槽位和已消除数量获取颜色数
|
|
let JieSuoColorConfig_GM = [
|
|
{curColorNum:2,nextNeedXiaoChu:1,needCaoWei:2},
|
|
{curColorNum:3,nextNeedXiaoChu:1,needCaoWei:2},
|
|
{curColorNum:4,nextNeedXiaoChu:1,needCaoWei:2},
|
|
{curColorNum:5,nextNeedXiaoChu:1,needCaoWei:3},
|
|
{curColorNum:6,nextNeedXiaoChu:1,needCaoWei:4},
|
|
{curColorNum:7,nextNeedXiaoChu:1,needCaoWei:4},
|
|
{curColorNum:8,nextNeedXiaoChu:1,needCaoWei:5},
|
|
{curColorNum:9,nextNeedXiaoChu:1,needCaoWei:6},
|
|
{curColorNum:10,nextNeedXiaoChu:1,needCaoWei:7},
|
|
{curColorNum:11,nextNeedXiaoChu:1,needCaoWei:8},
|
|
{curColorNum:12,nextNeedXiaoChu:1,needCaoWei:2},
|
|
{curColorNum:13,nextNeedXiaoChu:1,needCaoWei:2},
|
|
{curColorNum:14,nextNeedXiaoChu:1,needCaoWei:3},
|
|
{curColorNum:15,nextNeedXiaoChu:1,needCaoWei:4},
|
|
{curColorNum:16,nextNeedXiaoChu:1,needCaoWei:4},
|
|
{curColorNum:17,nextNeedXiaoChu:1,needCaoWei:5},
|
|
{curColorNum:18,nextNeedXiaoChu:1,needCaoWei:6},
|
|
{curColorNum:19,nextNeedXiaoChu:1,needCaoWei:7},
|
|
{curColorNum:20,nextNeedXiaoChu:1,needCaoWei:8},
|
|
{curColorNum:21,nextNeedXiaoChu:1,needCaoWei:2},
|
|
{curColorNum:22,nextNeedXiaoChu:1,needCaoWei:2},
|
|
{curColorNum:23,nextNeedXiaoChu:1,needCaoWei:3},
|
|
{curColorNum:24,nextNeedXiaoChu:1,needCaoWei:4},
|
|
{curColorNum:25,nextNeedXiaoChu:1,needCaoWei:4},
|
|
{curColorNum:26,nextNeedXiaoChu:1,needCaoWei:5},
|
|
{curColorNum:27,nextNeedXiaoChu:1,needCaoWei:6},
|
|
{curColorNum:28,nextNeedXiaoChu:1,needCaoWei:7},
|
|
{curColorNum:29,nextNeedXiaoChu:1,needCaoWei:8},
|
|
{curColorNum:30,nextNeedXiaoChu:1,needCaoWei:8},
|
|
{curColorNum:31,nextNeedXiaoChu:1,needCaoWei:8},
|
|
{curColorNum:32,nextNeedXiaoChu:1,needCaoWei:9},
|
|
{curColorNum:33,nextNeedXiaoChu:1,needCaoWei:9},
|
|
{curColorNum:34,nextNeedXiaoChu:100000,needCaoWei:9},
|
|
{curColorNum:35,nextNeedXiaoChu:100000,needCaoWei:9}
|
|
]
|
|
//根据槽位和已消除数量获取颜色数
|
|
//根据槽位和已消除数量获取颜色数
|
|
let JieSuoColorConfig = [
|
|
{curColorNum:2,nextNeedXiaoChu:3,needCaoWei:2},
|
|
{curColorNum:3,nextNeedXiaoChu:5,needCaoWei:2},
|
|
{curColorNum:4,nextNeedXiaoChu:7,needCaoWei:2},
|
|
{curColorNum:5,nextNeedXiaoChu:10,needCaoWei:3},
|
|
{curColorNum:6,nextNeedXiaoChu:12,needCaoWei:4},
|
|
{curColorNum:7,nextNeedXiaoChu:13,needCaoWei:4},
|
|
{curColorNum:8,nextNeedXiaoChu:14,needCaoWei:5},
|
|
{curColorNum:9,nextNeedXiaoChu:15,needCaoWei:6},
|
|
{curColorNum:10,nextNeedXiaoChu:15,needCaoWei:7},
|
|
{curColorNum:11,nextNeedXiaoChu:20,needCaoWei:8},
|
|
{curColorNum:12,nextNeedXiaoChu:20,needCaoWei:2},
|
|
{curColorNum:13,nextNeedXiaoChu:20,needCaoWei:2},
|
|
{curColorNum:14,nextNeedXiaoChu:7,needCaoWei:3},
|
|
{curColorNum:15,nextNeedXiaoChu:10,needCaoWei:4},
|
|
{curColorNum:16,nextNeedXiaoChu:12,needCaoWei:4},
|
|
{curColorNum:17,nextNeedXiaoChu:13,needCaoWei:5},
|
|
{curColorNum:18,nextNeedXiaoChu:14,needCaoWei:6},
|
|
{curColorNum:19,nextNeedXiaoChu:15,needCaoWei:7},
|
|
{curColorNum:20,nextNeedXiaoChu:15,needCaoWei:8},
|
|
{curColorNum:21,nextNeedXiaoChu:20,needCaoWei:2},
|
|
{curColorNum:22,nextNeedXiaoChu:20,needCaoWei:2},
|
|
{curColorNum:23,nextNeedXiaoChu:7,needCaoWei:3},
|
|
{curColorNum:24,nextNeedXiaoChu:10,needCaoWei:4},
|
|
{curColorNum:25,nextNeedXiaoChu:12,needCaoWei:4},
|
|
{curColorNum:26,nextNeedXiaoChu:13,needCaoWei:5},
|
|
{curColorNum:27,nextNeedXiaoChu:14,needCaoWei:6},
|
|
{curColorNum:28,nextNeedXiaoChu:15,needCaoWei:7},
|
|
{curColorNum:29,nextNeedXiaoChu:16,needCaoWei:8},
|
|
{curColorNum:30,nextNeedXiaoChu:20,needCaoWei:8},
|
|
{curColorNum:31,nextNeedXiaoChu:20,needCaoWei:8},
|
|
{curColorNum:32,nextNeedXiaoChu:20,needCaoWei:9},
|
|
{curColorNum:33,nextNeedXiaoChu:20,needCaoWei:9},
|
|
{curColorNum:34,nextNeedXiaoChu:100000,needCaoWei:9},
|
|
{curColorNum:35,nextNeedXiaoChu:100000,needCaoWei:9}
|
|
]
|
|
|
|
let MaJiangColorConfig = [
|
|
{id:1,nameStr:'1万',tuAn:"wan1",mjColor:'color1'},
|
|
{id:2,nameStr:'2万',tuAn:"wan2",mjColor:'color2'},
|
|
{id:3,nameStr:'3万',tuAn:"wan3",mjColor:'color3'},
|
|
{id:4,nameStr:'4万',tuAn:"wan4",mjColor:'color4'},
|
|
{id:5,nameStr:'5万',tuAn:"wan5",mjColor:'color5'},
|
|
{id:6,nameStr:'6万',tuAn:"wan6",mjColor:'color6'},
|
|
{id:7,nameStr:'7万',tuAn:"wan7",mjColor:'color7'},
|
|
{id:8,nameStr:'8万',tuAn:"wan8",mjColor:'color8'},
|
|
{id:9,nameStr:'9万',tuAn:"wan9",mjColor:'color9'},
|
|
{id:10,nameStr:'1筒',tuAn:"tong1",mjColor:'color10'},
|
|
{id:11,nameStr:'2筒',tuAn:"tong2",mjColor:'color11'},
|
|
{id:12,nameStr:'3筒',tuAn:"tong3",mjColor:'color12'},
|
|
{id:13,nameStr:'4筒',tuAn:"tong4",mjColor:'color1'},
|
|
{id:14,nameStr:'5筒',tuAn:"tong5",mjColor:'color2'},
|
|
{id:15,nameStr:'6筒',tuAn:"tong6",mjColor:'color3'},
|
|
{id:16,nameStr:'7筒',tuAn:"tong7",mjColor:'color4'},
|
|
{id:17,nameStr:'8筒',tuAn:"tong8",mjColor:'color5'},
|
|
{id:18,nameStr:'9筒',tuAn:"tong9",mjColor:'color6'},
|
|
{id:19,nameStr:'1条',tuAn:"tiao1",mjColor:'color7'},
|
|
{id:20,nameStr:'2条',tuAn:"tiao2",mjColor:'color8'},
|
|
{id:21,nameStr:'3条',tuAn:"tiao3",mjColor:'color9'},
|
|
{id:22,nameStr:'4条',tuAn:"tiao4",mjColor:'color1'},
|
|
{id:23,nameStr:'5条',tuAn:"tiao5",mjColor:'color2'},
|
|
{id:24,nameStr:'6条',tuAn:"tiao6",mjColor:'color3'},
|
|
{id:25,nameStr:'7条',tuAn:"tiao7",mjColor:'color4'},
|
|
{id:26,nameStr:'8条',tuAn:"tiao8",mjColor:'color5'},
|
|
{id:27,nameStr:'9条',tuAn:"tiao9",mjColor:'color6'},
|
|
{id:28,nameStr:'东',tuAn:"east",mjColor:'color10'},
|
|
{id:29,nameStr:'南',tuAn:"south",mjColor:'color11'},
|
|
{id:30,nameStr:'西',tuAn:"west",mjColor:'color12'},
|
|
{id:31,nameStr:'北',tuAn:"north",mjColor:'color13'},
|
|
{id:32,nameStr:'中',tuAn:"zhong",mjColor:'color14'},
|
|
{id:33,nameStr:'发',tuAn:"fa",mjColor:'color15'},
|
|
{id:34,nameStr:'白',tuAn:"bai",mjColor:'color16'},
|
|
{id:35,nameStr:'皇冠',tuAn:"皇冠",mjColor:'color6'}
|
|
]
|
|
export class CColorContent {
|
|
constructor(inputColor,inputColorCount) {
|
|
this.color = inputColor;
|
|
this.colorCount = inputColorCount;
|
|
}
|
|
public color = "";
|
|
public colorCount = 0;
|
|
}
|
|
|
|
export default class NewDataManage_xmj{
|
|
//默认参数
|
|
static maxColorOneStack = 4;
|
|
static maxDealCount = 6;
|
|
static randArr = [2,3,4,6];
|
|
static randArr2 = [2,3,4];
|
|
|
|
public static maxTime = -1;
|
|
//判断参数是否在数组
|
|
public static colorInArr(color,arr){
|
|
for (let i = 0; i< arr.length; i++){
|
|
if (color == arr[i].color){
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public static getJieSuoColorConfig(){
|
|
|
|
return JieSuoColorConfig
|
|
}
|
|
public static colorInColorArr(color,arr){
|
|
for (let i = 0; i< arr.length; i++){
|
|
if (color == arr[i]){
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public static insertColorToArr(color,arr){
|
|
if (!this.colorInColorArr(color,arr)){
|
|
arr.push(color);
|
|
}
|
|
}
|
|
public static getNewColor(color,dstColor,allColor){
|
|
if (!this.colorInColorArr(color,dstColor)){
|
|
return color;
|
|
}
|
|
if (dstColor.length >= allColor.length){
|
|
return color;
|
|
}
|
|
else {
|
|
color = allColor[Common5.getRandomNum(0,allColor.length)];
|
|
let num = 0
|
|
while (this.colorInColorArr(color,dstColor)){
|
|
num++
|
|
if(num > 100){
|
|
break
|
|
}
|
|
color = allColor[Common5.getRandomNum(0,allColor.length)];
|
|
}
|
|
return color;
|
|
}
|
|
}
|
|
//获取场中不超过颜色上限的颜色
|
|
public static getHaveColor(color,dstColor,haveColor,curMaxColor,allColor){
|
|
if (haveColor.length < curMaxColor){
|
|
if (!this.colorInColorArr(color,dstColor)){
|
|
haveColor.push(color);
|
|
}
|
|
else{
|
|
let num = 0
|
|
while (this.colorInColorArr(color,dstColor)){
|
|
num++
|
|
if(num > 100){
|
|
break
|
|
}
|
|
color = allColor[Common5.getRandomNum(0,allColor.length)];
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
let num = 0
|
|
while (this.colorInColorArr(color,dstColor)){
|
|
num++
|
|
if(num > 100){
|
|
break
|
|
}
|
|
color = haveColor[Common5.getRandomNum(0,haveColor.length)];
|
|
}
|
|
}
|
|
// for (let i = 0; i< haveColor.length; i++){
|
|
// if (color == haveColor[i]){
|
|
// find = true;
|
|
// break;
|
|
// }
|
|
// }
|
|
// if (!find){
|
|
// if (haveColor.length < curMaxColor){
|
|
// haveColor.push(color);
|
|
// }
|
|
// else {
|
|
// color = haveColor[Common5.getRandomNum(0,haveColor.length)];
|
|
// while (this.colorInColorArr(color,dstColor)){
|
|
// color = haveColor[Common5.getRandomNum(0,haveColor.length)];
|
|
// }
|
|
// }
|
|
// }
|
|
return color;
|
|
}
|
|
public static setTopColor(colorArr,index,type){
|
|
if (type == 1){
|
|
let find = false;
|
|
for (let i = index; i < colorArr.length; i++){
|
|
for (let j = i+1; j < colorArr.length; j++){
|
|
if (colorArr[i] == colorArr[j]){
|
|
find = true;
|
|
}
|
|
}
|
|
}
|
|
if (!find){
|
|
let randNum = Common5.getRandomNum(index,colorArr.length);
|
|
let ranNum2 = Common5.getRandomNum(0,colorArr.length);
|
|
let num = 0
|
|
while (randNum == ranNum2){
|
|
num++
|
|
if(num > 100){
|
|
break
|
|
}
|
|
ranNum2 = Common5.getRandomNum(0,colorArr.length);
|
|
}
|
|
colorArr[randNum] = colorArr[ranNum2];
|
|
}
|
|
}
|
|
else if (type == 2 && colorArr.length >= 4){
|
|
let arr = Common5.getRandomNumArr_custom(0,colorArr.length-1,4);
|
|
arr.sort();
|
|
colorArr[arr[0]] = colorArr[arr[2]];
|
|
colorArr[arr[1]] = colorArr[arr[3]];
|
|
}
|
|
else if (type == 3 && colorArr.length >= 4){
|
|
let randNum = Common5.getRandomNum(index,colorArr.length);
|
|
let randNum2 = Common5.getRandomNum(index,colorArr.length);
|
|
let randNum3 = Common5.getRandomNum(0,colorArr.length-2);
|
|
let num = 0
|
|
while (randNum == randNum2){
|
|
num++
|
|
if(num > 100){
|
|
break
|
|
}
|
|
randNum2 = Common5.getRandomNum(index,colorArr.length);
|
|
}
|
|
let num2 = 0
|
|
while ((randNum == randNum3) || (randNum2 == randNum3)){
|
|
num2++
|
|
if(num2 > 100){
|
|
break
|
|
}
|
|
randNum3 = Common5.getRandomNum(0,colorArr.length);
|
|
}
|
|
colorArr[randNum] = colorArr[randNum3];
|
|
colorArr[randNum2] = colorArr[randNum3];
|
|
}
|
|
}
|
|
/*
|
|
curColorCountArr:每个案板的颜色数组的数组,二维数组[]
|
|
curBlankCount:要发的颜色数
|
|
curDishwashingColorArr:当前洗碗池的颜色,一个都没有[],有一个["color1"],有2个["color1","color2"]
|
|
curMaxColor:当前场中可出现的最大颜色数(解锁案板+解锁洗碗池)*2 -2
|
|
*/
|
|
public static Deal(curColorCountArr,curBlankCount,curDishwashingColorArr,curMaxColor,xiaoChuNum){
|
|
console.log('发牌传参curColorCountArr=',curColorCountArr)
|
|
console.log('发牌传参curBlankCount=',curBlankCount)
|
|
console.log('发牌传参curDishwashingColorArr=',curDishwashingColorArr)
|
|
console.log('发牌传参curMaxColor=',curMaxColor)
|
|
console.log('发牌传参xiaoChuNum=',xiaoChuNum)
|
|
|
|
let retArr = [];
|
|
let tmpAllColor = [];
|
|
let tmpTopColor = [];
|
|
let tmpTopHaveColor = [];
|
|
let tmpButtomColor = [];
|
|
let addNewColor = false;
|
|
for (let i = 0; i < Math.max(curBlankCount,curColorCountArr.length); i++){
|
|
let tmpColor = i;
|
|
if (i >= curBlankCount){
|
|
tmpColor = Common5.getRandomNum(0,curBlankCount);
|
|
}
|
|
this.insertColorToArr(tmpColor,tmpAllColor);
|
|
tmpTopColor.push(tmpColor);
|
|
tmpButtomColor.push(tmpColor);
|
|
}
|
|
let tmpHaveColor = [];
|
|
let boardHaveColor = [];
|
|
let topArr = Common5.shuffle(tmpTopColor);
|
|
let start = 0;
|
|
let count = curColorCountArr.length;
|
|
topArr = topArr.splice(0,count);
|
|
let buttomArr = Common5.shuffle(tmpButtomColor);
|
|
buttomArr =buttomArr.splice(start,count);
|
|
console.log(topArr,buttomArr);
|
|
for (let i = 0; i < curColorCountArr.length; i++){
|
|
for (let j = 0; j < curColorCountArr[i].length; j++){
|
|
this.insertColorToArr(curColorCountArr[i][j].color,tmpHaveColor);
|
|
this.insertColorToArr(curColorCountArr[i][j].color,boardHaveColor);
|
|
}
|
|
}
|
|
//判断第一个洗碗池的颜色
|
|
for (let all = 0; all < curDishwashingColorArr.length; all++){
|
|
if (all > 0 && curDishwashingColorArr[0] == curDishwashingColorArr[1]){
|
|
break;
|
|
}
|
|
|
|
this.insertColorToArr(curDishwashingColorArr[0],boardHaveColor);
|
|
if (curDishwashingColorArr.length > 0){
|
|
let topColor = curDishwashingColorArr[all];
|
|
this.insertColorToArr(topColor,tmpHaveColor);
|
|
let tmpCount = this.randArr[Common5.getRandomNum(0,this.randArr.length)];
|
|
if (curColorCountArr.length > 3 && Common5.getRandomNum(0,100) > 30){
|
|
tmpCount = this.randArr2[Common5.getRandomNum(0,this.randArr2.length)];
|
|
}
|
|
if (curColorCountArr[all].length > (this.maxColorOneStack-2) && (!this.colorInArr(topColor,curColorCountArr[all]) && !this.colorInArr(topColor,curColorCountArr[all]))
|
|
|| topColor == buttomArr[all]){ //已经有3种颜色,或者随机出来的两种颜色一样,则发两张
|
|
tmpCount = this.maxDealCount;
|
|
}
|
|
let tmpArr = [];
|
|
let buttomColor = buttomArr[all];
|
|
if (buttomColor == topColor){
|
|
tmpCount = this.maxDealCount;
|
|
}
|
|
let tmpColorContentTop = new CColorContent(topColor,tmpCount);
|
|
this.insertColorToArr(topColor,tmpTopHaveColor);
|
|
tmpArr.unshift(tmpColorContentTop);
|
|
if (this.maxDealCount-tmpCount > 0){
|
|
buttomColor = this.getHaveColor(buttomColor,curDishwashingColorArr,tmpHaveColor,curMaxColor,tmpAllColor);
|
|
this.insertColorToArr(buttomColor,tmpHaveColor);
|
|
let tmpColorContentButtom = new CColorContent(buttomColor,this.maxDealCount-tmpCount);
|
|
tmpArr.unshift(tmpColorContentButtom);
|
|
}
|
|
retArr.push(tmpArr);
|
|
topArr[all] = topColor;
|
|
}
|
|
}
|
|
if (curDishwashingColorArr.length < 2){
|
|
let randNum = Common5.getRandomNum(0,100);
|
|
console.log("topArr1:",topArr);
|
|
if (xiaoChuNum < 50){
|
|
if (randNum < 60){
|
|
this.setTopColor(topArr,retArr.length,1);
|
|
}
|
|
else if (randNum < 80){
|
|
this.setTopColor(topArr,retArr.length,2);
|
|
}
|
|
else{
|
|
this.setTopColor(topArr,retArr.length,3);
|
|
}
|
|
}
|
|
else if (xiaoChuNum < 120){
|
|
if (randNum < 55){
|
|
this.setTopColor(topArr,retArr.length,1);
|
|
}
|
|
else if (randNum < 85){
|
|
this.setTopColor(topArr,retArr.length,2);
|
|
}
|
|
else {
|
|
this.setTopColor(topArr,retArr.length,3);
|
|
}
|
|
}
|
|
else if (xiaoChuNum < 200){
|
|
if (randNum < 65){
|
|
this.setTopColor(topArr,retArr.length,1);
|
|
}
|
|
else if (randNum < 85){
|
|
this.setTopColor(topArr,retArr.length,2);
|
|
}
|
|
else {
|
|
this.setTopColor(topArr,retArr.length,3);
|
|
}
|
|
}
|
|
else if (xiaoChuNum < 300){
|
|
if (randNum < 75){
|
|
this.setTopColor(topArr,retArr.length,1);
|
|
}
|
|
else if (randNum < 90){
|
|
this.setTopColor(topArr,retArr.length,2);
|
|
}
|
|
else{
|
|
this.setTopColor(topArr,retArr.length,3);
|
|
}
|
|
}
|
|
else {
|
|
if (randNum < 80){
|
|
this.setTopColor(topArr,retArr.length,1);
|
|
}
|
|
else if (randNum < 95){
|
|
this.setTopColor(topArr,retArr.length,2);
|
|
}
|
|
else{
|
|
this.setTopColor(topArr,retArr.length,3);
|
|
}
|
|
}
|
|
}
|
|
console.log("topArr2:",topArr);
|
|
for (let i = retArr.length; i < curColorCountArr.length; i++){
|
|
let topColor = topArr[i];
|
|
let tmpCount = this.randArr[Common5.getRandomNum(0,this.randArr.length)];
|
|
if (curColorCountArr.length > 3){
|
|
tmpCount = this.randArr2[Common5.getRandomNum(0,this.randArr2.length)];
|
|
}
|
|
if (curColorCountArr[i].length > (this.maxColorOneStack-2) && (!this.colorInArr(topColor,curColorCountArr[i]) && !this.colorInArr(topColor,curColorCountArr[i]))){ //已经有3种颜色
|
|
tmpCount = this.maxDealCount;
|
|
}
|
|
let buttomColor = buttomArr[i];
|
|
|
|
// topColor = this.getHaveColor(topColor,curDishwashingColorArr,tmpHaveColor,curMaxColor,tmpAllColor);
|
|
// if (tmpTopColor.length == i && i == curColorCountArr.length-1){
|
|
// let ranNum = Common5.getRandomNum(0,100);
|
|
// if (xiaoChuNum < 50 && ranNum <){
|
|
|
|
// }
|
|
// }
|
|
this.insertColorToArr(topColor,tmpHaveColor);
|
|
|
|
if ((curColorCountArr[i].length == 0 ||curDishwashingColorArr.length == 0) && !addNewColor){
|
|
if (tmpHaveColor.length >= curBlankCount){
|
|
buttomColor = this.getNewColor(buttomColor,boardHaveColor,tmpHaveColor);
|
|
}
|
|
else{
|
|
buttomColor = this.getNewColor(buttomColor,boardHaveColor,tmpAllColor);
|
|
}
|
|
this.insertColorToArr(topColor,tmpHaveColor);
|
|
addNewColor = true;
|
|
}
|
|
else{
|
|
if (tmpHaveColor.length >= curBlankCount){
|
|
buttomColor = this.getHaveColor(buttomColor,curDishwashingColorArr,tmpHaveColor,curMaxColor,tmpHaveColor);
|
|
}
|
|
else {
|
|
buttomColor = this.getHaveColor(buttomColor,curDishwashingColorArr,tmpHaveColor,curMaxColor,tmpAllColor);
|
|
}
|
|
this.insertColorToArr(topColor,tmpHaveColor);
|
|
}
|
|
this.insertColorToArr(buttomColor,tmpHaveColor);
|
|
let tmpArr = [];
|
|
if (buttomColor == topColor){
|
|
if (tmpHaveColor.length >= curBlankCount){
|
|
buttomColor = this.getNewColor(buttomColor,[topColor],tmpHaveColor);
|
|
}
|
|
else {
|
|
buttomColor = this.getNewColor(buttomColor,[topColor],tmpAllColor);
|
|
}
|
|
this.insertColorToArr(topColor,tmpHaveColor);
|
|
}
|
|
let tmpColorContentTop = new CColorContent(topColor,tmpCount);
|
|
tmpArr.unshift(tmpColorContentTop);
|
|
if (this.maxDealCount-tmpCount > 0){
|
|
let tmpColorContentButtom = new CColorContent(buttomColor,this.maxDealCount - tmpCount);
|
|
tmpArr.unshift(tmpColorContentButtom);
|
|
}
|
|
retArr.push(tmpArr);
|
|
}
|
|
console.log(retArr);
|
|
return retArr;
|
|
}
|
|
public static getSendCardData(callFunc){
|
|
let curColorCountArr= this.getCurLineColorArr()//[[new CColorContent(0,3),new CColorContent(1,3)],[new CColorContent(1,3),new CColorContent(0,3)]]
|
|
let curDishwashingColorArr = this.getXiWanChiColorArr()//[0,1];
|
|
let colorNum = this.getSendColorTypeNumByXiaoChuNum()
|
|
|
|
if(colorNum > 34){
|
|
colorNum = 34
|
|
}
|
|
//这里打个补丁???
|
|
if(this.curGuanQiaNum == 1){
|
|
|
|
}else if(this.curGuanQiaNum == 2){
|
|
colorNum -= 9
|
|
}else if(this.curGuanQiaNum == 3){
|
|
colorNum -= 19
|
|
}
|
|
let maxColorNum = this.canShowMaxColorNum()
|
|
let res = this.Deal(curColorCountArr,colorNum,curDishwashingColorArr,maxColorNum,this.yiXiaoChuNum);
|
|
console.log(JSON.stringify(res));
|
|
|
|
let faPaiData = {}
|
|
//处理为可用的数组
|
|
for(let i=0;i<res.length;i++){
|
|
let lineData = []
|
|
let fapaiNum = 15-this.cell_data[i].length
|
|
let num = 0
|
|
//已经大于15张不发牌
|
|
if(this.cell_data[i].length < 15){
|
|
for(let j=0;j<res[i].length;j++){
|
|
for(let k=0;k<res[i][j].colorCount;k++){
|
|
//这里打个补丁???
|
|
if(this.curGuanQiaNum == 1){
|
|
lineData.push(parseInt(res[i][j].color) + 1)
|
|
}else if(this.curGuanQiaNum == 2){
|
|
lineData.push(parseInt(res[i][j].color + 9) + 1)
|
|
}else if(this.curGuanQiaNum == 3){
|
|
lineData.push(parseInt(res[i][j].color + 19) + 1)
|
|
}
|
|
|
|
num++
|
|
if(num >= fapaiNum){
|
|
break
|
|
}
|
|
}
|
|
if(num >= fapaiNum){
|
|
break
|
|
}
|
|
}
|
|
}
|
|
faPaiData['line_'+i] = lineData
|
|
}
|
|
|
|
|
|
console.log('发牌数据==',faPaiData)
|
|
//发牌前数据
|
|
let faPaiQianData = Common5.deepClone(this.cell_data)
|
|
console.log("发牌前数据faPaiQianData=",faPaiQianData)
|
|
//将发牌数据全部导入总数组
|
|
for(let i=0;i<=this.unlock_cell;i++){
|
|
let lineData = faPaiData['line_'+i]
|
|
|
|
if(lineData){
|
|
for(let j=0;j<lineData.length;j++){
|
|
this.cell_data[i].push(lineData[j])
|
|
}
|
|
}
|
|
}
|
|
//增加了发牌数据,未向下压缩之前
|
|
let faPaiHouData = Common5.deepClone(this.cell_data)
|
|
console.log("增加了发牌数据faPaiHouData=",faPaiHouData)
|
|
|
|
let yaSuiNumTab = []
|
|
for(let i=0;i<=this.unlock_cell;i++){
|
|
let lineData = faPaiData['line_'+i]
|
|
let diXiaYaSuiShu = 0//最底下需要压碎的数量
|
|
//原本超过15张的话,保留15张
|
|
if(this.cell_data[i].length >= 15){
|
|
diXiaYaSuiShu = this.cell_data[i].length - 15
|
|
//原本少于6张,不压碎
|
|
}else{
|
|
diXiaYaSuiShu = 0
|
|
}
|
|
if(diXiaYaSuiShu > 0){
|
|
this.cell_data[i].splice(0,diXiaYaSuiShu)
|
|
}
|
|
yaSuiNumTab.push(diXiaYaSuiShu)
|
|
}
|
|
|
|
//压缩后数据
|
|
let yaSuoHouData = Common5.deepClone(this.cell_data)
|
|
console.log("压缩后数据yaSuoHouData=",yaSuoHouData)
|
|
|
|
this.saveGameProgressData()
|
|
|
|
|
|
callFunc && callFunc(faPaiData,faPaiQianData,faPaiHouData,yaSuiNumTab)
|
|
}
|
|
public static jieSuoColorNum:number = 2
|
|
public static getJieSuoColorNum(){
|
|
return this.jieSuoColorNum
|
|
}
|
|
public static yiXiaoChuNum:number = 0
|
|
public static addYiXiaoChuNum(){
|
|
this.yiXiaoChuNum ++
|
|
}
|
|
public static getYiXiaoChuNum(){
|
|
GameSecondLevelManage_xmj.setStartCellData()
|
|
return this.yiXiaoChuNum
|
|
}
|
|
public static setGMYiXiaoChuNum(num){
|
|
GameSecondLevelManage_xmj.setStartCellData()
|
|
this.yiXiaoChuNum = num
|
|
this.saveGameProgressData()
|
|
}
|
|
public static yiXiaoChuAllNum = 0
|
|
public static addYiXiaoChuAllNum(){
|
|
this.yiXiaoChuAllNum ++
|
|
|
|
}
|
|
public static getYiXiaoChuAllNum(){
|
|
// GameSecondLevelManage_xpz.setStartCellData()
|
|
return this.yiXiaoChuAllNum
|
|
}
|
|
public static xiaoChuColorNumTab = []
|
|
public static initXiaoChuColorNum(){
|
|
for(let i=0;i<36;i++){
|
|
this.xiaoChuColorNumTab[i] = 0
|
|
}
|
|
}
|
|
public static addXiaoChuColorNum(colorIndex,num){
|
|
if(!this.xiaoChuColorNumTab[colorIndex]){
|
|
this.xiaoChuColorNumTab[colorIndex] = 0
|
|
}
|
|
this.xiaoChuColorNumTab[colorIndex] += num
|
|
console.log('刷新已消除颜色数组==',this.xiaoChuColorNumTab)
|
|
this.saveGameProgressData()
|
|
// User.setFinishMeiRiTask(colorIndex,num)
|
|
// if(TaskManagerScript.getIsCanGetRewardTask()){
|
|
// EventMgr.emitEvent_custom(ryw_Event.RefreshTaskStatus)
|
|
// }
|
|
|
|
}
|
|
public static getXiaoChuColorNum(colorIndex){
|
|
for(let i=0;i<36;i++){
|
|
if(!this.xiaoChuColorNumTab[i]){
|
|
this.xiaoChuColorNumTab[i] = 0
|
|
}
|
|
}
|
|
return this.xiaoChuColorNumTab[colorIndex]
|
|
}
|
|
//提供给外部接口
|
|
public static getXiaoChuColorNumTab(){
|
|
// let saveData:GameProgressDataProperty_xmj = this.getGameProgressData()
|
|
// if(!saveData){
|
|
// this.initXiaoChuColorNum()
|
|
// return this.xiaoChuColorNumTab
|
|
// }else{
|
|
// return saveData.xiaoChuColorNumTab
|
|
// }
|
|
}
|
|
public static checkIsShouCangNewColor(colorIndex,heChengQianColorAccount,heChengHouColorAccount){
|
|
let targetNum = skinConfig[colorIndex].targetNum
|
|
if(heChengQianColorAccount < targetNum && heChengHouColorAccount >= targetNum){
|
|
return true
|
|
}
|
|
}
|
|
//获取要发的颜色种类数
|
|
public static getSendColorTypeNumByXiaoChuNum(){
|
|
let config = null
|
|
// if(GMManager.getToggleStatus_ShengXiaoPan()){
|
|
// config = JieSuoColorConfig_GM
|
|
// }else{
|
|
config = JieSuoColorConfig
|
|
// }
|
|
let xiaoChuNum = this.yiXiaoChuNum
|
|
let jieSuoAnBanNum = this.unlock_cell+1
|
|
//当前已解锁颜色数
|
|
let curColorNum = this.jieSuoColorNum
|
|
for(let i=0;i<config.length;i++){
|
|
if(config[i].curColorNum == curColorNum && xiaoChuNum >= config[i].nextNeedXiaoChu && jieSuoAnBanNum>=config[i].needCaoWei){
|
|
this.jieSuoColorNum++
|
|
if(this.jieSuoColorNum > 24){
|
|
this.addJieSuoShengXiaoId()
|
|
}
|
|
this.yiXiaoChuNum = 0
|
|
break
|
|
}
|
|
}
|
|
return this.jieSuoColorNum
|
|
}
|
|
|
|
|
|
public static getDaiJieSuoPZProgressTab(){
|
|
let config = null
|
|
// if(GMManager.getToggleStatus_ShengXiaoPan()){
|
|
// config = JieSuoColorConfig_GM
|
|
// }else{
|
|
config = JieSuoColorConfig
|
|
// }
|
|
//let xiaoChuNum = this.yiXiaoChuNum
|
|
let tab = {color:0, percent:0, isMax:false,lastColor:0, yiXiaoChuNum:0, nextNeedXiaoChu:0}
|
|
|
|
|
|
tab.lastColor = this.getJieSuoColorNum()
|
|
tab.color = this.jieSuoColorNum+1
|
|
tab.yiXiaoChuNum = this.yiXiaoChuNum
|
|
|
|
if(tab.color >= config.length+1){
|
|
tab.isMax = true
|
|
}
|
|
|
|
for(let i=0;i<config.length;i++){
|
|
if(config[i].curColorNum == this.jieSuoColorNum){
|
|
tab.nextNeedXiaoChu = config[i].nextNeedXiaoChu
|
|
tab.percent = Math.floor(this.yiXiaoChuNum/config[i].nextNeedXiaoChu*100)
|
|
break
|
|
}
|
|
}
|
|
|
|
return tab
|
|
|
|
|
|
// let panduanArray = [4,5,11,17,24,32,41,51,64,84,107,133,163,196,232,272,317,365,415,466,518,571,625]
|
|
// let colorArray = [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
|
|
// let colorNum = colorArray[0]
|
|
// let jiesuoAllNum = 0
|
|
// let oldAllNum = 0
|
|
// for(let i = 1;i<panduanArray.length;i++){
|
|
// if(xiaoChuNum <= panduanArray[i]-1){
|
|
// colorNum = colorArray[i-1]
|
|
// jiesuoAllNum = panduanArray[i]
|
|
|
|
// if(i==1){
|
|
// oldAllNum = 0
|
|
// }else{
|
|
// oldAllNum = panduanArray[i-1]
|
|
// }
|
|
// break
|
|
// }
|
|
// }
|
|
// tab.color = colorNum+1
|
|
|
|
// if(jiesuoAllNum){
|
|
// if(oldAllNum == 0){
|
|
// tab.percent = Math.floor((xiaoChuNum)/(jiesuoAllNum)*100)
|
|
// }else{
|
|
// console.log(xiaoChuNum-oldAllNum,'xiaoChuNum-oldAllNum1111111111++==')
|
|
// console.log(jiesuoAllNum-oldAllNum,'jiesuoAllNum-oldAllNum1111111111++==')
|
|
// tab.percent = Math.floor((xiaoChuNum-oldAllNum)/(jiesuoAllNum-oldAllNum)*100)
|
|
// }
|
|
|
|
// }
|
|
|
|
// if( xiaoChuNum >= panduanArray[panduanArray.length-1]){
|
|
// tab.isMax = true
|
|
// }
|
|
// return tab
|
|
|
|
}
|
|
|
|
|
|
// let tabChenghao = [
|
|
// {name:'刷碗小菜鸟', reward:0, needPZNum:0, maxPZ:50000},
|
|
// {name:'刷碗实习生', reward:200, needPZNum:500, maxPZ:50000},
|
|
// {name:'刷碗小能手', reward:400, needPZNum:1000, maxPZ:50000},
|
|
// {name:'刷碗正式工', reward:600, needPZNum:2000, maxPZ:50000},
|
|
// {name:'刷碗总经理', reward:800, needPZNum:5000, maxPZ:50000},
|
|
// {name:'盘子小卫士', reward:1000, needPZNum:10000, maxPZ:50000},
|
|
// {name:'盘子护理师', reward:1200, needPZNum:15000, maxPZ:50000},
|
|
// {name:'盘子美容师', reward:1500, needPZNum:20000, maxPZ:50000},
|
|
// {name:'盘子大总管', reward:1800, needPZNum:25000, maxPZ:50000},
|
|
// {name:'盘子收藏家', reward:2000, needPZNum:30000, maxPZ:50000},
|
|
// {name:'家务之星', reward:2200, needPZNum:35000, maxPZ:50000},
|
|
// {name:'刷碗之王', reward:2300, needPZNum:40000, maxPZ:50000},
|
|
// {name:'瓷洗太后', reward:2400, needPZNum:45000, maxPZ:50000},
|
|
// {name:'浴皇大帝', reward:2600, needPZNum:50000, maxPZ:50000},
|
|
// ]
|
|
|
|
public static getChenghaoConfigByid(chenghaoId){
|
|
for(let i = 0; i<tabChenghao.length;i++){
|
|
if(tabChenghao[i].chenghaoId == chenghaoId){
|
|
return tabChenghao[i]
|
|
}
|
|
}
|
|
}
|
|
|
|
//称号进度
|
|
public static getChenghaoProgressTab(){
|
|
// let allXiaochuNum = 0
|
|
// let tab= this.getXiaoChuColorNumTab()
|
|
// for(let i = 0;i<tab.length;i++){
|
|
// allXiaochuNum+=tab[i]
|
|
// }
|
|
|
|
// let oldConfig = null
|
|
|
|
// let newConfig = null
|
|
// for(let i = 0; i<tabChenghao.length;i++){
|
|
// let data_ = tabChenghao[i]
|
|
// if(allXiaochuNum < data_.needPZNum){
|
|
// newConfig = data_
|
|
// if( tabChenghao[i-1]){
|
|
// oldConfig = tabChenghao[i-1]
|
|
// }else{
|
|
// oldConfig = tabChenghao[0]
|
|
// }
|
|
// break
|
|
// }
|
|
|
|
// }
|
|
// console.log(oldConfig, 'oldConfig+++++++++++=====')
|
|
// console.log(newConfig, 'newConfig+++++++++++=====')
|
|
|
|
// if(newConfig && oldConfig){
|
|
// // let chenghaoId = User.getChenghaoIdMJ()
|
|
// // if(oldConfig.chenghaoId != chenghaoId){
|
|
// // User.setChenghaoIdMJ(oldConfig.chenghaoId)
|
|
// // }
|
|
// }else{
|
|
// //称号最大值
|
|
// // let chenghaoId = oldConfig[oldConfig.length-1].chenghaoId
|
|
// // User.setChenghaoIdMJ(chenghaoId)
|
|
// }
|
|
|
|
// let _Obj = null
|
|
// if(newConfig){
|
|
// let needShuaPanziNum = newConfig.needPZNum - oldConfig.needPZNum
|
|
// let xipanzi = allXiaochuNum - oldConfig.needPZNum
|
|
// console.log(needShuaPanziNum, xipanzi, 'needShuaPanziNum+++++++++++=====')
|
|
// _Obj = {allNum:needShuaPanziNum, needNum:xipanzi, skinName:oldConfig.name}
|
|
// }
|
|
|
|
// return _Obj
|
|
|
|
}
|
|
|
|
|
|
//可出现的最大颜色数(解锁案板+解锁洗碗池)*2 -2
|
|
public static canShowMaxColorNum(){
|
|
|
|
let jieSuoAnBanNum = this.unlock_cell+1
|
|
let jieSuoXiWanChi = 1
|
|
// if(this.unlock_adsXiWanChi2){
|
|
// jieSuoXiWanChi = 2
|
|
// }
|
|
let colorNum = 2
|
|
if(jieSuoAnBanNum == 2){
|
|
colorNum = 5
|
|
}else if(jieSuoAnBanNum == 3){
|
|
colorNum = 6
|
|
}else if(jieSuoAnBanNum == 4){
|
|
colorNum = 7
|
|
}else if(jieSuoAnBanNum == 5){
|
|
colorNum = 8
|
|
}else if(jieSuoAnBanNum == 6){
|
|
colorNum = 9
|
|
}else if(jieSuoAnBanNum == 7){
|
|
colorNum = 10
|
|
}else if(jieSuoAnBanNum == 8){
|
|
colorNum = 12
|
|
}else if(jieSuoAnBanNum == 9){
|
|
colorNum = 16
|
|
}
|
|
return colorNum
|
|
}
|
|
|
|
//获取单列color
|
|
public static getCurLineColorArr(){
|
|
let outArr = []
|
|
for(let i=0;i<=this.unlock_cell;i++){
|
|
let lineData = this.cell_data[i]
|
|
let tmpTab = {}
|
|
for(let j=0;j<lineData.length;j++){
|
|
if(!tmpTab[lineData[j]]){
|
|
tmpTab[lineData[j]] = 0
|
|
}
|
|
tmpTab[lineData[j]] += 1
|
|
}
|
|
outArr[i] = []
|
|
for(var key in tmpTab){
|
|
//这里打个补丁???
|
|
if(this.curGuanQiaNum == 1){
|
|
outArr[i].push(new CColorContent(parseInt(key)-1,tmpTab[key]))
|
|
}else if(this.curGuanQiaNum == 2){
|
|
outArr[i].push(new CColorContent(parseInt(key)-1 -9,tmpTab[key]))
|
|
}else if(this.curGuanQiaNum == 3){
|
|
outArr[i].push(new CColorContent(parseInt(key)-1 -19,tmpTab[key]))
|
|
}
|
|
|
|
}
|
|
}
|
|
console.log('输出所有的lineColor==',outArr)
|
|
return outArr
|
|
}
|
|
//洗碗池等级
|
|
public static curXiWanChiLevel = [1,2]
|
|
public static addXiWanChiLevel(index){
|
|
|
|
let nextLevel = this.curXiWanChiLevel[index] + 1
|
|
if(nextLevel > 4){
|
|
nextLevel = 4
|
|
}
|
|
this.curXiWanChiLevel[index] = nextLevel
|
|
this.saveGameProgressData()
|
|
}
|
|
public static getXiWanChiLevel(){
|
|
return this.curXiWanChiLevel
|
|
}
|
|
public static getPerPanZiPrice(index){
|
|
return XiWanChiLevelConfig['Level_'+this.curXiWanChiLevel[index]]
|
|
}
|
|
public static getNextLevelPerPanZiPrice(index){
|
|
let nextLevel = this.curXiWanChiLevel[index] + 1
|
|
if(nextLevel > 4){
|
|
return 0
|
|
}
|
|
return XiWanChiLevelConfig['Level_'+nextLevel]
|
|
}
|
|
//牌数据
|
|
public static cell_data = []
|
|
public static initStartCellData(){
|
|
// for(let i=0;i<12;i++){
|
|
// this.cell_data[i] = []
|
|
// let lineData = this.getSingleLineFaPaiData(0,true)
|
|
// if(i<5){
|
|
// this.cell_data[i] = lineData
|
|
// }
|
|
// }
|
|
for(let i=0;i<13;i++){
|
|
this.cell_data[i] = []
|
|
}
|
|
//第一关初始数据
|
|
if(this.curGuanQiaNum == 1){
|
|
this.cell_data = [[1,1,1,1,1,1,1,1,1,1],[2,2,2,2,2,2,2,2,2,2,1,1],[],[],[],[],[],[],[],[],[],[],[]]
|
|
//第二关初始数据
|
|
}else if(this.curGuanQiaNum == 2){
|
|
this.cell_data = [[10,10,10,10,10,10],[11,11,11,11,11,11],[],[],[],[],[],[],[],[],[],[],[]]
|
|
//第三关初始数据
|
|
}else if(this.curGuanQiaNum == 3){
|
|
this.cell_data = [[19,19,19,19,19,19],[20,20,20,20,20,20],[],[],[],[],[],[],[],[],[],[],[]]
|
|
//第四关初始数据
|
|
}else if(this.curGuanQiaNum == 4){
|
|
this.cell_data = [[1,1,1,1,1,1],[2,2,2,2,2,2],[],[],[],[],[],[],[],[],[],[],[]]
|
|
}
|
|
|
|
|
|
}
|
|
public static getCellData(){
|
|
return this.cell_data
|
|
}
|
|
// //新手引导牌数据
|
|
// public static xinShouYinDaoCellData(){
|
|
// for(let i=0;i<12;i++){
|
|
// this.cell_data[i] = []
|
|
// }
|
|
// this.cell_data[0] = [1,1,1,1,1]
|
|
// this.cell_data[2] = [1,1,1,1,1]
|
|
// }
|
|
public static clearSingleLineData(lineIndex){
|
|
if(Array.isArray(this.cell_data[lineIndex])){
|
|
this.cell_data[lineIndex].length = 0
|
|
}
|
|
this.saveGameProgressData()
|
|
}
|
|
//获得当列可选的牌数据(最上面相同的牌)
|
|
public static getLineCellSelectData(lineNum){
|
|
if(!lineNum && lineNum != 0){
|
|
return
|
|
}
|
|
let lineSelectCellData = []
|
|
|
|
let lineData = this.cell_data[lineNum]
|
|
let cardNum = lineData[lineData.length-1]
|
|
for(let i=lineData.length-1;i>=0;i--){
|
|
if(cardNum == lineData[i]){
|
|
lineSelectCellData.push({num:cardNum,index:i})
|
|
}else{
|
|
break
|
|
}
|
|
}
|
|
return lineSelectCellData
|
|
}
|
|
|
|
//移动牌(line1->line2)
|
|
public static MoveCellLine1ToLine2(line1Data,line1Index,line2Data,line2Index,moveFunc){
|
|
|
|
|
|
let canMoveData = []//可以移动的数据
|
|
//目标列为空(全部可移动)
|
|
if(line2Data.length <= 0){
|
|
for(let i=0;i<line1Data.length;i++){
|
|
canMoveData.push(line1Data[i])
|
|
}
|
|
}else{
|
|
//数值不同不可以移动
|
|
if(line2Data[0].num != line1Data[0].num){
|
|
|
|
//可以移动(需判断不能超过10张)
|
|
}else{
|
|
for(let i=0;i<line1Data.length;i++){
|
|
canMoveData.push(line1Data[i])
|
|
}
|
|
}
|
|
}
|
|
|
|
//移牌前数据
|
|
let yiPaiQianData = Common5.deepClone(this.cell_data)
|
|
|
|
//移完牌后刷新牌数据
|
|
for(let i=0;i<canMoveData.length;i++){
|
|
this.cell_data[line1Index].pop()
|
|
this.cell_data[line2Index].push(canMoveData[i].num)
|
|
}
|
|
this.saveGameProgressData()
|
|
console.log("移完牌刷新牌数据this.cell_data==",this.cell_data)
|
|
moveFunc && moveFunc(canMoveData,yiPaiQianData)
|
|
|
|
}
|
|
//使用魔法道具(最上层盘子变成同色)
|
|
public static useMoFaDaoJu(){
|
|
let changeColorPosTab = []//记录ui需要变化的位置
|
|
let colorNum = 1
|
|
if(this.curGuanQiaNum == 1){
|
|
colorNum = 1
|
|
}else if(this.curGuanQiaNum == 2){
|
|
colorNum = 10
|
|
}else if(this.curGuanQiaNum == 3){
|
|
colorNum = 19
|
|
}
|
|
//第一个洗碗池的数据
|
|
if(this.cell_data[12].length > 0){
|
|
colorNum = this.cell_data[12][0]
|
|
}
|
|
//所有列包括临时区
|
|
for(let i=0;i<=11;i++){
|
|
let lineData = this.cell_data[i]
|
|
let topNum = lineData[lineData.length-1]
|
|
changeColorPosTab[i] = []
|
|
for(let j=lineData.length-1;j>=0;j--){
|
|
if(topNum == lineData[j]){
|
|
lineData[j] = colorNum
|
|
changeColorPosTab[i].push(j)
|
|
}else{
|
|
break
|
|
}
|
|
}
|
|
}
|
|
console.log('使用魔法道具后this.cell_data=',this.cell_data,changeColorPosTab)
|
|
return {changeColorPosTab:changeColorPosTab,colorNum:colorNum}
|
|
}
|
|
//根据空格数获取发牌数
|
|
public static getFaPaiShuByKongGeShu(kongGeNum){
|
|
let num = 0
|
|
let index = Math.floor(Math.random()*100)
|
|
let lineConfig = FaPaiShu_KongGeShu_config['KG_'+kongGeNum]
|
|
for(let i=0;i<lineConfig.length;i++){
|
|
num += lineConfig[i].rate
|
|
if(index < num){
|
|
return lineConfig[i].faPaiShu
|
|
}
|
|
}
|
|
}
|
|
//根据发牌数获取种类数
|
|
public static getZhongLeiShuByFaPaiShu(faPaiShu){
|
|
let num = 0
|
|
let index = Math.floor(Math.random()*100)
|
|
let lineConfig = FaPaiShu_ZhongLei['PS_'+faPaiShu]
|
|
for(let i=0;i<lineConfig.length;i++){
|
|
num += lineConfig[i].rate
|
|
if(index < num){
|
|
return lineConfig[i].typeNum
|
|
}
|
|
}
|
|
}
|
|
//获取特定种类数组
|
|
public static getTeDingZhongLeiTab(kongGeNum){
|
|
let faPaiShu = this.getFaPaiShuByKongGeShu(kongGeNum)
|
|
let typeNum = this.getZhongLeiShuByFaPaiShu(faPaiShu)
|
|
|
|
let allTab = FaPaiShu_TeDingZhongLei['PS_'+faPaiShu]['numTabType_'+typeNum]
|
|
let index = Math.floor(Math.random()*allTab.length)
|
|
// console.log('根据发牌数和种类数获取特定种类数组=',faPaiShu,typeNum,allTab[index])
|
|
return allTab[index]
|
|
}
|
|
//获取总的空格数(用于判断洗牌按钮的显示与否)
|
|
public static getAllKongGeNum(){
|
|
let kongGeNum = 0
|
|
for(let j=0;j<=this.unlock_cell;j++){
|
|
kongGeNum += (10-this.cell_data[j].length)
|
|
}
|
|
return kongGeNum
|
|
}
|
|
//设置发牌数据
|
|
// public static setFaPaiData(callFunc){
|
|
// let recordFaPaiLineTab = []
|
|
// for(let i = 0;i<=this.unlock_cell;i++){
|
|
// if(this.cell_data[i].length < 10){
|
|
// recordFaPaiLineTab.push(i)
|
|
// }
|
|
// }
|
|
|
|
// let faPaiData = {}
|
|
// let lineLength = recordFaPaiLineTab.length
|
|
// //剔除一列不发牌
|
|
// if(lineLength > 1){
|
|
// let index = Math.floor(Math.random()*lineLength)
|
|
// recordFaPaiLineTab.splice(index,1)
|
|
|
|
// for(let j=0;j<recordFaPaiLineTab.length;j++){
|
|
// let kongGeNum = 10-this.cell_data[recordFaPaiLineTab[j]].length
|
|
// let lineData = this.getSingleLineFaPaiData(kongGeNum)
|
|
// faPaiData['line_'+recordFaPaiLineTab[j]] = lineData
|
|
// }
|
|
|
|
// //只有一列有空格的话,就发这列
|
|
// }else if(lineLength == 1){
|
|
// let kongGeNum = 10-this.cell_data[recordFaPaiLineTab[0]].length
|
|
// let lineData = this.getSingleLineFaPaiData(kongGeNum)
|
|
// faPaiData['line_'+recordFaPaiLineTab[0]] = lineData
|
|
// //没有空格了
|
|
// }else{
|
|
// console.log("没有空格了。。。")
|
|
// }
|
|
// console.log('发牌数据==',faPaiData)
|
|
// let finishSendCardCallFunc = ()=>{
|
|
|
|
// for(let i=0;i<=this.unlock_cell;i++){
|
|
// let lineData = faPaiData['line_'+i]
|
|
// if(lineData){
|
|
// for(let j=0;j<lineData.length;j++){
|
|
// this.cell_data[i].push(lineData[j])
|
|
// }
|
|
// }
|
|
// }
|
|
// this.saveGameProgressData()
|
|
// console.log("发完牌后所有牌数据this.cell_data=",this.cell_data)
|
|
// }
|
|
// callFunc && callFunc(faPaiData,finishSendCardCallFunc)
|
|
// }
|
|
//获取单列发牌数据(isFirstStatus表示获取初始牌数据)
|
|
// public static getSingleLineFaPaiData(kongGeNum,isFirstStatus?){
|
|
// //发牌的数组
|
|
// let fapaiArr = []
|
|
// if(isFirstStatus){
|
|
// let tab = [[4],[1,3],[3,1]]
|
|
// fapaiArr = tab[Math.floor(Math.random()*tab.length)]
|
|
// }else{
|
|
// fapaiArr = this.getTeDingZhongLeiTab(kongGeNum)
|
|
// }
|
|
// let lineData = []
|
|
// for(let k=0;k<fapaiArr.length;k++){
|
|
// let num = fapaiArr[k]
|
|
// let number = 0
|
|
|
|
// if((this.curTargetNumber - 5) % 6 == 0){
|
|
// // number = Math.floor(Math.random()*(this.curTargetNumber - 2))+ (this.curTargetMinNumber - 4)
|
|
// number = (this.curTargetMinNumber - 4) + Math.floor(Math.random()*4)
|
|
// }else{
|
|
// number = (this.curTargetMinNumber - 4) + Math.floor(Math.random()*(this.curTargetNumber-this.curTargetMinNumber+3))
|
|
// }
|
|
|
|
// for(let m=0;m<num;m++){
|
|
// lineData.push(number)
|
|
// }
|
|
// }
|
|
// return lineData
|
|
// }
|
|
//目标值
|
|
public static curTargetMinNumber = 5
|
|
public static getCurTargetMinNumber(){
|
|
return this.curTargetMinNumber
|
|
}
|
|
public static curTargetNumber = 5
|
|
public static getCurTargetNumber(){
|
|
return this.curTargetNumber
|
|
}
|
|
public static addTargetNumber(jieSuoKaCaoFunc){
|
|
this.curTargetNumber++
|
|
//从左往右第三个数不作为目标值
|
|
if(this.curTargetNumber - this.curTargetMinNumber == 3){
|
|
this.curTargetNumber++
|
|
}
|
|
|
|
|
|
//进入新的目标
|
|
if(this.curTargetNumber - this.curTargetMinNumber == 6){
|
|
this.addUnLockCell(jieSuoKaCaoFunc,false)
|
|
this.initNewPageData()
|
|
}else{
|
|
this.addUnLockCell(jieSuoKaCaoFunc,true)
|
|
}
|
|
}
|
|
//完成当前目标页,进入下一页
|
|
public static initNewPageData(){
|
|
// this.curTargetMinNumber = this.curTargetNumber
|
|
this.unlock_ads9 = false
|
|
this.unlock_ads10 = false
|
|
this.unlock_ads11 = false
|
|
this.unlock_cell = 1
|
|
// this.jieSuoTuJianId++
|
|
|
|
// this.unlock_adsXiWanChi2 = false
|
|
// this.leftPanZiNum = 1800
|
|
|
|
// this.initXiWanChiData()
|
|
// this.addLeftPanZiNum(this.getGuanQiaAwardNum())
|
|
this.curGuanQiaNum ++
|
|
this.curGuanQiaFinishNum = 0
|
|
this.initStartCellData()
|
|
// this.leftPanZiNum = 1800
|
|
this.initLeftPanZiNum()
|
|
this.saveGameProgressData()
|
|
this.maxTime = this.getChushiTime();
|
|
}
|
|
//重新开始当局游戏-重置数据
|
|
public static restartCurPageData(){
|
|
this.curTargetNumber = this.curTargetMinNumber
|
|
this.unlock_ads9 = false
|
|
this.unlock_ads10 = false
|
|
this.unlock_ads11 = false
|
|
this.unlock_ads13 = false
|
|
this.unlock_cell = 1
|
|
this.unlock_adsXiWanChi2 = false
|
|
this.curGuanQiaNum = 1
|
|
this.curGuanQiaFinishNum = 0
|
|
this.ads9LeftTimer = 180
|
|
this.ads10LeftTimer = 180
|
|
this.ads11LeftTimer = 180
|
|
this.yiXiaoChuNum = 0
|
|
this.jieSuoColorNum = 2
|
|
this.isAutoBuPanTimer = false
|
|
this.autoBuPanTimeNum = 0
|
|
this.curJieSuoShengXiaoId = 0
|
|
this.initXiaoChuColorNum()
|
|
this.initLeftPanZiNum()
|
|
this.initStartCellData()
|
|
this.maxTime = -1;
|
|
// this.initXiWanChiData()
|
|
this.saveGameProgressData()
|
|
}
|
|
public static getTargetNumber(){
|
|
return this.curTargetNumber
|
|
}
|
|
//当前已解锁格子(0开始)
|
|
public static unlock_cell = 1
|
|
public static getUnlockCell(){
|
|
return this.unlock_cell
|
|
}
|
|
public static jieSuoUnlockCell(num){
|
|
this.unlock_cell = num
|
|
this.saveGameProgressData()
|
|
}
|
|
public static addUnLockCell(jieSuoKaCaoFunc,bRefresh){
|
|
this.unlock_cell += 1
|
|
if(this.unlock_cell > 8){
|
|
this.unlock_cell = 8
|
|
}
|
|
//解锁卡槽回调处理ui
|
|
jieSuoKaCaoFunc && jieSuoKaCaoFunc(bRefresh,this.unlock_cell)
|
|
}
|
|
|
|
|
|
//检测合成
|
|
public static getHeChengLine(){
|
|
let heChengTab = []
|
|
for(let i=0;i<14;i++){
|
|
let lineData = this.cell_data[i]
|
|
//只检测满列状态
|
|
if(lineData.length >= 10){
|
|
let number = lineData[0]
|
|
let isHeCheng = true
|
|
for(let j=0;j<10;j++){
|
|
if(number != lineData[j]){
|
|
isHeCheng = false
|
|
break
|
|
}
|
|
}
|
|
if(isHeCheng){
|
|
heChengTab.push({line:i})
|
|
}
|
|
}
|
|
}
|
|
return heChengTab
|
|
}
|
|
public static checkHeCheng(lineIndex,callFunc){
|
|
let heChengTab = []
|
|
// for(let i=0;i<14;i++){
|
|
let lineData = this.cell_data[lineIndex]
|
|
let number = 1
|
|
let account = lineData.length
|
|
//只检测满列状态
|
|
if(lineData.length >= 12){
|
|
number = lineData[0]
|
|
heChengTab.push({line:lineIndex,num:number,account:account})
|
|
}
|
|
// }
|
|
console.log("检测合成heChengTab==",heChengTab)
|
|
let heChengQianData = Common5.deepClone(this.cell_data)
|
|
console.log('合成完成前数据heChengQianData=',heChengQianData)
|
|
|
|
let heChengQianColorAccount = 0
|
|
let heChengHouColorAccount = 0
|
|
if(heChengTab.length > 0){
|
|
for(let k=0;k<heChengTab.length;k++){
|
|
this.cell_data[heChengTab[k].line].length = 0
|
|
}
|
|
heChengQianColorAccount = this.getXiaoChuColorNum(number-1)
|
|
this.addXiaoChuColorNum(number-1,account)
|
|
heChengHouColorAccount = this.getXiaoChuColorNum(number-1)
|
|
this.addYiXiaoChuNum()
|
|
this.addYiXiaoChuAllNum()
|
|
this.saveGameProgressData()
|
|
console.log('合成完成后刷新牌数据this.cell_data=',this.cell_data)
|
|
}
|
|
callFunc && callFunc(heChengTab,heChengQianData,heChengQianColorAccount,heChengHouColorAccount)
|
|
}
|
|
//保存游戏进度数据
|
|
public static saveGameProgressData(){
|
|
let data:GameProgressDataProperty_xmj = {
|
|
unlock_cell:this.unlock_cell,
|
|
cell_data:this.cell_data,
|
|
curTargetMinNumber:this.curTargetMinNumber,
|
|
curTargetNumber:this.curTargetNumber,
|
|
unlock_ads9:this.unlock_ads9,
|
|
unlock_ads10:this.unlock_ads10,
|
|
unlock_ads11:this.unlock_ads11,
|
|
jieSuoTuJianId:this.jieSuoTuJianId,
|
|
|
|
curXiWanChiLevel:this.curXiWanChiLevel,
|
|
unlock_adsXiWanChi2:this.unlock_adsXiWanChi2,
|
|
leftPanZiNum:this.leftPanZiNum,
|
|
curGuanQiaNum:this.curGuanQiaNum,
|
|
curGuanQiaFinishNum:this.curGuanQiaFinishNum,
|
|
ads9LeftTimer:this.ads9LeftTimer,
|
|
ads10LeftTimer:this.ads10LeftTimer,
|
|
ads11LeftTimer:this.ads11LeftTimer,
|
|
yiXiaoChuNum:this.yiXiaoChuNum,
|
|
yiXiaoChuAllNum:this.yiXiaoChuAllNum,
|
|
jieSuoColorNum:this.jieSuoColorNum,
|
|
gameTime:this.maxTime,
|
|
xiaoChuColorNumTab:this.xiaoChuColorNumTab,
|
|
isAutoBuPanTimer:this.isAutoBuPanTimer,
|
|
autoBuPanTimeNum:this.autoBuPanTimeNum,
|
|
unlock_ads13:this.unlock_ads13,
|
|
curJieSuoShengXiaoId:this.curJieSuoShengXiaoId,
|
|
// xiWanChi_data:this.xiWanChi_data
|
|
}
|
|
// User.setSaveGameProgressData_xmj(data)
|
|
}
|
|
|
|
public static getGameProgressData(){
|
|
// return User.getSaveGameProgressData_xmj()
|
|
}
|
|
//洗牌(后三格不洗牌)
|
|
public static xiPaiRecordTab = []//记录洗牌数据(仅用于判断洗牌前后一致时不播音效)
|
|
public static getXiPaiRecordTab(){
|
|
return this.xiPaiRecordTab
|
|
}
|
|
public static xiPaiLogic(xiPaiCallFunc){
|
|
|
|
|
|
let sortTab = []
|
|
for(let i=0;i<9;i++){
|
|
sortTab[i] = []
|
|
}
|
|
for(let i=0;i<9;i++){
|
|
for(let j=0;j<this.cell_data[i].length;j++){
|
|
if(sortTab[this.cell_data[i][j] - (this.curTargetMinNumber-4)].length < 10){
|
|
sortTab[this.cell_data[i][j] - (this.curTargetMinNumber-4)].push({num:this.cell_data[i][j],posX:i,posY:j,isMove:true})
|
|
}else{
|
|
sortTab[this.cell_data[i][j] - (this.curTargetMinNumber-4)].push({num:this.cell_data[i][j],posX:i,posY:j,isMove:false})
|
|
}
|
|
|
|
}
|
|
}
|
|
console.log("tempTab==",sortTab)
|
|
//洗牌ui结束后刷新洗牌后的cellData
|
|
let refreshXiPaiDataFunc = ()=>{
|
|
|
|
for(let i=0;i<9;i++){
|
|
this.cell_data[i] = []
|
|
this.xiPaiRecordTab[i] = []
|
|
for(let j=0;j<sortTab[i].length;j++){
|
|
if(sortTab[i][j].isMove){
|
|
this.xiPaiRecordTab[i].push(sortTab[i][j])
|
|
this.cell_data[i].push(sortTab[i][j].num)
|
|
}
|
|
}
|
|
}
|
|
console.log('洗完牌ui后最新的牌数据this.cell_data===',this.cell_data)
|
|
}
|
|
xiPaiCallFunc && xiPaiCallFunc(sortTab,refreshXiPaiDataFunc)
|
|
}
|
|
//兔子图鉴
|
|
public static jieSuoTuJianId:number = -1
|
|
public static getJieSuoTuJianId(){
|
|
return this.jieSuoTuJianId
|
|
}
|
|
//三个备用卡槽
|
|
public static unlock_ads9:boolean = false
|
|
public static unlock_ads10:boolean = false
|
|
public static unlock_ads11:boolean = false
|
|
public static unlock_ads13:boolean = false
|
|
public static setUnlockAds(index,bLock){
|
|
if(index == 9){
|
|
this.unlock_ads9 = bLock
|
|
}else if(index == 10){
|
|
this.unlock_ads10 = bLock
|
|
}else if(index == 11){
|
|
this.unlock_ads11 = bLock
|
|
}else if(index == 13){
|
|
this.unlock_ads13 = bLock
|
|
}
|
|
this.saveGameProgressData()
|
|
}
|
|
public static getTempUnLockAdsStatus(index){
|
|
if(index == 9){
|
|
return this.unlock_ads9
|
|
}else if(index == 10){
|
|
return this.unlock_ads10
|
|
}else if(index == 11){
|
|
return this.unlock_ads11
|
|
}else if(index == 13){
|
|
return this.unlock_ads13
|
|
}
|
|
}
|
|
//临时区剩余时间
|
|
public static ads9LeftTimer:number = 180
|
|
public static ads10LeftTimer:number = 180
|
|
public static ads11LeftTimer:number = 180
|
|
public static setUnlockAdsLeftTimer(index){
|
|
if(index == 9){
|
|
this.ads9LeftTimer = 180
|
|
}else if(index == 10){
|
|
this.ads10LeftTimer = 180
|
|
}else if(index == 11){
|
|
this.ads11LeftTimer = 180
|
|
}
|
|
this.saveGameProgressData()
|
|
}
|
|
public static getUnlockAdsLeftTimer(index){
|
|
if(index == 9){
|
|
return this.ads9LeftTimer
|
|
}else if(index == 10){
|
|
return this.ads10LeftTimer
|
|
}else if(index == 11){
|
|
return this.ads11LeftTimer
|
|
}
|
|
}
|
|
public static refreshAdsLeftTimer(){
|
|
// if(this.unlock_ads9){
|
|
// this.ads9LeftTimer -= 1
|
|
// }
|
|
// if(this.unlock_ads10){
|
|
// this.ads10LeftTimer -= 1
|
|
// }
|
|
// if(this.unlock_ads11){
|
|
// this.ads11LeftTimer -= 1
|
|
// }
|
|
// if(this.ads9LeftTimer < 0){
|
|
// this.ads9LeftTimer = 0
|
|
// this.unlock_ads9 = false
|
|
// }
|
|
// if(this.ads10LeftTimer < 0){
|
|
// this.ads10LeftTimer = 0
|
|
// this.unlock_ads10 = false
|
|
// }
|
|
// if(this.ads11LeftTimer < 0){
|
|
// this.ads11LeftTimer = 0
|
|
// this.unlock_ads11 = false
|
|
// }
|
|
// this.saveGameProgressData()
|
|
}
|
|
|
|
//洗碗池2解锁状态
|
|
public static unlock_adsXiWanChi2:boolean = false
|
|
public static getUnlockAdsXiWanChi2(){
|
|
return this.unlock_adsXiWanChi2
|
|
}
|
|
public static setUnlockAdsXiWanChi2(bLock){
|
|
this.unlock_adsXiWanChi2 = bLock
|
|
this.saveGameProgressData()
|
|
}
|
|
|
|
//剩余盘子数
|
|
public static leftPanZiNum:number = 0
|
|
public static subLeftPanZiNum(num){
|
|
|
|
if(this.leftPanZiNum - num < 0){
|
|
return false
|
|
}else{
|
|
this.leftPanZiNum -= num
|
|
this.setAutoBuPanTimeNum()
|
|
this.saveGameProgressData()
|
|
return true
|
|
}
|
|
}
|
|
public static addLeftPanZiNum(num){
|
|
this.leftPanZiNum += num
|
|
let chuShiKuCun = this.getChuShiKuCun()
|
|
if(this.leftPanZiNum > chuShiKuCun){
|
|
this.leftPanZiNum = chuShiKuCun
|
|
}
|
|
this.saveGameProgressData()
|
|
}
|
|
public static initLeftPanZiNum(){
|
|
this.leftPanZiNum = GuanQiaDataConfig['G_'+this.curGuanQiaNum].chuShiKuCun
|
|
}
|
|
public static getChuShiKuCun(){
|
|
//根据槽位获取盘子
|
|
let cellNum = this.unlock_cell+1
|
|
let chuShiKuCun = 600
|
|
for(let i = 0; i<AllChuShiKuCun.length;i++){
|
|
if(cellNum == AllChuShiKuCun[i].kaCao){
|
|
chuShiKuCun = AllChuShiKuCun[i].ChuShiKuCun
|
|
}
|
|
}
|
|
return chuShiKuCun
|
|
|
|
}
|
|
public static getChushiTime(){
|
|
return GuanQiaDataConfig['G_'+this.curGuanQiaNum].time;
|
|
}
|
|
public static getAddTime(){
|
|
return GuanQiaDataConfig['G_'+this.curGuanQiaNum].addtime;
|
|
}
|
|
public static getLeftPanZiNum(){
|
|
return this.leftPanZiNum
|
|
}
|
|
// //洗碗池数据
|
|
// public static xiWanChi_data = []
|
|
// public static initXiWanChiData(){
|
|
// for(let i=0;i<2;i++){
|
|
// this.xiWanChi_data[i] = []
|
|
// }
|
|
// }
|
|
// public static getXiWanChiData(){
|
|
// return this.xiWanChi_data
|
|
// }
|
|
//卡槽解锁金币
|
|
public static getKaCaoJieSuoCoin(key){
|
|
return KaCaoJieSuo_CoinConfig['G_'+this.curGuanQiaNum][key]
|
|
}
|
|
//获取洗碗池颜色
|
|
public static getXiWanChiColorArr(){
|
|
let arr = []
|
|
// for(let i=14;i<=15;i++){
|
|
// if(this.cell_data[i].length > 0){
|
|
// arr.push(this.cell_data[i][0] - 1)
|
|
// continue
|
|
// }
|
|
// }
|
|
return arr
|
|
}
|
|
//第几关
|
|
public static curGuanQiaNum = 1
|
|
public static getCurGuanQiaNum(){
|
|
return this.curGuanQiaNum
|
|
}
|
|
public static getGuanQiaTargetNum(){
|
|
return GuanQiaDataConfig['G_'+this.curGuanQiaNum].targetNum
|
|
}
|
|
public static getNextGuanQiaTargetNum(){
|
|
return GuanQiaDataConfig['G_'+(this.curGuanQiaNum+1)].targetNum
|
|
}
|
|
public static getGuanQiaAwardNum(){
|
|
return GuanQiaDataConfig['G_'+this.curGuanQiaNum].awardNum
|
|
}
|
|
public static getGuanQiaTargetColor(){
|
|
return GuanQiaDataConfig['G_'+this.curGuanQiaNum].targetColor
|
|
}
|
|
public static getNextGuanQiaTargetColor(){
|
|
return GuanQiaDataConfig['G_'+(this.curGuanQiaNum+1)].targetColor
|
|
}
|
|
//当前关卡已完成数量
|
|
public static curGuanQiaFinishNum = 0
|
|
public static getCurGuanQiaFinishNum(){
|
|
return this.curGuanQiaFinishNum
|
|
}
|
|
public static addCurGuanQiaFinishNum(num,finishCurGuanQia){
|
|
// let initNextPageData
|
|
//超过目标值
|
|
let isEnterNext = false
|
|
let targetNum = this.getGuanQiaTargetNum()
|
|
|
|
this.curGuanQiaFinishNum += num
|
|
// Common5.ALLMJ_SCORE += num
|
|
if(this.curGuanQiaFinishNum >= targetNum){
|
|
console.log('达到目标,进入下一关')
|
|
|
|
// this.curGuanQiaFinishNum = targetNum
|
|
isEnterNext = true
|
|
}else{
|
|
// this.curGuanQiaFinishNum += num
|
|
}
|
|
// CommonDefine.setImRankData(this.curGuanQiaFinishNum+Common5.ALLXIPANZI_SCORE+ Common5.ALLDLS_SCORE)
|
|
this.saveGameProgressData()
|
|
finishCurGuanQia && finishCurGuanQia(isEnterNext,()=>{
|
|
// this.initNewPageData()
|
|
})
|
|
}
|
|
public static isAutoBuPanTimer = false
|
|
public static autoBuPanTimeNum = 0
|
|
public static getIsAutoBuPanTimer(){
|
|
return this.isAutoBuPanTimer
|
|
}
|
|
public static setAutoBuPanTimeNum(){
|
|
if(!this.isAutoBuPanTimer){
|
|
this.isAutoBuPanTimer = true
|
|
this.autoBuPanTimeNum = Date.now() + 1000*3600
|
|
}
|
|
}
|
|
public static getAutoBuPanTimeLeftNum(){
|
|
let leftSeconds = 0
|
|
if(this.isAutoBuPanTimer){
|
|
leftSeconds = Math.floor((this.autoBuPanTimeNum - Date.now())/1000)
|
|
}else{
|
|
|
|
}
|
|
return leftSeconds
|
|
}
|
|
public static finishAutoBuPanTime(){
|
|
this.isAutoBuPanTimer = false
|
|
this.autoBuPanTimeNum = 0
|
|
}
|
|
public static curJieSuoShengXiaoId = 0
|
|
public static addJieSuoShengXiaoId(){
|
|
this.curJieSuoShengXiaoId++
|
|
}
|
|
public static getJieSuoShengXiaoId(){
|
|
return this.curJieSuoShengXiaoId
|
|
}
|
|
|
|
public static checkIsCanSendCard(){
|
|
// let isGM = GMManager.getToggleStatus_FPBuXianZhi()
|
|
// if(isGM){
|
|
// return false
|
|
// }
|
|
|
|
let isFull = true
|
|
for(let i=0;i<=this.unlock_cell;i++){
|
|
if(this.cell_data[i].length < 15){
|
|
isFull = false
|
|
break
|
|
}
|
|
}
|
|
return isFull
|
|
}
|
|
|
|
public static addSendPZIndex(){
|
|
let index = User.getSendPZIndex()
|
|
index+=1
|
|
if(index>=2){
|
|
index = 2
|
|
}
|
|
|
|
User.setSendPZIndex(index)
|
|
}
|
|
|
|
public static subSendPZIndex(){
|
|
let index = User.getSendPZIndex()
|
|
index--
|
|
if(index<=0){
|
|
index = 0
|
|
}
|
|
User.setSendPZIndex(index)
|
|
|
|
}
|
|
|
|
public static isCanContinueGame(){
|
|
// let isGM = GMManager.getToggleStatus_FPBuXianZhi()
|
|
// if(isGM){
|
|
// return true
|
|
// }
|
|
let index = User.getSendPZIndex()
|
|
if(index<=0){
|
|
//如果台子上的盘子小于12也是可以发牌的
|
|
let cellNum = 0
|
|
for(let i = 0; i<this.cell_data.length;i++){
|
|
cellNum+=this.cell_data[i].length
|
|
}
|
|
if(cellNum<30){
|
|
return true
|
|
}
|
|
return false
|
|
|
|
}else{
|
|
return true
|
|
}
|
|
}
|
|
public static getMaJiangConfigById(id){
|
|
for(let i=0;i<MaJiangColorConfig.length;i++){
|
|
if(id == MaJiangColorConfig[i].id){
|
|
return MaJiangColorConfig[i]
|
|
}
|
|
}
|
|
return null
|
|
}
|
|
}
|
|
|
|
/********* 第一关 **********/
|
|
export class GameFirstLevelManage {
|
|
|
|
}
|
|
|
|
/********* 第二关 **********/
|
|
export class GameSecondLevelManage_xmj {
|
|
public static setStartCellData(){
|
|
// let saveData:GameProgressDataProperty_xmj = NewDataManage_xmj.getGameProgressData()
|
|
// // let firstIn = User.getFirstInNew()
|
|
// //console.warn("saveData ===xmj_+++==",saveData)
|
|
// // if(!saveData || firstIn){
|
|
// if(!saveData){
|
|
|
|
NewDataManage_xmj.unlock_cell = 1
|
|
NewDataManage_xmj.curTargetMinNumber = 5
|
|
NewDataManage_xmj.curTargetNumber = 5
|
|
|
|
NewDataManage_xmj.unlock_ads9 = false
|
|
NewDataManage_xmj.unlock_ads10 = false
|
|
NewDataManage_xmj.unlock_ads11 = false
|
|
NewDataManage_xmj.unlock_ads13 = false
|
|
NewDataManage_xmj.jieSuoTuJianId = -1
|
|
NewDataManage_xmj.curXiWanChiLevel = [1,2]
|
|
NewDataManage_xmj.unlock_adsXiWanChi2 = false
|
|
// NewDataManage_xmj.leftPanZiNum = 0
|
|
NewDataManage_xmj.curGuanQiaNum = 1
|
|
NewDataManage_xmj.curGuanQiaFinishNum = 0
|
|
NewDataManage_xmj.ads9LeftTimer = 180
|
|
NewDataManage_xmj.ads10LeftTimer = 180
|
|
NewDataManage_xmj.ads11LeftTimer = 180
|
|
NewDataManage_xmj.yiXiaoChuNum = 0
|
|
NewDataManage_xmj.yiXiaoChuAllNum = 0
|
|
NewDataManage_xmj.jieSuoColorNum = 2
|
|
NewDataManage_xmj.maxTime = -1;
|
|
NewDataManage_xmj.isAutoBuPanTimer = false
|
|
NewDataManage_xmj.autoBuPanTimeNum = 0
|
|
NewDataManage_xmj.curJieSuoShengXiaoId = 0
|
|
// //要做新手引导
|
|
// NewDataManage_xmj.xinShouYinDaoCellData()
|
|
NewDataManage_xmj.initXiaoChuColorNum()
|
|
NewDataManage_xmj.initLeftPanZiNum()
|
|
NewDataManage_xmj.initStartCellData()
|
|
// Common5.ALLMJ_SCORE = 0
|
|
// NewDataManage_xmj.initXiWanChiData()
|
|
// }else{
|
|
// NewDataManage_xmj.cell_data = saveData.cell_data
|
|
// NewDataManage_xmj.unlock_cell = saveData.unlock_cell
|
|
// NewDataManage_xmj.curTargetMinNumber = saveData.curTargetMinNumber
|
|
// NewDataManage_xmj.curTargetNumber = saveData.curTargetNumber
|
|
|
|
// NewDataManage_xmj.unlock_ads9 = saveData.unlock_ads9
|
|
// NewDataManage_xmj.unlock_ads10 = saveData.unlock_ads10
|
|
// NewDataManage_xmj.unlock_ads11 = saveData.unlock_ads11
|
|
// NewDataManage_xmj.unlock_ads13 = saveData.unlock_ads13
|
|
// NewDataManage_xmj.jieSuoTuJianId = saveData.jieSuoTuJianId
|
|
|
|
// NewDataManage_xmj.curXiWanChiLevel = saveData.curXiWanChiLevel
|
|
// NewDataManage_xmj.unlock_adsXiWanChi2 = saveData.unlock_adsXiWanChi2
|
|
// NewDataManage_xmj.leftPanZiNum = saveData.leftPanZiNum
|
|
// NewDataManage_xmj.curGuanQiaNum = saveData.curGuanQiaNum
|
|
// NewDataManage_xmj.curGuanQiaFinishNum = saveData.curGuanQiaFinishNum
|
|
// NewDataManage_xmj.ads9LeftTimer = saveData.ads9LeftTimer
|
|
// NewDataManage_xmj.ads10LeftTimer = saveData.ads10LeftTimer
|
|
// NewDataManage_xmj.ads11LeftTimer = saveData.ads11LeftTimer
|
|
// NewDataManage_xmj.yiXiaoChuNum = saveData.yiXiaoChuNum
|
|
// NewDataManage_xmj.jieSuoColorNum = saveData.jieSuoColorNum
|
|
// NewDataManage_xmj.maxTime = saveData.gameTime;
|
|
// NewDataManage_xmj.yiXiaoChuAllNum = saveData.yiXiaoChuAllNum || 0
|
|
// if(saveData.xiaoChuColorNumTab){
|
|
// NewDataManage_xmj.xiaoChuColorNumTab = saveData.xiaoChuColorNumTab
|
|
// }else{
|
|
// NewDataManage_xmj.initXiaoChuColorNum()
|
|
// }
|
|
// NewDataManage_xmj.isAutoBuPanTimer = saveData.isAutoBuPanTimer
|
|
// NewDataManage_xmj.autoBuPanTimeNum = saveData.autoBuPanTimeNum
|
|
// if(saveData.curJieSuoShengXiaoId){
|
|
// NewDataManage_xmj.curJieSuoShengXiaoId = saveData.curJieSuoShengXiaoId
|
|
// }else{
|
|
// NewDataManage_xmj.curJieSuoShengXiaoId = 0
|
|
// }
|
|
// Common5.ALLMJ_SCORE = saveData.curGuanQiaFinishNum
|
|
// // NewDataManage_xmj.xiWanChi_data = saveData.xiWanChi_data
|
|
// }
|
|
NewDataManage_xmj.saveGameProgressData()
|
|
}
|
|
|
|
} |