增加分享图片
This commit is contained in:
parent
6ba283997b
commit
0639f3fab4
|
|
@ -43,6 +43,8 @@ export default class JiaZai extends cc.Component {
|
||||||
private dailyQuestsNode: cc.Node | null = null;
|
private dailyQuestsNode: cc.Node | null = null;
|
||||||
private static cachedWinStreakPrefab: cc.Prefab | null = null;
|
private static cachedWinStreakPrefab: cc.Prefab | null = null;
|
||||||
private winStreakNode: cc.Node | null = null;
|
private winStreakNode: cc.Node | null = null;
|
||||||
|
private static cachedSharePrefab: cc.Prefab | null = null;
|
||||||
|
private ShareNode: cc.Node | null = null;
|
||||||
|
|
||||||
// 缓存 通行证
|
// 缓存 通行证
|
||||||
private static cachedPassCheckPrefab: cc.Prefab | null = null;
|
private static cachedPassCheckPrefab: cc.Prefab | null = null;
|
||||||
|
|
@ -116,9 +118,7 @@ export default class JiaZai extends cc.Component {
|
||||||
// LIFE-CYCLE CALLBACKS:
|
// LIFE-CYCLE CALLBACKS:
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
if (cc.fx.GameConfig.GM_INFO.otherUid != "") {
|
|
||||||
this.getShareInfo();
|
|
||||||
}
|
|
||||||
cc.fx.GameConfig.GM_INFO.sceneValue = "HomeScene";
|
cc.fx.GameConfig.GM_INFO.sceneValue = "HomeScene";
|
||||||
initProvinceLocator();
|
initProvinceLocator();
|
||||||
// this.RankNode = null;
|
// this.RankNode = null;
|
||||||
|
|
@ -129,6 +129,9 @@ export default class JiaZai extends cc.Component {
|
||||||
this.node.getChildByName("zhuanchang").zIndex = 1000;
|
this.node.getChildByName("zhuanchang").zIndex = 1000;
|
||||||
this.careerRank = null;
|
this.careerRank = null;
|
||||||
this.closeLoad();
|
this.closeLoad();
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.otherUid != "") {
|
||||||
|
this.getShareInfo();
|
||||||
|
}
|
||||||
this.checkShare();
|
this.checkShare();
|
||||||
this.closeAvatar();
|
this.closeAvatar();
|
||||||
this.setShareInfo();
|
this.setShareInfo();
|
||||||
|
|
@ -213,6 +216,15 @@ export default class JiaZai extends cc.Component {
|
||||||
JiaZai.cachedWinStreakPrefab = prefab;
|
JiaZai.cachedWinStreakPrefab = prefab;
|
||||||
console.log("连胜活动预制体已经准备好");
|
console.log("连胜活动预制体已经准备好");
|
||||||
});
|
});
|
||||||
|
bundle.load('prefab/Share', cc.Prefab, (err: Error, prefab: cc.Prefab) => {
|
||||||
|
if (err) {
|
||||||
|
cc.error(err.message || err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JiaZai.cachedSharePrefab = prefab;
|
||||||
|
console.log("分享预制体已经准备好");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -285,8 +297,8 @@ export default class JiaZai extends cc.Component {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// this.closeLoad();
|
// this.closeLoad();
|
||||||
this.isShow = false;
|
// this.isShow = false;
|
||||||
cc.fx.GameConfig.LEVEL_INFO_init(true, 1000, true);
|
// cc.fx.GameConfig.LEVEL_INFO_init(true, 1000, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -1114,7 +1126,7 @@ export default class JiaZai extends cc.Component {
|
||||||
} else {
|
} else {
|
||||||
// 非第一次使用,直接激活节点
|
// 非第一次使用,直接激活节点
|
||||||
this.monthlyCardNode.active = true;
|
this.monthlyCardNode.active = true;
|
||||||
this.monthlyCardNode.zIndex = 1000;
|
this.monthlyCardNode.zIndex = 799;
|
||||||
this.monthlyCardNode.getComponent("monthlyCard").init();
|
this.monthlyCardNode.getComponent("monthlyCard").init();
|
||||||
this.monthlyCardNode.getComponent("monthlyCard").juwai = true;
|
this.monthlyCardNode.getComponent("monthlyCard").juwai = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1605,6 +1617,80 @@ export default class JiaZai extends cc.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openShare() {
|
||||||
|
this.openLoad();
|
||||||
|
let otherNickName = null;
|
||||||
|
let otherAvatarUrl = null;
|
||||||
|
let otherKuang = "0";
|
||||||
|
let otherLevel = cc.fx.GameConfig.GM_INFO.otherLevel;
|
||||||
|
Utils.getUserInfoByID((data) => {
|
||||||
|
if (data.code == 1) {
|
||||||
|
console.log("获取好友信息:", data.data.name);
|
||||||
|
if (data.data.name) {
|
||||||
|
otherNickName = data.data.name;
|
||||||
|
}
|
||||||
|
if (data.data.useravatar) {
|
||||||
|
otherAvatarUrl = data.data.useravatar;
|
||||||
|
}
|
||||||
|
if (data.data.useravatarIcon) {
|
||||||
|
otherKuang = data.data.useravatarIcon;
|
||||||
|
}
|
||||||
|
let shuju = {
|
||||||
|
otherNickName: otherNickName,
|
||||||
|
otherAvatarUrl: otherAvatarUrl,
|
||||||
|
otherKuang: otherKuang,
|
||||||
|
otherLevel: otherLevel,
|
||||||
|
}
|
||||||
|
// 预加载 活动 预制体
|
||||||
|
console.log("好友名字:", otherNickName);
|
||||||
|
if (!JiaZai.cachedActionPrefab) {
|
||||||
|
cc.assetManager.loadBundle('action_bundle', (err: Error, bundle: cc.AssetManager.Bundle) => {
|
||||||
|
if (err) {
|
||||||
|
cc.error(err.message || err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bundle.load('prefab/Share', cc.Prefab, (err: Error, prefab: cc.Prefab) => {
|
||||||
|
if (err) {
|
||||||
|
cc.error(err.message || err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JiaZai.cachedSharePrefab = prefab;
|
||||||
|
console.log("2222分享预制体已经准备好", shuju);
|
||||||
|
if (!this.ShareNode) {
|
||||||
|
this.ShareNode = cc.instantiate(JiaZai.cachedSharePrefab);
|
||||||
|
if (this.node && this.ShareNode)
|
||||||
|
this.node.addChild(this.ShareNode);
|
||||||
|
this.ShareNode.zIndex = 800;
|
||||||
|
this.ShareNode.getComponent("shareFriend").init(true, shuju);
|
||||||
|
} else {
|
||||||
|
this.ShareNode.active = true;
|
||||||
|
this.ShareNode.getComponent("shareFriend").init(false, shuju);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!this.ShareNode) {
|
||||||
|
this.ShareNode = cc.instantiate(JiaZai.cachedSharePrefab);
|
||||||
|
if (this.node && this.ShareNode)
|
||||||
|
this.node.addChild(this.ShareNode);
|
||||||
|
this.ShareNode.zIndex = 800;
|
||||||
|
this.ShareNode.getComponent("Share").init(true, shuju);
|
||||||
|
} else {
|
||||||
|
this.ShareNode.active = true;
|
||||||
|
this.ShareNode.getComponent("Share").init(false, shuju);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.closeLoad();
|
||||||
|
MiniGameSdk.API.showToast("网络异常,获取好友帮玩信息失败,请从帮玩链接重新进入游戏");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
rewarded() {
|
rewarded() {
|
||||||
Utils.monthGetReward((data) => {
|
Utils.monthGetReward((data) => {
|
||||||
if (data.data == null) {
|
if (data.data == null) {
|
||||||
|
|
@ -1806,7 +1892,7 @@ export default class JiaZai extends cc.Component {
|
||||||
level: level //被帮助关卡等级
|
level: level //被帮助关卡等级
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("stage_help", eventData); //帮助通关
|
cc.fx.GameTool.shushu_Track("stage_help", eventData); //帮助通关
|
||||||
this.openLoad();
|
this.openShare();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cc.fx.GameConfig.GM_INFO.otherLevel = 0;
|
cc.fx.GameConfig.GM_INFO.otherLevel = 0;
|
||||||
|
|
@ -1841,19 +1927,19 @@ export default class JiaZai extends cc.Component {
|
||||||
//检测当日是否有分享行为,用不用主动获取分享关卡信息
|
//检测当日是否有分享行为,用不用主动获取分享关卡信息
|
||||||
checkShare() {
|
checkShare() {
|
||||||
const otherInfo = cc.fx.StorageMessage.getStorage("otherLevel");
|
const otherInfo = cc.fx.StorageMessage.getStorage("otherLevel");
|
||||||
// console.log("分享信息:", otherInfo);
|
console.log("分享信息:", otherInfo);
|
||||||
if (otherInfo != null && otherInfo != undefined && otherInfo != "") {
|
if (otherInfo != null && otherInfo != undefined && otherInfo != "") {
|
||||||
const currentTime = Date.now();
|
const currentTime = Date.now();
|
||||||
const timeDifference = currentTime - otherInfo.timeStamp;
|
const timeDifference = currentTime - otherInfo.timeStamp;
|
||||||
const oneDayInMilliseconds = 24 * 60 * 60 * 1000;
|
const oneDayInMilliseconds = 24 * 60 * 60 * 1000;
|
||||||
// console.log("计入时间计算");
|
console.log("计入时间计算");
|
||||||
if (timeDifference > oneDayInMilliseconds || cc.fx.GameConfig.GM_INFO.level >= otherInfo.otherLevel) {
|
if (timeDifference > oneDayInMilliseconds || cc.fx.GameConfig.GM_INFO.level >= otherInfo.otherLevel) {
|
||||||
// console.log("_______________检查分享信息过期或已获取过,清除存储信息");
|
console.log("_______________检查分享信息过期或已获取过,清除存储信息");
|
||||||
cc.fx.StorageMessage.setStorage("otherLevel", null);
|
cc.fx.StorageMessage.setStorage("otherLevel", null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// if ((cc.fx.GameConfig.GM_INFO.level + 1) == otherInfo.otherLevel) {
|
// if ((cc.fx.GameConfig.GM_INFO.level + 1) == otherInfo.otherLevel) {
|
||||||
// console.log("_______________有分享信息,并且符合条件");
|
console.log("_______________有分享信息,并且符合条件");
|
||||||
Utils.getShareLevel((res) => {
|
Utils.getShareLevel((res) => {
|
||||||
if (res.code == 1 && res.data) {
|
if (res.code == 1 && res.data) {
|
||||||
if (res.data.length > 0) {
|
if (res.data.length > 0) {
|
||||||
|
|
|
||||||
|
|
@ -475,6 +475,14 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
initMap() {
|
initMap() {
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
|
||||||
|
this.node.parent.getChildByName("Top").getChildByName("shareBtn").active = false;
|
||||||
|
this.node.parent.parent.parent.getChildByName("Pause").getChildByName("share").active = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.node.parent.getChildByName("Top").getChildByName("shareBtn").active = true;
|
||||||
|
this.node.parent.parent.parent.getChildByName("Pause").getChildByName("share").active = true;
|
||||||
|
}
|
||||||
if (cc.fx.GameConfig.GM_INFO.winStreak < 10 || cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
|
if (cc.fx.GameConfig.GM_INFO.winStreak < 10 || cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
|
||||||
this.winStreakBtn.node.active = false;
|
this.winStreakBtn.node.active = false;
|
||||||
this.destroyBtn.node.getChildByName("mul10").opacity = 255;
|
this.destroyBtn.node.getChildByName("mul10").opacity = 255;
|
||||||
|
|
|
||||||
|
|
@ -582,10 +582,9 @@ export default class SceneManager extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
shareFriend() {
|
shareFriend() {
|
||||||
|
if (this.node.getChildByName("Game").getChildByName("Lose").active == true) {
|
||||||
let shareTips = this.node.getChildByName("Game").getChildByName("Lose").getChildByName("share_tips");
|
let shareTips = this.node.getChildByName("Game").getChildByName("Lose").getChildByName("share_tips");
|
||||||
let closeBtn = shareTips.getChildByName("closeBtn");
|
|
||||||
let shareBtn = shareTips.getChildByName("shareBtn");
|
|
||||||
let checkbox = shareTips.getChildByName("checkbox");
|
|
||||||
// let isCheckboxChecked = cc.sys.localStorage.getItem("share_checkbox_state");
|
// let isCheckboxChecked = cc.sys.localStorage.getItem("share_checkbox_state");
|
||||||
let isCheckboxChecked = cc.fx.StorageMessage.getStorage("share_checkbox_state");
|
let isCheckboxChecked = cc.fx.StorageMessage.getStorage("share_checkbox_state");
|
||||||
|
|
||||||
|
|
@ -594,10 +593,15 @@ export default class SceneManager extends cc.Component {
|
||||||
} else {
|
} else {
|
||||||
this.shareFriend2();
|
this.shareFriend2();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.shareFriend2();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shareFriend2() {
|
shareFriend2() {
|
||||||
|
if (this.node.getChildByName("Game").getChildByName("Lose").active == true) {
|
||||||
let shareTips = this.node.getChildByName("Game").getChildByName("Lose").getChildByName("share_tips");
|
let shareTips = this.node.getChildByName("Game").getChildByName("Lose").getChildByName("share_tips");
|
||||||
if (shareTips.active) {
|
if (shareTips.active) {
|
||||||
shareTips.active = false;
|
shareTips.active = false;
|
||||||
|
|
@ -609,6 +613,9 @@ export default class SceneManager extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.StorageMessage.setStorage("share_checkbox_state", checkboxSelect);
|
cc.fx.StorageMessage.setStorage("share_checkbox_state", checkboxSelect);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
if (this.share_time) {
|
if (this.share_time) {
|
||||||
this.share_time = false;
|
this.share_time = false;
|
||||||
console.log("设置分享链接");
|
console.log("设置分享链接");
|
||||||
|
|
|
||||||
|
|
@ -894,9 +894,9 @@ export default class Utils {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
||||||
Utils.POST("getShareLv", data, res => {
|
Utils.POST("getShareLv", data, res => {
|
||||||
//console.log("获得shareLvSuccess数据:", res);
|
console.log("获得shareLvSuccess数据:", res);
|
||||||
if (res.code === 1) {
|
if (res.code === 1) {
|
||||||
//console.log("服务器:分享帮助通过关卡数据成功", res);
|
console.log("服务器:分享帮助通过关卡数据成功", res);
|
||||||
if (callBack) callBack(res);
|
if (callBack) callBack(res);
|
||||||
} else {
|
} else {
|
||||||
if (callBack) callBack(res);
|
if (callBack) callBack(res);
|
||||||
|
|
@ -1422,4 +1422,25 @@ export default class Utils {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getUserInfoByID(callBack) {
|
||||||
|
//@ts-ignore
|
||||||
|
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
||||||
|
let uid = cc.fx.GameConfig.GM_INFO.otherUid;
|
||||||
|
//旧的读取数据设置数据方法,以强联网为主
|
||||||
|
let setData = {
|
||||||
|
uid: uid
|
||||||
|
}
|
||||||
|
Utils.POST("getUserInfoByID", setData, res => {
|
||||||
|
// //console.log("获得monthGetReward数据:", res);
|
||||||
|
if (res.code === 1) {
|
||||||
|
console.log("服务器:获得分享人头像昵称'✅ ", res);
|
||||||
|
if (callBack) callBack(res);
|
||||||
|
} else {
|
||||||
|
console.log("服务器:获得分享人头像昵称'❌ ", res);
|
||||||
|
if (callBack) callBack(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,8 +134,8 @@ export default class Lock extends cc.Component {
|
||||||
|
|
||||||
reduce() {
|
reduce() {
|
||||||
this.time -= 1;
|
this.time -= 1;
|
||||||
NumberToImage.numberToImageNodes(this.time, 20, 8, "lock_", this.node.getChildByName("time"), false);
|
NumberToImage.numberToImageNodes(this.time, 20, 8, "lock_", this.node.getChildByName("icon").getChildByName("time"), false);
|
||||||
cc.fx.GameTool.numberScaleAction(this.node.getChildByName("time"));
|
cc.fx.GameTool.numberScaleAction(this.node.getChildByName("icon").getChildByName("time"));
|
||||||
if (this.time <= 0) {
|
if (this.time <= 0) {
|
||||||
if (this.type == "block") {
|
if (this.type == "block") {
|
||||||
if (this.node.parent) this.node.parent.getComponent("Block").type = 0;
|
if (this.node.parent) this.node.parent.getComponent("Block").type = 0;
|
||||||
|
|
|
||||||
13
assets/action_bundle/img/share.meta
Normal file
13
assets/action_bundle/img/share.meta
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"ver": "1.1.3",
|
||||||
|
"uuid": "eb6669f0-70c9-446f-a77e-2c13e6bd3102",
|
||||||
|
"importer": "folder",
|
||||||
|
"isBundle": false,
|
||||||
|
"bundleName": "",
|
||||||
|
"priority": 1,
|
||||||
|
"compressionType": {},
|
||||||
|
"optimizeHotUpdate": {},
|
||||||
|
"inlineSpriteFrames": {},
|
||||||
|
"isRemoteBundle": {},
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
BIN
assets/action_bundle/img/share/shareBG.png
Normal file
BIN
assets/action_bundle/img/share/shareBG.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
38
assets/action_bundle/img/share/shareBG.png.meta
Normal file
38
assets/action_bundle/img/share/shareBG.png.meta
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"ver": "2.3.7",
|
||||||
|
"uuid": "b72ed14f-5c00-4d47-beb3-1b54116a78c3",
|
||||||
|
"importer": "texture",
|
||||||
|
"type": "sprite",
|
||||||
|
"wrapMode": "clamp",
|
||||||
|
"filterMode": "bilinear",
|
||||||
|
"premultiplyAlpha": false,
|
||||||
|
"genMipmaps": false,
|
||||||
|
"packable": true,
|
||||||
|
"width": 880,
|
||||||
|
"height": 1402,
|
||||||
|
"platformSettings": {},
|
||||||
|
"subMetas": {
|
||||||
|
"shareBG": {
|
||||||
|
"ver": "1.0.6",
|
||||||
|
"uuid": "027a1bc7-6d3a-46c6-a949-c2f76487035e",
|
||||||
|
"importer": "sprite-frame",
|
||||||
|
"rawTextureUuid": "b72ed14f-5c00-4d47-beb3-1b54116a78c3",
|
||||||
|
"trimType": "auto",
|
||||||
|
"trimThreshold": 1,
|
||||||
|
"rotated": false,
|
||||||
|
"offsetX": 0,
|
||||||
|
"offsetY": 0,
|
||||||
|
"trimX": 0,
|
||||||
|
"trimY": 0,
|
||||||
|
"width": 880,
|
||||||
|
"height": 1402,
|
||||||
|
"rawWidth": 880,
|
||||||
|
"rawHeight": 1402,
|
||||||
|
"borderTop": 0,
|
||||||
|
"borderBottom": 0,
|
||||||
|
"borderLeft": 0,
|
||||||
|
"borderRight": 0,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/action_bundle/img/share/shareTitle.png
Normal file
BIN
assets/action_bundle/img/share/shareTitle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
38
assets/action_bundle/img/share/shareTitle.png.meta
Normal file
38
assets/action_bundle/img/share/shareTitle.png.meta
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"ver": "2.3.7",
|
||||||
|
"uuid": "766944d5-d47c-4cbd-ac18-105514e53972",
|
||||||
|
"importer": "texture",
|
||||||
|
"type": "sprite",
|
||||||
|
"wrapMode": "clamp",
|
||||||
|
"filterMode": "bilinear",
|
||||||
|
"premultiplyAlpha": false,
|
||||||
|
"genMipmaps": false,
|
||||||
|
"packable": true,
|
||||||
|
"width": 260,
|
||||||
|
"height": 65,
|
||||||
|
"platformSettings": {},
|
||||||
|
"subMetas": {
|
||||||
|
"shareTitle": {
|
||||||
|
"ver": "1.0.6",
|
||||||
|
"uuid": "5bf6daf8-5aed-47f4-b8a1-026e2ba8cde0",
|
||||||
|
"importer": "sprite-frame",
|
||||||
|
"rawTextureUuid": "766944d5-d47c-4cbd-ac18-105514e53972",
|
||||||
|
"trimType": "auto",
|
||||||
|
"trimThreshold": 1,
|
||||||
|
"rotated": false,
|
||||||
|
"offsetX": 0,
|
||||||
|
"offsetY": 0,
|
||||||
|
"trimX": 0,
|
||||||
|
"trimY": 0,
|
||||||
|
"width": 260,
|
||||||
|
"height": 65,
|
||||||
|
"rawWidth": 260,
|
||||||
|
"rawHeight": 65,
|
||||||
|
"borderTop": 0,
|
||||||
|
"borderBottom": 0,
|
||||||
|
"borderLeft": 0,
|
||||||
|
"borderRight": 0,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/action_bundle/img/share/share_dian.png
Normal file
BIN
assets/action_bundle/img/share/share_dian.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 406 B |
38
assets/action_bundle/img/share/share_dian.png.meta
Normal file
38
assets/action_bundle/img/share/share_dian.png.meta
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"ver": "2.3.7",
|
||||||
|
"uuid": "be066ea2-fe0c-4bf7-a3c3-fc80bc746d22",
|
||||||
|
"importer": "texture",
|
||||||
|
"type": "sprite",
|
||||||
|
"wrapMode": "clamp",
|
||||||
|
"filterMode": "bilinear",
|
||||||
|
"premultiplyAlpha": false,
|
||||||
|
"genMipmaps": false,
|
||||||
|
"packable": true,
|
||||||
|
"width": 28,
|
||||||
|
"height": 28,
|
||||||
|
"platformSettings": {},
|
||||||
|
"subMetas": {
|
||||||
|
"share_dian": {
|
||||||
|
"ver": "1.0.6",
|
||||||
|
"uuid": "a7c8232f-778c-4ee4-825b-4c626cbe9933",
|
||||||
|
"importer": "sprite-frame",
|
||||||
|
"rawTextureUuid": "be066ea2-fe0c-4bf7-a3c3-fc80bc746d22",
|
||||||
|
"trimType": "auto",
|
||||||
|
"trimThreshold": 1,
|
||||||
|
"rotated": false,
|
||||||
|
"offsetX": 0,
|
||||||
|
"offsetY": 0,
|
||||||
|
"trimX": 0,
|
||||||
|
"trimY": 0,
|
||||||
|
"width": 28,
|
||||||
|
"height": 28,
|
||||||
|
"rawWidth": 28,
|
||||||
|
"rawHeight": 28,
|
||||||
|
"borderTop": 0,
|
||||||
|
"borderBottom": 0,
|
||||||
|
"borderLeft": 0,
|
||||||
|
"borderRight": 0,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/action_bundle/img/share/share_getBtn.png
Normal file
BIN
assets/action_bundle/img/share/share_getBtn.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
38
assets/action_bundle/img/share/share_getBtn.png.meta
Normal file
38
assets/action_bundle/img/share/share_getBtn.png.meta
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"ver": "2.3.7",
|
||||||
|
"uuid": "bba5414e-af50-4671-abdf-79038741b308",
|
||||||
|
"importer": "texture",
|
||||||
|
"type": "sprite",
|
||||||
|
"wrapMode": "clamp",
|
||||||
|
"filterMode": "bilinear",
|
||||||
|
"premultiplyAlpha": false,
|
||||||
|
"genMipmaps": false,
|
||||||
|
"packable": true,
|
||||||
|
"width": 556,
|
||||||
|
"height": 157,
|
||||||
|
"platformSettings": {},
|
||||||
|
"subMetas": {
|
||||||
|
"share_getBtn": {
|
||||||
|
"ver": "1.0.6",
|
||||||
|
"uuid": "4d0555ca-53af-482b-a155-31611cd9ec9c",
|
||||||
|
"importer": "sprite-frame",
|
||||||
|
"rawTextureUuid": "bba5414e-af50-4671-abdf-79038741b308",
|
||||||
|
"trimType": "auto",
|
||||||
|
"trimThreshold": 1,
|
||||||
|
"rotated": false,
|
||||||
|
"offsetX": 0,
|
||||||
|
"offsetY": 0,
|
||||||
|
"trimX": 0,
|
||||||
|
"trimY": 0,
|
||||||
|
"width": 556,
|
||||||
|
"height": 157,
|
||||||
|
"rawWidth": 556,
|
||||||
|
"rawHeight": 157,
|
||||||
|
"borderTop": 0,
|
||||||
|
"borderBottom": 0,
|
||||||
|
"borderLeft": 0,
|
||||||
|
"borderRight": 0,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/action_bundle/img/share/share_wenzi.png
Normal file
BIN
assets/action_bundle/img/share/share_wenzi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
38
assets/action_bundle/img/share/share_wenzi.png.meta
Normal file
38
assets/action_bundle/img/share/share_wenzi.png.meta
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"ver": "2.3.7",
|
||||||
|
"uuid": "0baebaae-1bd3-4e80-917a-c3e9bf51381f",
|
||||||
|
"importer": "texture",
|
||||||
|
"type": "sprite",
|
||||||
|
"wrapMode": "clamp",
|
||||||
|
"filterMode": "bilinear",
|
||||||
|
"premultiplyAlpha": false,
|
||||||
|
"genMipmaps": false,
|
||||||
|
"packable": true,
|
||||||
|
"width": 447,
|
||||||
|
"height": 46,
|
||||||
|
"platformSettings": {},
|
||||||
|
"subMetas": {
|
||||||
|
"share_wenzi": {
|
||||||
|
"ver": "1.0.6",
|
||||||
|
"uuid": "4179e049-07eb-4773-b07d-50804e3525dc",
|
||||||
|
"importer": "sprite-frame",
|
||||||
|
"rawTextureUuid": "0baebaae-1bd3-4e80-917a-c3e9bf51381f",
|
||||||
|
"trimType": "auto",
|
||||||
|
"trimThreshold": 1,
|
||||||
|
"rotated": false,
|
||||||
|
"offsetX": 0,
|
||||||
|
"offsetY": 0,
|
||||||
|
"trimX": 0,
|
||||||
|
"trimY": 0,
|
||||||
|
"width": 447,
|
||||||
|
"height": 46,
|
||||||
|
"rawWidth": 447,
|
||||||
|
"rawHeight": 46,
|
||||||
|
"borderTop": 0,
|
||||||
|
"borderBottom": 0,
|
||||||
|
"borderLeft": 0,
|
||||||
|
"borderRight": 0,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/action_bundle/img/share/share_x.png
Normal file
BIN
assets/action_bundle/img/share/share_x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
38
assets/action_bundle/img/share/share_x.png.meta
Normal file
38
assets/action_bundle/img/share/share_x.png.meta
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"ver": "2.3.7",
|
||||||
|
"uuid": "e72d2d12-30fc-4953-98a7-08ef94b56d64",
|
||||||
|
"importer": "texture",
|
||||||
|
"type": "sprite",
|
||||||
|
"wrapMode": "clamp",
|
||||||
|
"filterMode": "bilinear",
|
||||||
|
"premultiplyAlpha": false,
|
||||||
|
"genMipmaps": false,
|
||||||
|
"packable": true,
|
||||||
|
"width": 69,
|
||||||
|
"height": 68,
|
||||||
|
"platformSettings": {},
|
||||||
|
"subMetas": {
|
||||||
|
"share_x": {
|
||||||
|
"ver": "1.0.6",
|
||||||
|
"uuid": "c4912a0d-9bac-4f41-8a63-b2e0f3327d68",
|
||||||
|
"importer": "sprite-frame",
|
||||||
|
"rawTextureUuid": "e72d2d12-30fc-4953-98a7-08ef94b56d64",
|
||||||
|
"trimType": "auto",
|
||||||
|
"trimThreshold": 1,
|
||||||
|
"rotated": false,
|
||||||
|
"offsetX": 0,
|
||||||
|
"offsetY": 0,
|
||||||
|
"trimX": 0,
|
||||||
|
"trimY": 0,
|
||||||
|
"width": 69,
|
||||||
|
"height": 68,
|
||||||
|
"rawWidth": 69,
|
||||||
|
"rawHeight": 68,
|
||||||
|
"borderTop": 0,
|
||||||
|
"borderBottom": 0,
|
||||||
|
"borderLeft": 0,
|
||||||
|
"borderRight": 0,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2181
assets/action_bundle/prefab/Share.prefab
Normal file
2181
assets/action_bundle/prefab/Share.prefab
Normal file
File diff suppressed because it is too large
Load Diff
9
assets/action_bundle/prefab/Share.prefab.meta
Normal file
9
assets/action_bundle/prefab/Share.prefab.meta
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"ver": "1.3.2",
|
||||||
|
"uuid": "b28790fb-50a0-4b31-8543-9c0a17693de0",
|
||||||
|
"importer": "prefab",
|
||||||
|
"optimizationPolicy": "AUTO",
|
||||||
|
"asyncLoadAssets": false,
|
||||||
|
"readonly": false,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
117
assets/action_bundle/script/shareFriend.ts
Normal file
117
assets/action_bundle/script/shareFriend.ts
Normal file
|
|
@ -0,0 +1,117 @@
|
||||||
|
import MapConroler from "../../Script/Map";
|
||||||
|
|
||||||
|
const { ccclass, property } = cc._decorator;
|
||||||
|
|
||||||
|
@ccclass
|
||||||
|
export default class shareFriend extends cc.Component {
|
||||||
|
|
||||||
|
@property(cc.SpriteAtlas)
|
||||||
|
ui: cc.SpriteAtlas = null;
|
||||||
|
|
||||||
|
onLoad() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
init(type, shuju) {
|
||||||
|
console.log("111111111", shuju);
|
||||||
|
this.node.getChildByName("level").getComponent(cc.Label).string = shuju.otherLevel + "";
|
||||||
|
|
||||||
|
let useravatarIcon = shuju.otherKuang;
|
||||||
|
useravatarIcon = "kuang_" + (parseInt(useravatarIcon) + 1);
|
||||||
|
console.log("3333333", useravatarIcon);
|
||||||
|
if (this.node.getChildByName("kuang"))
|
||||||
|
this.node.getChildByName("kuang").getComponent(cc.Sprite).spriteFrame =
|
||||||
|
this.ui.getSpriteFrame(useravatarIcon);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (shuju.otherAvatarUrl == "" || shuju.otherAvatarUrl == null || shuju.otherAvatarUrl == undefined
|
||||||
|
) {
|
||||||
|
console.log("头像为空", shuju.otherAvatarUrl);
|
||||||
|
}
|
||||||
|
else if (shuju.otherAvatarUrl == "0" || shuju.otherAvatarUrl == "1" || shuju.otherAvatarUrl == "2"
|
||||||
|
|| shuju.otherAvatarUrl == "3" || shuju.otherAvatarUrl == "4" || shuju.otherAvatarUrl == "5"
|
||||||
|
|| shuju.otherAvatarUrl == "6" || shuju.otherAvatarUrl == "7" || shuju.otherAvatarUrl == "8"
|
||||||
|
|| shuju.otherAvatarUrl == "9" || shuju.otherAvatarUrl == "10" || shuju.otherAvatarUrl == "11"
|
||||||
|
|| shuju.otherAvatarUrl == "12" || shuju.otherAvatarUrl == "13" || shuju.otherAvatarUrl == "14"
|
||||||
|
|| 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
else this.setPic(shuju.otherAvatarUrl);
|
||||||
|
|
||||||
|
|
||||||
|
let name = shuju.otherNickName;
|
||||||
|
if (name == "user" || name == null) name = "你的好友";
|
||||||
|
else {
|
||||||
|
if (shuju.otherNickName.length >= 7)
|
||||||
|
name = cc.fx.GameTool.subName(shuju.otherNickName, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("7777777");
|
||||||
|
|
||||||
|
if (this.node.getChildByName("name")) {
|
||||||
|
console.log("8888888", name);
|
||||||
|
this.node.getChildByName("name").getComponent(cc.Label).string = name + "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
helpBtn() {
|
||||||
|
const canvasTemp = cc.find("Canvas"); // 假设 Canvas 节点
|
||||||
|
if (canvasTemp) {
|
||||||
|
const JiaZai = canvasTemp.getComponent("JiaZai");
|
||||||
|
if (JiaZai) {
|
||||||
|
JiaZai.startGame();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closeBtn() {
|
||||||
|
this.node.active = false;
|
||||||
|
}
|
||||||
|
public setPic(url) {
|
||||||
|
// console.log("设置头像:", this.data.useravatar);
|
||||||
|
var self = this;
|
||||||
|
console.log("6666666", url);
|
||||||
|
self.node.getChildByName("iphone").getChildByName("icon").active = false;
|
||||||
|
|
||||||
|
|
||||||
|
cc.assetManager.loadRemote(url, { ext: '.png' }, (err, texture: cc.Texture2D) => {
|
||||||
|
if (texture) {
|
||||||
|
console.log("设置头像成功", self.node.getChildByName("iphone"));
|
||||||
|
|
||||||
|
|
||||||
|
if (self.node.getChildByName("iphone")) {
|
||||||
|
console.log("okokokokokok")
|
||||||
|
var sprite = self.node.getChildByName("iphone").getChildByName("icon").getComponent(cc.Sprite);
|
||||||
|
sprite.spriteFrame = new cc.SpriteFrame(texture);
|
||||||
|
console.log("最终设置成功")
|
||||||
|
self.node.getChildByName("iphone").getChildByName("icon").active = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self.node.getChildByName("iphone").getChildByName("icon").active = true;
|
||||||
|
console.log("设置头像失败", url);
|
||||||
|
console.log(err, texture)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
update() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
10
assets/action_bundle/script/shareFriend.ts.meta
Normal file
10
assets/action_bundle/script/shareFriend.ts.meta
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"ver": "1.1.0",
|
||||||
|
"uuid": "62af9284-b839-4276-8fd5-e322771218ee",
|
||||||
|
"importer": "typescript",
|
||||||
|
"isPlugin": false,
|
||||||
|
"loadPluginInWeb": true,
|
||||||
|
"loadPluginInNative": true,
|
||||||
|
"loadPluginInEditor": false,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user