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
6b3ee138
Commit
6b3ee138
authored
Oct 24, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
d63f67ed
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
205 additions
and
48 deletions
+205
-48
MapSkin.exml
egret/resource/skins/MapSkin.exml
+22
-8
CutTime.ts
egret/src/CutTime.ts
+142
-0
MapScene.ts
egret/src/mapScene/MapScene.ts
+17
-10
ScratchPanel.ts
egret/src/panels/ScratchPanel.ts
+23
-29
getInviteInfo.json
mock/happyclear/getInviteInfo.json
+1
-1
No files found.
egret/resource/skins/MapSkin.exml
View file @
6b3ee138
...
...
@@ -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"
/>
...
...
egret/src/CutTime.ts
0 → 100644
View file @
6b3ee138
/**
* 简单的倒计时
* 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
egret/src/mapScene/MapScene.ts
View file @
6b3ee138
...
...
@@ -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
)
...
...
egret/src/panels/ScratchPanel.ts
View file @
6b3ee138
...
...
@@ -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
();
});
});
...
...
mock/happyclear/getInviteInfo.json
View file @
6b3ee138
...
...
@@ -7,7 +7,7 @@
"invitationId"
:
"活动id"
,
"invitationCount"
:
5
,
"img"
:
"http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg"
,
"sysTime"
:
157067
2800
000
,
"sysTime"
:
157067
3805
000
,
"endTime"
:
1570673810000
,
"invitationUser"
:
[
{
...
...
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