Commit 9d919a69 authored by 邱旭's avatar 邱旭

Merge branch 'dev' of http://gitlab2.dui88.com/wanghongyuan/xiaoxiaole into dev

parents 02587b60 6098d066
......@@ -25,4 +25,26 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Group id="prizegroup" width="750" height="1206" x="0" y="0">
<e:Rect id="mask1" fillAlpha="0.8" x="0" y="0" scaleX="1" scaleY="1" width="750" height="1206"/>
<e:Group id="lightbot" width="750" height="1206" x="0" y="0"/>
<e:Group id="contmid" width="750" height="1206" y="0" x="0">
<e:Image id="prizeimg" scaleX="1" scaleY="1" x="317" y="545" source=""/>
<e:Image id="prizeimg1" source="turnprize_icon2_png" scaleX="1" scaleY="1" x="317" y="545" visible="false"/>
<e:Image id="prizeimg2" source="turnprize_icon2_png" scaleX="1" scaleY="1" x="317" y="545" visible="false"/>
<e:Group id="numsgroup" anchorOffsetX="0" width="188" anchorOffsetY="0" height="62" x="281" y="684">
<e:Label id="nums" text="×8" size="48" verticalAlign="middle" fontFamily="FZY3JW" textColor="0xC17343" bold="true" y="7" x="68"/>
</e:Group>
</e:Group>
<e:Group id="lightop" width="750" height="1206">
</e:Group>
<e:Button id="btn2" label="" horizontalCenter="0" bottom="242" x="191" y="861" scaleX="1" scaleY="1">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="signprize_btn_png" source.down="signprize_btn_png" source.disabled="signprize_btn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Group>
</e:Skin>
\ No newline at end of file
......@@ -8,15 +8,18 @@ import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import wait from "../../libs/new_tc/wait";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { getlogItem } from "../Main";
import {hortileLayout} from "../layout/hortileLayout";
import Utils from "../Utils";
import { NetName } from "../../libs/tw/enum/NetName";
import { hortileLayout } from "../layout/hortileLayout";
export default class SignPanel extends Panel {
list: eui.List;
scroll: eui.Scroller;
signidx:number=-1;
todayidx:number = 0;
signdata:Array<any> = [];
showsxbtn:boolean = false;
sevenIsGift:boolean = false;
async start(data) {
super.start();
......@@ -26,6 +29,12 @@ export default class SignPanel extends Panel {
if (!signInfoVO.todaySigned) {
todayIndex = signInfoVO.continueDay;
}
this["prizegroup"].visible = false;
this.once(egret.TouchEvent.ADDED_TO_STAGE, () => {
this["mask1"].height = this.stage.stageHeight;
this["mask1"].y = (this["prizegroup"].height-this["mask1"].height)/2;
}, this);
// this.scroll.viewport.scrollV = todayIndex * 162;
// if (todayIndex >= 4) {
......@@ -88,6 +97,9 @@ export default class SignPanel extends Panel {
console.log(data);
};
const list: any[] = [{}, {}, {}, {}, {}, {}, {}];
console.log("签到数据",configs);
list.forEach((ele, index) => {
ele.index = index;
ele.config = configs[index];
......@@ -105,6 +117,7 @@ export default class SignPanel extends Panel {
ele.btn = 1;
this.signidx = index;
}
this.todayidx = index;
} else if (index == tomorrowIndex) {
ele.btn = 3;
} else
......@@ -112,6 +125,11 @@ export default class SignPanel extends Panel {
});
this.signdata = Utils.deepClone(list);
if(this.signidx==6&&this.sevenIsGift){
this.showsxbtn = true;
}else{
this.showsxbtn = false;
}
this.list.dataProvider = new eui.ArrayCollection(list);
this.list.useVirtualLayout = false;
......@@ -136,6 +154,8 @@ export default class SignPanel extends Panel {
// { nums: '0.3元', type: 'quan30' }
private getConfigs() {
let config = DataManager.ins.getData(NetName.GET_CONFIG).data;
console.log("签到原始数据",config);
let getSignConfig = config && config.signConf;
if (getSignConfig && getSignConfig.sixDaysBeforeOptions && getSignConfig.theSeventhDayOptions) {
const { sixDaysBeforeOptions, theSeventhDayOptions } = getSignConfig;
......@@ -146,6 +166,7 @@ export default class SignPanel extends Panel {
result.push(resultItem);
});
const notGiftResult = this.isNotGift(theSeventhDayOptions);
this.sevenIsGift = !notGiftResult;
if (notGiftResult) {
result.push(this.getResultItem(notGiftResult));
} else {
......@@ -186,6 +207,7 @@ export default class SignPanel extends Panel {
isNotGift(theSeventhDayOptions: any[]) {
const results = theSeventhDayOptions.filter(item => item.rate == 100);
let result;
console.log("礼盒检测",result);
if (results.length == 1) {
result = results[0];
return result;
......@@ -224,6 +246,10 @@ export default class SignPanel extends Panel {
super.initEvents();
this["closeBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this["btn1"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.signToday, this);
this["btn2"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.kaixinshouxia, this);
}
kaixinshouxia(){
this["prizegroup"].visible = false;
}
signToday(){
if(this.signidx!=-1){
......@@ -252,6 +278,7 @@ export default class SignPanel extends Panel {
} else {
showToast('哎呀,奖励擦肩而过!');
}
this.signidx = signidx;//签到没成功,重签
return;
}
this.signdata[signidx].signed = true;
......@@ -267,10 +294,15 @@ export default class SignPanel extends Panel {
}, window['collectRuleId']);
});
this.changeShowPrize(customInfo);
} else {
this.signidx = signidx;//签到没成功,重签
showToast('哎呀,奖励擦肩而过!');
}
this.hidePanel();
// this.hidePanel();
},window["signActivityId"]);
}
}
......@@ -279,4 +311,70 @@ export default class SignPanel extends Panel {
this["closeBtn"].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this["btn1"].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.signToday, this);
}
changeShowPrize(customInfo){
this["prizegroup"].visible = true;
var prizeType = customInfo.prizeType;
var logo = customInfo.logo;
var prizeCount = customInfo.prizeCount;
var itemid = customInfo.itemId;
var propType = customInfo.propType;
console.log("签到完成,今日奖励",customInfo);
//奖品类型,none无奖励, object实物,
// virtual虚拟商品,coupon券,
// 道具prop,元宝coin,体力times,
if(logo && prizeType!= 'times' && prizeType!= 'coin'&& prizeType!= 'prop'){
this["prizeimg1"].visible = true;
this["prizeimg1"].source = logo;
this['numsgroup'].visible=false;
}else{
if(itemid){
this['prizeimg2'].visible = true;
this['prizeimg2'].source = `http://yun.duiba.com.cn/db_games/${window['imgver']}/${customInfo.itemId}.png`;
}
}
this['nums'].text ='x'+ prizeCount;
// if(prizeType=='prop') {
// this['numsgroup'].y=380.8;
// }
var showprizeimg:boolean = true;
if(prizeType=='times'){
this['prizeimg'].source = 'hbPrize_blood_png';
}else if(prizeType=='prop'){
this['prizeimg'].source = `hbPrize_icon${propType}_png`;
}else if(prizeType=='coin'){
this['prizeimg'].source = 'hbPrize_money_png';
}else{
showprizeimg = false;
console.log("之前应该有处理");
}
this['prizeimg'].visible = showprizeimg;
if(showprizeimg){
if(this["prizeimg1"].visible){
this["prizeimg1"].visible = false;
}
if(this['prizeimg2'].visible){
this["prizeimg2"].visible = false;
}
}
this["btn2"].visible = this.showsxbtn;
if(this.showsxbtn){//手动关闭
}else{//自动关闭
var item = this.list.getChildAt(this.todayidx);
var prizeimgx = item['prizeimg'].x;
var prizeimgy = item['prizeimg'].y;
var wtopos = item.localToGlobal(prizeimgx,prizeimgy);
var wstpos = this['contmid'].localToGlobal(this['prizeimg'].x,this['prizeimg'].y);
// egret.Tween.get()
// console.log(item.x);
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment