Commit 30f3e802 authored by zjz1994's avatar zjz1994

签到暂存

parent eb5860bd
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
"name": "helpGroup" "name": "helpGroup"
}, },
{ {
"keys": "help_blood_fail_text2_png,help_blood_fail_text3_png,help_blood_fail_text4_png,help_invite2_text3_png,help_invite2_text4_png,commom_prop_bg2_png,turnprize_icon12_png,turnprize_icon22_png,turnprize_icon32_png,recharge_icon2_png,turntabletit_png,turntable_paneldi_png,turntable_paneldi2_png,turntabletit2_png,sign_mask_png,signitemno_png,signitemyes_png,sign_mask2_png,signitemno2_png,signitemyes2_png", "keys": "help_blood_fail_text2_png,help_blood_fail_text3_png,help_blood_fail_text4_png,help_invite2_text3_png,help_invite2_text4_png,commom_prop_bg2_png,turnprize_icon12_png,turnprize_icon22_png,turnprize_icon32_png,recharge_icon2_png,turntabletit_png,turntable_paneldi_png,turntable_paneldi2_png,turntabletit2_png,sign_mask_png,signitemno_png,signitemyes_png",
"name": "preload" "name": "preload"
} }
], ],
...@@ -5186,21 +5186,6 @@ ...@@ -5186,21 +5186,6 @@
"type": "image", "type": "image",
"name": "signitemyes_png" "name": "signitemyes_png"
}, },
{
"url": "assets/sign/sign_mask.png",
"type": "image",
"name": "sign_mask2_png"
},
{
"url": "assets/sign/signitemno.png",
"type": "image",
"name": "signitemno2_png"
},
{
"url": "assets/sign/signitemyes.png",
"type": "image",
"name": "signitemyes2_png"
},
{ {
"url": "assets/TaskCenterPrize/taskPrize_money.png", "url": "assets/TaskCenterPrize/taskPrize_money.png",
"type": "image", "type": "image",
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e:Skin class="SignItemSkin" width="151" height="187" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing"> <e:Skin class="SignItemSkin" width="151" height="187" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="line1" source="sign_line_png" x="5.36" y="2.01" visible="false"/> <e:Image id="line1" source="sign_line_png" x="5.36" y="2.01" visible="false"/>
<e:Image right="0" y="2" source="signitemno_png"/> <e:Image id="nodi" source="signitemno_png" horizontalCenter="0" verticalCenter="0"/>
<e:Image id="yesdi" horizontalCenter="0" verticalCenter="0" x="10" y="10" source="signitemyes_png"/>
<e:Image id="line2" source="sign_line2_png" x="5.36" y="2.01" visible="false"/> <e:Image id="line2" source="sign_line2_png" x="5.36" y="2.01" visible="false"/>
<e:Label id="title" text="第1天" y="16" textColor="0x955200" size="24" fontFamily="FZY3JW" horizontalCenter="0.5" verticalAlign="middle"/> <e:Label id="title" text="第1天" y="16" textColor="0x955200" size="24" fontFamily="FZY3JW" horizontalCenter="0.5" verticalAlign="middle"/>
<e:Label id="amount" text="" textColor="0x955200" size="24" fontFamily="FZY3JW" horizontalCenter="0.5" bottom="14"/> <e:Label id="amount" text="" textColor="0x955200" size="24" fontFamily="FZY3JW" horizontalCenter="0.5" bottom="14"/>
<e:Image id="object" source="sign_icon1_png" horizontalCenter="0.5" verticalCenter="5.5" visible="false"/> <e:Image id="object" source="sign_icon1_png" horizontalCenter="0.5" y="59" visible="false"/>
<e:Image id="money" source="signicon2_png" y="85.52" horizontalCenter="0" visible="false"/> <e:Image id="money" source="signicon2_png" y="85.52" horizontalCenter="0" visible="false"/>
<e:Image id="hammer" source="signicon3_png" y="64.57" horizontalCenter="0" visible="false"/> <e:Image id="hammer" source="signicon3_png" y="64.57" horizontalCenter="0" visible="false"/>
<e:Image id="boom" source="signicon4_png" y="67.67" horizontalCenter="0.5" visible="false"/> <e:Image id="boom" source="signicon4_png" y="67.67" horizontalCenter="0.5" visible="false"/>
...@@ -59,8 +60,8 @@ ...@@ -59,8 +60,8 @@
</e:Skin> </e:Skin>
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Group id="light" width="151" height="187" horizontalCenter="0" verticalCenter="0" visible="false"> <e:Group id="light" width="151" height="187" horizontalCenter="0" verticalCenter="0">
<e:Image source="sign_mask_png" horizontalCenter="0" verticalCenter="0" x="5" y="5" scaleX="1" scaleY="1"/> <e:Image source="sign_mask_png" horizontalCenter="0" verticalCenter="0" x="5" y="5" scaleX="1" scaleY="1"/>
<e:Image source="sign_light_png" scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="0"/> <e:Image source="sign_light_png" scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="18.5"/>
</e:Group> </e:Group>
</e:Skin> </e:Skin>
\ No newline at end of file
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
</e:Skin> </e:Skin>
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Scroller id="scroll" width="560" height="400" y="420.64" horizontalCenter="0"> <e:Scroller id="scroll" width="604" height="400" y="420.64" horizontalCenter="0">
<e:Group height="400"> <e:Group height="400">
<e:List id="list" width="560" itemRendererSkinName="SignItemSkin"> <e:List id="list" width="604" itemRendererSkinName="SignItemSkin" height="400">
</e:List> </e:List>
</e:Group> </e:Group>
......
var UIComponentClass = "eui.UIComponent";
/**自定义的居中网格布局类*/
export class hortileLayout extends eui.LayoutBase{
public constructor(){
super();
}
/**
* 计算target的尺寸
* 因为环形布局,依赖容器尺寸来定义半径,所以需要容器显式的设置width和height,在这种情况下measure方法将失去作用
* 所以在这个例子里面,不需要重写measure方法
* 如果您的自定义布局需要根据内部子项计算尺寸,请重写这个方法
**/
public measure():void{
super.measure();
}
/**
* 重写显示列表更新
*/
public updateDisplayList(unscaledWidth:number, unscaledHeight:number):void{
super.updateDisplayList(unscaledWidth, unscaledHeight);
if (this.target==null)
return;
var centerX:number = unscaledWidth/2;// 获得容器中心的X坐标
var centerY:number = unscaledHeight/2;// 获得容器中心的Y坐标
var horizon:number = centerX/2;// 获得水平可用长度的一半
var vertical:number = centerY/2;// 获得垂直可用长度的一半
var count:number = this.target.numElements;
var maxX:number = 0;
var maxY:number = 0;
for (var i:number = 0; i < count; i++){
var layoutElement:eui.UIComponent = <eui.UIComponent> ( this.target.getElementAt(i) );
if ( !egret.is(layoutElement,UIComponentClass) || !layoutElement.includeInLayout ) {
continue;
}
var elementWidth:number = 151;
var elementHeight:number = 187;
var paddingy:number = 20;
var irow = Math.floor(i/4);
var ilie = i%4;
var rowmid:number;
if((irow+1)*4-1<count){
rowmid = 2;
}else{
rowmid = (count - irow*4)/2;
}
var childX:number = (ilie-rowmid)*elementWidth+centerX;
var childY:number = irow*(elementHeight+paddingy);
layoutElement.setLayoutBoundsPosition(childX, childY);
maxX = Math.max(maxX,childX+elementWidth);
maxY = Math.max(maxY,childY+elementHeight);
}
this.target.setContentSize(maxX,maxY);
}
}
\ No newline at end of file
...@@ -27,7 +27,24 @@ export default class SignItem extends eui.ItemRenderer { ...@@ -27,7 +27,24 @@ export default class SignItem extends eui.ItemRenderer {
this['line1'].visible = false;//this.data.index != 6; this['line1'].visible = false;//this.data.index != 6;
this['line2'].visible = false;//!this['line1'].visible; this['line2'].visible = false;//!this['line1'].visible;
this['light'].visible = this.data.signed; this['light'].visible = this.data.signed;
this['title'].text = `连续签到${this.data.index + 1}天`;
var titlestr:string;
var bgtype:number;
if(this.data.btn==1){
titlestr = "今天";
bgtype = 1;
}else if(this.data.btn==2){
titlestr = "已领取";
bgtype = 1;
}else{
titlestr = `第${this.data.index + 1}天`;
bgtype = 2;
}
this['title'].text = titlestr;//`连续签到${this.data.index + 1}天`;
this["title"].textColor = bgtype==1?"#955200":"#ffffff";
this["nodi"].visible = bgtype==2;
this["yesdi"].visible = bgtype==1;
this['amount'].text = this.data.config.nums; this['amount'].text = this.data.config.nums;
if (this.data.config.nums <= 0) if (this.data.config.nums <= 0)
......
...@@ -8,11 +8,12 @@ import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl"; ...@@ -8,11 +8,12 @@ import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import wait from "../../libs/new_tc/wait"; import wait from "../../libs/new_tc/wait";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl"; import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import {hortileLayout} from "../layout/hortileLayout";
export default class SignPanel extends Panel { export default class SignPanel extends Panel {
list: eui.List; list: eui.List;
scroll: eui.Scroller; scroll: eui.Scroller;
signidx:number=-1;
async start(data) { async start(data) {
super.start(); super.start();
...@@ -23,13 +24,18 @@ export default class SignPanel extends Panel { ...@@ -23,13 +24,18 @@ export default class SignPanel extends Panel {
todayIndex = signInfoVO.continueDay; todayIndex = signInfoVO.continueDay;
} }
this.scroll.viewport.scrollV = todayIndex * 162; // this.scroll.viewport.scrollV = todayIndex * 162;
if (todayIndex >= 4) { // if (todayIndex >= 4) {
this.scroll.viewport.scrollV = 4 * 162; // this.scroll.viewport.scrollV = 4 * 162;
} // }
const tomorrowIndex = todayIndex + 1; const tomorrowIndex = todayIndex + 1;
// var listlayout = new eui.TileLayout();
// listlayout.horizontalAlign = egret.HorizontalAlign.CENTER;
var listlayout = new hortileLayout();
this.list.layout = listlayout;
this.list.itemRenderer = SignItem; this.list.itemRenderer = SignItem;
const configs = this.getConfigs(); const configs = this.getConfigs();
const func = (data, item: SignItem) => { const func = (data, item: SignItem) => {
...@@ -89,10 +95,13 @@ export default class SignPanel extends Panel { ...@@ -89,10 +95,13 @@ export default class SignPanel extends Panel {
if (index < todayIndex) {//以前 if (index < todayIndex) {//以前
ele.btn = 2; ele.btn = 2;
} else if (index == todayIndex) {//现在 } else if (index == todayIndex) {//现在
if (signInfoVO.todaySigned) if (signInfoVO.todaySigned){
ele.btn = 2; ele.btn = 2;
else }
else{
ele.btn = 1; ele.btn = 1;
this.signidx = index;
}
} else if (index == tomorrowIndex) { } else if (index == tomorrowIndex) {
ele.btn = 3; ele.btn = 3;
} else } else
...@@ -114,11 +123,11 @@ export default class SignPanel extends Panel { ...@@ -114,11 +123,11 @@ export default class SignPanel extends Panel {
} }
// { nums: '10元宝', type: 'money' }, // { nums: '10元宝', type: 'money' },
// { nums: '*1', type: 'hammer' }, // { nums: 'x1', type: 'hammer' },
// { nums: '30元宝', type: 'money' }, // { nums: '30元宝', type: 'money' },
// { nums: '*1', type: 'boom' }, // { nums: 'x1', type: 'boom' },
// { nums: '50元宝', type: 'money' }, // { nums: '50元宝', type: 'money' },
// { nums: '*1', type: 'steps' }, // { nums: 'x1', type: 'steps' },
// { nums: '0.3元', type: 'quan30' } // { nums: '0.3元', type: 'quan30' }
private getConfigs() { private getConfigs() {
const getSignConfig = DataManager.ins.getData('getSignConfig'); const getSignConfig = DataManager.ins.getData('getSignConfig');
...@@ -134,7 +143,7 @@ export default class SignPanel extends Panel { ...@@ -134,7 +143,7 @@ export default class SignPanel extends Panel {
if (notGiftResult) { if (notGiftResult) {
result.push(this.getResultItem(notGiftResult)); result.push(this.getResultItem(notGiftResult));
} else { } else {
result.push({ nums: '*1', type: 'object' }); result.push({ nums: 'x1', type: 'object' });
} }
return result; return result;
} }
...@@ -144,24 +153,24 @@ export default class SignPanel extends Panel { ...@@ -144,24 +153,24 @@ export default class SignPanel extends Panel {
getResultItem(option) { getResultItem(option) {
const resultItem: any = {}; const resultItem: any = {};
if (option.categoryType == 2) { if (option.categoryType == 2) {
resultItem.nums = `*${option.num}` resultItem.nums = `x${option.num}`
resultItem.type = 'blood'; resultItem.type = 'blood';
} }
else if (option.categoryType == 3) { else if (option.categoryType == 3) {
resultItem.nums = `*1`; resultItem.nums = `x1`;
// resultItem.nums = `*${option.num}`; // resultItem.nums = `x${option.num}`;
resultItem.type = this.getPropType(option.propType); resultItem.type = this.getPropType(option.propType);
} }
else if (option.categoryType == 4) { else if (option.categoryType == 4) {
resultItem.type = 'money'; resultItem.type = 'money';
if (option.maxValue != option.minValue) if (option.maxValue != option.minValue)
resultItem.nums = `*?`; resultItem.nums = `x?`;
else else
resultItem.nums = `*${option.maxValue}`; resultItem.nums = `x${option.maxValue}`;
// if (option.maxValue != option.minValue) console.warn('元宝配置错误'); // if (option.maxValue != option.minValue) console.warn('元宝配置错误');
} }
else if (option.categoryType >= 5) { else if (option.categoryType >= 5) {
resultItem.nums = `*1`; resultItem.nums = `x1`;
resultItem.type = 'quan'; resultItem.type = 'quan';
resultItem.imgurl = option.smallImg; resultItem.imgurl = option.smallImg;
} }
...@@ -203,4 +212,17 @@ export default class SignPanel extends Panel { ...@@ -203,4 +212,17 @@ export default class SignPanel extends Panel {
// } // }
protected get closeBtns(): eui.Button[] { return [this['closeBtn'], this['close2Btn']] } protected get closeBtns(): eui.Button[] { return [this['closeBtn'], this['close2Btn']] }
get skinKey() { return 'Sign' } get skinKey() { return 'Sign' }
initEvents(){
super.initEvents();
this["closeBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
// this['close2Btn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this["btn1"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.signToday, this);
}
signToday(){
console.log(this.signidx);
console.log(this.list);
}
} }
\ 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