|
@@ -9,6 +9,7 @@ cc.Class({
|
|
extends: cc.Component,
|
|
extends: cc.Component,
|
|
|
|
|
|
properties: {
|
|
properties: {
|
|
|
|
+ itemSp: [cc.SpriteFrame],
|
|
labRound: cc.Label,
|
|
labRound: cc.Label,
|
|
lineNode: cc.Node,
|
|
lineNode: cc.Node,
|
|
labBetSize: cc.Label,
|
|
labBetSize: cc.Label,
|
|
@@ -21,15 +22,29 @@ cc.Class({
|
|
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
|
|
- // onLoad () {},
|
|
|
|
|
|
+ onLoad () {
|
|
|
|
+ this.valueCfg = [
|
|
|
|
+ {id: 1, name:'钻石', val:{3:20, 4:30, 5:40, 6:50} },
|
|
|
|
+ {id: 2, name:'美元', val:{3:10, 4:15, 5:20, 6:30} },
|
|
|
|
+ {id: 3, name:'金币', val:{3:8, 4:10, 5:15, 6:20} },
|
|
|
|
+ {id: 4, name:'铃铛', val:{3:5, 4:8, 5:10, 6:15} },
|
|
|
|
+ {id: 5, name:'柠檬', val:{3:3, 4:5, 5:8, 6:10} },
|
|
|
|
+ {id: 6, name:'樱桃', val:{3:2, 4:3, 5:5, 6:8} },
|
|
|
|
+ {id: 7, name:'树叶', val:{3:2, 4:3, 5:5, 6:8} },
|
|
|
|
+ {id: 8, name:'A', val:{3:1, 4:2, 5:3, 6:5} },
|
|
|
|
+ {id: 9, name:'K', val:{3:1, 4:2, 5:3, 6:5} },
|
|
|
|
+ {id: 10, name:'Q', val:{3:1, 4:2, 5:3, 6:5} },
|
|
|
|
+ {id: 11, name:'J', val:{3:1, 4:2, 5:3, 6:5} }
|
|
|
|
+ ];
|
|
|
|
+ },
|
|
|
|
|
|
start () {
|
|
start () {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- initData(detailJs, index){
|
|
|
|
|
|
+ initData(detailJs, data){
|
|
this.detailJs = detailJs;
|
|
this.detailJs = detailJs;
|
|
- this.index = index;
|
|
|
|
|
|
+ this.data = data;
|
|
this.info = this.detailJs.info;
|
|
this.info = this.detailJs.info;
|
|
this.game_report = this.detailJs.game_report;
|
|
this.game_report = this.detailJs.game_report;
|
|
if(!this.info.game_report_init){
|
|
if(!this.info.game_report_init){
|
|
@@ -39,69 +54,37 @@ cc.Class({
|
|
this.report_init[0] /= 100;
|
|
this.report_init[0] /= 100;
|
|
this.labBetSize.string = `Bet Size ${(this.report_init[0]).toFixed(2)}`;
|
|
this.labBetSize.string = `Bet Size ${(this.report_init[0]).toFixed(2)}`;
|
|
this.labBetLevel.string = `Bet Level ${this.report_init[1]}`;
|
|
this.labBetLevel.string = `Bet Level ${this.report_init[1]}`;
|
|
|
|
+
|
|
|
|
+ this.labRound.node.active = this.data.round != 1;
|
|
|
|
+ this.lineNode.active = this.data.round != 1;
|
|
|
|
+ this.labRound.string = `Round ${this.data.index + 1}/${this.data.round}`;
|
|
|
|
+
|
|
|
|
+
|
|
this.setIcon();
|
|
this.setIcon();
|
|
this.setDi();
|
|
this.setDi();
|
|
},
|
|
},
|
|
|
|
|
|
- // update (dt) {},p
|
|
|
|
|
|
+ // update (dt) {},
|
|
|
|
|
|
- setIcon(){
|
|
|
|
- //普通赋值
|
|
|
|
- let itemInfo = this.game_report.itemInfo; //itemInfo 界面展示的元素
|
|
|
|
- let showItemInfo = []; //中奖的元素
|
|
|
|
- for(let i=0; i < this.game_report.lineItem.length; i++){
|
|
|
|
- for(let j=0; j < this.game_report.lineItem[i].okPath.length; j++){
|
|
|
|
- showItemInfo.push(this.game_report.lineItem[i].okPath[j]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //超级转赋值
|
|
|
|
- if(this.game_report.superResult){ //是超级转
|
|
|
|
- itemInfo = this.game_report.superResult[this.index].itemInfo;
|
|
|
|
-
|
|
|
|
- if(this.index == 0){ //超级转展示界面, 空元素随机赋值.
|
|
|
|
- let arr = [1, 2, 3, 4, 5, 6];
|
|
|
|
- let selectItem = 1;
|
|
|
|
- for(let i=0; i < itemInfo.length; i++){
|
|
|
|
- if(itemInfo[i] != 0){
|
|
|
|
- selectItem = itemInfo[i];
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- arr = this.removeElement(arr, selectItem);
|
|
|
|
- for(let i=0; i < itemInfo.length; i++){
|
|
|
|
- if(itemInfo[i] == 0){
|
|
|
|
- itemInfo[i] = this.getRandomValue(arr);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- showItemInfo = [];
|
|
|
|
- let tLineItem = this.game_report.superResult[this.index].lineItem;
|
|
|
|
- for(let i=0; i < tLineItem.length; i++){
|
|
|
|
- for(let j=0; j < tLineItem[i].okPath.length; j++){
|
|
|
|
- showItemInfo.push(tLineItem[i].okPath[j]);
|
|
|
|
|
|
+ setIcon(){
|
|
|
|
+ let itemInfo = this.data.itemInfo;
|
|
|
|
+ let showItemInfo = [];
|
|
|
|
+ if(this.data.lineItem){
|
|
|
|
+ for(let i=0; i < this.data.lineItem.length; i++){
|
|
|
|
+ for(let j=0; j< this.data.lineItem[i].okPath.length; j++){
|
|
|
|
+ showItemInfo.push( this.data.lineItem[i].okPath[j] );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //数组去重
|
|
|
|
- showItemInfo = Array.from(new Set(showItemInfo));
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ //数组去重
|
|
|
|
+ showItemInfo = Array.from(new Set(showItemInfo));
|
|
|
|
+
|
|
//展示
|
|
//展示
|
|
- for(let i =0; i < this.iconCon.childrenCount; i++){
|
|
|
|
- for(let j=0; j < this.iconCon.children[i].childrenCount; j++){
|
|
|
|
- this.iconCon.children[i].children[j].active = false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for(let i=0; i< this.iconCon.childrenCount; i++){
|
|
|
|
- for(let j=0; j < this.iconCon.children[i].childrenCount; j++){
|
|
|
|
- if(itemInfo[i] == 0) continue;
|
|
|
|
- this.iconCon.children[i].children[itemInfo[i]-1].active = true;
|
|
|
|
- }
|
|
|
|
- // tNode.getChildByName('select').active = showItemInfo.indexOf(i) != -1;
|
|
|
|
|
|
+ for(let i=2; i < itemInfo.length; i++){
|
|
|
|
+ this.iconCon.children[i].getChildByName('sp').getComponent(cc.Sprite).spriteFrame = this.itemSp[itemInfo[i]-1];
|
|
|
|
+ this.iconCon.children[i].getChildByName('select').active = showItemInfo.indexOf(i) != -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
},
|
|
},
|
|
|
|
|
|
getRandomValue(arr){
|
|
getRandomValue(arr){
|
|
@@ -110,60 +93,78 @@ cc.Class({
|
|
},
|
|
},
|
|
|
|
|
|
removeElement(arr, element){
|
|
removeElement(arr, element){
|
|
- return arr.filter( (item)=> {
|
|
|
|
|
|
+ return arr.filter( (item)=> {
|
|
return item != element;
|
|
return item != element;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ countOccurrences(arr, val) {
|
|
|
|
+ return arr.filter(item => item === val).length;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ getIdColWays(id, lineItem){
|
|
|
|
+ //把百搭转换成id
|
|
|
|
+ let copyLineItem = JSON.parse(JSON.stringify(lineItem));
|
|
|
|
+ for(let i=0; i< copyLineItem.length; i++){
|
|
|
|
+ if(copyLineItem[i] == 12 || copyLineItem[i] == 13){
|
|
|
|
+ copyLineItem[i] = id;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let tempArr = [ [0,6,12,18], [1,7,13,19], [2,8,14,20], [3,9,15,21], [4,10,16,22], [5,11,17,23] ];
|
|
|
|
+ let col = 0;
|
|
|
|
+ let ways = 1;
|
|
|
|
+ for(let i=0; i< tempArr.length; i++){
|
|
|
|
+ for(let j=0; j < tempArr[i].length; j++){
|
|
|
|
+ tempArr[i][j] = copyLineItem[ tempArr[i][j] ];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for(let i=0; i < tempArr.length; i++){
|
|
|
|
+ if(tempArr[i].indexOf(id) != -1){
|
|
|
|
+ col += 1;
|
|
|
|
+ }else{
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for(let i=0; i< col; i++){
|
|
|
|
+ let nums = this.countOccurrences(tempArr[i], id);
|
|
|
|
+ ways *= nums;
|
|
|
|
+ }
|
|
|
|
+ return {col: col, ways: ways};
|
|
|
|
+ },
|
|
|
|
+
|
|
setDi(){
|
|
setDi(){
|
|
//构造数据
|
|
//构造数据
|
|
let showData = [];
|
|
let showData = [];
|
|
- if(!this.game_report.superResult){ //普通
|
|
|
|
- if(this.game_report.lineItem.length == 0){ //未中奖
|
|
|
|
- showData.push({s1:true, labS1:'No Winning Combination'});
|
|
|
|
- }else{ //中奖
|
|
|
|
- if(this.game_report.lineItem.length == 10){ //全中展示
|
|
|
|
- showData.push({s1:true, labS1:'Win Multiplier x10 '});
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //排序
|
|
|
|
- this.game_report.lineItem.sort((a, b)=>{
|
|
|
|
- return a.lineIndex - b.lineIndex;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- for(let i=0; i < this.game_report.lineItem.length; i++){
|
|
|
|
- showData.push({
|
|
|
|
- s1:false, labS1:'',
|
|
|
|
- s2Data: this.game_report.lineItem[i]
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ if(this.data.type == 0 && this.data.index +1 == this.data.round){
|
|
|
|
+ let scatterCount = this.countOccurrences(this.data.itemInfo, 13);
|
|
|
|
+ if(scatterCount >= 4){ //超过4个,中了超级转
|
|
|
|
+ showData.push({showS: 'status1', nums:scatterCount,
|
|
|
|
+ des:`${this.detailJs.game_report.superResult.length} Free Spins`});
|
|
}
|
|
}
|
|
- }else{ //是超级转
|
|
|
|
- if(this.index == this.game_report.superResult.length-1){//最后一个展示中奖信息
|
|
|
|
- let xLineItem = this.game_report.superResult[this.index].lineItem;
|
|
|
|
- if(xLineItem.length == 10){ //貌似是大奖倍数展示
|
|
|
|
- showData.push({s1:true, labS1:'Win Multiplier x10 '});
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //排序
|
|
|
|
- xLineItem.sort((a, b)=>{
|
|
|
|
- return a.lineIndex - b.lineIndex;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- for(let i=0; i < xLineItem.length; i++){
|
|
|
|
- showData.push({
|
|
|
|
- s1:false, labS1:'',
|
|
|
|
- s2Data: xLineItem[i]
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- showData.push({s1:true, labS1:'Fortune Cow Feature Respin'});
|
|
|
|
|
|
+ }
|
|
|
|
+ let mult = this.data.mult;
|
|
|
|
+ if(!this.data.lineItem){
|
|
|
|
+ mult += 1;
|
|
|
|
+ }
|
|
|
|
+ showData.push({showS: 'status2', des: `Win Multiplier x${mult}`}); //当前倍数
|
|
|
|
+ if(!this.data.lineItem){ //未中奖
|
|
|
|
+ showData.push({showS: 'status3', des: `No Winning Combination`});
|
|
|
|
+ }
|
|
|
|
+ if(this.data.lineItem){ //中奖
|
|
|
|
+ for(let i=0; i < this.data.lineItem.length; i++){
|
|
|
|
+ let obj = {};
|
|
|
|
+ let temp = this.getIdColWays(this.data.lineItem[i].cardValue, this.data.itemInfo);
|
|
|
|
+ obj.showS = 'status4';
|
|
|
|
+ obj.itemId = this.data.lineItem[i].cardValue;
|
|
|
|
+ obj.awTimes = this.data.lineItem[i].awTimes * this.data.mult;
|
|
|
|
+ obj.ways = temp.ways;
|
|
|
|
+ obj.col = temp.col;
|
|
|
|
+ obj.val = this.valueCfg[this.data.lineItem[i].cardValue -1].val[temp.col];
|
|
|
|
+ showData.push(obj);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//展示
|
|
//展示
|
|
- // this.diLayoutNode.removeAllChildren();
|
|
|
|
- this.tipsArr = []; //存放tips
|
|
|
|
for(let i=0; i < showData.length; i++){
|
|
for(let i=0; i < showData.length; i++){
|
|
let xx = cc.instantiate(this.diItemPrefab);
|
|
let xx = cc.instantiate(this.diItemPrefab);
|
|
xx.active = true;
|
|
xx.active = true;
|
|
@@ -173,41 +174,45 @@ cc.Class({
|
|
this.diLayoutNode.height = 210 + 130 * i;
|
|
this.diLayoutNode.height = 210 + 130 * i;
|
|
|
|
|
|
let s1 = xx.getChildByName('status1');
|
|
let s1 = xx.getChildByName('status1');
|
|
- s1.getChildByName('des').getComponent(cc.Label).string = showData[i].labS1;
|
|
|
|
- s1.active = showData[i].s1;
|
|
|
|
-
|
|
|
|
|
|
+ s1.active = false;
|
|
let s2 = xx.getChildByName('status2');
|
|
let s2 = xx.getChildByName('status2');
|
|
- s2.active = !showData[i].s1;
|
|
|
|
- if(s1.active){
|
|
|
|
- continue;
|
|
|
|
|
|
+ s2.active = false;
|
|
|
|
+ let s3 = xx.getChildByName('status3');
|
|
|
|
+ s3.active = false;
|
|
|
|
+ let s4 = xx.getChildByName('status4');
|
|
|
|
+ s4.active = false;
|
|
|
|
+
|
|
|
|
+ if(showData[i].showS == 'status1'){
|
|
|
|
+ s1.active = true;
|
|
|
|
+ s1.getChildByName('num').getComponent(cc.Label).string = `x${showData[i].nums}`;
|
|
|
|
+ s1.getChildByName('score').getComponent(cc.Label).string = showData[i].des;
|
|
|
|
+ }
|
|
|
|
+ if(showData[i].showS == 'status2'){
|
|
|
|
+ s2.active = true;
|
|
|
|
+ s2.getChildByName('des').getComponent(cc.Label).string = showData[i].des;
|
|
|
|
+ }
|
|
|
|
+ if(showData[i].showS == 'status3'){
|
|
|
|
+ s3.getChildByName('des').getComponent(cc.Label).string = showData[i].des;
|
|
|
|
+ }
|
|
|
|
+ if(showData[i].showS == 'status4'){
|
|
|
|
+ s4.active = true;
|
|
|
|
+ s4.getChildByName('icon').getComponent(cc.Sprite).spriteFrame = this.itemSp[showData[i].itemId-1];
|
|
|
|
+ s4.getChildByName('kind').getComponent(cc.Label).string =
|
|
|
|
+ showData[i].col + ' of a kind';
|
|
|
|
+ s4.getChildByName('way').getComponent(cc.Label).string =
|
|
|
|
+ showData[i].ways + ' way(s)';
|
|
|
|
+ s4.getChildByName('score').getComponent(cc.Label).string = (showData[i].awTimes/100).toFixed(2);
|
|
|
|
+ s4.getChildByName('score2').getComponent(cc.Label).string =
|
|
|
|
+ (showData[i].awTimes/this.data.mult/100).toFixed(2) + ' x' + this.data.mult;
|
|
|
|
+
|
|
|
|
+ UIHelper.addButtonListener(s4, this.node, 'LuckyPigHistoryDetailItemDev', 'onClickS4', showData[i]);
|
|
|
|
+ let tipMask = cc.find('tips/mask', s4);
|
|
|
|
+ UIHelper.addButtonListener(tipMask, this.node, 'LuckyPigHistoryDetailItemDev', 'onClickS4', {bClose:true});
|
|
}
|
|
}
|
|
-
|
|
|
|
- // let numCi =showData[0].s1 ? i : (i+1); //序号从1开始
|
|
|
|
- let numCi = showData[i].s2Data.lineIndex;
|
|
|
|
- let score = this.report_init[0] * this.report_init[1] * showData[i].s2Data.awTimes;
|
|
|
|
-
|
|
|
|
- s2.getChildByName('ci').getComponent(cc.Label).string = ('0' + numCi).slice(-2);
|
|
|
|
- s2.getChildByName('score').getComponent(cc.Label).string = (score).toFixed(2);
|
|
|
|
- this.setDiIcon(s2, showData[i].s2Data.okPath);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- let data = {bei:showData[i].s2Data.awTimes, 'id': numCi-1}; //idcon
|
|
|
|
- UIHelper.addButtonListener(s2, this.node, "CowHistoryDetailItemDev", "onClickS2", data);
|
|
|
|
- let tipMask = cc.find('tips/mask', s2);
|
|
|
|
- UIHelper.addButtonListener(tipMask, this.node, "CowHistoryDetailItemDev", "onClickS2", {bClose:true});
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- setDiIcon(tNode, path){
|
|
|
|
- let con = cc.find('kuang/layout', tNode);
|
|
|
|
- for(let i=0 ; i < con.childrenCount; i++){
|
|
|
|
- con.children[i].getChildByName('sp').active = path.indexOf(i) != -1;
|
|
|
|
- // con.children[i].active = path.indexOf(i) != -1;
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
- onClickS2(event, info){
|
|
|
|
-
|
|
|
|
|
|
+ onClickS4(event, info){
|
|
if(info.bClose){
|
|
if(info.bClose){
|
|
event.target.parent.active = false;
|
|
event.target.parent.active = false;
|
|
return;
|
|
return;
|
|
@@ -216,12 +221,10 @@ cc.Class({
|
|
let temp = event.target.getChildByName('tips');
|
|
let temp = event.target.getChildByName('tips');
|
|
temp.active = true;
|
|
temp.active = true;
|
|
let lab1 = temp.getChildByName('lab1').getComponent(cc.Label);
|
|
let lab1 = temp.getChildByName('lab1').getComponent(cc.Label);
|
|
- lab1.string = 'Bet Size x Bet Level x Symbol Payout Values';
|
|
|
|
|
|
+ lab1.string = 'Bet Size x Bet Level x Symbol Payout Values x Way(s) x Multiplier';
|
|
let lab2 = temp.getChildByName('lab2').getComponent(cc.Label);
|
|
let lab2 = temp.getChildByName('lab2').getComponent(cc.Label);
|
|
- lab2.string = this.report_init[0] + ' x ' + this.report_init[1] + ' x ' + info.bei;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ lab2.string = this.report_init[0]+' x '+this.report_init[1]+' x '+info.val+' x '+info.ways+' x '+ this.data.mult;
|
|
|
|
+ },
|
|
|
|
|
|
|
|
|
|
});
|
|
});
|