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
deecdc2b
Commit
deecdc2b
authored
May 18, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
全屏幕适配代码暂存
parent
01dd4530
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
17 deletions
+35
-17
MainScene.ts
egret/src/mainScene/MainScene.ts
+8
-5
MapScene.ts
egret/src/mapScene/MapScene.ts
+1
-1
PropBtnCon.ts
egret/src/something/uis/PropBtnCon.ts
+8
-1
PropGuide.ts
egret/src/something/uis/PropGuide.ts
+18
-10
No files found.
egret/src/mainScene/MainScene.ts
View file @
deecdc2b
...
...
@@ -442,7 +442,7 @@ export default class MainScene extends Scene {
this
.
islongScreen
=
true
;
}
if
(
this
.
islongScreen
){
this
[
'adapttop'
].
y
=
4
0
;
this
[
'adapttop'
].
y
=
6
0
;
}
else
{
this
[
'adapttop'
].
y
=
0
;
}
...
...
@@ -468,7 +468,7 @@ export default class MainScene extends Scene {
this
[
'adapttop'
].
addChild
(
this
.
curScoreNum
);
//初始换道具容器
this
.
propBtnCon
=
new
PropBtnCon
();
this
.
propBtnCon
=
new
PropBtnCon
(
this
.
islongScreen
);
this
.
addChild
(
this
.
propBtnCon
);
this
.
mapContainer
=
new
egret
.
DisplayObjectContainer
();
...
...
@@ -493,7 +493,9 @@ export default class MainScene extends Scene {
this
.
addChildAt
(
this
.
festivalContainer
,
1
);
//道具使用时蒙层 无需加入场景,带入propBtnCo的位置数据
this
.
propGuide
=
new
PropGuide
(
this
.
propBtnCon
.
y
);
console
.
log
(
'偏移'
,
this
.
propBtnCon
.
y
,
this
.
propBtnCon
.
boomBtn
.
y
);
this
.
propGuide
=
new
PropGuide
(
this
.
propBtnCon
.
y
,
this
.
islongScreen
);
this
.
propGuide
.
touchEnabled
=
true
;
}
...
...
@@ -951,8 +953,9 @@ export default class MainScene extends Scene {
//当前分数
//初始换道具容器
this
.
propBtnCon
.
y
=
299
+
Tool
.
gameAreaHeight
// + 55;
this
.
propGuide
.
changeOffset
(
this
.
propBtnCon
.
y
);
var
propbtny
:
number
=
299
+
Tool
.
gameAreaHeight
// + 55;
this
.
propBtnCon
.
y
=
propbtny
;
this
.
propGuide
.
changeOffset
(
this
.
propBtnCon
.
y
,
this
.
islongScreen
);
//初始化道具信息
this
.
updateScene
();
...
...
egret/src/mapScene/MapScene.ts
View file @
deecdc2b
...
...
@@ -143,7 +143,7 @@ export default class MapScene extends Scene {
}
console
.
log
(
"手机长短屏幕适配"
,
whl
,
this
.
islongScreen
);
if
(
this
.
islongScreen
){
this
[
'adapttop'
].
y
=
4
0
;
this
[
'adapttop'
].
y
=
5
0
;
this
[
'settingsx'
].
bottom
=
50
;
}
else
{
this
[
'adapttop'
].
y
=
0
;
...
...
egret/src/something/uis/PropBtnCon.ts
View file @
deecdc2b
...
...
@@ -8,7 +8,7 @@ export class PropBtnCon extends eui.Component {
bg
:
eui
.
Image
;
constructor
()
{
constructor
(
islongScreen
:
boolean
)
{
super
();
var
textureBg
=
RES
.
getRes
(
"propBg_png"
);
...
...
@@ -16,14 +16,21 @@ export class PropBtnCon extends eui.Component {
this
.
bg
.
y
=
-
137
;
this
.
addChild
(
this
.
bg
);
var
cuty
:
number
=
0
;
if
(
islongScreen
){
cuty
=
40
;
}
this
.
boomBtn
=
new
CusButton
(
"boomBtn_png"
);
this
.
boomBtn
.
x
=
375
-
110
-
50
;
//110图片宽度,50按钮间隔
this
.
boomBtn
.
y
=
-
cuty
;
this
.
addChild
(
this
.
boomBtn
);
this
.
hammerBtn
=
new
CusButton
(
"hammerBtn_png"
);
this
.
hammerBtn
.
x
=
375
;
this
.
hammerBtn
.
y
=
-
cuty
;
this
.
addChild
(
this
.
hammerBtn
);
this
.
stepBtn
=
new
CusButton
(
"stepBtn_png"
);
this
.
stepBtn
.
x
=
375
+
110
+
50
;
this
.
stepBtn
.
y
=
-
cuty
;
this
.
addChild
(
this
.
stepBtn
);
}
}
...
...
egret/src/something/uis/PropGuide.ts
View file @
deecdc2b
...
...
@@ -13,21 +13,25 @@ export class PropGuide extends egret.DisplayObjectContainer {
hammerBtn
:
egret
.
Bitmap
;
stepBtn
:
egret
.
Bitmap
;
msgTxt
:
egret
.
TextField
;
constructor
(
offsetY
:
number
)
{
constructor
(
offsetY
:
number
,
islongScreen
:
boolean
)
{
super
()
this
.
bg
=
new
egret
.
Shape
();
this
.
addChild
(
this
.
bg
);
this
.
boomBtn
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"boomBtn_png"
));
this
.
boomBtn
.
x
=
375
-
110
-
50
-
55
;
//110图片宽度,50按钮间隔,55一半的图片宽度
this
.
boomBtn
.
y
=
offsetY
-
55
;
var
cuty
:
number
=
0
;
if
(
islongScreen
){
cuty
=
-
100
;
}
this
.
boomBtn
.
y
=
offsetY
-
55
+
cuty
;
this
.
addChild
(
this
.
boomBtn
);
this
.
hammerBtn
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"hammerBtn_png"
));
this
.
hammerBtn
.
x
=
375
-
55
;
this
.
hammerBtn
.
y
=
offsetY
-
55
;
this
.
hammerBtn
.
y
=
offsetY
-
55
+
cuty
;
this
.
addChild
(
this
.
hammerBtn
);
this
.
stepBtn
=
new
egret
.
Bitmap
(
RES
.
getRes
(
"stepBtn_png"
));
this
.
stepBtn
.
x
=
375
+
110
+
50
-
55
;
this
.
stepBtn
.
y
=
offsetY
-
55
;
this
.
stepBtn
.
y
=
offsetY
-
55
+
cuty
;
this
.
addChild
(
this
.
stepBtn
);
//再调
var
text
:
egret
.
TextField
=
new
egret
.
TextField
();
...
...
@@ -35,7 +39,7 @@ export class PropGuide extends egret.DisplayObjectContainer {
text
.
textColor
=
0xffffff
;
text
.
size
=
20
;
text
.
x
=
(
750
-
500
)
/
2
;
text
.
y
=
offsetY
-
80
;
text
.
y
=
offsetY
-
80
+
cuty
;
text
.
textAlign
=
egret
.
HorizontalAlign
.
CENTER
;
text
.
width
=
500
;
this
.
addChild
(
text
);
...
...
@@ -44,11 +48,15 @@ export class PropGuide extends egret.DisplayObjectContainer {
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
)
},
this
)
}
changeOffset
(
offsetY
:
number
){
this
.
boomBtn
.
y
=
offsetY
-
55
;
this
.
hammerBtn
.
y
=
offsetY
-
55
;
this
.
stepBtn
.
y
=
offsetY
-
55
;
this
.
msgTxt
.
y
=
offsetY
-
80
;
changeOffset
(
offsetY
:
number
,
islongScreen
:
boolean
){
var
cuty
:
number
=
0
;
if
(
islongScreen
){
cuty
=
-
40
;
}
this
.
boomBtn
.
y
=
offsetY
-
55
+
cuty
;
this
.
hammerBtn
.
y
=
offsetY
-
55
+
cuty
;
this
.
stepBtn
.
y
=
offsetY
-
55
+
cuty
;
this
.
msgTxt
.
y
=
offsetY
-
80
+
cuty
;
}
init
(
prop
:
PropType
,
adapttopy
:
number
)
{
if
(
prop
==
PropType
.
BOOM
)
{
...
...
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