Commit 903d03ef authored by wjf's avatar wjf

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

parents 48e6178b 7eb87926
......@@ -112,6 +112,7 @@
{ nums: '随机奖励', type: 'random' }
];
// localStorage.clear();
window['imgver']='1022'
window['total_level'] = 18 + 13 * 8;
window['last_level'] = 120;//必须大于等于total_level
......
......@@ -14,7 +14,7 @@ export default class RulePanel2 extends Panel {
private addRule() {
const text =
`<br>1、新用户点击“帮TA助力”按钮后,进入游戏参与闯关即可为好友助力成功。<br>2、新用户仅包含未参与过狮狮连萌活动的用户。<br>3、用户不可为自己助力,或重复为好友助力。<br>`;
`<br>1、新用户点击“去闯关”按钮后,进入游戏参与闯关即可为好友助力成功。<br>2、新用户仅包含未参与过狮狮连萌活动的用户。<br>3、用户不可为自己助力,或重复为好友助力。<br>`;
this.labContent.textFlow = (new HtmlTextParser).parser(text);
}
......
......@@ -141,8 +141,12 @@
"name": "scratchrulepanel"
},
{
"keys": "map大转盘_png,map刮现金红包_png",
"name": "preload"
"keys": "bagbtn我的奖券_png,bagbtn我的道具_png,bag我的奖券_png,bag我的道具_png,bag_item_bg2_png,bag_item_bg_png,bag_icon3_png,bag_icon2_png,bag_icon1_png,bag按钮 副本 9_png",
"name": "bag"
},
{
"keys": "bag退出弹窗_png,bag退出按钮_png,bag继续按钮_png",
"name": "bagquit"
}
],
"resources": [
......@@ -2485,6 +2489,71 @@
"url": "assets/mainScene/bubbleStar18.png",
"type": "image",
"name": "bubbleStar18_png"
},
{
"url": "assets/bag/bag_item_bg.png",
"type": "image",
"name": "bag_item_bg_png"
},
{
"url": "assets/bag/bag_icon1.png",
"type": "image",
"name": "bag_icon1_png"
},
{
"url": "assets/bag/bag_icon2.png",
"type": "image",
"name": "bag_icon2_png"
},
{
"url": "assets/bag/bag_icon3.png",
"type": "image",
"name": "bag_icon3_png"
},
{
"url": "assets/bag/bag我的道具.png",
"type": "image",
"name": "bag我的道具_png"
},
{
"url": "assets/bag/bag_item_bg2.png",
"type": "image",
"name": "bag_item_bg2_png"
},
{
"url": "assets/bag/bag我的奖券.png",
"type": "image",
"name": "bag我的奖券_png"
},
{
"url": "assets/bag/bagbtn我的道具.png",
"type": "image",
"name": "bagbtn我的道具_png"
},
{
"url": "assets/bag/bagbtn我的奖券.png",
"type": "image",
"name": "bagbtn我的奖券_png"
},
{
"url": "assets/bag/bag按钮 副本 9.png",
"type": "image",
"name": "bag按钮 副本 9_png"
},
{
"url": "assets/bagquit/bag继续按钮.png",
"type": "image",
"name": "bag继续按钮_png"
},
{
"url": "assets/bagquit/bag退出弹窗.png",
"type": "image",
"name": "bag退出弹窗_png"
},
{
"url": "assets/bagquit/bag退出按钮.png",
"type": "image",
"name": "bag退出按钮_png"
}
]
}
\ No newline at end of file
......@@ -164,18 +164,32 @@
</e:Group>
<e:Label text="点击开宝箱" y="791" size="37" horizontalCenter="0" bold="true"/>
</e:Group>
<e:Group x="567.36" y="318.43" locked="true">
<e:Image source="map大转盘_png" x="33.36" y="0"/>
<e:Group id="turnTableGroup" x="567.36" y="318.43">
<e:Button id="turnTableBtn" label="" x="33.36" y="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="map大转盘_png" source.down="map大转盘_png" source.disabled="map大转盘_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Group x="6" y="10.24">
<e:Image id="inviteTipsBg0" source="invite_txtbg_png" y="0" touchEnabled="false"/>
<e:Label id="inviteTips0" text="立即到" horizontalCenter="0" verticalCenter="0" verticalAlign="middle" textAlign="center" textColor="0xFFFFFF" size="18" fontFamily="Helvetica"/>
<e:Image id="turnTableTipsBg" source="invite_txtbg_png" y="0" touchEnabled="false"/>
<e:Label id="turnTableTips" text="立即到" horizontalCenter="0" verticalCenter="0" verticalAlign="middle" textAlign="center" textColor="0xFFFFFF" size="18" fontFamily="Helvetica"/>
</e:Group>
</e:Group>
<e:Group y="476" right="30">
<e:Image source="map刮现金红包_png" y="0"/>
<e:Group id="scratchGroup" y="476" right="30">
<e:Button id="scratchBtn" label="" y="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="map刮现金红包_png" source.down="map刮现金红包_png" source.disabled="map刮现金红包_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Group x="-24">
<e:Image id="inviteTipsBg1" source="invite_txtbg_png" y="0" touchEnabled="false"/>
<e:Label id="inviteTips1" text="立即到" horizontalCenter="0" verticalCenter="0" verticalAlign="middle" textAlign="center" textColor="0xFFFFFF" size="18" fontFamily="Helvetica"/>
<e:Image id="scratchTipsBg" source="invite_txtbg_png" y="0" touchEnabled="false"/>
<e:Label id="scratchTips" text="立即到" horizontalCenter="0" verticalCenter="0" verticalAlign="middle" textAlign="center" textColor="0xFFFFFF" size="18" fontFamily="Helvetica"/>
</e:Group>
</e:Group>
<w:Config id="16c89f4ae1a"/>
......
......@@ -18,7 +18,7 @@
<e:Image id="pic1" source="点亮 副本 2_png" x="222" y="125.62" anchorOffsetX="80" anchorOffsetY="58"/>
<e:Image id="pic3" source="点亮 副本 2_png" x="536" y="119.62" scaleX="-1" anchorOffsetX="72" anchorOffsetY="52"/>
<e:Image id="pic2" source="点亮_png" y="94.62" horizontalCenter="0" anchorOffsetX="96" anchorOffsetY="76"/>
<e:Image source="signprize元宝_png" y="329.86" horizontalCenter="-2"/>
<e:Image source="signprize元宝_png" y="361.86" horizontalCenter="-2" scaleX="0.8" scaleY="0.8"/>
<e:Button id="shareBtn" label="" y="663.62" horizontalCenter="-145.5">
<e:skinName>
<e:Skin states="up,down,disabled">
......
......@@ -4,7 +4,7 @@
<e:Component y="698.52" skinName="ADSmallSkin" x="84" visible="false"/>
<e:Image source="singprizebg_png" y="20" horizontalCenter="0"/>
<e:Image id="img" y="297" touchEnabled="true" source="{data.img}" width="512" height="240" scaleX="1" scaleY="1" horizontalCenter="0" visible="false"/>
<e:Image id="money" source="signprize元宝_png" y="234.88" horizontalCenter="0"/>
<e:Image id="money" source="signprize元宝_png" y="270.88" horizontalCenter="0" scaleX="0.8" scaleY="0.8"/>
<e:Image id="blood" source="singprize体力_png" y="233.8" horizontalCenter="0" visible="false"/>
<e:Group id="numsgroup" x="396.38" y="283.76">
<e:Image id="numsbg" source="signprize_numsbg_png" x="0" y="0"/>
......
/**
* 简单的倒计时
* 2019.10.24
*/
export default class CutTime {
private _timer: egret.Timer = null;
private _label: eui.Label = null;
private _labelText: string = "hh:mm:ss";
public set labelText(labelText: string) {
this._labelText = labelText;
}
// 倒计时时间
private _cutTime: number = 0;
public set cutTime(cutTime: number) {
this._cutTime = cutTime;
}
// 回调函数
private _callFun: Function = null;
public set callFun(callFun: Function) {
this._callFun = callFun;
}
/**
* @param label 传入显示的label
* @param labelText 该字符串将作为倒计时显示的文字,hh、mm、ss将被分别替换成时,分,秒,例:将在hh:mm:ss后消失 -> 将在18:07:21后消失
* @param callFun 如果希望他在结束时去做一些什么则传入一个回调函数
*/
constructor(label: eui.Label, labelText: string, callFun?: Function) {
this._label = label;
this._labelText = labelText;
if(callFun) {
this._callFun = callFun;
}
}
/**
* 根据时间开始倒计时
* 1.假如已经存在一个倒计时返回false(失败),表示要先执行stop或stopAndCallFun
* 2.保存倒计时时间 +1秒弥补第5步操作
* 3.创建一个倒计时对象
* 4.注册时间监听
* 5.立即执行一次倒计时(为了立即刷新label)
* 6.开始倒计时
* 7.返回true(成功)
* @param cutTime 时间戳
*/
public start(cutTime: number) {
if(this._timer) {
return false;
}
this._cutTime = cutTime + 1000; // +1秒弥补立即刷新
this._timer = new egret.Timer(1000, 0);
this._timer.addEventListener(egret.TimerEvent.TIMER, this._cutTimer, this);
this._cutTimer();
this._timer.start();
return true;
}
/**
* 结束计时器,不执行回调函数
* 1.停止计时器
* 2.移除事件监听
* 3.置空计时器
* 4.如果希望执行回调函数请使用stopAndCallFun()
*/
public stop() {
if(!this._timer) {
return;
}
this._timer.stop();
this._timer.removeEventListener(egret.TimerEvent.TIMER, this._cutTimer, this);
this._timer = null;
}
/**
* 结束倒数计时并执行回调函数
* 1.停止计时器
* 2.移除事件监听
* 3.置空计时器
* 4.执行回调函数函数,如果不希望执行回调函数则使用stop()
*/
public stopAndCallFun() {
if(!this._timer) {
return;
}
this._timer.stop();
this._timer.removeEventListener(egret.TimerEvent.TIMER, this._cutTimer, this);
this._timer = null;
if(this._callFun) {
this._callFun();
}
}
/**
* 倒计时回调函数
* @private
*/
private _cutTimer() {
let timer = this._convertTime(this._cutTime -= 1000);
if(timer.hour === "00"
&& timer.min === "00"
&& timer.sec === "00") {
this.stopAndCallFun();
}
let str = this._labelText;
str = str.replace(/hh/g, timer.hour);
str = str.replace(/mm/g, timer.min);
str = str.replace(/ss/g, timer.sec);
this._label.text = str;
}
/**
* 通过时间戳获取几时积分几秒 例:666666666 -> {hour: 18, min: 51, sec: 16}
* @param time 时间戳(毫秒)
* @private
*/
private _convertTime(time: number): { hour, min, sec } {
let hour = ~~(time / 3600000); // 小时
let min = ~~((time - hour * 3600000) / 60000); // 分
let sec = ~~((time - hour * 3600000 - min * 60000) / 1000); // 秒
return {
hour: this._prefixInteger(hour, 2),
min: this._prefixInteger(min, 2),
sec: this._prefixInteger(sec, 2)
}
}
/**
* 数字补0 例:(num = 2, length = 2) -> 02
* @param num 数字
* @param length 位数
* @private
*/
private _prefixInteger(num, length): string {
return (Array(length).join('0') + num).slice(-length);
}
}
\ No newline at end of file
......@@ -69,16 +69,6 @@ export default class MapScene extends Scene {
private cutTime: number;
async start(data?) {
setTimeout(() => {
NetManager.ins.getInviteInfo((success, res) => {
if(!success) {
}
PanelCtrl.instance.show('scratch', res.data);
});
}, 1000);
super.start();
this.sendInvite();
......@@ -640,8 +630,25 @@ export default class MapScene extends Scene {
}, window['signActivityId'])
}
////////////////////////////////////////////////// 刮刮卡 //////////////////////////////////////////////////
onTap_scratchBtn() {
NetManager.ins.getInviteInfo((success, res) => {
if(!success) {
return;
}
PanelCtrl.instance.show('scratch', res.data);
});
}
////////////////////////////////////////////////// 大转盘 //////////////////////////////////////////////////
onTap_turnTableBtn() {
}
protected initEvents() {
// this['goldBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this)
this['turnTableBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_turnTableBtn, this)
this['scratchBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_scratchBtn, this)
this['inviteBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_inviteBtn, this)
this['friendBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_friendBtn, this)
this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_adBtn, this)
......
......@@ -5,11 +5,11 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import { iswx } from "../iswx";
import Utils from "../Utils";
import ScratchRulePanel from "./ScratchRulePanel";
import CutTime from "../CutTime";
export default class ScratchPanel extends Panel {
private invite_img: egret.Texture;
private timer: egret.Timer;
private cutTime: number;
private cutTimer: CutTime;
constructor(data) {
super();
......@@ -85,29 +85,29 @@ export default class ScratchPanel extends Panel {
this['numLabel'] = `共${this.data.invitationUser.length}位好友帮你刮了${90.3}%`;
this["prizeImg"].source = this.data.prizeImg;
if (!this.data.invitationUser) {
if(!this.data.invitationUser) {
this.data.invitationUser = [];
}
let dNum = this.data.invitationCount - this.data.invitationUser.length;
for (let i = 0; i < dNum; i++) {
for(let i = 0; i < dNum; i++) {
this.data.invitationUser.push({
nickname: "nickname",
avatar: this.invite_img,
});
}
for (let i = 0; i < this.data.invitationUser.length; i++) {
for(let i = 0; i < this.data.invitationUser.length; i++) {
this.data.invitationUser[i]['callFun'] = () => {
NetManager.ins.getShareCode((success, res) => {
if (!success) {
if(!success) {
return;
}
let shareCode = res.data; // 分享码
CFG.wxShareLink = window['h5URL'] + "&shareCode=" + shareCode; // 分享链接
CFG.wxShareTitle = '狮狮连萌超好玩~我已经玩到第一了!';
CFG.wxShareDesc = '我在萌狮消消乐等你来挑战哦';
CFG.wxShareImg="http://yun.duiba.com.cn/db_games/xiaoxiaole2.jpg";
if (iswx()) { //微信端
CFG.wxShareImg = "http://yun.duiba.com.cn/db_games/xiaoxiaole2.jpg";
if(iswx()) { //微信端
this["wxShareTip"].visible = true;
window["invokeWX"]();
} else {//端内
......@@ -121,14 +121,16 @@ export default class ScratchPanel extends Panel {
this["list"].itemRenderer = ScratchItem;
this["list"].dataProvider = new eui.ArrayCollection(this.data.invitationUser);
this.cutTime = this.data.endTime - this.data.sysTime + 5000;
if (this.timer) {
this.timer.stop();
// 倒计时
this.cutTimer = new CutTime(this["cutTimeLabel"], "将在hh:mm:ss后消失", () => {
this.hidePanel();
}
);
let cutTime = this.data.endTime - this.data.sysTime + 5000;
if(!this.cutTimer.start(cutTime)) {
this.cutTimer.stop();
this.cutTimer.start(cutTime);
}
this.timer = new egret.Timer(1000, 0);
this.timer.addEventListener(egret.TimerEvent.TIMER, this.cutTimer, this);
this.timer.start();
this.cutTimer();
}
/**
......@@ -148,26 +150,18 @@ export default class ScratchPanel extends Panel {
egret.Tween.get(this["progress"]).to({width: _width}, _duration);
}
private cutTimer() {
let timer = Utils.convertTime(this.cutTime -= 1000);
if(timer.hour === "00"
&& timer.min === "00"
&& timer.sec === "00") {
this.timer.stop();
this.hidePanel();
}
this["cutTimeLabel"].text = `将在${timer.hour}:${timer.min}:${timer.sec}后失效`;
}
private setWXShareTip() {
this["wxShareTip"].visible = false;
this["wxShareTip"].width = this.width / window.innerWidth * window.innerWidth;
this["wxShareTip"].height = this.width / window.innerWidth * window.innerHeight;
}
private hongbaoEffect(){
egret.Tween.get(this["hongbao"]).to({scaleX:0.8, scaleY:0.8}, 200, egret.Ease.quadInOut).call(()=>{
egret.Tween.get(this["hongbao"]).to({scaleX:1, scaleY:1}, 100, egret.Ease.quadInOut).wait(1500).call(()=>{
private hongbaoEffect() {
egret.Tween.get(this["hongbao"]).to({scaleX: 0.8, scaleY: 0.8}, 200, egret.Ease.quadInOut).call(() => {
egret.Tween.get(this["hongbao"]).to({
scaleX: 1,
scaleY: 1
}, 100, egret.Ease.quadInOut).wait(1500).call(() => {
this.hongbaoEffect();
});
});
......
......@@ -7,7 +7,7 @@
"invitationId": "活动id",
"invitationCount": 5,
"img": "http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg",
"sysTime": 1570672800000,
"sysTime": 1570673805000,
"endTime": 1570673810000,
"invitationUser": [
{
......
......@@ -5,7 +5,7 @@
"success":true,
"errorMsg":null,
"code":"",
"prizeType":"times",
"prizeType":"coin",
"prizeName":"奖品名称",
"logo":"http://yun.duiba.com.cn/db_games/activity/game/guideImage/guide2.png",
"prizeCount":11,
......
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