Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sun_cocos1
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
sun_cocos1
Commits
77be4b04
Commit
77be4b04
authored
Nov 24, 2020
by
tttal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#
parent
f0d07c0d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
3 deletions
+27
-3
index.fire
play/assets/template/scene/index.fire
+1
-1
index.js
play/assets/template/script/index.js
+24
-0
local.js
play/assets/template/script/local.js
+2
-2
No files found.
play/assets/template/scene/index.fire
View file @
77be4b04
...
...
@@ -90,7 +90,7 @@
"__id__": 14
}
],
"_active":
tru
e,
"_active":
fals
e,
"_components": [
{
"__id__": 68
...
...
play/assets/template/script/index.js
View file @
77be4b04
...
...
@@ -25,6 +25,7 @@ cc.Class({
// LIFE-CYCLE CALLBACKS:
onLoad
()
{
console
.
log
(
'
index
'
);
this
.
light_action
();
this
.
lamp_action
();
this
.
audio_button_update
();
...
...
@@ -32,8 +33,31 @@ cc.Class({
//文字数据加载部分
this
.
load_title
(
local
.
getTempData
(
'
text0
'
));
this
.
load_text
(
local
.
getTempData
(
'
text1
'
),
local
.
getTempData
(
'
text2
'
));
this
.
initSize
();
},
initSize
()
{
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
let
screen_size
=
cc
.
view
.
getFrameSize
().
width
/
cc
.
view
.
getFrameSize
().
height
let
design_size
=
cc
.
Canvas
.
instance
.
designResolution
.
width
/
cc
.
Canvas
.
instance
.
designResolution
.
height
let
f
=
screen_size
>=
design_size
cc
.
Canvas
.
instance
.
fitHeight
=
f
cc
.
Canvas
.
instance
.
fitWidth
=
!
f
const
frameSize
=
cc
.
view
.
getFrameSize
();
this
.
_frameSize
=
frameSize
;
this
.
_designSize
=
cc
.
view
.
getDesignResolutionSize
();
let
sx
=
cc
.
winSize
.
width
/
frameSize
.
width
;
let
sy
=
cc
.
winSize
.
height
/
frameSize
.
height
;
this
.
_cocosScale
=
Math
.
min
(
sx
,
sy
);
sx
=
frameSize
.
width
/
this
.
_designSize
.
width
;
sy
=
frameSize
.
height
/
this
.
_designSize
.
height
;
this
.
_mapScaleMin
=
Math
.
min
(
sx
,
sy
)
*
this
.
_cocosScale
;
this
.
_mapScaleMax
=
Math
.
max
(
sx
,
sy
)
*
this
.
_cocosScale
;
},
start
()
{
au
.
play
(
'
audio4
'
);
},
...
...
play/assets/template/script/local.js
View file @
77be4b04
...
...
@@ -17,7 +17,7 @@ cc.Class({
local_name
:
'
拳击机模板
'
,
},
onLoad
()
{
console
.
log
(
'
local
'
);
cc
.
game
.
addPersistRootNode
(
this
.
node
);
window
.
local
=
this
;
this
[
this
.
local_name
]
=
{
...
...
@@ -27,8 +27,8 @@ cc.Class({
this
.
init_data
();
},
init_data
()
{
console
.
log
(
'
init_data
'
);
try
{
// cc.find('Canvas').active = false;
window
.
courseware
.
getData
(
function
(
res
)
{
this
.
data
=
res
;
cc
.
find
(
'
Canvas
'
).
active
=
true
;
...
...
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