Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dfzx_cocos_trace_letter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
dfzx_cocos_trace_letter
Commits
ed971814
Commit
ed971814
authored
Jun 11, 2021
by
Seaborn Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: extract BaseBgManager
parent
458d3c90
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
719 additions
and
656 deletions
+719
-656
.gitignore
.gitignore
+2
-1
ET_07.fire.meta
play/assets/ET_07/scene/ET_07.fire.meta
+1
-1
ET_07.js
play/assets/ET_07/scene/ET_07.js
+618
-584
BaseBgManager.js
play/assets/ET_07/script/BaseBgManager.js
+35
-0
BaseBgManager.js.meta
play/assets/ET_07/script/BaseBgManager.js.meta
+9
-0
BgManager.js
play/assets/ET_07/script/BgManager.js
+48
-67
project.json
play/project.json
+1
-1
project.json
play/settings/project.json
+4
-1
services.json
play/settings/services.json
+1
-1
No files found.
.gitignore
View file @
ed971814
...
@@ -7,4 +7,5 @@
...
@@ -7,4 +7,5 @@
/publish/publish/android
/publish/publish/android
/publish/publish/ios
/publish/publish/ios
/publish/publish/*.zip
/publish/publish/*.zip
/node_modules
/node_modulestags
\ No newline at end of file
tags
play/assets/ET_07/scene/ET_07.fire.meta
View file @
ed971814
{
{
"ver": "1.2.
7
",
"ver": "1.2.
9
",
"uuid": "57ea7c61-9b8b-498a-b024-c98ee9124beb",
"uuid": "57ea7c61-9b8b-498a-b024-c98ee9124beb",
"asyncLoadAssets": false,
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"autoReleaseAssets": true,
...
...
play/assets/ET_07/scene/ET_07.js
View file @
ed971814
This diff is collapsed.
Click to expand it.
play/assets/ET_07/script/BaseBgManager.js
0 → 100644
View file @
ed971814
cc
.
Class
({
properties
:
{
_context
:
null
,
},
setContext
(
ctx
)
{
this
.
_context
=
ctx
;
},
ctor
()
{},
toTop
(
item
)
{
item
.
y
=
this
.
_context
.
bgHeight
/
2
;
item
.
anchorY
=
1
;
item
.
scale
=
this
.
_context
.
bgWidth
/
item
.
width
;
},
toBottom
(
item
)
{
item
.
y
=
-
this
.
_context
.
bgHeight
/
2
;
item
.
anchorY
=
0
;
item
.
scale
=
this
.
_context
.
bgWidth
/
item
.
width
;
},
toLeft
(
item
)
{
item
.
x
=
-
this
.
_context
.
bgWidth
/
2
;
item
.
anchorX
=
0
;
item
.
scale
=
this
.
_context
.
bgHeight
/
item
.
height
;
},
toRight
(
item
)
{
item
.
x
=
this
.
_context
.
bgWidth
/
2
;
item
.
anchorX
=
1
;
item
.
scale
=
this
.
_context
.
bgHeight
/
item
.
height
;
},
});
play/assets/ET_07/script/BaseBgManager.js.meta
0 → 100644
View file @
ed971814
{
"ver": "1.0.8",
"uuid": "0520cb4a-1cc8-4344-9355-72fa942c91b7",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/ET_07/script/BgManager.js
View file @
ed971814
import
{
getSprNode
}
from
"
./util
"
import
{
getSprNode
}
from
"
./util
"
;
cc
.
Class
({
import
BaseBgManager
from
"
./BaseBgManager
"
;
properties
:
{
bgArr
:
{
default
:
[]
},
_bgWidth
:
0
,
_bgHeight
:
0
,
_mapScaleMin
:
1
,
_mapScaleMax
:
1
,
},
ctor
(
width
,
height
,
mapScaleMin
,
mapScaleMax
)
{
this
.
_bgWidth
=
width
;
this
.
_bgHeight
=
height
;
this
.
_mapScaleMin
=
mapScaleMin
;
this
.
_mapScaleMax
=
mapScaleMax
;
this
.
initAllBg
();
},
initAllBg
()
{
cc
.
Class
({
extends
:
BaseBgManager
,
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
properties
:
{
const
bg
=
this
.
initOneBg
(
i
+
1
);
bgArr
:
{
this
.
bgArr
.
push
(
bg
);
default
:
[],
}
},
},
},
initOneBg
(
id
)
{
initAllBg
()
{
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
const
bg
=
this
.
initOneBg
(
i
+
1
);
this
.
bgArr
.
push
(
bg
);
}
},
const
bg
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_
"
+
id
);
initOneBg
(
id
)
{
bg
.
scale
=
this
.
_mapScaleMax
;
const
bg
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_
"
+
id
);
bg
.
scale
=
this
.
_context
.
mapScaleMax
;
const
bgItemLayer
=
new
cc
.
Node
();
const
bgItemLayer
=
new
cc
.
Node
();
bgItemLayer
.
scale
=
1
/
bg
.
scale
;
bgItemLayer
.
scale
=
1
/
bg
.
scale
;
bg
.
addChild
(
bgItemLayer
);
bg
.
addChild
(
bgItemLayer
);
const
itemTop
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_top
"
+
id
)
bgItemLayer
.
addChild
(
itemTop
,
1
);
itemTop
.
y
=
this
.
_bgHeight
/
2
;
itemTop
.
anchorY
=
1
;
itemTop
.
scale
=
this
.
_bgWidth
/
itemTop
.
width
;
const
itemTop
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_top
"
+
id
);
const
itemBottom
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_bottom
"
+
id
)
bgItemLayer
.
addChild
(
itemTop
,
1
);
bgItemLayer
.
addChild
(
itemBottom
,
1
);
this
.
toTop
(
itemTop
);
itemBottom
.
y
=
-
this
.
_bgHeight
/
2
;
itemBottom
.
anchorY
=
0
;
itemBottom
.
scale
=
this
.
_bgWidth
/
itemBottom
.
width
;
const
item
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_dian
"
+
id
)
const
itemBottom
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_bottom
"
+
id
);
bgItemLayer
.
addChild
(
item
);
bgItemLayer
.
addChild
(
itemBottom
,
1
);
item
.
x
=
-
this
.
_bgWidth
/
10
*
4
;
this
.
toBottom
(
itemBottom
);
item
.
y
=
-
this
.
_bgHeight
/
6
;
item
.
scale
=
this
.
_mapScaleMin
;
if
(
id
==
4
)
{
const
item
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_dian
"
+
id
);
bgItemLayer
.
addChild
(
item
);
item
.
x
=
(
-
this
.
_context
.
bgWidth
/
10
)
*
4
;
item
.
y
=
-
this
.
_context
.
bgHeight
/
6
;
item
.
scale
=
this
.
_context
.
mapScaleMin
;
itemTop
.
scale
=
this
.
_mapScaleMin
;
if
(
id
==
4
)
{
itemTop
.
scale
=
this
.
_context
.
mapScaleMin
;
const
itemLeft
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_left
"
)
const
itemLeft
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_left
"
);
bgItemLayer
.
addChild
(
itemLeft
);
bgItemLayer
.
addChild
(
itemLeft
);
itemLeft
.
x
=
-
this
.
_bgWidth
/
2
;
this
.
toLeft
(
itemLeft
);
itemLeft
.
anchorX
=
0
;
itemLeft
.
scale
=
this
.
_bgHeight
/
itemLeft
.
height
;
const
itemRight
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_right
"
)
const
itemRight
=
getSprNode
(
"
bg/
"
+
id
+
"
/bg_right
"
);
bgItemLayer
.
addChild
(
itemRight
);
bgItemLayer
.
addChild
(
itemRight
);
itemRight
.
x
=
this
.
_bgWidth
/
2
;
this
.
toRight
(
itemRight
);
itemRight
.
anchorX
=
1
;
}
itemRight
.
scale
=
this
.
_bgHeight
/
itemRight
.
height
;
}
return
bg
;
return
bg
;
},
},
getNext
()
{
getNext
()
{
return
this
.
bgArr
[
3
];
if
(
this
.
bgArr
.
length
===
0
)
{
this
.
initAllBg
();
}
}
})
return
this
.
bgArr
[
3
];
\ No newline at end of file
},
});
play/project.json
View file @
ed971814
...
@@ -3,6 +3,6 @@
...
@@ -3,6 +3,6 @@
"packages"
:
"packages"
,
"packages"
:
"packages"
,
"name"
:
"play"
,
"name"
:
"play"
,
"id"
:
"9af72fd2-44a6-4131-8ea3-3e1b3fa22231"
,
"id"
:
"9af72fd2-44a6-4131-8ea3-3e1b3fa22231"
,
"version"
:
"2.4.
0
"
,
"version"
:
"2.4.
4
"
,
"isNew"
:
false
"isNew"
:
false
}
}
\ No newline at end of file
play/settings/project.json
View file @
ed971814
{
{
"last-module-event-record-time"
:
1600677246969
"last-module-event-record-time"
:
1600677246969
,
"migrate-history"
:
[
"cloud-function"
]
}
}
play/settings/services.json
View file @
ed971814
{
{
"game"
:
{
"game"
:
{
"name"
:
"
未知游戏
"
,
"name"
:
"
UNKNOW GAME
"
,
"appid"
:
"UNKNOW"
"appid"
:
"UNKNOW"
}
}
}
}
\ 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