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
5bb1fbd7
Commit
5bb1fbd7
authored
May 19, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地图调整
parent
f09b2dae
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
199 additions
and
3705 deletions
+199
-3705
AvatarSkin.exml
egret/resource/skins/AvatarSkin.exml
+4
-4
MapRpeatPart.ts
egret/src/mapScene/MapRpeatPart.ts
+24
-24
MapScene.ts
egret/src/mapScene/MapScene.ts
+137
-57
StartScene.ts
egret/src/startScene/StartScene.ts
+23
-22
home.json
mock/happyclear/home.json
+10
-3597
mapRank.json
mock/happyclear/mapRank.json
+1
-1
No files found.
egret/resource/skins/AvatarSkin.exml
View file @
5bb1fbd7
<?xml version="1.0" encoding="utf-8"?>
<e:Skin
class=
"AvatarSkin"
width=
"95"
height=
"104"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Image
source=
"friend_avatar_png"
anchorOffsetX=
"0"
anchorOffsetY=
"0"
/>
<e:Group
x=
"8.5"
y=
"8.8"
width=
"77"
height=
"77"
>
<e:Image
id=
"avatar"
y=
"0"
source=
""
width=
"77"
height=
"77"
x=
"0"
anchorOffsetX=
"0"
anchorOffsetY=
"0"
/>
<e:Rect
id=
"avatarMask"
width=
"77"
height=
"77"
y=
"0"
ellipseWidth=
"999"
ellipseHeight=
"999"
anchorOffsetY=
"0"
x=
"1"
/>
<e:Image
source=
"friend_avatar_png"
anchorOffsetX=
"0"
anchorOffsetY=
"0"
touchEnabled=
"false"
/>
<e:Group
x=
"8.5"
y=
"8.8"
width=
"77"
height=
"77"
touchEnabled=
"false"
>
<e:Image
id=
"avatar"
y=
"0"
source=
""
width=
"77"
height=
"77"
x=
"0"
anchorOffsetX=
"0"
anchorOffsetY=
"0"
touchEnabled=
"false"
/>
<e:Rect
id=
"avatarMask"
width=
"77"
height=
"77"
y=
"0"
ellipseWidth=
"999"
ellipseHeight=
"999"
anchorOffsetY=
"0"
x=
"1"
touchEnabled=
"false"
/>
</e:Group>
</e:Skin>
\ No newline at end of file
egret/src/mapScene/MapRpeatPart.ts
View file @
5bb1fbd7
...
...
@@ -42,34 +42,34 @@ export default class MapRpeatPart extends ComponentBase {
return
;
for
(
let
i
=
0
;
i
<
MapRpeatPart
.
LEVEL_NUMS
;
i
++
)
{
const
levelOrder
=
MapTopPart
.
LEVEL_NUMS
+
this
.
_index
*
MapRpeatPart
.
LEVEL_NUMS
+
i
+
1
;
this
.
getTxt
(
i
).
text
=
levelOrder
+
''
;
//
for (let i = 0; i < MapRpeatPart.LEVEL_NUMS; i++) {
//
const levelOrder = MapTopPart.LEVEL_NUMS + this._index * MapRpeatPart.LEVEL_NUMS + i + 1;
//
this.getTxt(i).text = levelOrder + '';
/// TODO 如果是在Repeat页的关卡超过了最大关卡,也要加点击toast
if
(
levelOrder
>
window
[
'last_level'
])
{
setGray
(
this
.
getIcon
(
i
));
this
.
getIcon
(
i
).
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
showToast
(
'敬请期待更多关卡~'
);
},
this
);
//
/// TODO 如果是在Repeat页的关卡超过了最大关卡,也要加点击toast
//
if ( levelOrder > window['last_level']) {
//
setGray(this.getIcon(i));
//
this.getIcon(i).addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
//
showToast('敬请期待更多关卡~');
//
}, this);
}
//
}
const
icon
=
MapScene
.
iconHash
[
levelOrder
]
=
this
.
getIcon
(
i
);
this
.
removeChild
(
icon
);
icon
.
show
=
()
=>
{
this
.
addChild
(
icon
)};
icon
.
hide
=
()
=>
{
this
.
removeChild
(
icon
)};
icon
[
'nums'
]
=
icon
.
getChildAt
(
0
);
icon
[
'bmptxt'
]
=
icon
.
getChildAt
(
1
);
icon
[
'mappart'
]
=
this
;
//
const icon = MapScene.iconHash[levelOrder] = this.getIcon(i);
//
this.removeChild(icon);
//
icon.show = ()=>{this.addChild(icon)};
//
icon.hide = ()=>{this.removeChild(icon)};
//
icon['nums'] = icon.getChildAt(0);
//
icon['bmptxt']=icon.getChildAt(1);
//
icon['mappart']=this;
const
star
=
new
MapStarComp
();
star
.
loadSkin
();
star
.
start
();
MapScene
.
starHash
[
levelOrder
]
=
star
;
icon
.
addChild
(
star
);
icon
[
'visibleY'
]
=
this
.
_topHeight
+
this
.
height
*
this
.
_index
+
icon
.
y
;
// console.log(icon['visibleY'] );
}
//
const star = new MapStarComp();
//
star.loadSkin(); star.start();
//
MapScene.starHash[levelOrder] = star;
//
icon.addChild(star);
//
icon['visibleY'] = this._topHeight + this.height * this._index + icon.y;
//
// console.log(icon['visibleY'] );
//
}
// this['animal1'].visible = this._index % 2;
// this['animal2'].visible = !this['animal1'].visible;
...
...
egret/src/mapScene/MapScene.ts
View file @
5bb1fbd7
...
...
@@ -48,11 +48,11 @@ export default class MapScene extends Scene {
static
adData
;
scrollGroup
:
eui
.
Group
;
scroll
:
eui
.
Scroller
;
topPart
:
MapTopPart
;
bottomPart
:
MapBottomPart
;
repeatsPart
:
MapRpeatPart
[];
static
iconHash
:
any
=
{};
static
starHash
:
any
=
{};
//
topPart: MapTopPart;
//
bottomPart: MapBottomPart;
//
repeatsPart: MapRpeatPart[];
//
static iconHash: any = {};
//
static starHash: any = {};
_data
;
private
icons
=
{};
...
...
@@ -62,6 +62,10 @@ export default class MapScene extends Scene {
onemapreppart
:
MapRpeatPart
;
twomapreppart
:
MapRpeatPart
;
mapbotpart
:
MapBottomPart
;
maprankdata
:
Array
<
{
levelNum
,
rank
}
>
=
[];
private
sendInvite
(
panels
:
any
[],
parmas
:
any
[])
{
const
code
=
Utils
.
getRequestByKey
(
'shareCode'
)
||
Utils
.
getRequestByKey
(
'token'
);
//0224新加用token取一边
if
(
!
code
)
return
false
;
...
...
@@ -410,7 +414,7 @@ export default class MapScene extends Scene {
async
start
(
data
?)
{
// console.log("mapscene---------------start");
super
.
start
();
this
.
_avatarsCache
=
new
Array
();
//
this._avatarsCache = new Array();
// this.addIcon(); // 添加Icon
...
...
@@ -725,25 +729,24 @@ export default class MapScene extends Scene {
const
y0
=
this
.
scroll
.
viewport
.
scrollV
+
offset
;
const
y1
=
this
.
stage
.
stageHeight
+
this
.
scroll
.
viewport
.
scrollV
-
offset
;
// console.log(y0, y1);
let
count
=
0
;
for
(
const
key
in
MapScene
.
iconHash
)
{
const
icon
=
MapScene
.
iconHash
[
key
];
if
(
icon
[
'visibleY'
]
>=
y0
&&
icon
[
'visibleY'
]
<=
y1
)
{
icon
.
show
();
}
else
if
(
icon
.
parent
)
{
icon
.
hide
();
}
//
let count = 0;
//
for (const key in MapScene.iconHash) {
//
const icon = MapScene.iconHash[key];
//
if (icon['visibleY'] >= y0 && icon['visibleY'] <= y1) {
//
icon.show();
//
} else if (icon.parent) {
//
icon.hide();
//
}
if
(
icon
.
parent
)
count
++
;
}
//
if (icon.parent)
//
count++;
//
}
if
(
this
.
_avatarsCache
)
{
this
.
_avatarsCache
.
forEach
((
item
)
=>
{
if
(
item
.
parent
)
item
.
parent
.
addChild
(
item
);
});
}
// if (this._avatarsCache) {
// this._avatarsCache.forEach((item) => {
// if (item.parent) item.parent.addChild(item);
// });
// }
}
scrollMapy
:
Array
<
number
>
=
[];
...
...
@@ -884,6 +887,33 @@ export default class MapScene extends Scene {
icon
.
removeChild
(
this
.
pic
);
}
}
var
isinrank
=
false
;
var
avatarrank
;
for
(
var
ir
=
0
;
ir
<
this
.
maprankdata
.
length
;
ir
++
){
var
irdata
=
this
.
maprankdata
[
ir
];
if
(
irdata
.
levelNum
==
levelOrder
){
isinrank
=
true
;
avatarrank
=
irdata
.
rank
;
break
;
}
}
var
avatarname
:
string
=
"avatarank"
;
var
avatar
=
icon
.
getChildByName
(
avatarname
);
if
(
avatar
){
avatar
.
parent
.
removeChild
(
avatar
);
}
if
(
isinrank
){
const
avatar
=
new
AvatarComp
();
avatar
.
loadSkin
();
avatar
.
start
(
avatarrank
);
avatar
.
name
=
avatarname
;
icon
.
addChild
(
avatar
);
avatar
.
x
=
6
;
avatar
.
y
=
-
avatar
.
height
+
10
;
if
(
!
icon
[
'starsp'
].
visible
)
{
avatar
.
y
=
-
avatar
.
height
;
}
}
if
(
!
icon
.
hasEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
)){
icon
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
clickIcon
,
this
);
}
...
...
@@ -920,7 +950,7 @@ export default class MapScene extends Scene {
if
(
e
.
target
.
name
!=
'water_light'
){
let
icon
=
e
.
target
as
eui
.
Group
;
let
txt
=
icon
[
'bmptxt'
]
as
eui
.
BitmapLabel
;
console
.
log
(
'关卡点击'
,
txt
.
text
);
//
console.log('关卡点击',txt.text);
var
homeData
=
getHomeData
();
var
clicklevel
=
Number
(
txt
.
text
);
if
(
clicklevel
<=
homeData
.
levels
.
length
+
1
){
//可进行关卡
...
...
@@ -1034,10 +1064,10 @@ export default class MapScene extends Scene {
this
.
scroll
.
removeEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
);
this
.
_avatarsCache
.
forEach
((
item
)
=>
{
if
(
item
.
parent
)
item
.
parent
.
removeChild
(
item
);
});
this
.
_avatarsCache
=
null
;
//
this._avatarsCache.forEach((item) => {
//
if (item.parent) item.parent.removeChild(item);
//
});
//
this._avatarsCache = null;
}
getScrollV
(
lastOrder
,
stageHeight
)
{
...
...
@@ -1171,27 +1201,37 @@ export default class MapScene extends Scene {
this
.
updateSign
();
}
private
_avatarsCache
=
[];
//
private _avatarsCache = [];
//添加地图页头像
addAvatar
(
level
,
ele
?)
{
return
;
const
item
=
MapScene
.
iconHash
[
level
];
const
parent
=
item
[
'mappart'
];
const
avatar
=
new
AvatarComp
();
avatar
.
loadSkin
();
avatar
.
start
(
ele
);
parent
.
addChild
(
avatar
);
avatar
.
x
=
item
.
x
+
6
;
avatar
.
y
=
item
.
y
-
avatar
.
height
+
10
;
if
(
!
MapScene
.
starHash
[
level
].
visible
)
{
avatar
.
y
=
item
.
y
-
avatar
.
height
;
const
item
=
this
.
getInShowIconByLevel
(
level
);
console
.
log
(
'地图页头像'
,
level
,
item
);
if
(
item
){
const
parent
=
item
;
var
avatarname
:
string
=
"avatarank"
;
var
oldavatar
=
parent
.
getChildByName
(
'avatarname'
);
if
(
oldavatar
){
oldavatar
.
parent
.
removeChild
(
oldavatar
);
}
const
avatar
=
new
AvatarComp
();
avatar
.
loadSkin
();
avatar
.
start
(
ele
);
parent
.
addChild
(
avatar
);
avatar
.
name
=
avatarname
;
avatar
.
x
=
6
;
avatar
.
y
=
-
avatar
.
height
+
10
;
if
(
!
item
[
'starsp'
].
visible
)
{
avatar
.
y
=
-
avatar
.
height
;
}
// this._avatarsCache.push(avatar);
}
this
.
_avatarsCache
.
push
(
avatar
);
}
// 更新地图上的排行榜
updateFriends
()
{
this
.
maprankdata
=
new
Array
();
NetManager
.
ins
.
hc_mapRank
(()
=>
{
const
hc_mapRank
=
DataManager
.
ins
.
getData
(
'hc_mapRank'
).
data
;
if
(
!
hc_mapRank
)
return
;
...
...
@@ -1203,6 +1243,11 @@ export default class MapScene extends Scene {
else
ele
.
rank
[
0
].
avatar
=
data
.
avatar
||
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
}
this
.
maprankdata
.
push
({
levelNum
:
ele
.
levelNum
,
rank
:
ele
.
rank
[
0
]
})
this
.
addAvatar
(
ele
.
levelNum
,
ele
.
rank
[
0
]);
});
});
...
...
@@ -1661,25 +1706,25 @@ export default class MapScene extends Scene {
}
showRedBagAni
()
{
const
hash
=
MapScene
.
iconHash
;
const
keys
=
[];
for
(
const
key
in
hash
)
{
const
ele
=
hash
[
key
];
if
(
ele
.
parent
)
keys
.
push
(
key
);
}
const
p0
=
new
egret
.
Point
(
750
/
2
,
750
/
1.5
);
const
pics
=
[];
for
(
const
key
of
keys
)
{
const
icon
=
MapScene
.
iconHash
[
key
]
as
egret
.
DisplayObject
;
const
p
=
(
icon
.
localToGlobal
(
0
,
0
));
const
pic
=
createRedBagIcon
(
this
);
pic
.
visible
=
false
;
pic
[
'__p2__'
]
=
p
;
pic
[
'__icon__'
]
=
icon
;
p
.
x
+=
50
;
p
.
y
+=
25
;
pics
.
push
(
pic
);
var
total_level
=
window
[
'total_level'
];
for
(
var
i0
=
0
;
i0
<
total_level
;
i0
++
){
var
i0level
=
i0
+
1
;
var
icon
=
this
.
getInShowIconByLevel
(
i0level
);
if
(
icon
&&
icon
.
parent
){
keys
.
push
(
icon
.
parent
);
const
p
=
(
icon
.
localToGlobal
(
0
,
0
));
const
pic
=
createRedBagIcon
(
this
);
pic
.
visible
=
false
;
pic
[
'__p2__'
]
=
p
;
pic
[
'__icon__'
]
=
icon
;
p
.
x
+=
50
;
p
.
y
+=
25
;
pics
.
push
(
pic
);
}
}
// console.log(keys);
pics
.
forEach
((
pic
,
index
)
=>
{
...
...
@@ -1725,6 +1770,41 @@ export default class MapScene extends Scene {
}
}
//获取指定显示的icon
getInShowIconByLevel
(
level
:
number
){
var
icon
:
any
;
icon
=
this
.
getPartIconByLevel
(
this
.
maptoppart
,
level
,
'top'
);
if
(
!
icon
){
icon
=
this
.
getPartIconByLevel
(
this
.
onemapreppart
,
level
,
'mid'
);
}
if
(
!
icon
){
icon
=
this
.
getPartIconByLevel
(
this
.
twomapreppart
,
level
,
'mid'
);
}
if
(
!
icon
){
icon
=
this
.
getPartIconByLevel
(
this
.
mapbotpart
,
level
,
'bot'
);
}
return
icon
;
}
getPartIconByLevel
(
mapart
:
any
,
level
:
number
,
mappartype
:
string
){
var
mapnums
:
number
;
if
(
mappartype
==
"top"
){
mapnums
=
MapTopPart
.
LEVEL_NUMS
;
}
else
if
(
mappartype
==
"mid"
){
mapnums
=
MapRpeatPart
.
LEVEL_NUMS
;
}
else
if
(
mappartype
==
"bot"
){
mapnums
=
MapBottomPart
.
LEVEL_NUMS
;
}
for
(
var
i
=
0
;
i
<
mapnums
;
i
++
){
var
icon
=
mapart
.
getIcon
(
i
);
var
iconlevel
=
Number
(
icon
[
'bmptxt'
].
text
);
if
(
iconlevel
==
level
){
return
icon
;
}
}
return
null
;
}
}
export
const
getNick
=
(
nickname
,
max
=
4
)
=>
{
if
(
!
nickname
)
return
nickname
;
...
...
egret/src/startScene/StartScene.ts
View file @
5bb1fbd7
...
...
@@ -133,6 +133,7 @@ export const changeMapScene = (p?) => {
let
_startSceneData
;
export
const
createData
=
()
=>
{
if
(
_startSceneData
)
{
if
(
_startSceneData
.
level
!==
null
&&
_startSceneData
.
level
!==
undefined
)
delete
_startSceneData
.
level
...
...
@@ -140,28 +141,28 @@ export const createData = () => {
}
const
startSceneData
:
any
=
{};
_startSceneData
=
startSceneData
;
const
repeatCount
=
getRepeatCount
();
const
list
=
[];
startSceneData
.
list
=
list
;
startSceneData
.
top
=
new
MapTopPart
();
startSceneData
.
top
.
loadSkin
();
startSceneData
.
top
.
start
();
for
(
let
i
=
0
;
i
<
repeatCount
;
i
++
)
{
const
repeat
=
new
MapRpeatPart
();
//new MapRpeatPart(i, startSceneData.top.height);
repeat
.
loadSkin
();
repeat
.
start
();
list
.
push
(
repeat
);
}
startSceneData
.
bottom
=
new
MapBottomPart
();
startSceneData
.
bottom
.
loadSkin
();
startSceneData
.
bottom
.
start
({
repeatHeight
:
list
[
0
].
height
,
topHeight
:
startSceneData
.
top
.
height
});
return
startSceneData
return
startSceneData
;
//
const repeatCount = getRepeatCount();
//
const list = [];
//
startSceneData.list = list;
//
startSceneData.top = new MapTopPart();
//
startSceneData.top.loadSkin(); startSceneData.top.start();
//
for (let i = 0; i < repeatCount; i++) {
//
const repeat = new MapRpeatPart();//new MapRpeatPart(i, startSceneData.top.height);
//
repeat.loadSkin(); repeat.start();
//
list.push(repeat);
//
}
//
startSceneData.bottom = new MapBottomPart();
//
startSceneData.bottom.loadSkin();
//
startSceneData.bottom.start({
//
repeatHeight: list[0].height,
//
topHeight: startSceneData.top.height
//
});
//
return startSceneData
};
export
const
getRepeatCount
=
()
=>
{
...
...
mock/happyclear/home.json
View file @
5bb1fbd7
This diff is collapsed.
Click to expand it.
mock/happyclear/mapRank.json
View file @
5bb1fbd7
...
...
@@ -5,7 +5,7 @@
"timestamp"
:
1571322224593
,
"data"
:
[
{
"levelNum"
:
10
1
,
"levelNum"
:
10
,
"rank"
:
[
{
"nickName"
:
null
,
...
...
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