更新各种头像昵称

This commit is contained in:
COMPUTER\EDY 2026-01-28 17:53:43 +08:00
parent ea5de9114f
commit d2d030b311
20 changed files with 13018 additions and 12094 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -90,12 +90,19 @@ export default class Avatar extends cc.Component {
// this.content2.getChildByName(this.avatarKuang).getChildByName("select").active = true;
console.log("获取进入头像:", this.avatar);
if (this.avatar.length > 10) {
this.node.getChildByName("self").getChildByName("icon").getChildByName("sp").active = false;
this.node.getChildByName("self").getChildByName("icon").getChildByName("texture").active = true;
this.setSelfAvatar(true);
}
else {
console.log("没有头像", this.avatar);
this.node.getChildByName("self").getChildByName("icon").getChildByName("texture").getComponent(cc.Sprite).spriteFrame =
this.ui.getSpriteFrame(this.avatar);
this.node.getChildByName("self").getChildByName("icon").getChildByName("sp").active = true;
this.node.getChildByName("self").getChildByName("icon").getChildByName("texture").active = false;
let actionName = cc.fx.GameTool.getActionName(this.avatar);
this.node.getChildByName("self").getChildByName("icon").getChildByName("sp").scale = 0.85;
cc.fx.GameTool.loadSpineSimple(this.node.getChildByName("self").getChildByName("icon").getChildByName("sp"), actionName);
// this.node.getChildByName("self").getChildByName("icon").getChildByName("texture").getComponent(cc.Sprite).spriteFrame =
// this.ui.getSpriteFrame(this.avatar);
}
this.node.getChildByName("self").getChildByName("kuang").getComponent(cc.Sprite).spriteFrame =
@ -207,43 +214,43 @@ export default class Avatar extends cc.Component {
this.content.children[4].getChildByName("select").active = true;
break
case "icon_4":
this.content.children[5].getChildByName("select").active = true;
this.content.children[4].getChildByName("select").active = true;
break;
case "icon_5":
this.content.children[6].getChildByName("select").active = true;
this.content.children[5].getChildByName("select").active = true;
break;
case "icon_6":
this.content.children[7].getChildByName("select").active = true;
this.content.children[6].getChildByName("select").active = true;
break;
case "icon_7":
this.content.children[8].getChildByName("select").active = true;
this.content.children[7].getChildByName("select").active = true;
break;
case "icon_8":
this.content.children[9].getChildByName("select").active = true;
this.content.children[8].getChildByName("select").active = true;
break;
case "icon_9":
this.content.children[10].getChildByName("select").active = true;
this.content.children[9].getChildByName("select").active = true;
break;
case "icon_10":
this.content.children[11].getChildByName("select").active = true;
this.content.children[9].getChildByName("select").active = true;
break;
case "icon_11":
this.content.children[12].getChildByName("select").active = true;
this.content.children[10].getChildByName("select").active = true;
break;
case "icon_12":
this.content.children[13].getChildByName("select").active = true;
this.content.children[11].getChildByName("select").active = true;
break;
case "icon_13":
this.content.children[14].getChildByName("select").active = true;
this.content.children[12].getChildByName("select").active = true;
break;
case "icon_14":
this.content.children[15].getChildByName("select").active = true;
this.content.children[11].getChildByName("select").active = true;
break;
case "icon_15":
this.content.children[16].getChildByName("select").active = true;
this.content.children[13].getChildByName("select").active = true;
break;
case "icon_16":
this.content.children[17].getChildByName("select").active = true;
this.content.children[14].getChildByName("select").active = true;
break;
default:
if (this.avatar.length > 10) {
@ -283,11 +290,18 @@ export default class Avatar extends cc.Component {
cc.fx.GameConfig.GM_INFO.useravatarIcon = this.avatar;
if (cc.fx.GameConfig.GM_INFO.useravatarIcon.length > 10) {
cc.fx.GameConfig.GM_INFO.useravatarIcon = cc.fx.GameConfig.GM_INFO.useravatar;
this.node.getChildByName("self").getChildByName("icon").getChildByName("sp").active = false;
this.node.getChildByName("self").getChildByName("icon").getChildByName("texture").active = true;
this.setSelfAvatar(true);
}
else {
this.node.getChildByName("self").getChildByName("icon").getChildByName("texture").getComponent(cc.Sprite).spriteFrame =
this.ui.getSpriteFrame(this.avatar);
this.node.getChildByName("self").getChildByName("icon").getChildByName("sp").active = true;
this.node.getChildByName("self").getChildByName("icon").getChildByName("texture").active = false;
let actionName = cc.fx.GameTool.getActionName(this.avatar);
this.node.getChildByName("self").getChildByName("icon").getChildByName("sp").scale = 0.85;
cc.fx.GameTool.loadSpineSimple(this.node.getChildByName("self").getChildByName("icon").getChildByName("sp"), actionName);
// this.node.getChildByName("self").getChildByName("icon").getChildByName("texture").getComponent(cc.Sprite).spriteFrame =
// this.ui.getSpriteFrame(this.avatar);
}
}
else {
@ -325,14 +339,16 @@ export default class Avatar extends cc.Component {
}
switchAddress(event, address) {
this.address = address;
cc.fx.GameConfig.GM_INFO.address = this.address;
let node = this.content2.getChildByName(this.address);
if (cc.fx.GameConfig.GM_INFO.address != address) {
cc.fx.GameConfig.GM_INFO.address = address;
}
let node = this.content2.getChildByName(address);
if (node) {
this.content2.getChildByName("choice").active = true;
this.content2.getChildByName("choice").x = node.x;
this.content2.getChildByName("choice").y = node.y;
let name = this.address;
let name = address;
if (name != "北京" && name != "天津" && name != "上海" && name != "重庆" && name != "广西" && name != "新疆" && name != "西藏" && name != "宁夏" && name != "港澳台" && name != "内蒙古") {
name = name.substring(0, name.length - 1);
}
@ -398,44 +414,54 @@ export default class Avatar extends cc.Component {
}
closeAddress() {
let Info = this.node.getChildByName("Info");
//用户城市
let city = cc.fx.GameConfig.GM_INFO.address;
if (city == "北京" || city == "上海" || city == "重庆" || city == "天津") {
city = city + "市";
if (this.address != cc.fx.GameConfig.GM_INFO.address) {
this.address = cc.fx.GameConfig.GM_INFO.address;
let Info = this.node.getChildByName("Info");
//用户城市
let city = cc.fx.GameConfig.GM_INFO.address;
if (city == "北京" || city == "上海" || city == "重庆" || city == "天津") {
city = city + "市";
}
Info.getChildByName("Address").getComponent(cc.Label).string = city + "";
let nowTime = Math.floor(Date.now() / 1000);
let addressInfo = {
address: cc.fx.GameConfig.GM_INFO.address,
time: nowTime,
authorize: false
}
cc.fx.StorageMessage.setStorage("address", addressInfo);
Utils.setCityInfo(null, cc.fx.GameConfig.GM_INFO.address, true);
let locationInfo = {
type: "manual",
result: cc.fx.GameConfig.GM_INFO.address,
is_success: true,
info: ""
}
cc.fx.GameTool.shushu_Track("location", locationInfo);
let changeCount = 0;
let change = cc.fx.StorageMessage.getStorage("changeAddress");
//没缓存过,没授权过
if (change == "" || change == null || change == undefined) {
// changeCount = 1;
changeCount += 1;
}
else {
changeCount = change.changeCount + 1;
}
let changeInfo = {
time: nowTime,
changeCount: changeCount
}
cc.fx.StorageMessage.setStorage("changeAddress", changeInfo);
}
Info.getChildByName("Address").getComponent(cc.Label).string = city + "";
this.node.getChildByName("address").active = false;
let nowTime = Math.floor(Date.now() / 1000);
let addressInfo = {
address: cc.fx.GameConfig.GM_INFO.address,
time: nowTime,
authorize: false
}
cc.fx.StorageMessage.setStorage("address", addressInfo);
Utils.setCityInfo(null, cc.fx.GameConfig.GM_INFO.address, true);
let locationInfo = {
type: "manual",
result: cc.fx.GameConfig.GM_INFO.address,
is_success: true,
info: ""
}
cc.fx.GameTool.shushu_Track("location", locationInfo);
let changeCount = 0;
let change = cc.fx.StorageMessage.getStorage("changeAddress");
//没缓存过,没授权过
if (change == "" || change == null || change == undefined) {
// changeCount = 1;
changeCount += 1;
}
else {
changeCount = change.changeCount + 1;
}
let changeInfo = {
time: nowTime,
changeCount: changeCount
}
cc.fx.StorageMessage.setStorage("changeAddress", changeInfo);
const jiazaiNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点
const jiazaiComp = jiazaiNode.getComponent(JiaZai);
if (jiazaiComp) {

View File

@ -255,6 +255,10 @@ export default class GameManager extends cc.Component {
}
if (data.data.useravatar) {
cc.fx.GameConfig.GM_INFO.useravatarIcon = data.data.useravatar;
if (cc.fx.GameConfig.GM_INFO.useravatarIcon == "4")
cc.fx.GameConfig.GM_INFO.useravatarIcon = "5";
else if (cc.fx.GameConfig.GM_INFO.useravatarIcon == "10" || cc.fx.GameConfig.GM_INFO.useravatarIcon == "14")
cc.fx.GameConfig.GM_INFO.useravatarIcon = "7";
if (cc.fx.GameConfig.GM_INFO.useravatarIcon) {
if (cc.fx.GameConfig.GM_INFO.useravatarIcon.length < 10)
cc.fx.GameConfig.GM_INFO.useravatarIcon = "icon_" + cc.fx.GameConfig.GM_INFO.useravatarIcon

View File

@ -153,7 +153,7 @@ export default class JiaZai extends cc.Component {
this.shareTime = 0;
this.node.getChildByName("Snow").active = false;
this.node.getChildByName("Snow").zIndex = 999;
console.log("最新版本___________");
this.node.getChildByName("zhuanchang").zIndex = 1000;
this.careerRank = null;
this.closeLoad();
@ -172,7 +172,7 @@ export default class JiaZai extends cc.Component {
this.checkAndSetPlayerPassLevel();
// this.checkDailyQuests();
console.log("进入首页获取的share", cc.fx.GameConfig.GM_INFO.otherUid, cc.fx.GameConfig.GM_INFO.otherLevel);
// console.log("进入首页获取的share", cc.fx.GameConfig.GM_INFO.otherUid, cc.fx.GameConfig.GM_INFO.otherLevel);
cc.game.setFrameRate(63);
@ -238,7 +238,7 @@ export default class JiaZai extends cc.Component {
return;
}
JiaZai.cachedAvatarPrefab = prefab;
console.log("头像预制体已经准备好");
// console.log("头像预制体已经准备好");
});
bundle.load('prefab/dailyQuests', cc.Prefab, (err: Error, prefab: cc.Prefab) => {
if (err) {
@ -246,7 +246,7 @@ export default class JiaZai extends cc.Component {
return;
}
JiaZai.cachedDailyQuestsPrefab = prefab;
console.log("每日任务预制体已经准备好");
// console.log("每日任务预制体已经准备好");
});
bundle.load('prefab/winStreak', cc.Prefab, (err: Error, prefab: cc.Prefab) => {
if (err) {
@ -254,7 +254,7 @@ export default class JiaZai extends cc.Component {
return;
}
JiaZai.cachedWinStreakPrefab = prefab;
console.log("连胜活动预制体已经准备好");
// console.log("连胜活动预制体已经准备好");
});
bundle.load('prefab/Share', cc.Prefab, (err: Error, prefab: cc.Prefab) => {
if (err) {
@ -262,7 +262,7 @@ export default class JiaZai extends cc.Component {
return;
}
JiaZai.cachedSharePrefab = prefab;
console.log("分享预制体已经准备好");
// console.log("分享预制体已经准备好");
});
@ -733,13 +733,15 @@ export default class JiaZai extends cc.Component {
}
closeAvatar() {
console.log("最终头像:", cc.fx.GameConfig.GM_INFO.useravatarIcon);
console.log("最终头像框:", cc.fx.GameConfig.GM_INFO.useravaterkuang);
// console.log("最终头像:", cc.fx.GameConfig.GM_INFO.useravatarIcon);
// console.log("最终头像框:", cc.fx.GameConfig.GM_INFO.useravaterkuang);
let top = this.node.getChildByName("Load").getChildByName("Top");
if (this.AvatarNode) this.AvatarNode.active = false;
if (cc.fx.GameConfig.GM_INFO.useravatarIcon) {
if (cc.fx.GameConfig.GM_INFO.useravatarIcon.length > 10) {
console.log("获取头像链接:", cc.fx.GameConfig.GM_INFO.useravatarIcon);
// console.log("获取头像链接:", cc.fx.GameConfig.GM_INFO.useravatarIcon);
top.getChildByName("avatar").getChildByName("avatar").active = true;
top.getChildByName("avatar").getChildByName("sp").active = false;
cc.assetManager.loadRemote(cc.fx.GameConfig.GM_INFO.useravatarIcon, { ext: '.png' }, (err, texture: cc.Texture2D) => {
if (texture) {
top.getChildByName("avatar").getChildByName("avatar").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
@ -748,8 +750,13 @@ export default class JiaZai extends cc.Component {
top.getChildByName("kuang1").opacity = 255;
})
} else {
top.getChildByName("avatar").getChildByName("avatar").getComponent(cc.Sprite).spriteFrame =
this.avatarUI.getSpriteFrame(cc.fx.GameConfig.GM_INFO.useravatarIcon);
top.getChildByName("avatar").getChildByName("avatar").active = false;
top.getChildByName("avatar").getChildByName("sp").active = true;
let actionName = cc.fx.GameTool.getActionName(cc.fx.GameConfig.GM_INFO.useravatarIcon);
top.getChildByName("avatar").getChildByName("sp").scale = 0.8;
cc.fx.GameTool.loadSpineSimple(top.getChildByName("avatar").getChildByName("sp"), actionName);
// top.getChildByName("avatar").getChildByName("avatar").getComponent(cc.Sprite).spriteFrame =
// this.avatarUI.getSpriteFrame(cc.fx.GameConfig.GM_INFO.useravatarIcon);
top.getChildByName("avatar").opacity = 255;
top.getChildByName("kuang1").opacity = 255;
}
@ -1027,7 +1034,7 @@ export default class JiaZai extends cc.Component {
// 最大关卡后第一次进入关卡弹窗
enterGame() {
let recordInfinity = cc.fx.StorageMessage.getStorage("EndLevelPop");
console.log("已经最大关卡 弹窗提示", recordInfinity, cc.fx.GameTool.maxLevel())
// console.log("已经最大关卡 弹窗提示", recordInfinity, cc.fx.GameTool.maxLevel())
if (cc.fx.GameTool.maxLevel()) {
if (recordInfinity == null || recordInfinity == "") {
// 没有弹过窗
@ -2149,19 +2156,19 @@ export default class JiaZai extends cc.Component {
//检测当日是否有分享行为,用不用主动获取分享关卡信息
checkShare() {
const otherInfo = cc.fx.StorageMessage.getStorage("otherLevel");
console.log("分享信息:", otherInfo);
// console.log("分享信息:", otherInfo);
if (otherInfo != null && otherInfo != undefined && otherInfo != "") {
const currentTime = Date.now();
const timeDifference = currentTime - otherInfo.timeStamp;
const oneDayInMilliseconds = 24 * 60 * 60 * 1000;
console.log("计入时间计算");
// console.log("计入时间计算");
if (timeDifference > oneDayInMilliseconds || cc.fx.GameConfig.GM_INFO.level >= otherInfo.otherLevel) {
console.log("_______________检查分享信息过期或已获取过清除存储信息");
// console.log("_______________检查分享信息过期或已获取过清除存储信息");
cc.fx.StorageMessage.setStorage("otherLevel", null);
}
else {
// if ((cc.fx.GameConfig.GM_INFO.level + 1) == otherInfo.otherLevel) {
console.log("_______________有分享信息并且符合条件");
// console.log("_______________有分享信息并且符合条件");
Utils.getShareLevel((res) => {
if (res.code == 1 && res.data) {
if (res.data.length > 0) {
@ -2243,7 +2250,7 @@ export default class JiaZai extends cc.Component {
}
setShareInfo() {
console.log("设置分享信息");
// console.log("设置分享信息");
MiniGameSdk.API.shareAppToFriends();
}
@ -2252,7 +2259,7 @@ export default class JiaZai extends cc.Component {
let top = this.node.getChildByName("Load").getChildByName("Top");
top.getChildByName("day").getChildByName("red").active = false;
if (cc.fx.GameConfig.GM_INFO.tasks.levelPass.target == 0) {
console.log("没有获取任务列表从服务器拿");
// console.log("没有获取任务列表从服务器拿");
cc.fx.GameTool.getDailyQuestsInfo((data) => {
if (data.code == 1) {
let res = data.data.task;
@ -2418,7 +2425,7 @@ export default class JiaZai extends cc.Component {
}
popUpPassCheck() {
console.log("弹出通行证", cc.fx.GameConfig.GM_INFO.popPassCheck)
// console.log("弹出通行证", cc.fx.GameConfig.GM_INFO.popPassCheck)
if (cc.fx.GameConfig.GM_INFO.popPassCheck) {
let date = new Date();
let day = date.getDate(); // 当前日期1-31
@ -2978,13 +2985,13 @@ export default class JiaZai extends cc.Component {
}
closePassCheck() {
console.log("关闭过时数据", cc.fx.GameConfig.GM_INFO.getItemType)
// console.log("关闭过时数据", cc.fx.GameConfig.GM_INFO.getItemType)
this.checkAndSetPlayerPassLevel();
}
//获取入职排行榜
getSRank(isShow: boolean = true) {
console.log("_________________________重新获取排行");
// console.log("_________________________重新获取排行");
if (this.RankNode == null && this.RankNode == undefined) {
this.LoadCareer(() => {
Utils.getSRank(res => {
@ -3044,16 +3051,16 @@ export default class JiaZai extends cc.Component {
rankData: JSON.parse(JSON.stringify(rankData)),
topData: JSON.parse(JSON.stringify(topData))
}
console.log("自己的addLevel", cc.fx.GameConfig.GM_INFO.addLevel);
// console.log("自己的addLevel", cc.fx.GameConfig.GM_INFO.addLevel);
if (cc.fx.GameConfig.GM_INFO.addLevel > 4) {
console.log("______________自己入职了");
// console.log("______________自己入职了");
this.addSelfToRank(rankData);
}
for (let i = 0; i < rankData.length; i++) {
rankData[i].rank = i + 1;
}
if (this.RankNode != null && this.RankNode != undefined) {
console.log("_________________________预制体已经加载好了准备渲染");
// console.log("_________________________预制体已经加载好了准备渲染");
this.node.getChildByName("Career").addChild(this.RankNode);
// this.node.getChildByName("Career").getChildByName("bg").parent = this.RankNode;
this.RankNode.opacity = 0;
@ -3063,12 +3070,12 @@ export default class JiaZai extends cc.Component {
.to(0.3, { opacity: 255 })
.delay(0.2)
.call(() => {
console.log("_________________________渲染完成");
// console.log("_________________________渲染完成");
this.node.getChildByName("Snow").active = true;
})
.start()
} else {
console.log("_________________________预制体已经加载好了准备渲染");
// console.log("_________________________预制体已经加载好了准备渲染");
this.LoadCareer(() => {
this.node.getChildByName("Career").addChild(this.RankNode);
// this.node.getChildByName("Career").getChildByName("bg").parent = this.RankNode;
@ -3079,7 +3086,7 @@ export default class JiaZai extends cc.Component {
.to(0.3, { opacity: 255 })
.delay(0.2)
.call(() => {
console.log("_________________________渲染完成");
// console.log("_________________________渲染完成");
this.node.getChildByName("Snow").active = true;
})
.start()
@ -3372,7 +3379,7 @@ export default class JiaZai extends cc.Component {
// 找到了对应的记录
startBtn.getChildByName("difficultySpr").active = true;
} else {
console.log("未找到关卡数据");
// console.log("未找到关卡数据");
}
}

View File

@ -4814,6 +4814,17 @@ export default class MapConroler extends cc.Component {
const anim = title.getChildByName("cai").getComponent(cc.Animation);
anim.defaultClip.speed = 0.5; // 全局默认速度
anim.play(); // 开始播放
let iphone = cc.fx.GameConfig.GM_INFO.useravatarIcon.substring(0, 4);
// console.log("头像_________", cc.fx.GameConfig.GM_INFO.useravatarIcon, cc.fx.GameConfig.GM_INFO.useravatar);
if (iphone == "icon") {
title.getChildByName("icon").getChildByName("icon").active = false;
title.getChildByName("icon").getChildByName("sp").active = true;
let actionName = cc.fx.GameTool.getActionName(cc.fx.GameConfig.GM_INFO.useravatarIcon);
title.getChildByName("icon").getChildByName("sp").scale = 1.15;
cc.fx.GameTool.loadSpineSimple(title.getChildByName("icon").getChildByName("sp"), actionName);
// this.icon.getComponent(cc.Sprite).spriteFrame = icon;
}
})
.to(0.12, { scale: 1.2 }, { easing: 'quadOut' })
.to(0.08, { scale: 0.85 }, { easing: 'quadIn' })
@ -4890,9 +4901,16 @@ export default class MapConroler extends cc.Component {
let iphone = cc.fx.GameConfig.GM_INFO.useravatarIcon.substring(0, 4);
// console.log("头像_________", cc.fx.GameConfig.GM_INFO.useravatarIcon, cc.fx.GameConfig.GM_INFO.useravatar);
if (iphone == "icon") {
ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = icon;
ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("icon").active = false;
ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("sp").active = true;
let actionName = cc.fx.GameTool.getActionName(cc.fx.GameConfig.GM_INFO.useravatarIcon);
ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("sp").scale = 1.15;
cc.fx.GameTool.loadSpineSimple(ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("sp"), actionName);
// ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = icon;
}
else if (iphone == "http") {
ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("icon").active = true;
ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("sp").active = false;
this.setPic(cc.fx.GameConfig.GM_INFO.useravatarIcon, ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("icon"));
}
if (cc.fx.GameConfig.GM_INFO.addLevel == 5) {
@ -4900,6 +4918,15 @@ export default class MapConroler extends cc.Component {
.delay(1)
.call(() => {
ruzhi.active = true;
if (iphone == "icon") {
ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("icon").active = false;
ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("sp").active = true;
let actionName = cc.fx.GameTool.getActionName(cc.fx.GameConfig.GM_INFO.useravatarIcon);
ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("sp").scale = 1.15;
cc.fx.GameTool.loadSpineSimple(ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("sp"), actionName);
// ruzhi.getChildByName("bg").getChildByName("icon").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = icon;
}
cc.tween(ruzhi.getChildByName("bg"))
.to(0.3, { rotation: -5, scaleX: 1, scaleY: 1 })
.start();

View File

@ -62,6 +62,9 @@ export default class SceneManager extends cc.Component {
@property(cc.Node)
icon: cc.Node = null;
@property(cc.Node)
sp: cc.Node = null;
@property(cc.Node)
kuang: cc.Node = null;
@ -178,9 +181,16 @@ export default class SceneManager extends cc.Component {
let iphone = cc.fx.GameConfig.GM_INFO.useravatarIcon.substring(0, 4);
// console.log("头像_________", cc.fx.GameConfig.GM_INFO.useravatarIcon, cc.fx.GameConfig.GM_INFO.useravatar);
if (iphone == "icon") {
this.icon.getComponent(cc.Sprite).spriteFrame = icon;
// this.icon.active = false;
// this.sp.active = true;
// let actionName = cc.fx.GameTool.getActionName(cc.fx.GameConfig.GM_INFO.useravatarIcon);
// this.sp.scale = 1.15;
// cc.fx.GameTool.loadSpineSimple(this.sp, actionName);
// this.icon.getComponent(cc.Sprite).spriteFrame = icon;
}
else if (iphone == "http") {
this.icon.active = true;
this.sp.active = false;
this.setPic(cc.fx.GameConfig.GM_INFO.useravatarIcon, this.icon);
}
}

View File

@ -221,7 +221,7 @@ export default class AudioManager extends cc.Component {
return this.play(this[name], false, callback, this.mEffectSwitch);
}
playMusic(key, callback, loop) {
console.log("音频开关________________________________________");
// console.log("音频开关________________________________________");
if (!cc.fx.GameConfig.GM_INFO.musicOpen) {
return;
}

View File

@ -60,7 +60,11 @@ export default class ItemRender extends cc.Component {
}
if (this.data.useravatar == "" || this.data.useravatar == null || this.data.useravatar == undefined
) {
this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.defaultsprite;
if (this.node.getChildByName("pic")) {
this.node.getChildByName("pic").getChildByName("pic").active = true;
this.node.getChildByName("pic").getChildByName("sp").active = false;
this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.defaultsprite;
}
}
else if (this.data.useravatar == "0" || this.data.useravatar == "1" || this.data.useravatar == "2"
|| this.data.useravatar == "3" || this.data.useravatar == "4" || this.data.useravatar == "5" || this.data.useravatar == "6"
@ -68,13 +72,20 @@ export default class ItemRender extends cc.Component {
|| this.data.useravatar == "11" || this.data.useravatar == "12" || this.data.useravatar == "13" || this.data.useravatar == "14"
|| this.data.useravatar == "15" || this.data.useravatar == "16" || this.data.useravatar == "17"
) {
let useravatar = this.data.useravatar;
let useravatarTemp = "icon_" + useravatar;
// console.log("用户头像:", useravatarTemp);
this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.ui.getSpriteFrame(useravatarTemp);
this.node.getChildByName("pic").getChildByName("pic").active = false;
this.node.getChildByName("pic").getChildByName("sp").active = true;
let actionName = cc.fx.GameTool.getActionName(this.data.useravatar);
this.node.getChildByName("pic").getChildByName("sp").scale = 0.6;
cc.fx.GameTool.loadSpineSimple(this.node.getChildByName("pic").getChildByName("sp"), actionName);
// this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.ui.getSpriteFrame(useravatarTemp);
}
else this.setPic();
else {
this.node.getChildByName("pic").getChildByName("pic").active = true;
this.node.getChildByName("pic").getChildByName("sp").active = false;
this.setPic();
}
}
public setPic() {

View File

@ -2182,5 +2182,105 @@ var GameTool = {
levelNum.x = 50 + numDigits * 15;
},
getActionName(useravatar: string) {
let actionName = "action01";
if (useravatar.length > 2) {
useravatar = useravatar.substring(5);
}
switch (useravatar) {
case "0":
actionName = "action03";
break;
case "1":
actionName = "action01";
break;
case "2":
actionName = "action09";
break;
case "3":
actionName = "action07";
break;
case "4":
actionName = "action04";
break;
case "5":
actionName = "action04";
break;
case "6":
actionName = "action05";
break;
case "7":
actionName = "action06";
break;
case "8":
actionName = "action02";
break;
case "9":
actionName = "action11";
break;
case "10":
actionName = "action06";
break;
case "11":
actionName = "action15";
break;
case "12":
actionName = "action13";
break;
case "13":
actionName = "action16";
break;
case "14":
actionName = "action06";
break;
case "15":
actionName = "action14";
break;
case "16":
actionName = "action18";
break;
}
return actionName;
},
loadSpineSimple(iconNode: cc.Node, spineName: string) {
// 构建spine资源路径
const spinePath = `spine/${spineName}/skeleton`;
// 加载spine资源
cc.resources.load(spinePath, sp.SkeletonData, (err: Error, skeletonData: sp.SkeletonData) => {
if (err) {
console.error(`加载spine资源失败: ${spinePath}`, err);
return;
}
// 检查节点是否已经有spine组件
let spineComponent = iconNode.getComponent(sp.Skeleton);
if (!spineComponent) {
// 如果没有spine组件添加一个
spineComponent = iconNode.addComponent(sp.Skeleton);
}
// 设置skeleton数据
spineComponent.skeletonData = skeletonData;
let actionNumber = "";
if (spineName.startsWith("action")) {
actionNumber = spineName.substring(6); // 提取"action"后面的部分
}
spineComponent.setAnimation(0, actionNumber, true);
// 设置spine组件属性
spineComponent.premultipliedAlpha = true;
spineComponent.timeScale = 1.0;
});
}
};
export { GameTool };

View File

@ -326,13 +326,24 @@ export default class ranking extends cc.Component {
if (this.selfInfo.useravatar == "" || this.selfInfo.useravatar == null || this.selfInfo.useravatar == undefined
) {
this.selfNode.getChildByName("pic").getChildByName("pic").active = true;
this.selfNode.getChildByName("pic").getChildByName("sp").active = false;
this.selfNode.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.defaultsprite;
}
else if (this.selfInfo.useravatar.substring(0, 4) == "icon") {
this.selfNode.getChildByName("pic").getChildByName("pic").active = false;
this.selfNode.getChildByName("pic").getChildByName("sp").active = true;
let useravatar = this.selfInfo.useravatar;
this.selfNode.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.ui.getSpriteFrame(useravatar);
let actionName = cc.fx.GameTool.getActionName(useravatar);
this.selfNode.getChildByName("pic").getChildByName("sp").scale = 0.6;
cc.fx.GameTool.loadSpineSimple(this.selfNode.getChildByName("pic").getChildByName("sp"), actionName);
// this.selfNode.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.ui.getSpriteFrame(useravatar);
}
else {
this.selfNode.getChildByName("pic").getChildByName("pic").active = true;
this.selfNode.getChildByName("pic").getChildByName("sp").active = false;
this.setPic();
}
else this.setPic();
this.selfNode.opacity = 255;
}

File diff suppressed because it is too large Load Diff

View File

@ -41,9 +41,6 @@
{
"__id__": 29
},
{
"__id__": 35
},
{
"__id__": 38
},
@ -61,19 +58,22 @@
},
{
"__id__": 53
},
{
"__id__": 56
}
],
"_active": true,
"_components": [
{
"__id__": 58
"__id__": 61
},
{
"__id__": 59
"__id__": 62
}
],
"_prefab": {
"__id__": 60
"__id__": 63
},
"_opacity": 255,
"_color": {
@ -1090,16 +1090,19 @@
"_children": [
{
"__id__": 30
},
{
"__id__": 33
}
],
"_active": true,
"_components": [
{
"__id__": 33
"__id__": 36
}
],
"_prefab": {
"__id__": 34
"__id__": 37
},
"_opacity": 255,
"_color": {
@ -1257,6 +1260,121 @@
"fileId": "c3ajVa85VPxr8KbFOayTFk",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "sp",
"_objFlags": 0,
"_parent": {
"__id__": 29
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 34
}
],
"_prefab": {
"__id__": 35
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-15,
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": ""
},
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
},
"_enabled": true,
"_materials": [
{
"__uuid__": "7afd064b-113f-480e-b793-8817d19f63c3"
}
],
"paused": false,
"defaultSkin": "",
"defaultAnimation": "",
"_preCacheMode": -1,
"_cacheMode": 0,
"loop": true,
"premultipliedAlpha": false,
"timeScale": 1,
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_skeletonCache": null,
"_animationName": "",
"_animationQueue": [],
"_headAniInfo": null,
"_playTimes": 0,
"_isAniComplete": true,
"_N$skeletonData": null,
"_N$_defaultCacheMode": 0,
"_N$debugSlots": false,
"_N$debugBones": false,
"_N$debugMesh": false,
"_N$useTint": false,
"_N$enableBatch": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "aclhebFSJDa4ZZmCEeagUz",
"sync": false
},
{
"__type__": "cc.Mask",
"_name": "",
@ -1301,11 +1419,11 @@
"_active": true,
"_components": [
{
"__id__": 36
"__id__": 39
}
],
"_prefab": {
"__id__": 37
"__id__": 40
},
"_opacity": 255,
"_color": {
@ -1359,7 +1477,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 35
"__id__": 38
},
"_enabled": true,
"_materials": [
@ -1398,113 +1516,6 @@
"fileId": "e5vDPGLf9LqbQXrej4mVR+",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "New Sprite",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 39
}
],
"_prefab": {
"__id__": 40
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 28,
"height": 28
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
6.974,
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": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 38
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a7c8232f-778c-4ee4-825b-4c626cbe9933"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "fagY/CPsxOk4QQYVdw2G/g",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "New Sprite",
@ -1544,15 +1555,15 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-50,
0,
6.974,
0,
0,
0,
0,
1,
0.75,
0.75,
1,
1,
1
]
},
@ -1609,7 +1620,7 @@
"asset": {
"__id__": 0
},
"fileId": "c2XiCnasZPFbbjgyMdrd1y",
"fileId": "fagY/CPsxOk4QQYVdw2G/g",
"sync": false
},
{
@ -1651,7 +1662,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
50,
-50,
6.974,
0,
0,
@ -1716,7 +1727,7 @@
"asset": {
"__id__": 0
},
"fileId": "e7fHYPZfdJeoEyibfnXziZ",
"fileId": "c2XiCnasZPFbbjgyMdrd1y",
"sync": false
},
{
@ -1758,7 +1769,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-100,
50,
6.974,
0,
0,
@ -1823,7 +1834,7 @@
"asset": {
"__id__": 0
},
"fileId": "6dnsmhoaxDJpjadbAZkTvu",
"fileId": "e7fHYPZfdJeoEyibfnXziZ",
"sync": false
},
{
@ -1865,7 +1876,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
100,
-100,
6.974,
0,
0,
@ -1922,6 +1933,113 @@
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "6dnsmhoaxDJpjadbAZkTvu",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "New Sprite",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 54
}
],
"_prefab": {
"__id__": 55
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 28,
"height": 28
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
100,
6.974,
0,
0,
0,
0,
1,
0.75,
0.75,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 53
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a7c8232f-778c-4ee4-825b-4c626cbe9933"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
@ -1944,14 +2062,14 @@
"_active": true,
"_components": [
{
"__id__": 54
"__id__": 57
},
{
"__id__": 55
"__id__": 58
}
],
"_prefab": {
"__id__": 57
"__id__": 60
},
"_opacity": 255,
"_color": {
@ -2005,7 +2123,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 53
"__id__": 56
},
"_enabled": true,
"_materials": [
@ -2037,7 +2155,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 53
"__id__": 56
},
"_enabled": true,
"_normalMaterial": null,
@ -2046,7 +2164,7 @@
"zoomScale": 1.1,
"clickEvents": [
{
"__id__": 56
"__id__": 59
}
],
"_N$interactable": true,
@ -2102,7 +2220,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 53
"__id__": 56
},
"_id": ""
},

View File

@ -41,13 +41,23 @@ export default class shareFriend extends cc.Component {
|| shuju.otherAvatarUrl == "15" || shuju.otherAvatarUrl == "16" || shuju.otherAvatarUrl == "17") {
let useravatar = shuju.otherAvatarUrl;
let useravatarTemp = "icon_" + useravatar;
console.log("用户头像:", useravatarTemp);
console.log("44444444");
if (this.node.getChildByName("iphone"))
this.node.getChildByName("iphone").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.ui.getSpriteFrame(useravatarTemp);
if (this.node.getChildByName("iphone")) {
this.node.getChildByName("iphone").getChildByName("icon").active = false;
this.node.getChildByName("iphone").getChildByName("sp").active = true;
let actionName = cc.fx.GameTool.getActionName(shuju.otherAvatarUrl);
this.node.getChildByName("iphone").getChildByName("sp").scale = 1.2;
cc.fx.GameTool.loadSpineSimple(this.node.getChildByName("iphone").getChildByName("sp"), actionName);
}
// this.node.getChildByName("iphone").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.ui.getSpriteFrame(useravatarTemp);
}
else {
this.node.getChildByName("iphone").getChildByName("icon").active = true;
this.node.getChildByName("iphone").getChildByName("sp").active = false;
this.setPic(shuju.otherAvatarUrl);
}
else this.setPic(shuju.otherAvatarUrl);
let name = shuju.otherNickName;

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,9 @@ export default class CareerItem extends cc.Component {
UI2: cc.SpriteAtlas = null;
randerChildren: any;
@property(cc.Prefab)
iconPrefab: cc.Prefab = null;
/**数据改变时调用 */
public dataChanged() {
this.randerChildren = [];
@ -90,12 +93,26 @@ export default class CareerItem extends cc.Component {
this.data.rankingData[i - 4].useravatar == "10" || this.data.rankingData[i - 4].useravatar == "11" || this.data.rankingData[i - 4].useravatar == "12" || this.data.rankingData[i - 4].useravatar == "13" || this.data.rankingData[i - 4].useravatar == "14"
|| this.data.rankingData[i - 4].useravatar == "15" || this.data.rankingData[i - 4].useravatar == "16" || this.data.rankingData[i - 4].useravatar == "17"
) {
this.node.children[i].getChildByName("mask").getChildByName("icon").active = false;
this.node.children[i].getChildByName("mask").getChildByName("sp").active = true;
let useravatar = this.data.rankingData[i - 4].useravatar;
let useravatarTemp = "icon_" + useravatar;
// console.log("头像名称", useravatarTemp, "用户名字:", username);
this.node.children[i].getChildByName("mask").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.UI.getSpriteFrame(useravatarTemp);
if (this.node.children[i]) {
//this.firstRender.children[i].getChildByName("mask").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.UI.getSpriteFrame(useravatarTemp);
let actionName = cc.fx.GameTool.getActionName(useravatar);
this.node.children[i].getChildByName("mask").getChildByName("sp").scale = 0.85;
cc.fx.GameTool.loadSpineSimple(this.node.children[i].getChildByName("mask").getChildByName("sp"), actionName);
// this.node.children[i].getChildByName("mask").getChildByName("icon").width = 150;
// this.node.children[i].getChildByName("mask").getChildByName("icon").height = 150;
}
// let useravatar = this.data.rankingData[i - 4].useravatar;
// let useravatarTemp = "icon_" + useravatar;
// this.node.children[i].getChildByName("mask").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.UI.getSpriteFrame(useravatarTemp);
}
else {
this.node.children[i].getChildByName("mask").getChildByName("icon").active = true;
this.node.children[i].getChildByName("mask").getChildByName("sp").active = false;
this.setPic(this.data.rankingData[i - 4].useravatar, this.node.children[i].getChildByName("mask").getChildByName("icon"));
}
else this.setPic(this.data.rankingData[i - 4].useravatar, this.node.children[i].getChildByName("mask").getChildByName("icon"));
}
}
}
@ -105,6 +122,8 @@ export default class CareerItem extends cc.Component {
}
}
public setPic(url, node) {
// this.node.getChildByName("pic").getChildByName("icon").active = false;
// this.node.getChildByName("pic").active = false;

View File

@ -128,6 +128,9 @@ export default class CareerList extends cc.Component {
randerChildren: any[];
topData: any;
@property(cc.Prefab)
iconPrefab: cc.Prefab = null;
@property(cc.SpriteAtlas)
UI: cc.SpriteAtlas = null;
@ -135,8 +138,7 @@ export default class CareerList extends cc.Component {
this.randerChildren = [];
this.itemHeight = this.itemRender.height;
this.itemWidth = this.itemRender.width;
if (this.node)
this.scrollView = this.node.getComponent(cc.ScrollView);
this.scrollView = this.node.getComponent(cc.ScrollView);
this.content = this.scrollView.content;
this.content.anchorX = 0;
this.content.anchorY = 1;
@ -233,13 +235,11 @@ export default class CareerList extends cc.Component {
continue;
}
if (item) {
let itemRender: CareerItem = item.getComponent(CareerItem);
itemRender.itemIndex = i + startIndex;
itemRender.data = this.itemDataList[i + startIndex];
itemRender.dataChanged();
}
let itemRender: CareerItem = item.getComponent(CareerItem);
itemRender.itemIndex = i + startIndex;
itemRender.data = this.itemDataList[i + startIndex];
itemRender.dataChanged();
// 计算firstRender的高度偏移
let firstRenderHeight = this.firstRender ? this.firstRender.height : 0;
@ -501,22 +501,29 @@ export default class CareerList extends cc.Component {
let useravatarTemp = "icon_" + useravatar;
// console.log("222头像名称", useravatarTemp, "333用户名字:", username);
if (this.firstRender.children[i]) {
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.UI.getSpriteFrame(useravatarTemp);
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").width = 150;
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").height = 150;
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").active = false;
this.firstRender.children[i].getChildByName("mask").getChildByName("sp").active = true;
this.firstRender.children[i].getChildByName("mask").getChildByName("sp").scale = 0.85;
//this.firstRender.children[i].getChildByName("mask").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.UI.getSpriteFrame(useravatarTemp);
let actionName = cc.fx.GameTool.getActionName(useravatar);
cc.fx.GameTool.loadSpineSimple(this.firstRender.children[i].getChildByName("mask").getChildByName("sp"), actionName);
}
}
else this.setPic(this.topData[i - 3].useravatar, this.firstRender.children[i].getChildByName("mask").getChildByName("icon"));
else {
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").active = true;
this.firstRender.children[i].getChildByName("mask").getChildByName("sp").active = false;
this.setPic(this.topData[i - 3].useravatar, this.firstRender.children[i].getChildByName("mask").getChildByName("icon"));
}
}
}
}
}
}
public setPic(url, node) {
// this.node.getChildByName("pic").getChildByName("icon").active = false;
// this.node.getChildByName("pic").active = false;
@ -526,11 +533,8 @@ export default class CareerList extends cc.Component {
cc.assetManager.loadRemote(url, { ext: '.png' }, (err, texture: cc.Texture2D) => {
if (texture && node) {
// node.getChildByName("pic").active = true;
if (node.getComponent(cc.Sprite)) {
var sprite = node.getComponent(cc.Sprite);
sprite.spriteFrame = new cc.SpriteFrame(texture);
}
var sprite = node.getComponent(cc.Sprite);
sprite.spriteFrame = new cc.SpriteFrame(texture);
}
else {

View File

@ -22,27 +22,20 @@ export default class CareerManager extends cc.Component {
}
//初始化数据
init(data, topData) {
this.rankList = cc.find("ScrollView", this.node).getComponent(CareerList);
this.listData = data;
this.selfData = null;
this.rankNumber = 100;
this.rankTotal = 100;
if (this.node) {
this.rankList = cc.find("ScrollView", this.node).getComponent(CareerList);
this.rankList.setData(data, topData);
}
this.rankList.setData(data, topData);
// 获取当前日期
let currentDate = new Date();
let month = currentDate.getMonth() + 1;
let day = currentDate.getDate();
if (this.bg) {
if (this.bg.getChildByName("month"))
this.bg.getChildByName("month").getComponent(cc.Label).string = month.toString();
if (this.bg.getChildByName("day"))
this.bg.getChildByName("day").getComponent(cc.Label).string = day.toString();
}
if (this.bg.getChildByName("month"))
this.bg.getChildByName("month").getComponent(cc.Label).string = month.toString();
if (this.bg.getChildByName("day"))
this.bg.getChildByName("day").getComponent(cc.Label).string = day.toString();
}
start() {

View File

@ -54,8 +54,13 @@ export default class Item extends cc.Component {
}
if (this.data.useravatar == "" || this.data.useravatar == null || this.data.useravatar == undefined
) {
if (this.node.getChildByName("pic"))
if (this.node.getChildByName("pic")) {
this.node.getChildByName("pic").getChildByName("pic").active = true;
this.node.getChildByName("pic").getChildByName("sp").active = false;
this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.defaultsprite;
}
}
else if (this.data.useravatar == "0" || this.data.useravatar == "1" || this.data.useravatar == "2"
|| this.data.useravatar == "3" || this.data.useravatar == "4" || this.data.useravatar == "5"
@ -66,11 +71,22 @@ export default class Item extends cc.Component {
let useravatar = this.data.useravatar;
let useravatarTemp = "icon_" + useravatar;
console.log("用户头像:", useravatarTemp);
if (this.node.getChildByName("pic"))
this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.ui.getSpriteFrame(useravatarTemp);
this.node.getChildByName("pic").getChildByName("pic").active = false;
this.node.getChildByName("pic").getChildByName("sp").active = true;
let actionName = cc.fx.GameTool.getActionName(this.data.useravatar);
this.node.getChildByName("pic").getChildByName("sp").scale = 0.6;
cc.fx.GameTool.loadSpineSimple(this.node.getChildByName("pic").getChildByName("sp"), actionName);
// if (this.node.getChildByName("pic"))
// this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.ui.getSpriteFrame(useravatarTemp);
}
else this.setPic();
else {
this.node.getChildByName("pic").getChildByName("pic").active = true;
this.node.getChildByName("pic").getChildByName("sp").active = false;
this.setPic();
}
}
public setPic() {

View File

@ -116,8 +116,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
4.112,
3.084,
0,
0,
0,
0,
0,
@ -160,7 +160,7 @@
"_preCacheMode": 0,
"_cacheMode": 0,
"loop": true,
"premultipliedAlpha": true,
"premultipliedAlpha": false,
"timeScale": 1,
"_accTime": 0,
"_playCount": 0,