Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
NJ_YouLeChang
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_YouLeChang
Commits
46c3f9ea
Commit
46c3f9ea
authored
May 30, 2022
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 头像
parent
0591d703
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
421 additions
and
8 deletions
+421
-8
NJ_YouLeChang.fire
assets/NJ_YouLeChang/scene/NJ_YouLeChang.fire
+326
-5
NJ_YouLeChang.ts
assets/NJ_YouLeChang/scene/NJ_YouLeChang.ts
+23
-3
avatar_border.png
assets/NJ_YouLeChang/textures/avatar_border.png
+0
-0
avatar_border.png.meta
assets/NJ_YouLeChang/textures/avatar_border.png.meta
+36
-0
defaulte_avatar.png
assets/NJ_YouLeChang/textures/defaulte_avatar.png
+0
-0
defaulte_avatar.png.meta
assets/NJ_YouLeChang/textures/defaulte_avatar.png.meta
+36
-0
No files found.
assets/NJ_YouLeChang/scene/NJ_YouLeChang.fire
View file @
46c3f9ea
...
...
@@ -76,18 +76,21 @@
},
{
"__id__": 8
},
{
"__id__": 41
}
],
"_active": true,
"_components": [
{
"__id__": 4
1
"__id__": 4
8
},
{
"__id__": 4
2
"__id__": 4
9
},
{
"__id__":
43
"__id__":
50
}
],
"_prefab": null,
...
...
@@ -543,8 +546,6 @@
"__id__": 9
},
"_enabled": true,
"label": null,
"text": "hello",
"_id": "ff9uNaGnhEcLHHfM+YJKBe"
},
{
...
...
@@ -1990,6 +1991,326 @@
"_originalHeight": 0,
"_id": "8b0eLwnbJAEL6CYDp9IT3T"
},
{
"__type__": "cc.Node",
"_name": "avatar_border",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 42
},
{
"__id__": 44
}
],
"_active": true,
"_components": [
{
"__id__": 46
},
{
"__id__": 47
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 140,
"height": 140
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-550,
270,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "138S2J5/NAsI3yuuWqCC1i"
},
{
"__type__": "cc.Node",
"_name": "nick_name",
"_objFlags": 0,
"_parent": {
"__id__": 41
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 43
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 120,
"height": 37.8
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
74.574,
36.423,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "05x/se8vVNKJRfu76R91g8"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 42
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "拼读达人",
"_N$string": "拼读达人",
"_fontSize": 30,
"_lineHeight": 30,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "afimnR8BRMopbhdzfkAYV3"
},
{
"__type__": "cc.Node",
"_name": "defaulte_avatar",
"_objFlags": 0,
"_parent": {
"__id__": 41
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 45
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 130,
"height": 130
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "942oczS95A9bySadrmDJDi"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 44
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "c5a3d5a2-9772-44ff-a2e4-53ea3b0c7ebd"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "93AkchfING+49fJM2+uZLo"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 41
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "d9666997-f9e2-442a-b7d6-b0784a1cbb53"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "2cA2zwycNA8Z4mBiUzgQXG"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 41
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 9,
"_left": 20,
"_right": 0,
"_top": 20,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "fdY3+F8RNG1aR9W0nM4FrH"
},
{
"__type__": "cc.Canvas",
"_name": "",
...
...
assets/NJ_YouLeChang/scene/NJ_YouLeChang.ts
View file @
46c3f9ea
import
{
asyncCallNetworkApiGet
,
asyncDelay
,
buttonOnClick
,
jumpToBundle
,
onHomeworkFinish
}
from
"
../script/util
"
;
import
{
asyncCallNetworkApiGet
,
asyncDelay
,
buttonOnClick
,
jumpToBundle
,
onHomeworkFinish
,
getSpriteFrimeByUrl
}
from
"
../script/util
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -11,7 +11,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
async
onLoadEnd
()
{
await
this
.
initData
();
this
.
initView
();
await
this
.
initView
();
this
.
initListener
();
}
...
...
@@ -36,7 +36,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
console
.
log
(
this
.
classData
);
}
initView
()
{
async
initView
()
{
const
canvas
=
cc
.
find
(
'
Canvas
'
);
const
sky
=
cc
.
find
(
'
Canvas/bg_sky
'
);
sky
.
scale
=
Math
.
max
(
...
...
@@ -55,6 +55,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
canvas
.
width
/
(
box
.
width
*
ground
.
scale
),
(
canvas
.
height
-
100
)
/
((
box
.
height
+
100
)
*
ground
.
scale
)
);
// 头像等基本信息
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
!
middleLayer
)
{
return
;
}
const
getUserInfo
=
middleLayer
.
getComponent
(
'
middleLayer
'
).
getUserInfo
;
const
kidInfo
=
await
getUserInfo
();
cc
.
find
(
"
Canvas/avatar_border/nick_name
"
).
getComponent
(
cc
.
Label
).
string
=
kidInfo
.
nick_name
;
const
avatarUrl
=
middleLayer
.
getComponent
(
'
middleLayer
'
).
getHeadUrl
(
kidInfo
.
avatar_url
||
1
);
getSpriteFrimeByUrl
(
avatarUrl
,
(
spriteFrame
)
=>
{
cc
.
find
(
"
Canvas/avatar_border/defaulte_avatar
"
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
spriteFrame
;
});
}
initListener
()
{
...
...
@@ -92,5 +106,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
buttonOnClick
(
btn_center
,
()
=>
{
jumpToBundle
(
'
NJ_usercenter
'
);
});
const
avatar_border
=
cc
.
find
(
'
Canvas/avatar_border
'
);
buttonOnClick
(
avatar_border
,
()
=>
{
middleLayerComponent
.
showConfirm
(
"
确定退出?
"
,
()
=>
{
jumpToBundle
(
'
NJ_login
'
);
});
});
}
}
assets/NJ_YouLeChang/textures/avatar_border.png
0 → 100644
View file @
46c3f9ea
4.12 KB
assets/NJ_YouLeChang/textures/avatar_border.png.meta
0 → 100644
View file @
46c3f9ea
{
"ver": "2.3.5",
"uuid": "5f6a1d44-a5e7-411f-a22c-55c1a88643b4",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 140,
"height": 140,
"platformSettings": {},
"subMetas": {
"avatar_border": {
"ver": "1.0.4",
"uuid": "d9666997-f9e2-442a-b7d6-b0784a1cbb53",
"rawTextureUuid": "5f6a1d44-a5e7-411f-a22c-55c1a88643b4",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 140,
"height": 140,
"rawWidth": 140,
"rawHeight": 140,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/NJ_YouLeChang/textures/defaulte_avatar.png
0 → 100644
View file @
46c3f9ea
103 KB
assets/NJ_YouLeChang/textures/defaulte_avatar.png.meta
0 → 100644
View file @
46c3f9ea
{
"ver": "2.3.5",
"uuid": "0184f7d4-46c8-4de2-a44e-461192b9ce08",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 320,
"height": 320,
"platformSettings": {},
"subMetas": {
"defaulte_avatar": {
"ver": "1.0.4",
"uuid": "c5a3d5a2-9772-44ff-a2e4-53ea3b0c7ebd",
"rawTextureUuid": "0184f7d4-46c8-4de2-a44e-461192b9ce08",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 320,
"height": 320,
"rawWidth": 320,
"rawHeight": 320,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ 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