Commit 060c04e3 authored by 范雪寒's avatar 范雪寒
parents 4c3ebb4b 14b5f51a
...@@ -76,18 +76,21 @@ ...@@ -76,18 +76,21 @@
}, },
{ {
"__id__": 8 "__id__": 8
},
{
"__id__": 41
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 41 "__id__": 49
}, },
{ {
"__id__": 42 "__id__": 50
}, },
{ {
"__id__": 43 "__id__": 51
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1988,6 +1991,399 @@ ...@@ -1988,6 +1991,399 @@
"_originalHeight": 0, "_originalHeight": 0,
"_id": "8b0eLwnbJAEL6CYDp9IT3T" "_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
},
{
"__id__": 48
}
],
"_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.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 41
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 41
},
"_id": "9dG7baF/9HzqX1HgbFVbkE"
},
{ {
"__type__": "cc.Canvas", "__type__": "cc.Canvas",
"_name": "", "_name": "",
......
import { asyncCallNetworkApiGet, asyncDelay, buttonOnClick, jumpToBundle, onHomeworkFinish } from "../script/util"; import { asyncCallNetworkApiGet, asyncDelay, buttonOnClick, jumpToBundle, onHomeworkFinish, getSpriteFrimeByUrl } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent"; import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
...@@ -11,7 +11,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -11,7 +11,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
async onLoadEnd() { async onLoadEnd() {
await this.initData(); await this.initData();
this.initView(); await this.initView();
this.initListener(); this.initListener();
} }
...@@ -36,7 +36,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -36,7 +36,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
console.log(this.classData); console.log(this.classData);
} }
initView() { async initView() {
const canvas = cc.find('Canvas'); const canvas = cc.find('Canvas');
const sky = cc.find('Canvas/bg_sky'); const sky = cc.find('Canvas/bg_sky');
sky.scale = Math.max( sky.scale = Math.max(
...@@ -55,6 +55,19 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -55,6 +55,19 @@ export default class SceneComponent extends MyCocosSceneComponent {
canvas.width / (box.width * ground.scale), canvas.width / (box.width * ground.scale),
(canvas.height - 100) / ((box.height + 100) * ground.scale) (canvas.height - 100) / ((box.height + 100) * ground.scale)
); );
// 头像等基本信息
const middleLayer = cc.find('middleLayer');
if (!middleLayer) {
return;
}
const kidInfo = await middleLayer.getComponent('middleLayer').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() { initListener() {
...@@ -92,5 +105,11 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -92,5 +105,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
buttonOnClick(btn_center, () => { buttonOnClick(btn_center, () => {
jumpToBundle('NJ_usercenter'); jumpToBundle('NJ_usercenter');
}); });
const avatar_border = cc.find('Canvas/avatar_border');
buttonOnClick(avatar_border, () => {
middleLayerComponent.showConfirm("确定退出?", () => {
jumpToBundle('NJ_login');
});
});
} }
} }
...@@ -87,7 +87,7 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -87,7 +87,7 @@ export class MyCocosSceneComponent extends cc.Component {
preload() { preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList); const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => { cc.assetManager.loadAny(preloadArr, null, null, async (err, data) => {
if (window && window["air"]) { if (window && window["air"]) {
// window["air"].onCourseInScreen = (next) => { // window["air"].onCourseInScreen = (next) => {
...@@ -95,7 +95,7 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -95,7 +95,7 @@ export class MyCocosSceneComponent extends cc.Component {
// this.onLoadEnd(); // this.onLoadEnd();
// next(); // next();
// }; // };
this.onLoadEnd(); await this.onLoadEnd();
window["air"].hideAirClassLoading(); window["air"].hideAirClassLoading();
} else { } else {
this.onLoadEnd(); this.onLoadEnd();
......
{
"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
{
"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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment