Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wildfirecode13
xiaoxiaole
Commits
f8452261
Commit
f8452261
authored
Oct 26, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
fbbd6d16
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
309 additions
and
107 deletions
+309
-107
NetName.ts
egret/libs/tw/enum/NetName.ts
+6
-1
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+72
-0
ScratchPrizeSkin.exml
egret/resource/skins/ScratchPrizeSkin.exml
+4
-4
CutTimer.ts
egret/src/CutTimer.ts
+1
-1
IconBase.ts
egret/src/mapScene/icon/IconBase.ts
+20
-16
ScratchIcon.ts
egret/src/mapScene/icon/ScratchIcon.ts
+70
-5
ScratchPanel.ts
egret/src/panels/ScratchPanel.ts
+47
-51
ScratchPrizePanel.ts
egret/src/panels/ScratchPrizePanel.ts
+33
-28
config.js
mock/config.js
+13
-1
scratchDoHelp.json
mock/happyclear/scratchDoHelp.json
+7
-0
scratchGetShareCode.json
mock/happyclear/scratchGetShareCode.json
+7
-0
scratchGetTaskInfo.json
mock/happyclear/scratchGetTaskInfo.json
+20
-0
scratchTakePrize.json
mock/happyclear/scratchTakePrize.json
+9
-0
No files found.
egret/libs/tw/enum/NetName.ts
View file @
f8452261
...
...
@@ -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
egret/libs/tw/manager/NetManager.ts
View file @
f8452261
...
...
@@ -2036,4 +2036,76 @@ 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
);
}
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
);
}
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
egret/resource/skins/ScratchPrizeSkin.exml
View file @
f8452261
<?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>
...
...
egret/src/CutTimer.ts
View file @
f8452261
/**
* 简单的倒计时
* Created
by haiyoucuv
on 2019/10/24
* Created on 2019/10/24
*/
export
default
class
CutTimer
{
private
_timer
:
egret
.
Timer
=
null
;
...
...
egret/src/mapScene/icon/IconBase.ts
View file @
f8452261
/**
* 地图页图标基类
* 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
;
...
...
egret/src/mapScene/icon/ScratchIcon.ts
View file @
f8452261
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"
;
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
();
// 获取任务信息 (控制角标)
}
protected
initEvents
()
{
super
.
initEvents
();
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
;
default
:
break
;
}
})
}
/**
* 点击icon
* @param e 点击事件
*/
protected
onTouchBtn
(
e
:
egret
.
TouchEvent
)
{
super
.
onTouchBtn
(
e
);
NetManager
.
ins
.
getInvite
Info
((
success
,
res
)
=>
{
NetManager
.
ins
.
scratchGetTask
Info
((
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
):
// 当前任务进行中 打开任务面板
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
();
}
...
...
egret/src/panels/ScratchPanel.ts
View file @
f8452261
...
...
@@ -52,7 +52,7 @@ export default class ScratchPanel extends Panel {
}
onTouchTap_closeBtn
()
{
// GDispatcher.dispatchEvent("getInviteInfo
");
GDispatcher
.
dispatchEvent
(
"updateScratchTips
"
);
super
.
onTouchTap_closeBtn
();
}
...
...
@@ -80,61 +80,43 @@ export default class ScratchPanel extends Panel {
this
.
hongbaoEffect
();
this
.
setWXShareTip
();
this
[
"progressGroup"
].
mask
=
this
[
"progressMask"
];
this
.
setProgress
(
98
);
this
[
"prizeImg"
].
source
=
this
.
data
.
prizeIm
g
;
if
(
!
this
.
data
.
invitationUser
)
{
this
.
data
.
invitationUser
=
[];
this
[
"prizeImg"
].
source
=
this
.
data
.
prizeIm
age
;
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"
,
});
// 添加回调函数
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
.
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
});
}
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
.
sys
Time
+
3000
;
let
cutTime
=
this
.
data
.
endTime
-
this
.
data
.
current
Time
+
3000
;
if
(
!
this
.
cutTimer
.
start
(
cutTime
))
{
this
.
cutTimer
.
stop
();
this
.
cutTimer
.
start
(
cutTime
);
...
...
@@ -151,28 +133,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 +179,7 @@ export default class ScratchPanel extends Panel {
destroy
()
{
super
.
destroy
();
this
.
cutTimer
.
stop
();
this
.
cutTimer
.
stop
();
// 面板销毁停止计时器(停止计时器,移除时间事件监听)
}
protected
get
closeBtns
():
eui
.
Button
[]
{
...
...
@@ -230,9 +212,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
);
}
}
egret/src/panels/ScratchPrizePanel.ts
View file @
f8452261
...
...
@@ -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
.
onT
apGoPrize
,
this
);
this
.
game_btn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
OK
,
this
);
this
.
closeBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchTap
,
this
);
this
.
ok_btn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onT
ouchTap
,
this
);
this
.
game_btn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
Tap
,
this
);
}
removeEvents
()
{
super
.
removeEvents
();
this
.
closeBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchTap
_closeBtn
,
this
);
this
.
ok_btn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onT
apGoPrize
,
this
);
this
.
game_btn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
OK
,
this
);
this
.
closeBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchTap
,
this
);
this
.
ok_btn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onT
ouchTap
,
this
);
this
.
game_btn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
Tap
,
this
);
}
onTouchTap_closeBtn
()
{
// GDispatcher.dispatchEvent("getInviteInfo");
super
.
onTouchTap_closeBtn
();
}
onTouchTap
(
e
:
egret
.
TouchEvent
)
{
switch
(
true
)
{
case
(
e
.
target
==
this
.
closeBtn
):
// 关闭按钮
super
.
onTouchTap_closeBtn
();
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
;
}
PanelCtrl
.
instance
.
show
(
"StartPanel"
,
getHomeData
().
levels
.
length
+
1
);
break
;
onTouchOK
()
{
if
((
getHomeData
().
levels
.
length
+
1
)
>
window
[
'last_level'
])
{
changeMapScene
();
super
.
hidePanel
();
return
;
default
:
break
;
}
// GDispatcher.dispatchEvent("getInviteInfo");
PanelCtrl
.
instance
.
show
(
"StartPanel"
,
getHomeData
().
levels
.
length
+
1
);
}
onTapGoPrize
()
{
window
.
location
.
href
=
window
[
'__link__'
];
GDispatcher
.
dispatchEvent
(
"updateScratchTips"
);
}
initUI
()
{
this
.
prizeImg
.
source
=
this
.
data
.
prizeIm
g
;
addAdComp
(
84
,
8
45.33
,
this
);
this
.
prizeImg
.
source
=
this
.
data
.
prizeIm
age
;
addAdComp
(
84
,
8
75
,
this
);
}
protected
get
closeBtns
():
eui
.
Button
[]
{
...
...
mock/config.js
View file @
f8452261
...
...
@@ -133,7 +133,19 @@ 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
)
{
...
...
mock/happyclear/scratchDoHelp.json
0 → 100644
View file @
f8452261
{
"success"
:
true
,
"code"
:
null
,
"desc"
:
null
,
"timestamp"
:
1566199822308
,
"data"
:
""
}
\ No newline at end of file
mock/happyclear/scratchGetShareCode.json
0 → 100644
View file @
f8452261
{
"success"
:
true
,
"code"
:
null
,
"desc"
:
null
,
"timestamp"
:
1566199822308
,
"data"
:
""
}
\ No newline at end of file
mock/happyclear/scratchGetTaskInfo.json
0 → 100644
View file @
f8452261
{
"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
mock/happyclear/scratchTakePrize.json
0 → 100644
View file @
f8452261
{
"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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment