Commit a996c501 authored by wjf's avatar wjf

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

parents b9f0340b 16b88d7b
......@@ -2,6 +2,7 @@ module.exports = {
devPort: 8080,
opn:0,
proxy: {
'/crecord/*': 'http://localhost:3000',
'/signactivity/*': 'http://localhost:3000',
'/customActivity/*': 'http://localhost:3000',
'/ngapi/*': 'http://localhost:3000',
......
......@@ -31,7 +31,7 @@
<body>
<div style="margin: auto;width: 100%;height: 100%;" class="egret-player" data-entry-class="Main"
data-orientation="auto" data-scale-mode="showAll" data-frame-rate="60" data-content-width="750"
data-content-height="1624" data-multi-fingered="2" data-show-fps="true" data-show-log="false"
data-content-height="1624" data-multi-fingered="2" data-show-fps="false" data-show-log="false"
data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
</div>
......@@ -48,6 +48,7 @@
<script src="libs/pad-zeropadding.js"></script>
<img id="pic" style="width:100%;position: absolute;z-index: 999;display: none;" />
<script>
window['plugs']=[1,2,3]
// localStorage.clear();
window['isInvitePage']=0;
var targetUrl='https://gameact.suning.com/sngame-web/api/duiba/private/v1/getLoginUrl.do?appCode=duiba&activityCode=3651404';
......
......@@ -60,6 +60,8 @@ import BagQuitPanel from "../../src/panels/BagQuitPanel";
import H52Scene from "../../src/H52Scene";
import TurnPrizePanel from "../../src/panels/TurntablePanel/TurntablePrizePanel";
import TurnRulePanel from "./components/TurnRulePanel";
import TurntableNoPrizePanel from "../../src/panels/TurntablePanel/TurntableNoPrizePanel";
import TurnPrize2Panel from "../../src/panels/TurntablePanel/TurntablePrize2Panel";
export default class MainBase extends eui.UILayer {
constructor() {
......@@ -108,6 +110,8 @@ export default class MainBase extends eui.UILayer {
['turnTable', { cls: Turntable }],
['TurnRulePanel', { cls: TurnRulePanel }],
['TurnPrizePanel', { cls: TurnPrizePanel }],
['TurnPrize2Panel', { cls: TurnPrize2Panel }],
['TurntableNoPrizePanel', { cls: TurntableNoPrizePanel }],
['friend', { cls: FriendPanel }],
['ad', { cls: ADPanel }],
];
......
......@@ -77,6 +77,11 @@ export enum NetName {
GET_SHARECODE,
DO_HELP,
GET_INVATE_INFO,
ACCEPT_INVITATION
ACCEPT_INVITATION,
SCRATCH_GET_TASKINFO,
SCRATCH_TAKEPRIZE,
SCRATCH_GET_SHARECODE,
SCRATCH_DOHELP,
}
\ No newline at end of file
......@@ -910,6 +910,56 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
public hc_getRecord(origins) {
return new Promise((r) => {
const param: any = {
page: 1,
pageSize: 500,
origins: origins
};
const net: INetData = {
name: 'hc_getRecord',
uri: window['duiba'] +'/crecord/getrecord',
type: 'get',
dataType: 'json',
param: param,
callback: r
};
this.send(net);
})
}
public hc_turnableBaseInfo(callback: Function, propType?: number): void {
const d: any = {
activityId: DataManager.ins.customCfgData.actId
};
const net: INetData = {
name: 'hc_turnableBaseInfo',
uri: window['duiba'] + '/customActivity/happyclear/bigWheel/baseInfo',
type: 'get',
dataType: 'json',
hideMsg:true,
param: d,
callback: callback
};
this.send(net);
}
public hc_turnableDojoin(callback: Function, propType?: number): void {
const d: any = {
activityId: DataManager.ins.customCfgData.actId,
detect: window['detect'],
deviceSessionId: window['_device_session_id']
};
const net: INetData = {
name: 'hc_turnableDojoin',
uri: window['duiba'] + '/customActivity/happyclear/bigWheel/dojoin',
type: 'post',
dataType: 'json',
hideMsg:true,
param: d,
callback: callback
};
this.send(net);
}
public hc_askForEnergy(callback: Function): void {
const net: INetData = {
......@@ -2036,4 +2086,86 @@ export class NetManager extends ABNetManager {
this.send(net);
}
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// 消消乐刮刮卡 /////////////////////////////////////
/**
* 刮刮卡获取任务信息
* @param callback
*/
public scratchGetTaskInfo(callback: Function): void {
const net: INetData = {
name: NetName.SCRATCH_GET_TASKINFO,
uri: window['duiba'] +'/customActivity/happyclear/scratchCard/getTaskInfo',
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
},
callback: callback
};
this.send(net);
}
/**
* 刮刮卡领取奖励
* @param callback
* @param scratchCardTaskId 刮刮卡任务id
*/
public scratchTakePrize(callback: Function, scratchCardTaskId): void {
const net: INetData = {
name: NetName.SCRATCH_TAKEPRIZE,
uri: window['duiba'] +'/customActivity/happyclear/scratchCard/takePrize',
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
scratchCardTaskId:scratchCardTaskId
},
callback: callback
};
this.send(net);
}
/**
* 获取邀请码
* @param callback
* @param scratchCardTaskId 刮刮卡任务id
*/
public scratchGetShareCode(callback: Function, scratchCardTaskId): void {
const net: INetData = {
name: NetName.SCRATCH_GET_SHARECODE,
uri: window['duiba'] +'/customActivity/happyclear/scratchCard/getShareCode',
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
scratchCardTaskId:scratchCardTaskId
},
callback: callback
};
this.send(net);
}
/**
* 助力
* @param callback
* @param shareCode 分享码
*/
public scratchDoHelp(callback: Function, shareCode): void {
const net: INetData = {
name: NetName.SCRATCH_DOHELP,
uri: window['duiba'] +'/customActivity/happyclear/scratchCard/doHelp',
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId,
shareCode:shareCode
},
callback: callback
};
this.send(net);
}
}
\ No newline at end of file
......@@ -81,7 +81,7 @@
"name": "signprize"
},
{
"keys": "toast_png,share_btn2_png,share_btn1_png,prizePanelbg_png,nums2_png,nums2_fnt,nums_png,nums_fnt,lightani_png,common_yuanbao_png,common_prizelight_png,common_adbg_png,commmon_okbtn1_png,closeCommonBtn_png,btn_png,alertbg_png,朋友圈中间分享蒙层1_jpg,按钮 副本 4_png,按钮 副本 3_png,exchangebtn_png",
"keys": "toast_png,share_btn2_png,share_btn1_png,prizePanelbg_png,nums2_png,nums2_fnt,nums_png,nums_fnt,lightani_png,common_yuanbao_png,common_prizelight_png,common_adbg_png,commmon_okbtn1_png,closeCommonBtn_png,btn_png,alertbg_png,朋友圈中间分享蒙层1_jpg,按钮 副本 4_png,按钮 副本 3_png,exchangebtn_png,turnnoprize再来一次2_png",
"name": "common"
},
{
......@@ -149,7 +149,7 @@
"name": "bagquit"
},
{
"keys": "turntable_bg_png,turntable_panel_png,turntable_startbtn_png,turntable_rulebtn_png",
"keys": "turntable_bg_png,turntable_panel_png,turntable_startbtn_png,turntable_rulebtn_png,turnable_icon1_png,turnable_icon2_png,turnable_icon3_png",
"name": "turntable"
},
{
......@@ -157,7 +157,7 @@
"name": "back"
},
{
"keys": "turnprize再抽一次按钮_png,turprize继续闯关按钮_png,turprizebg_png",
"keys": "turprize继续闯关按钮_png,turprizebg_png",
"name": "turntableprize"
},
{
......@@ -165,8 +165,16 @@
"name": "turnrule"
},
{
"keys": "turnnoprize再来一次_png,turnnoprize离奖励只差一毫米! 再来一次吧!_png,turnnoprize奖励溜走了,再试一次吧!_png,turnnoprize继续闯关_png,turnnoprize换个姿势再来一次!_png",
"keys": "turnnoprize再来一次_png,turnnoprize离奖励只差一毫米! 再来一次吧!_png,turnnoprize奖励溜走了,再试一次吧!_png,turnnoprize继续闯关_png,turnnoprize换个姿势再来一次!_png,turnnoprizebg_png",
"name": "turntablenoprize"
},
{
"keys": "h52按钮_png",
"name": "h52"
},
{
"keys": "turnprize2按钮_png,turnprize2bg_png",
"name": "turntableprize2"
}
],
"resources": [
......@@ -2605,11 +2613,6 @@
"type": "image",
"name": "backbg_png"
},
{
"url": "assets/turntableprize/turnprize再抽一次按钮.png",
"type": "image",
"name": "turnprize再抽一次按钮_png"
},
{
"url": "assets/turntableprize/turprize继续闯关按钮.png",
"type": "image",
......@@ -2699,6 +2702,51 @@
"url": "assets/turnnoprize/turnnoprize继续闯关.png",
"type": "image",
"name": "turnnoprize继续闯关_png"
},
{
"url": "assets/h52/h52按钮.png",
"type": "image",
"name": "h52按钮_png"
},
{
"url": "assets/h52bg.jpg",
"type": "image",
"name": "h52bg_jpg"
},
{
"url": "assets/common/turnnoprize再来一次.png",
"type": "image",
"name": "turnnoprize再来一次2_png"
},
{
"url": "assets/turnnoprize/turnnoprizebg.png",
"type": "image",
"name": "turnnoprizebg_png"
},
{
"url": "assets/turnprize2/turnprize2按钮.png",
"type": "image",
"name": "turnprize2按钮_png"
},
{
"url": "assets/turnprize2/turnprize2bg.png",
"type": "image",
"name": "turnprize2bg_png"
},
{
"url": "assets/turntable/turnable_icon1.png",
"type": "image",
"name": "turnable_icon1_png"
},
{
"url": "assets/turntable/turnable_icon2.png",
"type": "image",
"name": "turnable_icon2_png"
},
{
"url": "assets/turntable/turnable_icon3.png",
"type": "image",
"name": "turnable_icon3_png"
}
]
}
\ No newline at end of file
......@@ -76,8 +76,9 @@
"resource/skins/Toast2Skin.exml",
"resource/skins/TurntableSkin.exml",
"resource/skins/TurnRuleSkin.exml",
"resource/skins/TurntablePrize2Skin.exml",
"resource/skins/TurntablePrizeSkin.exml",
"resource/skins/TurntableNoPrizeSkin.exml",
"resource/skins/VScrollBarSkin.exml"
],
"path": "resource/default.thm.json"
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="BagItem2Skin" width="508" height="225" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<w:Config id="16e01911ccd"/>
<e:Image width="508" height="225" source="{data.url}"/>
<e:Image width="508" height="225" source="{data.img}"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="H52Skin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="invitebg_jpg"/>
<e:Image id="gobtn" source="h5_gobtn_png" y="995" horizontalCenter="0"/>
<e:Skin class="H52Skin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Group id="group" y="0" x="0">
<e:Image source="h52bg_jpg" x="0" y="0"/>
<e:Image id="gobtn" y="1196" source="h52按钮_png" alpha="0" x="135"/>
</e:Group>
<e:Image id="rulebtn" source="h5btn_png" y="954" horizontalCenter="0" visible="false"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="InviteSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui"
xmlns:w="http://ns.egret.com/wing">
<e:Image y="45.33" horizontalCenter="0" source="scratchPrize_bg_png"/>
xmlns:w="http://ns.egret.com/wing" xmlns:ns1="*">
<e:Image y="45" horizontalCenter="0" source="scratchPrize_bg_png"/>
<e:Image id="prizeImg" y="426.77" source="" horizontalCenter="0" width="510" height="228"/>
<e:Button id="closeBtn" label="" x="624" y="313.33">
<e:skinName>
......@@ -15,7 +15,7 @@
<e:Button id="ok_btn" label="" y="764" anchorOffsetX="138.5" anchorOffsetY="56.5" x="236.5">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="scratchPrize_btn_png"/>
<e:Image width="100%" height="100%" source="scratchPrize_btn_png" source.down="scratchPrize_btn_png" source.disabled="scratchPrize_btn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
......@@ -23,7 +23,7 @@
<e:Button id="game_btn" label="" y="764" anchorOffsetX="139" anchorOffsetY="56.5" x="527">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="scratchPrize_game_btn_png"/>
<e:Image width="100%" height="100%" source="scratchPrize_game_btn_png" source.down="scratchPrize_game_btn_png" source.disabled="scratchPrize_game_btn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
......
......@@ -4,8 +4,7 @@
<w:Config id="16dd8f58b77" visible="false"/>
<e:Image id="light2" x="376" y="317" anchorOffsetX="356" anchorOffsetY="296" source="scratchbg2_png"/>
<e:Image id="light1" x="376" y="317" anchorOffsetX="356" anchorOffsetY="296" source="scratchbg2_png"/>
<e:Image y="259.33" source="scratch_bg_png" horizontalCenter="0"/>
<e:Group id="con" y="-67"/>
<e:Group id="con" y="58.03"/>
<e:Label id="numLabel" text="共2位好友帮你刮了90.3%" y="381.33" textColor="0xF54500" size="28" horizontalCenter="0" fontFamily="Lucida Family" verticalAlign="middle" textAlign="center"/>
<e:Image y="414" horizontalCenter="0" source="scratch_card_bg_png"/>
<e:Image id="prizeImg" y="435" source="" width="510" height="228" horizontalCenter="0"/>
......@@ -28,6 +27,7 @@
</e:skinName>
</e:Button>
<e:Label id="cutTimeLabel" text="将在23:43:21后失效" y="895.33" size="28" textColor="0xffffff" horizontalCenter="0.5"/>
<e:Label text="帮刮\n记录" y="805" size="28" textColor="0xFFFFFF" horizontalCenter="-248"/>
<e:Scroller width="487" height="90" y="783" anchorOffsetX="0" anchorOffsetY="0" horizontalCenter="32.5">
<e:Group anchorOffsetX="0" y="2">
<e:List id="list" x="0" y="0" anchorOffsetX="0">
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="TurntableNoPrizeSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<w:Config id="16e02c1ad57"/>
<e:Component y="635" skinName="ADSmallSkin" horizontalCenter="0" visible="false"/>
<e:Image y="161" horizontalCenter="0.5" source="turnnoprizebg_png"/>
<e:Button id="closeBtn" label="" y="224.88" x="623">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Group y="494.67" horizontalCenter="0.5">
<e:Button id="btn1" label="" y="0" x="9.09">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="turnnoprize再来一次_png" source.down="turnnoprize再来一次_png" source.disabled="turnnoprize再来一次_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="btn2" label="" y="0" x="279">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="turnnoprize继续闯关_png" source.down="turnnoprize继续闯关_png" source.disabled="turnnoprize继续闯关_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Label id="status2" text="(免费次数:1)" x="69.3" y="62.66" size="22" touchEnabled="false"/>
<e:Group id="status1" x="52" y="60" touchChildren="false" touchEnabled="false">
<e:Label text=")" x="132" y="2" size="22" touchEnabled="false"/>
<e:Label id="nums" text="(-50" x="0" y="0" size="22" textAlign="right" width="82" touchEnabled="false"/>
<e:Image source="common_yuanbao_png" x="91.99" y="1.67"/>
</e:Group>
</e:Group>
<e:Image id="tips1" source="turnnoprize换个姿势再来一次!_png" y="358" horizontalCenter="0" visible="false"/>
<e:Image id="tips2" source="turnnoprize奖励溜走了,再试一次吧!_png" y="360" horizontalCenter="0" visible="false"/>
<e:Image id="tips3" source="turnnoprize离奖励只差一毫米! 再来一次吧!_png" y="340" horizontalCenter="0.5" visible="false"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="TurntablePrize2" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<w:Config id="16e02c1ad57"/>
<e:Image id="light2" source="invitebg2_png" x="376" y="297" anchorOffsetX="356" anchorOffsetY="296"/>
<e:Image id="light1" source="invitebg2_png" x="386" y="307" anchorOffsetX="356" anchorOffsetY="296"/>
<e:Group id="container" y="-98.45" x="-3"/>
<e:Image source="turnprize2bg_png" y="159" horizontalCenter="0"/>
<e:Group y="326" horizontalCenter="0">
<e:Image width="508" height="225" source="{data.url}" horizontalCenter="0" verticalCenter="0"/>
<e:Image id="scratch_progress" y="0" x="0" source="scratch_card_98_png"/>
</e:Group>
<e:Button id="closeBtn" label="" y="242.88" x="615">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Image id="btn" source="turnprize2按钮_png" y="677" horizontalCenter="0"/>
<e:Group x="124" y="606" width="506" height="57" anchorOffsetX="0" anchorOffsetY="0">
<e:Image id="progressMask" source="scratch_progress_bg_png" anchorOffsetX="0" anchorOffsetY="0" x="7" verticalCenter="0"/>
<e:Group id="progressGroup" x="8" verticalCenter="0">
<e:Image id="progressBg" source="scratch_progress_bg_png" anchorOffsetX="0" anchorOffsetY="0" x="0" y="0" width="437" height="22"/>
<e:Rect id="progress" fillColor="0xEB1917" left="0" verticalCenter="0" width="0" top="0" bottom="0"/>
<e:Label id="progressLabel" text="仅剩90.7%" size="18" verticalCenter="0" horizontalCenter="0" bold="true"/>
</e:Group>
<e:Image id="hongbao" source="scratch_hongbao_png" scaleX="1" scaleY="1" verticalCenter="0" horizontalCenter="219"/>
</e:Group>
</e:Skin>
\ No newline at end of file
......@@ -2,9 +2,9 @@
<e:Skin class="TurntablePrize" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<w:Config id="16e02c1ad57"/>
<e:Component y="788" skinName="ADSmallSkin" horizontalCenter="0" visible="false"/>
<e:Image id="light2" source="invitebg2_png" x="376" y="317" anchorOffsetX="356" anchorOffsetY="296"/>
<e:Image id="light1" source="invitebg2_png" x="386" y="327" anchorOffsetX="356" anchorOffsetY="296"/>
<e:Group id="container" y="-45.45" x="-3"/>
<e:Image id="light2" source="invitebg2_png" x="376" y="297" anchorOffsetX="356" anchorOffsetY="296"/>
<e:Image id="light1" source="invitebg2_png" x="386" y="307" anchorOffsetX="356" anchorOffsetY="296"/>
<e:Group id="container" y="-98.45" x="-3"/>
<e:Image source="turprizebg_png" y="161" horizontalCenter="0.5"/>
<e:Image width="508" height="225" source="{data.url}" horizontalCenter="0" y="355.76"/>
<e:Button id="closeBtn" label="" y="242.88" x="615">
......@@ -19,7 +19,7 @@
<e:Button id="btn1" label="" y="0" x="9.09">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="turnprize再抽一次按钮_png" source.down="turnprize再抽一次按钮_png" source.disabled="turnprize再抽一次按钮_png"/>
<e:Image width="100%" height="100%" source="turnnoprize再来一次_png" source.down="turnnoprize再来一次_png" source.disabled="turnnoprize再来一次_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
......@@ -32,7 +32,11 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Label text=")" x="184" y="62" size="22" touchEnabled="false"/>
<e:Label id="nums" text="(-50" x="52" y="60" size="22" textAlign="right" width="82" touchEnabled="false"/>
<e:Group id="status1" x="52" y="60" visible="false">
<e:Label text=")" x="132" y="2" size="22" touchEnabled="false"/>
<e:Label id="nums" text="(-50" x="0" y="0" size="22" textAlign="right" width="82" touchEnabled="false"/>
<e:Image source="common_yuanbao_png" x="91.99" y="1.67"/>
</e:Group>
</e:Group>
<e:Label id="satus2" text="(免费次数:1)" x="169.3" y="693.66" size="22" touchEnabled="false" visible="false"/>
</e:Skin>
\ No newline at end of file
......@@ -38,6 +38,7 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Label id="btnLabel" text="Label" size="20" verticalCenter="30.5" verticalAlign="middle" textAlign="center" bold="true" horizontalCenter="0"/>
</e:Group>
<e:Button id="closeBtn" label="" y="292.88" x="565.89">
<e:skinName>
......
/**
* 简单的倒计时
* Created by haiyoucuv on 2019/10/24
* Created on 2019/10/24
*/
export default class CutTimer {
private _timer: egret.Timer = null;
......
......@@ -7,6 +7,8 @@ export default class H52Scene extends Scene {
async start(data?) {
super.start();
this['group'].y = (this.stage.stageHeight -1624)/2
// this.height=this.stage.stageHeight;
// this['rulebtn'].addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{
// PanelCtrl.instance.show('inviterule')
// },this);
......
/**
* 地图页图标基类
* Created by haiyoucuv on 2019/10/25
* Created on 2019/10/25
*/
export default class IconBase{
private iconGroup:eui.Group;
private iconBtn:eui.Button;
private iconTipsBg:eui.Image;
private iconTips:eui.Label;
private readonly _name:string;
public get name(){
export default class IconBase {
protected iconGroup: eui.Group;
protected iconBtn: eui.Button;
protected iconTipsBg: eui.Image;
protected iconTips: eui.Label;
protected readonly _name: string;
public get name() {
return this._name;
}
constructor(name:string, group:eui.Group, btn:eui.Button, tipsBg?:eui.Image, tipsLabel?:eui.Label){
constructor(name: string, group: eui.Group, btn: eui.Button, tipsBg?: eui.Image, tipsLabel?: eui.Label) {
this.iconGroup = group;
this.iconBtn = btn;
this.iconTipsBg = tipsBg;
......@@ -23,23 +24,23 @@ export default class IconBase{
this.start();
}
protected start(){
protected start() {
this.initEvents();
}
protected initEvents(){
protected initEvents() {
this.iconBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchBtn, this);
}
protected onTouchBtn(e:egret.TouchEvent){
protected onTouchBtn(e: egret.TouchEvent) {
}
protected removeEvents(){
protected removeEvents() {
this.iconBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchBtn, this);
}
protected destory(){
protected destory() {
this.removeEvents();
}
......@@ -48,7 +49,10 @@ export default class IconBase{
* 设置图标提示的隐藏与显示
* @param visible
*/
public set tipsVisible(visible:boolean){
public set tipsVisible(visible: boolean) {
if(visible == true) {
this.visible = true;
}
this.iconTipsBg.visible = visible;
this.iconTips.visible = visible;
}
......@@ -57,7 +61,7 @@ export default class IconBase{
* 设置图标隐藏与显示
* @param visible
*/
public set visible(visible:boolean){
public set visible(visible: boolean) {
this.iconGroup.visible = visible;
this.iconBtn.visible = visible;
this.iconTipsBg.visible = visible;
......
import IconBase from "./IconBase";
import { NetManager } from "../../../libs/tw/manager/NetManager";
import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
import CutTimer from "../../CutTimer";
import { GDispatcher } from "../../../libs/tc/util/GDispatcher";
import { ModuleTypes } from "../../../libs/new_wx/types/sceneTypes";
import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath";
import Utils from "../../Utils";
export default class ScratchIcon extends IconBase {
private cutTimer: CutTimer = null;
constructor(name: string, group: eui.Group, btn: eui.Button, tipsBg?: eui.Image, tipsLabel?: eui.Label) {
super(name, group, btn, tipsBg, tipsLabel);
}
protected start() {
super.start();
this.getTaskInfo(); // 获取任务信息 (控制角标)
}
public getTaskInfo() {
NetManager.ins.scratchGetTaskInfo((success, res) => {
if(!success) {
return;
}
let status = res.data.taskStatus;
if(this.cutTimer) { // 先停止计时器一次
this.cutTimer.stop();
}
switch(true) {
case (status == 0): // 当前无任务,隐藏icon
this.visible = false;
break;
case (status == 1): // 当前任务进行中,显示倒计时
this.tipsVisible = true;
// 开启新的计时器
this.cutTimer = new CutTimer(this.iconTips, "hh:mm:ss", () => {
this.getTaskInfo();
});
let cutTime = res.data.endTime - res.data.currentTime + 3000;
if(!this.cutTimer.start(cutTime)) {
this.cutTimer.stop();
this.cutTimer.start(cutTime);
}
break;
case (status == 2): // 当前任务完成待领奖,显示待领奖
this.tipsVisible = true;
this.iconTips.text = "待领取";
break;
protected initEvents() {
super.initEvents();
default:
break;
}
})
}
/**
* 点击icon
* @param e 点击事件
*/
protected onTouchBtn(e: egret.TouchEvent) {
super.onTouchBtn(e);
NetManager.ins.getInviteInfo((success, res) => {
NetManager.ins.scratchGetTaskInfo((success, res) => {
if(!success) {
return;
}
PanelCtrl.instance.show('scratch', res.data);
let status = res.data.taskStatus;
switch(true) {
case (status == 0): // 当前无任务(一般icon不会出现),拦截
break;
case (status == 1): // 当前任务进行中 打开任务面板
loadSvga(getResPath() + 'resource/assets/svgas/sprize.svga').then(async (mv: any) => {
// await wait(100);
let data = Utils.deepClone(res.data);
data.mv = mv;
PanelCtrl.instance.show('scratch', data);
});
// PanelCtrl.instance.show('scratch', res.data);
break;
case (status == 2): // 当前任务完成待领奖 请求领奖接口
NetManager.ins.scratchTakePrize((success, res) => {
if(!success) {
return;
}
PanelCtrl.instance.show("scratchPrize", res.data);
}, res.data.scratchCardTaskId);
break;
default:
break;
}
});
}
protected initEvents() {
GDispatcher.addEvent("updateScratchTips", this.getTaskInfo, this);
super.initEvents();
}
protected removeEvents() {
GDispatcher.removeEvent("updateScratchTips", this.getTaskInfo, this);
super.removeEvents();
}
......
......@@ -12,7 +12,9 @@ export default class TurntableIcon extends IconBase {
protected start() {
super.start();
//有免费次数
//没有免费次数
//如果元宝足够
}
protected initEvents() {
......
......@@ -4,7 +4,18 @@ import BagItemRenderer from "./bag/BagItemRenderer";
import BagIte2mRenderer from "./bag/BagItemRenderer2";
import { getPropNums } from "../getHomeData";
import PropType from "../PropType";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { DataManager } from "../../libs/tw/manager/DataManager";
const getorigins = () => {
// const pre = CFG.actId + '00';
let plugs: any = window['plugs'];
let list: any = [DataManager.ins.customCfgData.oaId+'00'];
// list.push(pre);
plugs = plugs.map(p => p + '01');
list = list.concat(plugs);
return list.join(',')
}
export default class BagPanel extends Panel {
list:eui.List;
list2:eui.List;
......@@ -47,20 +58,10 @@ export default class BagPanel extends Panel {
}
]);
this.list2.itemRenderer=BagIte2mRenderer;
this.list2.dataProvider = new eui.ArrayCollection([
{
url:"http://yun.duiba.com.cn/db_games/1022/111.png"
},
{
url:"http://yun.duiba.com.cn/db_games/1022/111.png"
},
{
url:"http://yun.duiba.com.cn/db_games/1022/111.png"
},
{
url:"http://yun.duiba.com.cn/db_games/1022/111.png"
}
]);
NetManager.ins.hc_getRecord(getorigins()).then(()=>{
const {records}=DataManager.ins.getData('hc_getRecord');
this.list2.dataProvider = new eui.ArrayCollection(records);
});
}
showlog() {
......
......@@ -32,8 +32,8 @@ export default class Buy2Panel extends Panel {
this.buyBtn.enabled = false;
NetManager.ins.hc_exchange((success) => {
this.buyBtn.enabled = true;
showToast2();
if (success) {
showToast2();
this.hidePanel();
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
......
......@@ -32,9 +32,9 @@ export default class Buy3Panel extends Panel {
NetManager.ins.clickLog(getlogItem(14));
this.buyBtn.enabled = false;
NetManager.ins.hc_exchange((success) => {
showToast2();
this.buyBtn.enabled = true;
if (success) {
showToast2();
this.hidePanel();
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
......
......@@ -32,9 +32,9 @@ export default class ExchangePanel extends Panel {
this.buyBtn.enabled = false;
NetManager.ins.hc_exchange((success) => {
showToast2();
this.buyBtn.enabled = true;
if (success) {
showToast2();
this.hidePanel();
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
......
......@@ -3,9 +3,10 @@ import getSkinPath from "../../libs/new_wx/utils/getSkinPath";
import { GDispatcher } from "../../libs/tc/util/GDispatcher";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { iswx } from "../iswx";
import Utils from "../Utils";
import ScratchRulePanel from "./ScratchRulePanel";
import CutTimer from "../CutTimer";
import Utils from "../Utils";
import { DataManager } from "../../libs/tw/manager/DataManager";
export default class ScratchPanel extends Panel {
private cutTimer: CutTimer;
......@@ -18,13 +19,15 @@ export default class ScratchPanel extends Panel {
async start(data) {
super.start();
this.showlog();
const scratchData =DataManager.ins.getData('hc_turnableDojoin');
this['light1'].visible = this['light2'].visible = false;
// this['con'].addChild(this.data.svga);
// this.data.svga.gotoAndPlay(1, true);
// this.data.svga.once(egret.Event.COMPLETE, () => {
// this.data.svga.stop(1);
// }, this);
this['con'].addChild(this.data.mv);
this.data.mv.gotoAndPlay(1, true);
this.data.mv.once(egret.Event.COMPLETE, () => {
this.data.mv.stop(1);
}, this);
setTimeout(() => {
this.playBgAni();
......@@ -52,7 +55,7 @@ export default class ScratchPanel extends Panel {
}
onTouchTap_closeBtn() {
// GDispatcher.dispatchEvent("getInviteInfo");
GDispatcher.dispatchEvent("updateScratchTips");
super.onTouchTap_closeBtn();
}
......@@ -80,61 +83,44 @@ export default class ScratchPanel extends Panel {
this.hongbaoEffect();
this.setWXShareTip();
this["progressGroup"].mask = this["progressMask"];
this.setProgress(98);
this["prizeImg"].source = this.data.prizeImg;
if(!this.data.invitationUser) {
this.data.invitationUser = [];
this["prizeImg"].source = this.data.prizeImage;
if(!this.data.avatarList) {
this.data.avatarList = [];
}
// 添加邀请图标
let dNum = this.data.invitationCount - this.data.invitationUser.length;
let dNum = this.data.helpedCount - this.data.avatarList.length;
for(let i = 0; i < dNum; i++) {
this.data.invitationUser.push({
nickname: "nickname",
avatar: "scratch_invite_png",
});
this.data.avatarList.push("scratch_invite_png");
}
// 添加假用户
this.data.invitationUser.unshift({
nickname: "nickname",
avatar: "scratch_user1_png",
}, {
nickname: "nickname",
avatar: "scratch_user2_png",
this.data.avatarList.unshift("scratch_user1_png", "scratch_user2_png");
// 创建渲染列表
let rendererList = [];
for(let i = 0; i < this.data.avatarList.length; i++) {
rendererList.push({
avatar: this.data.avatarList[i], // 传递头像
wxShareTip: this["wxShareTip"], // 传递shareGroup的引用
scratchTaskId: this.data.scratchCardTaskId, // 任务id
});
// 添加回调函数
for(let i = 0; i < this.data.invitationUser.length; i++) {
this.data.invitationUser[i]['callFun'] = () => {
NetManager.ins.getShareCode((success, res) => {
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()) { //微信端
this["wxShareTip"].visible = true;
window["invokeWX"]();
} else {//端内
this["wxShareTip"].visible = false;
window["inviteShare"](shareCode);
}
});
}
}
this["list"].useVirtualLayout = false;
this["list"].itemRenderer = ScratchItem;
this["list"].dataProvider = new eui.ArrayCollection(this.data.invitationUser);
this["list"].dataProvider = new eui.ArrayCollection(rendererList);
this.setProgress(+this.data.completePercent);
// 倒计时
this.cutTimer = new CutTimer(this["cutTimeLabel"], "将在hh:mm:ss后消失", () => {
this.hidePanel();
GDispatcher.dispatchEvent("updateScratchTips");
}
);
let cutTime = this.data.endTime - this.data.sysTime + 3000;
let cutTime = this.data.endTime - this.data.currentTime + 3000;
if(!this.cutTimer.start(cutTime)) {
this.cutTimer.stop();
this.cutTimer.start(cutTime);
......@@ -151,28 +137,28 @@ export default class ScratchPanel extends Panel {
} else if(progress < 0) {
progress = 0;
}
this['numLabel'].text = `共${this.data.invitationUser.length + 2}位好友帮你刮了${progress}%`;
this['numLabel'].text = `共${this.data.avatarList.length}位好友帮你刮了${progress}%`;
this["progressLabel"].text = `仅剩${(100 - progress).toFixed(2)}%`; // 进度条文字
let _width = this["progressBg"].width * progress / 100; // 宽度
let dProgress = Math.abs(progress - this["progress"].width / this["progressBg"].width); // 比当前进度的差值的绝对值
let _duration = 1000 * dProgress / 100; // 算出变化的时间
egret.Tween.get(this["progress"]).to({width: _width}, _duration);
let i = new eui.Image();
if(progress >= 100){
if(progress >= 100) {
this["scratch_progress"].visible = false;
} else if(progress >= 98 && progress < 100){
} else if(progress >= 98 && progress < 100) {
this["scratch_progress"].visible = true;
this["scratch_progress"].source = "scratch_card_98_png";
}else if(progress >= 96 && progress < 98){
} else if(progress >= 96 && progress < 98) {
this["scratch_progress"].visible = true;
this["scratch_progress"].source = "scratch_card_96_png";
}else if(progress >= 94 && progress < 96){
} else if(progress >= 94 && progress < 96) {
this["scratch_progress"].visible = true;
this["scratch_progress"].source = "scratch_card_94_png";
}else if(progress >= 92 && progress < 96){
} else if(progress >= 92 && progress < 96) {
this["scratch_progress"].visible = true;
this["scratch_progress"].source = "scratch_card_92_png";
}else if(progress < 92){
} else if(progress < 92) {
this["scratch_progress"].visible = true;
this["scratch_progress"].source = "scratch_card_90_png";
}
......@@ -197,7 +183,7 @@ export default class ScratchPanel extends Panel {
destroy() {
super.destroy();
this.cutTimer.stop();
this.cutTimer.stop(); // 面板销毁停止计时器(停止计时器,移除时间事件监听)
}
protected get closeBtns(): eui.Button[] {
......@@ -230,9 +216,23 @@ class ScratchItem extends eui.ItemRenderer {
this.img.mask = this.mask;
this.img.source = this.data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png";
this.img.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(this.data.callFun) {
this.data.callFun();
NetManager.ins.scratchGetShareCode((success, res) => {
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()) { //微信端
this.data.wxShareTip.visible = true;
window["invokeWX"]();
} else {//端内
this.data.wxShareTip.visible = false;
window["inviteShare"](shareCode);
}
}, this.data.scratchTaskId);
}, this);
}
}
......@@ -9,10 +9,10 @@ import { GDispatcher } from "../../libs/tc/util/GDispatcher";
* 邀请规则面板
*/
export default class ScratchPrizePanel extends Panel {
public prizeImg:eui.Image;
public closeBtn:eui.Button;
public ok_btn:eui.Button;
public game_btn:eui.Button;
public prizeImg: eui.Image;
public closeBtn: eui.Button;
public ok_btn: eui.Button;
public game_btn: eui.Button;
constructor(data) {
super();
......@@ -21,48 +21,53 @@ export default class ScratchPrizePanel extends Panel {
start() {
super.start();
this.initUI();
}
protected onSkinComplete() {
this.initUI();
}
initEvents() {
super.initEvents();
this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this.ok_btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapGoPrize, this);
this.game_btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchOK, this);
this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
this.ok_btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
this.game_btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
}
removeEvents() {
super.removeEvents();
this.closeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this.ok_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapGoPrize, this);
this.game_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchOK, this);
this.closeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
this.ok_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
this.game_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
}
onTouchTap_closeBtn() {
// GDispatcher.dispatchEvent("getInviteInfo");
onTouchTap(e: egret.TouchEvent) {
switch(true) {
case (e.target == this.closeBtn): // 关闭按钮
super.onTouchTap_closeBtn();
}
onTouchOK() {
break;
case (e.target == this.ok_btn): // 去领奖
window.location.href = window['__link__'];
break;
case (e.target == this.game_btn): // 继续闯关
if((getHomeData().levels.length + 1) > window['last_level']) {
changeMapScene();
super.hidePanel();
return;
}
// GDispatcher.dispatchEvent("getInviteInfo");
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1);
}
break;
onTapGoPrize() {
window.location.href = window['__link__'];
default:
break;
}
GDispatcher.dispatchEvent("updateScratchTips");
}
initUI() {
this.prizeImg.source = this.data.prizeImg;
addAdComp(84, 845.33, this);
this.prizeImg.source = this.data.prizeImage;
addAdComp(84, 875, this);
}
protected get closeBtns(): eui.Button[] {
......
......@@ -5,14 +5,14 @@ import RotaryData from './RotaryData';
import Panel from "../../../libs/new_wx/components/Panel";
import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
import { ModuleTypes } from "../../../libs/new_wx/types/sceneTypes";
import hdGameDoDojoin from "../../../libs/new_tw/ctrls/hdGameDoDojoin";
import submit from "../../../libs/new_tw/ctrls/submit";
import Loading from "../../../libs/new_wx/components/Loading";
import { NetManager } from "../../../libs/tw/manager/NetManager";
import Utils from "../../Utils";
import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath";
import wait from "../../../libs/new_tc/wait";
import { showToast } from "../../../libs/new_wx/ctrls/toastCtrl";
import getHomeData from "../../getHomeData";
// export const loadTurntableSvga = (callback) => {
// loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => {
// // await wait(100);
......@@ -24,6 +24,9 @@ export default class Turntable extends Panel {
public start_btn: eui.Button;
public closeBtn: eui.Button;
private nextTimeNeedCoin: number = 0;
private remainTimes: number = 0;
public get skinKey() {
return 'Turntable'
}
......@@ -32,23 +35,29 @@ export default class Turntable extends Panel {
super();
this.data = data;
}
hand;
async start(data?) {
super.start();
console.log(data.onceAgain)
if(data.onceAgain) { // 再抽一次
this.onTapStart();
}
this['container'].addChild(this.data.mv);
this.hand = await loadSvga(getResPath() + 'resource/assets/svgas/hand.svga', this['container2'])
this['container2'].touchEnabled=false;
this['container2'].touchChildren=false;
this['container2'].touchEnabled = false;
this['container2'].touchChildren = false;
this['nums'].text = `当前可用元宝:${getHomeData().wealth}`;
this.initUI();
}
rulebtn;
initEvents() {
super.initEvents();
this["closeBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this.start_btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapStart, this);
this.rulebtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapRulebtn, this);
GDispatcher.addEvent('queryPrize', this.queryPrize, this);
GDispatcher.addEvent('panelEffect', this.panelEffect, this);
}
onTouchTap_closeBtn() {
......@@ -59,29 +68,40 @@ export default class Turntable extends Panel {
super.removeEvents();
this["closeBtn"].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this.start_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapStart, this);
GDispatcher.removeEvent('queryPrize', this.queryPrize, this);
GDispatcher.removeEvent('panelEffect', this.panelEffect, this);
this.rulebtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapRulebtn, this);
}
onTapRulebtn() {
PanelCtrl.instance.show('TurnRulePanel')
}
onTapStart() {
// this.setBtnTouch(false); // 锁定按钮
// Loading.instace.show();
// GDispatcher.dispatchEvent('queryPrize');
PanelCtrl.instance.show('TurnPrizePanel');
this.setBtnTouch(false); // 锁定按钮
Loading.instace.show();
if(this.remainTimes <= 0 && (getHomeData().wealth < this.nextTimeNeedCoin)) {
showToast("元宝不足咯~快去闯关赢元宝吧");
Loading.instace.hide();
this.setBtnTouch(true);
return;
}
this.queryPrize();
}
updateIcon() {
GDispatcher.dispatchEvent("updateScratchTips");
}
// 设置全部按钮是否可以点击
private setBtnTouch(touchEnabled: boolean) {
this.start_btn.touchEnabled = touchEnabled;
this["closeBtn"].touchEnabled = touchEnabled;
}
/**
* 开始抽奖
*/
private queryPrize() {
this['container2'].visible = false;
egret.Tween.removeTweens(this.panel);
this.doJoin();
}
......@@ -90,37 +110,63 @@ export default class Turntable extends Panel {
* 开始游戏
*/
private doJoin() {
/////////////////////////////////////////// 开始转盘并查询奖品 ///////////////////////////////////////////
// hdGameDoDojoin((success, res) => {
//
// if(!success) {
// Loading.instace.hide();
// this.setBtnTouch(true);
// return;
// }
// submit((success, res) => {
// Loading.instace.hide();
try {
if(window['getRST']) window['getRST']();
} catch(error) {
console.warn(error)
}
NetManager.ins.hc_turnableDojoin((success, res) => {
Loading.instace.hide();
// if(!success) {
// this.setBtnTouch(true);
// return;
// }
// // if(!res.lottery || res.lottery.type == 'thanks') {
// // PanelCtrl.instance.show(ModuleTypes.GAME_FAIL_NO_PRIZE_PANEL);
// // } else {
// // PanelCtrl.instance.show(ModuleTypes.GAME_FAIL_PRIZE_PANEL, res.lottery);
// // }
// this.rotateByPrize(res.lotteryId, () => {
// if(!res.lottery || res.lottery.type == 'thanks') { // 如果未中奖
// PanelCtrl.instance.show(ModuleTypes.NO_PRIZE_PANEL);
// this.setBtnTouch(true); // 开启按钮
// } else {
// PanelCtrl.instance.show(ModuleTypes.PRIZE_PANEL, res.lottery);
// GDispatcher.dispatchEvent('getCount'); // 更新免费抽奖次数
// this.setBtnTouch(true); // 开启按钮
// }
// });
// }, 2);
// });
const data = res.data;
const code = res.code;
let id = data.option.categoryType;
if(!success || !data.option) {
id = "thanks";
} else if(data.isScratchCard) {
id = "scratch";
}
this.rotateByPrize(id, () => {
if(!success) {
switch(true) {
case (code == "600051"): // 元宝不足
showToast("元宝不足咯~快去闯关赢元宝吧");
this.hidePanel();
break;
case (code == "600015"): // 命中风控参与规则
PanelCtrl.instance.show("TurntableNoPrizePanel", {type: 1});
break;
case (code == "600016"): // 苏宁风控 命中
PanelCtrl.instance.show("TurntableNoPrizePanel", {type: 1});
break;
default:
break;
}
return;
}
if(data.isScratchCard) { // 刮刮卡
//如果是刮刮卡类型
this.updateIcon();
loadSvga(getResPath() + 'resource/assets/svgas/turnprize.svga').then(async (mv: any) => {
let _data = Utils.deepClone(data);
_data.mv = mv;
PanelCtrl.instance.show('TurnPrize2Panel', _data);
});
} else if(!data.option) {
PanelCtrl.instance.show("TurntableNoPrizePanel", {type: 3});
} else {
loadSvga(getResPath() + 'resource/assets/svgas/turnprize.svga').then(async (mv: any) => {
let _data = Utils.deepClone(data);
_data.mv = mv;
PanelCtrl.instance.show('TurnPrizePanel', _data);
});
}
});
})
}
/**
......@@ -146,16 +192,11 @@ export default class Turntable extends Panel {
*/
private rotate(rotation: number, time: number, callFun: Function) {
let tw = egret.Tween.get(this.panel);
tw.to({ rotation: rotation }, time, egret.Ease.cubicInOut).wait(500).call(callFun);
tw.to({rotation: rotation}, time, egret.Ease.cubicInOut).wait(500).call(callFun);
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.onLoad();
}
protected onLoad(): void {
this.initUI();
}
private initUI(): void {
......@@ -168,14 +209,14 @@ export default class Turntable extends Panel {
}
private panelEffect() {
egret.Tween.get(this.panel).to({ rotation: 360 }, 20000).call(() => {
egret.Tween.get(this.panel).to({rotation: 360}, 20000).call(() => {
this.panelEffect();
});
}
protected async preLoadRes() {
return new Promise(function (resolve, reject) {
return new Promise(function(resolve, reject) {
resolve();
});
}
......@@ -184,22 +225,76 @@ export default class Turntable extends Panel {
* 获得所有奖品信息
*/
private getPrizeInfo() {
/////////////////////////////////////////// 查询奖品加入转盘数据 ///////////////////////////////////////////
// let data = DataManager.ins.ajaxElementData.options;
// let options = Utils.deepClone(data);
// for(let i = 0; i < options.length; i++) {
// let v = options[i];
// if(v.scoreArea == "1,1") {
// options.splice(i--, 1);
// }
// }
// for(let i = 0; i < options.length; i++) {
// let v = options[i];
// RotaryData.key.push(v.id);
// RotaryData.data[v.id] = [{start: i * 40 - 15, end: i * 40 + 15}];
// this[`img${i}`].source = v.logo;
// this[`lab${i}`].text = v.name;
// }
NetManager.ins.hc_turnableBaseInfo((success, res) => {
if(!success) {
return;
}
const data = res.data;
// 设置按钮次数显示
if(data.remainTimes > 0) {
this['btnLabel'].text = `免费次数:\n${data.remainTimes}次`;
} else {
this['btnLabel'].text = `${data.nextTimeNeedCoin}元宝/次`;
}
this.remainTimes = data.remainTimes;
this.nextTimeNeedCoin = data.nextTimeNeedCoin;
// 添加奖品
let prizeList = [];
for(let v of data.luckyDrawInfo.prizeList) {
prizeList.push(Utils.deepClone(v));
}
prizeList.push({
categoryType: 'thanks',
}, {
categoryType: 'scratch',
});
for(let i = 0; i < prizeList.length; i++) {
let v = prizeList[i];
let prizeImg = "";
switch(v.categoryType) {
case "scratch":
prizeImg = "//yun.duiba.com.cn/developer/img/activityTool/slotMachine/object.png";
break;
case "thanks":
prizeImg = "//yun.duiba.com.cn/upload/uP99F1462438316972.png";
break;
case 1:
prizeImg = "//yun.duiba.com.cn/developer/img/activityTool/slotMachine/alipay.png";
break;
case 2:
prizeImg = "//yun.duiba.com.cn/developer/img/activityTool/slotMachine/qb.png";
break;
case 3:
prizeImg = `turnable_icon${v.propType}_png`;
break;
case 4:
prizeImg = "//yun.duiba.com.cn/developer/img/activityTool/slotMachine/object.png";
break;
case 5:
prizeImg = "//yun.duiba.com.cn/developer/img/activityTool/slotMachine/alipay.png";
break;
case 6:
prizeImg = "//yun.duiba.com.cn/developer/img/activityTool/slotMachine/qb.png";
break;
case 7:
prizeImg = "//yun.duiba.com.cn/developer/img/activityTool/slotMachine/phonebill.png";
break;
default:
break;
}
v.prizeImg = prizeImg;
RotaryData.key.push(v.categoryType);
RotaryData.data[v.categoryType] = [{start: i * 60 - 20, end: i * 60 + 20}];
this[`img${i}`].source = v.prizeImg;
}
});
console.log(RotaryData);
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import { gotoNextLevel } from "../gotoNextLevel";
import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath";
import { NetManager } from "../../../libs/tw/manager/NetManager";
export default class TurntableNoPrizePanel extends Panel {
......@@ -11,7 +12,18 @@ export default class TurntableNoPrizePanel extends Panel {
super.start();
this.showlog();
addAdComp(84, 788, this);
addAdComp(84, 635, this);
if (this['tips' + data.type])
this['tips' + data.type].visible = true;
NetManager.ins.hc_turnableBaseInfo((success, res) => {
const data = res.data;
this['status1'].visible=data.remainTimes <=0;
this['status2'].visible=!this['status1'].visible;
this['nums'].text=`(-${data.remainTimes}`;
this['status2'].text=`免费次数:\n${data.remainTimes}次`;
});
}
showlog() {
......@@ -31,7 +43,7 @@ export default class TurntableNoPrizePanel extends Panel {
console.log('再来一次');
loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => {
// await wait(100);
PanelCtrl.instance.show('turnTable', { onceAgain: 1,mv:mv });
PanelCtrl.instance.show('turnTable', { onceAgain: 1, mv: mv });
})
}
onTap_btn2() {
......
import Panel from "../../../libs/new_wx/components/Panel";
import { addAdComp } from "../BoxPanel";
import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath";
import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
import { NetManager } from "../../../libs/tw/manager/NetManager";
import CutTimer from "../../CutTimer";
import Utils from "../../Utils";
export default class TurnPrize2Panel extends Panel {
start(data) {
super.start();
this.showlog();
this["progressGroup"].mask = this["progressMask"];
this.setProgress(+data.option.completePercent);
this.data.url = data.option.prizeImage;
this['light1'].visible = this['light2'].visible = false;
addAdComp(84, 816, this);
data.mv.gotoAndPlay(10, true)
data.mv.once(egret.Event.COMPLETE, () => {
data.mv.stop(1);
this.playBgAni();
}, this);
this['container'].addChild(data.mv);
}
private setProgress(progress) {
if(progress > 100) {
progress = 100;
} else if(progress < 0) {
progress = 0;
}
this["progressLabel"].text = `仅剩${(100 - progress).toFixed(2)}%`; // 进度条文字
const _width = this["progressBg"].width * progress / 100; // 宽度
const dProgress = Math.abs(progress - this["progress"].width / this["progressBg"].width); // 比当前进度的差值的绝对值
const _duration = 1000 * dProgress / 100; // 算出变化的时间
egret.Tween.get(this["progress"]).to({width: _width}, _duration);
const i = new eui.Image();
if(progress >= 100) {
this["scratch_progress"].visible = false;
} else if(progress >= 98 && progress < 100) {
this["scratch_progress"].visible = true;
this["scratch_progress"].source = "scratch_card_98_png";
} else if(progress >= 96 && progress < 98) {
this["scratch_progress"].visible = true;
this["scratch_progress"].source = "scratch_card_96_png";
} else if(progress >= 94 && progress < 96) {
this["scratch_progress"].visible = true;
this["scratch_progress"].source = "scratch_card_94_png";
} else if(progress >= 92 && progress < 96) {
this["scratch_progress"].visible = true;
this["scratch_progress"].source = "scratch_card_92_png";
} else if(progress < 92) {
this["scratch_progress"].visible = true;
this["scratch_progress"].source = "scratch_card_90_png";
}
}
playBgAni() {
this['light1'].visible = this['light2'].visible = true;
const time = 7000;
egret.Tween.get(this['light1'], { loop: true }).to({ rotation: 360 }, time);
egret.Tween.get(this['light2'], { loop: true }).to({ rotation: -360 }, time);
}
showlog() {
// NetManager.ins.showLog(getlogItem(3));
// NetManager.ins.showLog(getlogItem(4));
}
initEvents() {
super.initEvents();
this['btn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_btn1, this)
}
onTap_btn1() {
console.log('onTap_btn1');
NetManager.ins.scratchGetTaskInfo((success, res) => {
if (!success) {
return;
}
const status = res.data.taskStatus;
switch (true) {
case (status == 0): // 当前无任务(一般icon不会出现),拦截
this.hidePanel();
break;
case (status == 1): // 当前任务进行中 打开任务面板
loadSvga(getResPath() + 'resource/assets/svgas/sprize.svga').then(async (mv: any) => {
// await wait(100);
const data = Utils.deepClone(res.data);
data.mv = mv;
PanelCtrl.instance.show('scratch', data);
});
// PanelCtrl.instance.show('scratch', res.data);
break;
break;
case (status == 2): // 当前任务完成待领奖 请求领奖接口
NetManager.ins.scratchTakePrize((success, res) => {
if (!success) {
return;
}
PanelCtrl.instance.show("scratchPrize", res.data);
}, res.data.scratchCardTaskId);
break;
default:
break;
}
});
}
protected get closeBtns(): eui.Button[] { return [this['closeBtn']] }
get skinKey() { return 'TurntablePrize2' }
}
\ No newline at end of file
......@@ -5,14 +5,27 @@ import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath";
export default class TurnPrizePanel extends Panel {
start(data) {
super.start();
this.showlog();
this.data.url = "http://yun.duiba.com.cn/db_games/1022/111.png";
this['light1'].visible = this['light2'].visible = false;
addAdComp(84, 788, this);
data.mv.gotoAndPlay(10, true)
data.mv.once(egret.Event.COMPLETE, () => {
data.mv.stop(1);
this.playBgAni();
}, this);
this['container'].addChild(data.mv);
}
playBgAni() {
this['light1'].visible = this['light2'].visible = true;
const time = 7000;
egret.Tween.get(this['light1'], { loop: true }).to({ rotation: 360 }, time);
egret.Tween.get(this['light2'], { loop: true }).to({ rotation: -360 }, time);
}
showlog() {
......@@ -33,7 +46,7 @@ export default class TurnPrizePanel extends Panel {
loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => {
// await wait(100);
PanelCtrl.instance.show('turnTable', { onceAgain: 1,mv:mv });
})
});
}
onTap_btn2() {
gotoNextLevel()
......
const path = require('path');
const config = {
'/crecord/getrecord': {
data: './happyclear/getrecord.json'
},
'/customActivity/happyclear/bigWheel/baseInfo': {
data: './happyclear/turnablebaseInfo.json'
},
'/customActivity/happyclear/bigWheel/dojoin': {
data: './happyclear/turnabledojoin.json'
},
'/customActivity/happyclear/totalNumRank': {
data: './happyclear/totalNumRank.json'
},
'/customActivity/happyclear/totalNumRank': {
data: './happyclear/totalNumRank.json'
},
......@@ -133,7 +145,20 @@ const config = {
},
'/customActivity/happyclear/acceptInvitationPrize':{
data: './happyclear/acceptInvitationPrize.json'
}
},
//////////////////// 消消乐刮刮卡 ////////////////////
'/customActivity/happyclear/scratchCard/getTaskInfo':{
data: './happyclear/scratchGetTaskInfo.json'
},
'/customActivity/happyclear/scratchCard/takePrize':{
data: './happyclear/scratchTakePrize.json'
},
'/customActivity/happyclear/scratchCard/getShareCode':{
data: './happyclear/scratchGetShareCode.json'
},
'/customActivity/happyclear/scratchCard/doHelp':{
data: './happyclear/scratchDoHelp.json'
},
}
for (let item in config) {
......
{
"success":1
"success":0
}
\ No newline at end of file
{
"records": [
{
"new": false,
"img": "//yun.dui88.com/images/201907/himtwh01g7.png",
"itemType": "coupon",
"quantity": 1,
"gmtCreate": "2019-07-31 14:48:06",
"title": "亚组委-每日一次",
"type": 20,
"orderTypeTitle": "抽奖获得",
"url": "/crecord/recordDetailNew?orderId=1059793873663030339&dpm=1.26.0.1&dcm=101.49383.0.0&fromPage=record&dbnewopen",
"emdDpmJson": "{\"dpm\":\"1.26.0.1\",\"domain\":\"//activity.m.duibadev.com.cn\",\"dcm\":\"101.49383.0.0\"}",
"statusText": "<span>有效期至:2019-08-17</span>",
"invalid": false,
"emdJson": "{\"consumer_id\":500212051,\"info_type\":\"1\",\"login_type\":1,\"button_type\":\"20001\",\"domain\":\"//activity.m.duibadev.com.cn\",\"ip\":\"10.10.94.90\",\"locationType\":5,\"locationNum\":1,\"app_id\":1,\"info\":\"30034663\"}"
},
{
"new": false,
"img": "//yun.dui88.com/images/201907/himtwh01g7.png",
"itemType": "coupon",
"quantity": 1,
"gmtCreate": "2019-07-31 14:48:06",
"title": "亚组委-每日一次",
"type": 20,
"orderTypeTitle": "抽奖获得",
"url": "/crecord/recordDetailNew?orderId=1059793873663030339&dpm=1.26.0.1&dcm=101.49383.0.0&fromPage=record&dbnewopen",
"emdDpmJson": "{\"dpm\":\"1.26.0.1\",\"domain\":\"//activity.m.duibadev.com.cn\",\"dcm\":\"101.49383.0.0\"}",
"statusText": "<span>有效期至:2019-08-17</span>",
"invalid": false,
"emdJson": "{\"consumer_id\":500212051,\"info_type\":\"1\",\"login_type\":1,\"button_type\":\"20001\",\"domain\":\"//activity.m.duibadev.com.cn\",\"ip\":\"10.10.94.90\",\"locationType\":5,\"locationNum\":1,\"app_id\":1,\"info\":\"30034663\"}"
},
{
"new": false,
"img": "//yun.dui88.com/images/201907/himtwh01g7.png",
"itemType": "coupon",
"quantity": 1,
"gmtCreate": "2019-07-31 14:48:06",
"title": "亚组委-每日一次",
"type": 20,
"orderTypeTitle": "抽奖获得",
"url": "/crecord/recordDetailNew?orderId=1059793873663030339&dpm=1.26.0.1&dcm=101.49383.0.0&fromPage=record&dbnewopen",
"emdDpmJson": "{\"dpm\":\"1.26.0.1\",\"domain\":\"//activity.m.duibadev.com.cn\",\"dcm\":\"101.49383.0.0\"}",
"statusText": "<span>有效期至:2019-08-17</span>",
"invalid": false,
"emdJson": "{\"consumer_id\":500212051,\"info_type\":\"1\",\"login_type\":1,\"button_type\":\"20001\",\"domain\":\"//activity.m.duibadev.com.cn\",\"ip\":\"10.10.94.90\",\"locationType\":5,\"locationNum\":1,\"app_id\":1,\"info\":\"30034663\"}"
},
{
"new": false,
"img": "//yun.dui88.com/images/201907/3pi154iy9u.png",
"itemType": "virtual",
"quantity": 1,
"gmtCreate": "2019-07-31 14:48:06",
"title": "亚组委-2能量",
"type": 20,
"orderTypeTitle": "抽奖获得",
"url": "/crecord/recordDetailNew?orderId=1059793873663020339&dpm=1.26.0.1&dcm=101.49387.0.0&fromPage=record&dbnewopen",
"emdDpmJson": "{\"dpm\":\"1.26.0.1\",\"domain\":\"//activity.m.duibadev.com.cn\",\"dcm\":\"101.49387.0.0\"}",
"statusText": "<span class='invalid'>失败</span>",
"invalid": true,
"emdJson": "{\"consumer_id\":500212051,\"info_type\":\"1\",\"login_type\":1,\"button_type\":\"20001\",\"domain\":\"//activity.m.duibadev.com.cn\",\"ip\":\"10.10.94.90\",\"locationType\":5,\"locationNum\":2,\"app_id\":1,\"info\":\"30034662\"}"
}
],
"success": true,
"nextPage": false,
"invalidPage": false
}
\ No newline at end of file
{
"success":true,
"code":null,
"desc":null,
"timestamp":1566199822308,
"data":""
}
\ No newline at end of file
{
"success":true,
"code":null,
"desc":null,
"timestamp":1566199822308,
"data":"66666"
}
\ No newline at end of file
{
"success": true,
"code": null,
"desc": null,
"timestamp": 1566199822308,
"data": {
"scratchCardTaskId": 1222,
"taskStatus": 1,
"prizeImage": "http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg",
"currentTime": 1570673808000,
"endTime": 1570673810000,
"completePercent": "90.50",
"remainPercent": "9.50",
"helpedCount": 4,
"avatarList": [
"http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg",
""
]
}
}
\ No newline at end of file
{
"success":true,
"code":null,
"desc":null,
"timestamp":1566199822308,
"data":{
"prizeImage": "http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg"
}
}
\ No newline at end of file
{
"code":"0000000000",
"data":{
"luckyDrawInfo":{
"baseCount":50,
"bonusCount":10,
"enable":true,
"id":"1234",
"prizeList":[
{
"categoryType":4,
"coinType":1,
"maxValue":10,
"minValue":10,
"rate":"20",
"title":"奖品信息"
},
{
"appItemId":2099,
"categoryType":5,
"img":"虚拟商品图片",
"name":"虚拟商品名称",
"rate":"30",
"title":"奖品信息",
"value":"虚拟商品编码"
},
{
"categoryType":7,
"num":10,
"propType":2,
"rate":"30",
"title":"奖品信息"
},
{
"categoryType":3,
"num":10,
"propType":2,
"rate":"30",
"title":"奖品信息"
}
]
},
"remainTimes":0,
"costCoinJoinTimes":10,
"nextTimeNeedCoin":10000
},
"desc":"OK",
"success":true,
"timestamp":1572060015013
}
{
"code":"600051",
"data":{
"isScratchCard":false,
"option":{
"completePercent":"99",
"prizeImage":"http://yun.duiba.com.cn/db_games/1022/111.png",
"remainPercent":"剩余进度",
"scratchCardTaskId":1,
"categoryType":4,
"title":"奖品信息",
"coinType":1,
"maxValue":10,
"minValue":10,
"appItemId":2099,
"img":"虚拟商品图片",
"name":"虚拟商品名称",
"value":"虚拟商品编码",
"num":10,
"propType":2
},
"orderNum":"24487583"
},
"desc":"OK",
"success":true,
"timestamp":1572061348762
}
\ 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