Commit 0c290c6a authored by liujiangnan's avatar liujiangnan

feat

parent fcd1f274
...@@ -93,7 +93,7 @@ cc.Class({ ...@@ -93,7 +93,7 @@ cc.Class({
const nickObj = await drawOpenNickName(res.nickName); const nickObj = await drawOpenNickName(res.nickName);
await asyncCallNetworkApiPost('/api/douyin/v1/create', {roomid: this.roomId, uid: this.uid, nickname: nickObj.data, role: this.role}); await asyncCallNetworkApiPost('/api/douyin/v1/create', {roomid: this.roomId, uid: this.uid, nickname: JSON.stringify(nickObj), role: this.role});
if (this.role == 'anchor') { if (this.role == 'anchor') {
// 主播 // 主播
cc.director.loadScene('wordgame_syllabus'); cc.director.loadScene('wordgame_syllabus');
......
...@@ -62,7 +62,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -62,7 +62,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.find(`ready`,itemClone).active = false; cc.find(`ready`,itemClone).active = false;
cc.find(`score`,itemClone).active = true; cc.find(`score`,itemClone).active = true;
cc.find(`score`,itemClone).getComponent(cc.Label).string = row.score; cc.find(`score`,itemClone).getComponent(cc.Label).string = row.score;
await this.drawNickName(itemClone, row.nick_name); await this.drawNickName(itemClone, JSON.parse(row.nickObj));
} }
} else { } else {
this.rankpage.active = false; this.rankpage.active = false;
...@@ -74,7 +74,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -74,7 +74,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}, 1); }, 1);
} }
drawNickName(node, data) { drawNickName(node, nickObj) {
return new Promise((resolve) => { return new Promise((resolve) => {
const image = new Image(); const image = new Image();
image.onload = () => { image.onload = () => {
...@@ -84,12 +84,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -84,12 +84,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
const spriteFrame = new cc.SpriteFrame(texture); const spriteFrame = new cc.SpriteFrame(texture);
const coverNode = cc.find(`nickname`, node); const coverNode = cc.find(`nickname`, node);
coverNode.getComponent(cc.Sprite).spriteFrame = spriteFrame; coverNode.getComponent(cc.Sprite).spriteFrame = spriteFrame;
// const sx = nickObj.width / coverNode.width; const sx = nickObj.width / coverNode.width;
// const sy = nickObj.height / coverNode.height; const sy = nickObj.height / coverNode.height;
// coverNode.scale = Math.max(sx, sy); coverNode.scale = Math.max(sx, sy);
resolve(); resolve();
} }
image.src = data; image.src = nickObj.data;
}); });
} }
......
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