Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
NJ_MonkyTree
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
NJ_MonkyTree
Commits
8b8a4014
Commit
8b8a4014
authored
Sep 16, 2022
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: debug
parent
6f11e2c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
46 deletions
+57
-46
NJ_MonkyTree.ts
assets/NJ_MonkyTree/scene/NJ_MonkyTree.ts
+57
-46
No files found.
assets/NJ_MonkyTree/scene/NJ_MonkyTree.ts
View file @
8b8a4014
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
import
Attributes
from
"
../script/Attributes
"
;
import
{
callNetworkApiGet
,
callNetworkApiPost
,
jumpToCourseWare
,
buttonOnClick
,
jumpToBundle
,
delayCall
}
from
"
../script/util
"
;
import
{
callNetworkApiGet
,
callNetworkApiPost
,
jumpToCourseWare
,
buttonOnClick
,
jumpToBundle
,
delayCall
,
exchangeNodePos
}
from
"
../script/util
"
;
// @ts-ignore
import
{
assign
,
createMachine
,
interpret
,
actions
,
forwardTo
,
matchesState
}
from
"
../script/xstate
"
;
const
{
pure
,
send
,
raise
,
sendParent
}
=
actions
;
...
...
@@ -204,27 +204,33 @@ export default class SceneComponent extends MyCocosSceneComponent {
lock
.
active
=
true
;
const
titleNode
=
attr
.
querySelector
(
'
.title
'
);
//
const outline = '#000';
//
const name = "";
//
const richText = titleNode.getComponent(cc.RichText);
//
if ( !richText.fontSizeBase ) {
//
richText.fontSizeBase = richText.fontSize;
//
}
//
richText.fontSize = richText.fontSizeBase;
//
if (name.length > 14) {
//
richText.fontSize = richText.fontSizeBase * 0.7;
//
}
//
richText.font = cc.find("Canvas/res/font/BRLNSDB").getComponent(cc.Label).font;
const
outline
=
'
#000
'
;
const
name
=
""
;
const
richText
=
titleNode
.
getComponent
(
cc
.
RichText
);
if
(
!
richText
.
fontSizeBase
)
{
richText
.
fontSizeBase
=
richText
.
fontSize
;
}
richText
.
fontSize
=
richText
.
fontSizeBase
;
if
(
name
.
length
>
14
)
{
richText
.
fontSize
=
richText
.
fontSizeBase
*
0.7
;
}
richText
.
font
=
cc
.
find
(
"
Canvas/res/font/BRLNSDB
"
).
getComponent
(
cc
.
Label
).
font
;
// titleNode.getComponent(cc.RichText).string = `<outline align=top color=${outline}
// width=4>${name}</outline>`
titleNode
.
getComponent
(
cc
.
RichText
).
string
=
`<outline align=top color=
${
outline
}
width=4>
${
name
}
</outline>`
// const pos = exchangeNodePos(b, titleNode);
// titleNode.x = pos.x;
// titleNode.y = pos.y;
// titleNode.parent = b;
const
textPng
=
this
.
getSprNode
(
"
Game
"
);
titleNode
.
addChild
(
textPng
);
textPng
.
y
=
-
titleNode
.
height
;
textPng
.
active
=
false
;
titleNode
.
textPng
=
textPng
;
// const textPng = this.getSprNode("Game");
// titleNode.addChild(textPng);
// textPng.y = -titleNode.height;
// textPng.active = false;
// titleNode.textPng = textPng;
});
...
...
@@ -271,33 +277,38 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
pa
=
parent
.
getComponent
(
'
Attributes
'
);
const
{
outline
}
=
pa
.
attrMap
;
// const name = lesson.name;
// const richText = titleNode.getComponent(cc.RichText);
// if ( !richText.fontSizeBase ) {
// richText.fontSizeBase = richText.fontSize;
// }
// richText.fontSize = richText.fontSizeBase;
// if (name.length > 14) {
// richText.fontSize = richText.fontSizeBase * 0.7;
// }
// richText.font = cc.find("Canvas/res/font/BRLNSDB").getComponent(cc.Label).font;
// console.log('idx: ', idx);
// console.log("传入按钮名1:", name);
// titleNode.getComponent(cc.RichText).string = `<outline align=top color=${outline}
// width=4>${name}</outline>`;
// console.log("显示按钮名1:", titleNode.getComponent(cc.RichText).string);
// console.log('titleNode.x: ', titleNode.x);
// console.log('titleNode.y: ', titleNode.y);
// console.log('titleNode.active: ', titleNode.active);
// console.log('titleNode.parent.x: ', titleNode.parent.x);
// console.log('titleNode.parent.y: ', titleNode.parent.y);
// console.log('titleNode.parent.active: ', titleNode.parent.active);
titleNode
.
textPng
.
active
=
true
;
const
name
=
lesson
.
name
;
const
richText
=
titleNode
.
getComponent
(
cc
.
RichText
);
if
(
!
richText
.
fontSizeBase
)
{
richText
.
fontSizeBase
=
richText
.
fontSize
;
}
richText
.
fontSize
=
richText
.
fontSizeBase
;
if
(
name
.
length
>
14
)
{
richText
.
fontSize
=
richText
.
fontSizeBase
*
0.7
;
}
richText
.
font
=
cc
.
find
(
"
Canvas/res/font/BRLNSDB
"
).
getComponent
(
cc
.
Label
).
font
;
console
.
log
(
'
idx:
'
,
idx
);
console
.
log
(
"
传入按钮名1:
"
,
name
);
titleNode
.
getComponent
(
cc
.
RichText
).
string
=
`<outline align=top color=
${
outline
}
width=4>
${
name
}
</outline>`
;
const
pos
=
exchangeNodePos
(
b
,
titleNode
);
titleNode
.
x
=
pos
.
x
;
titleNode
.
y
=
pos
.
y
;
titleNode
.
parent
=
b
;
console
.
log
(
"
显示按钮名1:
"
,
titleNode
.
getComponent
(
cc
.
RichText
).
string
);
console
.
log
(
'
titleNode.x:
'
,
titleNode
.
x
);
console
.
log
(
'
titleNode.y:
'
,
titleNode
.
y
);
console
.
log
(
'
titleNode.active:
'
,
titleNode
.
active
);
console
.
log
(
'
titleNode.parent.x:
'
,
titleNode
.
parent
.
x
);
console
.
log
(
'
titleNode.parent.y:
'
,
titleNode
.
parent
.
y
);
console
.
log
(
'
titleNode.parent.active:
'
,
titleNode
.
parent
.
active
);
// delayCall(1, () => {
...
...
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