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
a871d0b6
Commit
a871d0b6
authored
Oct 28, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
52c46874
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
111 deletions
+109
-111
map.tmproject
egret/resource/TextureMerger/map.tmproject
+1
-1
MapScene.ts
egret/src/mapScene/MapScene.ts
+105
-107
ScratchPanel.ts
egret/src/panels/ScratchPanel.ts
+3
-3
No files found.
egret/resource/TextureMerger/map.tmproject
View file @
a871d0b6
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"map","version":5,"files":["../assets/map/taskicon.png","../assets/map/recordbtn.png","../assets/map/progress2.png","../assets/map/progress1.png","../assets/map/namebg.png","../assets/map/msgTri.png","../assets/map/map_signicon.png","../assets/map/lionMsgBg.png","../assets/map/invite_txtbg.png","../assets/map/invite_icon.png","../assets/map/iconbg.png","../assets/map/icon.png","../assets/map/guideOver.png","../assets/map/guideMoney.png","../assets/map/guideLove.png","../assets/map/guideLevel.png","../assets/map/guideBox.png","../assets/map/friend_avatar.png","../assets/map/avatar.png","../assets/map/animal1.png","../assets/map/ad_icon.png","../assets/map/元宝bg.png","../assets/map/有星星.png","../assets/map/音乐关闭.png","../assets/map/音乐.png","../assets/map/星星bg.png","../assets/map/星星.png","../assets/map/无星星.png","../assets/map/问题.png","../assets/map/退出.png","../assets/map/狮子.png","../assets/map/声音关闭.png","../assets/map/声音.png","../assets/map/设置bg.png","../assets/map/设置.png","../assets/map/光 副本 4.png","../assets/map/关闭 拷贝.png","../assets/map/道具.png","../assets/map/宝箱btn.png","../assets/map/宝箱bg.png","../assets/map/宝箱3.png","../assets/map/宝箱2.png","../assets/map/宝箱1.png","../assets/map/宝箱.png","../assets/map/map明日可领.png","../assets/map/map今日可领.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"map","version":5,"files":["../assets/map/taskicon.png","../assets/map/recordbtn.png","../assets/map/progress2.png","../assets/map/progress1.png","../assets/map/namebg.png","../assets/map/msgTri.png","../assets/map/map_signicon.png","../assets/map/lionMsgBg.png","../assets/map/invite_txtbg.png","../assets/map/invite_icon.png","../assets/map/iconbg.png","../assets/map/icon.png","../assets/map/guideOver.png","../assets/map/guideMoney.png","../assets/map/guideLove.png","../assets/map/guideLevel.png","../assets/map/guideBox.png","../assets/map/friend_avatar.png","../assets/map/avatar.png","../assets/map/animal1.png","../assets/map/ad_icon.png","../assets/map/元宝bg.png","../assets/map/有星星.png","../assets/map/音乐关闭.png","../assets/map/音乐.png","../assets/map/星星bg.png","../assets/map/星星.png","../assets/map/无星星.png","../assets/map/问题.png","../assets/map/退出.png","../assets/map/狮子.png","../assets/map/声音关闭.png","../assets/map/声音.png","../assets/map/设置bg.png","../assets/map/设置.png","../assets/map/光 副本 4.png","../assets/map/关闭 拷贝.png","../assets/map/道具.png","../assets/map/宝箱btn.png","../assets/map/宝箱bg.png","../assets/map/宝箱3.png","../assets/map/宝箱2.png","../assets/map/宝箱1.png","../assets/map/宝箱.png","../assets/map/map明日可领.png","../assets/map/map今日可领.png","../assets/map/map刮现金红包.png","../assets/map/map大转盘.png"]}
\ No newline at end of file
egret/src/mapScene/MapScene.ts
View file @
a871d0b6
...
...
@@ -42,30 +42,29 @@ export default class MapScene extends Scene {
sendInvite
()
{
const
code
=
Utils
.
getRequestByKey
(
'shareCode'
);
if
(
!
code
)
return
;
const
code2
=
Utils
.
getRequestByKey
(
'shareCode2'
);
if
(
!
code
&&
!
code2
)
return
;
const
dojoin
=
DataManager
.
ins
.
getData
(
'hc_doJoin'
);
if
(
!
dojoin
)
return
;
if
(
doHelpFlag
)
{
if
(
!
dojoin
)
return
;
if
(
doHelpFlag
)
{
return
;
}
NetManager
.
ins
.
doHelp
(
(
success
,
res
)
=>
{
let
callBack
=
(
success
,
res
)
=>
{
doHelpFlag
=
true
;
switch
(
true
)
{
case
(
res
.
code
==
"400017"
):
showToast
(
"您不是新用户呢~"
);
break
;
case
(
res
.
code
==
"0000022"
):
showToast
(
"不可以给自己助力哦~"
);
break
;
case
(
res
.
code
==
"0200202"
):
showToast
(
"已经给好友助力过了哦~"
);
break
;
}
if
(
!
success
)
{
return
;
switch
(
true
)
{
case
(
res
.
code
==
"400017"
):
showToast
(
"您不是新用户呢~"
);
break
;
case
(
res
.
code
==
"0000022"
):
showToast
(
"不可以给自己助力哦~"
);
break
;
case
(
res
.
code
==
"0200202"
):
showToast
(
"已经给好友助力过了哦~"
);
break
;
default
:
break
;
}
if
(
!
success
)
{
return
;
}
showToast
(
"助力成功"
);
},
Utils
.
getRequestByKey
(
"shareCode"
),
dojoin
.
data
);
};
if
(
code
)
{
NetManager
.
ins
.
doHelp
(
callBack
,
code
,
dojoin
.
data
);
}
else
if
(
code2
)
{
NetManager
.
ins
.
scratchDoHelp
(
callBack
,
code2
);
}
}
// 邀请有礼角标倒计时
...
...
@@ -80,7 +79,6 @@ export default class MapScene extends Scene {
this
.
sendInvite
();
this
.
updateMyInfo
();
this
.
updateAdData
();
GDispatcher
.
dispatchEvent
(
"getInviteInfo"
);
// 查询邀请信息,控制邀请有礼角标
...
...
@@ -90,7 +88,7 @@ export default class MapScene extends Scene {
// PanelCtrl.instance.show('failed');
},
1000
);
if
(
getBgOn
()
&&
MapScene
[
'firstPlayBgTag'
]
==
true
)
{
if
(
getBgOn
()
&&
MapScene
[
'firstPlayBgTag'
]
==
true
)
{
playBg
();
}
...
...
@@ -107,12 +105,12 @@ export default class MapScene extends Scene {
const
oldTimerStr2
=
localStorage
.
getItem
(
'nowTimer2Str'
+
window
[
'CFG'
].
consumerId
);
const
hc_advert
=
DataManager
.
ins
.
getData
(
'hc_advert'
).
data
;
let
{
noticeAdvert
}
=
hc_advert
;
if
(
noticeAdvert
==
null
)
{
noticeAdvert
=
{
enable
:
false
}
let
{
noticeAdvert
}
=
hc_advert
;
if
(
noticeAdvert
==
null
)
{
noticeAdvert
=
{
enable
:
false
}
}
if
(
noticeAdvert
&&
noticeAdvert
.
enable
&&
nowTimerStr2
!=
oldTimerStr2
)
{
if
(
noticeAdvert
&&
noticeAdvert
.
enable
&&
nowTimerStr2
!=
oldTimerStr2
)
{
// if (!adTag) {
panels
.
push
(
'ad'
);
// adTag = true;
...
...
@@ -120,16 +118,16 @@ export default class MapScene extends Scene {
localStorage
.
setItem
(
'nowTimer2Str'
+
window
[
'CFG'
].
consumerId
,
nowTimerStr2
);
}
const
{
signInfoVO
}
=
DataManager
.
ins
.
getData
(
'getSignInfo'
);
if
(
signInfoVO
.
continueDay
<
7
)
{
//表示明天还可以签到
if
(
signInfoVO
.
todaySigned
==
0
&&
oldTimerStr
!=
nowTimerStr
)
{
const
{
signInfoVO
}
=
DataManager
.
ins
.
getData
(
'getSignInfo'
);
if
(
signInfoVO
.
continueDay
<
7
)
{
//表示明天还可以签到
if
(
signInfoVO
.
todaySigned
==
0
&&
oldTimerStr
!=
nowTimerStr
)
{
panels
.
push
(
'sign'
);
localStorage
.
setItem
(
'nowTimerStr'
+
window
[
'CFG'
].
consumerId
,
nowTimerStr
);
}
}
this
.
updateSign
();
if
(
!
readCache
()
&&
getHomeData
().
levels
.
length
<=
0
)
{
//引导
if
(
!
readCache
()
&&
getHomeData
().
levels
.
length
<=
0
)
{
//引导
const
guide
=
new
GuideCon
(()
=>
{
PanelCtrl
.
instance
.
showPanels
(
panels
);
...
...
@@ -171,18 +169,18 @@ export default class MapScene extends Scene {
let
target
;
const
homeData
=
getHomeData
();
if
(
homeData
.
levels
.
length
==
0
)
{
if
(
homeData
.
levels
.
length
==
0
)
{
target
=
1
;
}
else
if
(
homeData
.
levels
.
length
==
window
[
'total_level'
])
{
}
else
if
(
homeData
.
levels
.
length
==
window
[
'total_level'
])
{
target
=
window
[
'total_level'
]
+
1
;
}
else
{
target
=
homeData
.
levels
.
length
+
1
;
}
for
(
const
key
in
MapScene
.
iconHash
)
{
for
(
const
key
in
MapScene
.
iconHash
)
{
const
levelOrder
=
parseInt
(
key
);
const
element
=
MapScene
.
iconHash
[
key
];
element
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
if
(
if
(
(
levelOrder
>
(
homeData
.
levels
.
length
+
1
)
&&
levelOrder
>
1
)
||
(
levelOrder
>
window
[
'last_level'
])
)
{
...
...
@@ -194,7 +192,7 @@ export default class MapScene extends Scene {
},
this
);
}
if
(
homeData
.
levels
.
length
<
window
[
'total_level'
])
{
if
(
homeData
.
levels
.
length
<
window
[
'total_level'
])
{
const
targetIcon
=
MapScene
.
iconHash
[
target
];
const
light
=
RES
.
getRes
(
'lightani_png'
);
...
...
@@ -207,7 +205,7 @@ export default class MapScene extends Scene {
pic
.
anchorOffsetY
=
61
;
// pic.x = 50 - 2;
// pic.y = 37 + 10;
egret
.
Tween
.
get
(
pic
,
{
loop
:
true
}).
to
({
scaleX
:
2
,
scaleY
:
2
,
alpha
:
0
},
1000
).
wait
(
1000
);
egret
.
Tween
.
get
(
pic
,
{
loop
:
true
}).
to
({
scaleX
:
2
,
scaleY
:
2
,
alpha
:
0
},
1000
).
wait
(
1000
);
this
[
'pic'
]
=
pic
;
}
...
...
@@ -217,8 +215,8 @@ export default class MapScene extends Scene {
this
.
showLog
();
this
.
updateBox
();
if
(
data
.
level
)
{
if
(
homeData
.
remainEnargy
==
0
)
if
(
data
.
level
)
{
if
(
homeData
.
remainEnargy
==
0
)
PanelCtrl
.
instance
.
show
(
'bloodPanel'
)
else
...
...
@@ -226,8 +224,8 @@ export default class MapScene extends Scene {
}
this
.
stage
.
once
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
if
(
!
MapScene
[
'firstPlayBgTag'
])
{
if
(
getBgOn
())
{
if
(
!
MapScene
[
'firstPlayBgTag'
])
{
if
(
getBgOn
())
{
playBg
();
}
MapScene
[
'firstPlayBgTag'
]
=
true
;
...
...
@@ -235,7 +233,7 @@ export default class MapScene extends Scene {
},
this
);
let
lastOrder
=
homeData
.
levels
.
length
+
1
;
if
(
homeData
.
levels
.
length
>=
window
[
'total_level'
])
if
(
homeData
.
levels
.
length
>=
window
[
'total_level'
])
lastOrder
=
window
[
'total_level'
];
this
.
scroll
.
viewport
.
scrollV
=
this
.
getScrollV
(
lastOrder
,
this
.
stage
.
stageHeight
);
// console.warn(this.getScrollV(lastOrder, this.stage.stageHeight))
...
...
@@ -245,14 +243,14 @@ export default class MapScene extends Scene {
Promise
.
all
([
RES
.
getResAsync
(
`
${
key
}
_json`
),
RES
.
getResAsync
(
`
${
key
}
_png`
)]);
}
catch
(
error
)
{
}
catch
(
error
)
{
}
}
// 添加图标
private
addIcon
(){
private
addIcon
()
{
this
.
icons
=
{
"scratchIcon"
:
new
ScratchIcon
(
"scratchIcon"
,
this
[
"scratchGroup"
],
this
[
"scratchBtn"
],
this
[
"scratchTipsBg"
],
this
[
"scratchTips"
]),
"turntableIcon"
:
new
TurntableIcon
(
"turntableIcon"
,
this
[
"turnTableGroup"
],
this
[
"turnTableBtn"
],
this
[
"turnTableTipsBg"
],
this
[
"turnTableTips"
])
...
...
@@ -264,20 +262,20 @@ export default class MapScene extends Scene {
this
[
'nameTxt'
].
text
=
''
;
// NetManager.ins.hc_userInfo(() => {
this
[
'avatar'
].
visible
=
true
;
const
{
data
}
=
DataManager
.
ins
.
getData
(
'hc_userInfo'
);
if
(
data
)
const
{
data
}
=
DataManager
.
ins
.
getData
(
'hc_userInfo'
);
if
(
data
)
this
[
'avatar'
].
source
=
data
.
avatar
||
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
else
this
[
'avatar'
].
source
=
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
if
(
data
&&
data
.
nickname
)
if
(
data
&&
data
.
nickname
)
this
[
'nameTxt'
].
text
=
getNick
(
data
.
nickname
);
// });
}
updateSign
()
{
const
{
signInfoVO
}
=
DataManager
.
ins
.
getData
(
'getSignInfo'
);
if
(
signInfoVO
.
continueDay
<
7
)
{
//表示明天还可以签到
const
{
signInfoVO
}
=
DataManager
.
ins
.
getData
(
'getSignInfo'
);
if
(
signInfoVO
.
continueDay
<
7
)
{
//表示明天还可以签到
this
[
'sign_s1'
].
visible
=
signInfoVO
.
todaySigned
==
0
;
this
[
'sign_s2'
].
visible
=
!
this
[
'sign_s1'
].
visible
;
}
else
{
...
...
@@ -287,14 +285,14 @@ export default class MapScene extends Scene {
updateAdData
()
{
const
hc_advert
=
DataManager
.
ins
.
getData
(
'hc_advert'
).
data
;
let
{
mapAdvert
}
=
hc_advert
;
if
(
mapAdvert
==
null
)
mapAdvert
=
{
enable
:
false
,
advertList
:
[]
}
let
{
mapAdvert
}
=
hc_advert
;
if
(
mapAdvert
==
null
)
mapAdvert
=
{
enable
:
false
,
advertList
:
[]
}
this
[
'adBtn'
].
visible
=
mapAdvert
.
enable
;
if
(
mapAdvert
.
enable
)
{
if
(
mapAdvert
.
enable
)
{
let
result
;
result
=
mapAdvert
.
advertList
;
if
(
Array
.
isArray
(
mapAdvert
.
advertList
))
{
if
(
Array
.
isArray
(
mapAdvert
.
advertList
))
{
const
index
=
Math
.
floor
(
mapAdvert
.
advertList
.
length
*
Math
.
random
());
result
=
mapAdvert
.
advertList
[
index
];
}
...
...
@@ -307,7 +305,7 @@ export default class MapScene extends Scene {
destroy
()
{
super
.
destroy
();
if
(
this
[
'pic'
])
if
(
this
[
'pic'
])
egret
.
Tween
.
removeTweens
(
this
[
'pic'
]);
if
(
this
.
inviteTimer
)
{
...
...
@@ -318,11 +316,11 @@ export default class MapScene extends Scene {
getScrollV
(
lastOrder
,
stageHeight
)
{
// lastOrder = 69;
if
(
lastOrder
<=
7
)
{
//顶部的1-7关
if
(
lastOrder
<=
7
)
{
//顶部的1-7关
return
this
.
getScrollV1
(
lastOrder
,
stageHeight
);
}
if
(
lastOrder
>=
window
[
'total_level'
]
-
10
)
{
//底部的60-70关 70-10
if
(
lastOrder
>=
window
[
'total_level'
]
-
10
)
{
//底部的60-70关 70-10
return
this
.
getScrollV2
(
lastOrder
,
stageHeight
);
}
//中部的4个循环*13 8~59
...
...
@@ -333,7 +331,7 @@ export default class MapScene extends Scene {
const
ylist
=
[
26
,
158
,
302
,
435
,
547
,
674
,
821
,
897
,
969
,
1072
,
1137
,
1254
,
1367
];
const
y0
=
this
.
_data
.
top
.
height
;
//顶部的高度
let
a0
=
(
lastOrder
-
MapTopPart
.
LEVEL_NUMS
)
%
MapRpeatPart
.
LEVEL_NUMS
;
//减去7后的order 8-7 = 1
if
(
a0
==
0
)
a0
=
MapRpeatPart
.
LEVEL_NUMS
if
(
a0
==
0
)
a0
=
MapRpeatPart
.
LEVEL_NUMS
const
a1
=
Math
.
ceil
((
lastOrder
-
MapTopPart
.
LEVEL_NUMS
)
/
MapRpeatPart
.
LEVEL_NUMS
)
-
1
;
//当前地图repeat的顺序
const
y1
=
ylist
[
a0
-
1
];
const
y2
=
y0
+
y1
+
a1
*
this
.
_data
.
list
[
0
].
height
;
...
...
@@ -343,7 +341,7 @@ export default class MapScene extends Scene {
getScrollV1
(
lastOrder
,
stageHeight
)
{
const
ylist
=
[
492
,
550.35
,
744
,
803
,
810
,
975
,
1089.69
].
map
(
i
=>
i
+
40
);
const
targetY
=
ylist
[
lastOrder
-
1
]
-
stageHeight
/
2
;
if
(
targetY
<=
0
)
return
0
if
(
targetY
<=
0
)
return
0
return
targetY
;
}
...
...
@@ -355,7 +353,7 @@ export default class MapScene extends Scene {
+
this
.
_data
.
bottom
.
height
;
const
ylist
=
[
44
,
148.44
,
331
,
403
,
513
,
660
,
829.69
,
949.69
,
1052.69
,
1148.69
,
1209.69
].
map
(
i
=>
i
+
40
);
const
targetY
=
y0
+
ylist
[
lastOrder
-
1
]
-
stageHeight
/
2
;
if
(
targetY
>=
(
totalHeight
-
stageHeight
))
return
totalHeight
-
stageHeight
if
(
targetY
>=
(
totalHeight
-
stageHeight
))
return
totalHeight
-
stageHeight
return
targetY
;
}
...
...
@@ -377,7 +375,7 @@ export default class MapScene extends Scene {
updateBox
()
{
const
homeData
=
getHomeData
();
if
(
homeData
.
canReceiveTreasureBoxNum
<=
0
)
if
(
homeData
.
canReceiveTreasureBoxNum
<=
0
)
setGray
(
this
[
'box'
]);
this
[
'boxiconWrapper'
].
visible
=
homeData
.
canReceiveTreasureBoxNum
>
0
;
this
[
'totalStarTxt'
].
text
=
`
${
homeData
.
totalStars
}
/
${
homeData
.
nextRangeStarsNum
}
`
;
...
...
@@ -399,7 +397,7 @@ export default class MapScene extends Scene {
parent
.
addChild
(
avatar
);
avatar
.
x
=
item
.
x
+
10
;
avatar
.
y
=
item
.
y
-
avatar
.
height
-
30
;
if
(
!
MapScene
.
starHash
[
level
].
visible
)
{
if
(
!
MapScene
.
starHash
[
level
].
visible
)
{
avatar
.
y
=
item
.
y
-
avatar
.
height
;
}
}
...
...
@@ -407,11 +405,11 @@ export default class MapScene extends Scene {
updateFriends
()
{
NetManager
.
ins
.
hc_mapRank
(()
=>
{
const
hc_mapRank
=
DataManager
.
ins
.
getData
(
'hc_mapRank'
).
data
;
if
(
!
hc_mapRank
)
return
;
const
{
data
}
=
DataManager
.
ins
.
getData
(
'hc_userInfo'
);
if
(
!
hc_mapRank
)
return
;
const
{
data
}
=
DataManager
.
ins
.
getData
(
'hc_userInfo'
);
hc_mapRank
.
forEach
((
ele
)
=>
{
if
(
ele
.
levelNum
==
getHomeData
().
levels
.
length
+
1
)
{
if
(
data
==
null
)
if
(
ele
.
levelNum
==
getHomeData
().
levels
.
length
+
1
)
{
if
(
data
==
null
)
ele
.
rank
[
0
].
avatar
=
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
else
ele
.
rank
[
0
].
avatar
=
data
.
avatar
||
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
...
...
@@ -426,24 +424,24 @@ export default class MapScene extends Scene {
this
[
'goldTxt'
].
text
=
`
${
homeData
.
wealth
}
`
;
for
(
let
j
=
1
;
j
<
window
[
'total_level'
];
j
++
)
{
for
(
let
j
=
1
;
j
<
window
[
'total_level'
];
j
++
)
{
this
.
disableIcon
(
j
+
1
);
}
for
(
let
i
=
0
;
i
<
homeData
.
levels
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
homeData
.
levels
.
length
;
i
++
)
{
const
level
=
homeData
.
levels
[
i
];
const
star
=
MapScene
.
starHash
[
i
+
1
];
if
(
level
)
{
if
(
level
)
{
star
.
setStar
(
level
.
stars
);
this
.
enableIcon
(
level
.
levelNum
);
}
else
{
this
.
disableIcon
(
level
.
levelNum
);
}
}
if
(
homeData
.
levels
.
length
==
0
)
{
if
(
homeData
.
levels
.
length
==
0
)
{
const
star
=
MapScene
.
starHash
[
1
];
star
.
setStar
(
0
);
this
.
enableIcon
(
1
);
}
else
if
(
homeData
.
levels
.
length
==
window
[
'last_level'
])
{
}
else
if
(
homeData
.
levels
.
length
==
window
[
'last_level'
])
{
}
else
{
const
star
=
MapScene
.
starHash
[
homeData
.
levels
.
length
+
1
];
...
...
@@ -457,11 +455,11 @@ export default class MapScene extends Scene {
updateTimerView
()
{
//更新倒计时
if
(
this
.
_countDown
==
null
)
{
if
(
this
.
_countDown
==
null
)
{
this
.
_countDown
=
new
CountDown
(
this
[
'countdown'
]);
}
const
data
=
getHomeData
();
if
(
data
.
remainEnargy
>=
BLOOD_NUMS_MAX
)
{
//满了
if
(
data
.
remainEnargy
>=
BLOOD_NUMS_MAX
)
{
//满了
this
.
_countDown
.
stop
();
this
[
'fullTxt'
].
visible
=
true
;
...
...
@@ -481,28 +479,28 @@ export default class MapScene extends Scene {
onTap_inviteBtn
()
{
NetManager
.
ins
.
getInviteInfo
((
success
,
res
)
=>
{
if
(
!
success
||
!
res
.
data
)
{
if
(
!
success
||
!
res
.
data
)
{
return
;
}
const
flag
=
res
.
data
.
completeFlag
;
switch
(
true
)
{
switch
(
true
)
{
case
(
flag
==
0
):
// 未完成
this
.
loadsvga
(
res
);
break
;
case
(
flag
==
1
):
// 完成未开奖 待领奖 请求领奖接口
try
{
if
(
window
[
'getRST'
])
window
[
'getRST'
]();
}
catch
(
error
)
{
if
(
window
[
'getRST'
])
window
[
'getRST'
]();
}
catch
(
error
)
{
console
.
warn
(
error
)
}
NetManager
.
ins
.
acceptInvitationPrize
((
success
,
res
)
=>
{
if
(
!
success
)
{
if
(
!
success
)
{
showToast
(
"哎呀,萌狮开小差啦!
\n
过会再来看吧!"
);
GDispatcher
.
dispatchEvent
(
"getInviteInfo"
);
return
;
}
// console.log(res.data);
if
(
res
.
data
.
completeFlag
==
3
)
{
if
(
res
.
data
.
completeFlag
==
3
)
{
showToast
(
"哎呀,萌狮开小差啦!
\n
过会再来看吧!"
);
GDispatcher
.
dispatchEvent
(
"getInviteInfo"
);
}
else
{
...
...
@@ -517,7 +515,7 @@ export default class MapScene extends Scene {
case
(
flag
==
4
):
// 可以开启下一次发任务
NetManager
.
ins
.
acceptInvitationInfo
((
success
,
res
)
=>
{
if
(
!
success
)
{
if
(
!
success
)
{
return
;
}
this
.
loadsvga
(
res
);
...
...
@@ -533,7 +531,7 @@ export default class MapScene extends Scene {
}
loadsvga
(
res
)
{
if
(
MapScene
[
'svga'
])
{
if
(
MapScene
[
'svga'
])
{
const
mv
=
MapScene
[
'svga'
]
mv
.
gotoAndStop
(
1
);
res
.
data
.
svga
=
mv
;
...
...
@@ -558,14 +556,14 @@ export default class MapScene extends Scene {
*/
getInviteInfo
()
{
NetManager
.
ins
.
getInviteInfo
((
success
,
res
)
=>
{
if
(
!
success
||
!
res
.
data
)
{
if
(
!
success
||
!
res
.
data
)
{
return
;
}
const
flag
=
res
.
data
.
completeFlag
;
if
(
this
.
inviteTimer
)
{
if
(
this
.
inviteTimer
)
{
this
.
inviteTimer
.
stop
();
}
switch
(
true
)
{
switch
(
true
)
{
case
(
flag
==
0
):
// 未完成 显示倒计时
this
[
"inviteGroup"
].
visible
=
true
;
this
[
"inviteTipsBg"
].
visible
=
true
;
...
...
@@ -612,7 +610,7 @@ export default class MapScene extends Scene {
// 倒计时
private
inviteCutTimer
()
{
const
timer
=
this
.
convertTime
(
this
.
cutTime
-=
1000
);
if
(
timer
.
hour
===
"00"
if
(
timer
.
hour
===
"00"
&&
timer
.
min
===
"00"
&&
timer
.
sec
===
"00"
)
{
this
.
inviteTimer
.
stop
();
...
...
@@ -699,9 +697,9 @@ export default class MapScene extends Scene {
async
onTap_boxLayer
()
{
NetManager
.
ins
.
clickLog
(
getlogItem
(
1
));
const
data
=
getHomeData
();
if
(
data
.
canReceiveTreasureBoxNum
>
0
)
{
if
(
data
.
canReceiveTreasureBoxNum
>
0
)
{
this
[
'boxLayer'
].
visible
=
true
;
if
(
!
this
.
_mc
)
if
(
!
this
.
_mc
)
this
.
_mc
=
await
loadSvga
(
getResPath
()
+
'resource/assets/svgas/box.svga'
,
this
[
'boxani'
]);
this
.
_mc
.
stop
();
this
.
_mc
.
gotoAndStop
(
1
);
...
...
@@ -713,18 +711,18 @@ export default class MapScene extends Scene {
await
wait
(
50
);
this
.
_mc
.
visible
=
true
;
const
a
=
100
,
b
=
10
;
egret
.
Tween
.
get
(
this
.
_mc
,
{
loop
:
true
}).
set
({
rotation
:
b
})
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
0
},
a
/
2
)
egret
.
Tween
.
get
(
this
.
_mc
,
{
loop
:
true
}).
set
({
rotation
:
b
})
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
0
},
a
/
2
)
.
wait
(
1000
);
}
}
async
playAni
()
{
if
(
this
.
_mc
)
{
if
(
this
.
_mc
)
{
egret
.
Tween
.
removeTweens
(
this
.
_mc
);
this
.
_mc
.
gotoAndPlay
(
1
,
true
);
await
this
.
onPlaySTOP
();
...
...
@@ -735,7 +733,7 @@ export default class MapScene extends Scene {
async
onPlaySTOP
()
{
return
new
Promise
((
r
)
=>
{
const
func
=
()
=>
{
if
(
this
.
_mc
.
currentFrame
>=
100
)
{
if
(
this
.
_mc
.
currentFrame
>=
100
)
{
this
.
_mc
.
removeEventListener
(
egret
.
Event
.
ENTER_FRAME
,
func
,
this
);
this
.
_mc
.
stop
();
r
();
...
...
@@ -754,14 +752,14 @@ export default class MapScene extends Scene {
this
[
'boxani'
].
touchChildren
=
false
;
await
this
.
playAni
();
try
{
if
(
window
[
'getRST'
])
window
[
'getRST'
]();
}
catch
(
error
)
{
if
(
window
[
'getRST'
])
window
[
'getRST'
]();
}
catch
(
error
)
{
console
.
warn
(
error
)
}
NetManager
.
ins
.
hc_openTreasureBox
((
success
)
=>
{
this
[
'boxani'
].
touchEnabled
=
true
;
this
[
'boxani'
].
touchChildren
=
true
;
if
(
success
)
{
if
(
success
)
{
const
boxdata
=
DataManager
.
ins
.
getData
(
'hc_openTreasureBox'
).
data
;
const
homeData
=
DataManager
.
ins
.
getData
(
'hc_home'
).
data
;
homeData
.
canReceiveTreasureBoxNum
=
boxdata
.
canReceiveTreasureBoxNum
;
...
...
@@ -771,10 +769,10 @@ export default class MapScene extends Scene {
this
.
updateBox
();
const
data
=
DataManager
.
ins
.
getData
(
'hc_openTreasureBox'
).
data
;
NetManager
.
ins
.
getPlugOrderStatus
((
s
)
=>
{
if
(
s
)
{
if
(
s
)
{
const
data
=
DataManager
.
ins
.
getData
(
'getPlugOrderStatus'
);
//区分奖品
if
(
data
.
lottery
&&
data
.
lottery
.
type
!=
'thanks'
)
{
if
(
data
.
lottery
&&
data
.
lottery
.
type
!=
'thanks'
)
{
PanelCtrl
.
instance
.
show
(
'box'
);
}
else
{
showToast
(
'哎呀!奖励与您擦肩而过!快继续闯关!'
);
...
...
@@ -817,7 +815,7 @@ export default class MapScene extends Scene {
onTap_bloodBtn
()
{
NetManager
.
ins
.
clickLog
(
getlogItem
(
2
));
if
(
getHomeData
().
remainEnargy
>
0
)
if
(
getHomeData
().
remainEnargy
>
0
)
PanelCtrl
.
instance
.
show
(
'bloodPanel'
)
else
PanelCtrl
.
instance
.
show
(
'blood2Panel'
)
...
...
@@ -840,9 +838,9 @@ export default class MapScene extends Scene {
}
}
export
const
getNick
=
(
nickname
,
max
=
4
)
=>
{
if
(
!
nickname
)
return
nickname
;
if
(
!
nickname
)
return
nickname
;
if
(
nickname
.
length
>
max
)
if
(
nickname
.
length
>
max
)
return
nickname
.
slice
(
0
,
max
)
+
'...'
;
return
nickname
;
}
\ No newline at end of file
egret/src/panels/ScratchPanel.ts
View file @
a871d0b6
...
...
@@ -220,8 +220,8 @@ class ScratchItem extends eui.ItemRenderer {
if
(
!
success
)
{
return
;
}
let
shareCode
=
res
.
data
;
// 分享码
CFG
.
wxShareLink
=
window
[
'h5URL'
]
+
"&shareCode
="
+
shareCode
;
// 分享链接
let
shareCode
2
=
res
.
data
;
// 分享码
CFG
.
wxShareLink
=
window
[
'h5URL'
]
+
"&shareCode
2="
+
shareCode2
;
// 分享链接
CFG
.
wxShareTitle
=
'狮狮连萌超好玩~我已经玩到第一了!'
;
CFG
.
wxShareDesc
=
'我在萌狮消消乐等你来挑战哦'
;
CFG
.
wxShareImg
=
"http://yun.duiba.com.cn/db_games/xiaoxiaole2.jpg"
;
...
...
@@ -230,7 +230,7 @@ class ScratchItem extends eui.ItemRenderer {
window
[
"invokeWX"
]();
}
else
{
//端内
this
.
data
.
wxShareTip
.
visible
=
false
;
window
[
"inviteShare"
](
shareCode
);
window
[
"inviteShare"
](
shareCode
2
);
}
},
this
.
data
.
scratchTaskId
);
},
this
);
...
...
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