抖音修改
This commit is contained in:
parent
3b4d4ada51
commit
7359de543a
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -303,6 +303,9 @@ export default class GameManager extends cc.Component {
|
||||||
if (data.data.address) {
|
if (data.data.address) {
|
||||||
cc.fx.GameConfig.GM_INFO.address = data.data.address;
|
cc.fx.GameConfig.GM_INFO.address = data.data.address;
|
||||||
}
|
}
|
||||||
|
if (data.data.dy_sidebar) {
|
||||||
|
cc.fx.GameConfig.GM_INFO.dy_sidebar = data.data.dy_sidebar;
|
||||||
|
}
|
||||||
this.checkDailyQuests();
|
this.checkDailyQuests();
|
||||||
//如果有连胜记录,就赋值
|
//如果有连胜记录,就赋值
|
||||||
if (data.data.winStreak) {
|
if (data.data.winStreak) {
|
||||||
|
|
@ -513,9 +516,6 @@ export default class GameManager extends cc.Component {
|
||||||
if (time == undefined || time == null) {
|
if (time == undefined || time == null) {
|
||||||
time = timestamp;
|
time = timestamp;
|
||||||
}
|
}
|
||||||
if (cc.sys.platform === cc.sys.BYTEDANCE_GAME) {
|
|
||||||
time = cc.fx.GameTool.formatDate(new Date(timestamp));
|
|
||||||
}
|
|
||||||
MiniGameSdk.API.shushu_userSet(time);
|
MiniGameSdk.API.shushu_userSet(time);
|
||||||
this.setFirstInfo();
|
this.setFirstInfo();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,8 @@ export default class JiaZai extends cc.Component {
|
||||||
// this.checkDailyQuests();
|
// 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);
|
||||||
|
|
||||||
|
// 添加抖音必须功能判断
|
||||||
|
this.dyCheck();
|
||||||
|
|
||||||
cc.game.setFrameRate(63);
|
cc.game.setFrameRate(63);
|
||||||
LQCollideSystem.is_enable = true;
|
LQCollideSystem.is_enable = true;
|
||||||
|
|
@ -2230,6 +2232,16 @@ export default class JiaZai extends cc.Component {
|
||||||
cc.fx.GameConfig.GM_INFO.otherUid = uid;
|
cc.fx.GameConfig.GM_INFO.otherUid = uid;
|
||||||
cc.fx.GameConfig.GM_INFO.otherLevel = level;
|
cc.fx.GameConfig.GM_INFO.otherLevel = level;
|
||||||
// 可以在这里处理关卡信息和 UID
|
// 可以在这里处理关卡信息和 UID
|
||||||
|
let eventData = {
|
||||||
|
identity: "helper", //发起者为helped 帮助者为helper
|
||||||
|
helpedId: cc.fx.GameConfig.GM_INFO.otherUid, //被帮助者UID
|
||||||
|
level: level //被帮助关卡等级
|
||||||
|
}
|
||||||
|
cc.fx.GameTool.shushu_Track("stage_help", eventData); //帮助通关
|
||||||
|
this.openShare();
|
||||||
|
} else {
|
||||||
|
cc.fx.GameConfig.GM_INFO.otherLevel = 0;
|
||||||
|
cc.fx.GameConfig.GM_INFO.otherUid = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3555,15 +3567,27 @@ export default class JiaZai extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
toSidebarShow(isGet: boolean) {
|
toSidebarShow(isGet: boolean) {
|
||||||
this.node.getChildByName("ToSidebar").active = true;
|
if (!this.node) {
|
||||||
|
console.log('节点不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const toSidebarNode = this.node.getChildByName("ToSidebar");
|
||||||
|
if (!toSidebarNode) {
|
||||||
|
console.log('ToSidebar节点不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
toSidebarNode.active = true;
|
||||||
|
|
||||||
this.node.getChildByName("ToSidebar").getChildByName("sidebarBtn_1").active = false;
|
this.node.getChildByName("ToSidebar").getChildByName("sidebarBtn_1").active = false;
|
||||||
this.node.getChildByName("ToSidebar").getChildByName("sidebarBtn_2").active = false;
|
this.node.getChildByName("ToSidebar").getChildByName("sidebarBtn_2").active = false;
|
||||||
if (isGet) {
|
if (isGet) {
|
||||||
this.node.getChildByName("ToSidebar").getChildByName("sidebarBtn_2").active = true;
|
this.node.getChildByName("ToSidebar").getChildByName("sidebarBtn_2").active = true;
|
||||||
|
this.node.getChildByName("ToSidebar").getChildByName("close_btn").active = false;
|
||||||
} else {
|
} else {
|
||||||
this.node.getChildByName("ToSidebar").getChildByName("sidebarBtn_1").active = true;
|
this.node.getChildByName("ToSidebar").getChildByName("sidebarBtn_1").active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onSidebarClose() {
|
onSidebarClose() {
|
||||||
|
|
@ -3605,7 +3629,7 @@ export default class JiaZai extends cc.Component {
|
||||||
sidebarBtn_1.active = false;
|
sidebarBtn_1.active = false;
|
||||||
}
|
}
|
||||||
// 给予用户提示
|
// 给予用户提示
|
||||||
MiniGameSdk.API.showToast('请在侧边栏中找到游戏图标', 3);
|
// MiniGameSdk.API.showToast('请在侧边栏中找到游戏图标', 3);
|
||||||
} else {
|
} else {
|
||||||
console.log('跳转侧边栏失败');
|
console.log('跳转侧边栏失败');
|
||||||
MiniGameSdk.API.showToast('跳转侧边栏失败,请稍后重试', 3);
|
MiniGameSdk.API.showToast('跳转侧边栏失败,请稍后重试', 3);
|
||||||
|
|
@ -3620,7 +3644,7 @@ export default class JiaZai extends cc.Component {
|
||||||
// MiniGameSdk.BytedanceSidebar.listenFromSidebar((fromSidebar: boolean) => {
|
// MiniGameSdk.BytedanceSidebar.listenFromSidebar((fromSidebar: boolean) => {
|
||||||
// if (fromSidebar) {
|
// if (fromSidebar) {
|
||||||
// console.log('用户从侧边栏启动游戏');
|
// console.log('用户从侧边栏启动游戏');
|
||||||
// // this.handleSidebarReward();
|
// this.handleSidebarReward();
|
||||||
|
|
||||||
// } else {
|
// } else {
|
||||||
// console.log('用户不是从侧边栏启动');
|
// console.log('用户不是从侧边栏启动');
|
||||||
|
|
@ -3657,6 +3681,14 @@ export default class JiaZai extends cc.Component {
|
||||||
cc.fx.GameConfig.GM_INFO.hammerAmount += rewardHammer;
|
cc.fx.GameConfig.GM_INFO.hammerAmount += rewardHammer;
|
||||||
const newHammerAmount = cc.fx.GameConfig.GM_INFO.hammerAmount;
|
const newHammerAmount = cc.fx.GameConfig.GM_INFO.hammerAmount;
|
||||||
|
|
||||||
|
Utils.setSidebar((res) => {
|
||||||
|
if (res.code === 1) {
|
||||||
|
// MiniGameSdk.API.showToast('侧边栏奖励领取成功');
|
||||||
|
console.log('侧边栏奖励领取成功');
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
// 同步到服务器
|
// 同步到服务器
|
||||||
cc.fx.GameTool.setUserProp(hammerPropId, newHammerAmount, (data) => {
|
cc.fx.GameTool.setUserProp(hammerPropId, newHammerAmount, (data) => {
|
||||||
});
|
});
|
||||||
|
|
@ -3665,6 +3697,7 @@ export default class JiaZai extends cc.Component {
|
||||||
MiniGameSdk.API.showToast(`侧边栏奖励!获得${rewardHammer}个锤子`, 3);
|
MiniGameSdk.API.showToast(`侧边栏奖励!获得${rewardHammer}个锤子`, 3);
|
||||||
console.log(`获得侧边栏奖励: ${rewardHammer}个锤子`);
|
console.log(`获得侧边栏奖励: ${rewardHammer}个锤子`);
|
||||||
cc.fx.StorageMessage.setStorage('sidebar_reward_date', 1);
|
cc.fx.StorageMessage.setStorage('sidebar_reward_date', 1);
|
||||||
|
this.initDouyinSidebar();
|
||||||
this.onSidebarClose();
|
this.onSidebarClose();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -3710,7 +3743,7 @@ export default class JiaZai extends cc.Component {
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加到桌面,暂时没加按钮调用
|
// 抖音添加到桌面,暂时没加按钮调用
|
||||||
onAddDesktop() {
|
onAddDesktop() {
|
||||||
console.log('点击添加到桌面按钮');
|
console.log('点击添加到桌面按钮');
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
@ -3735,6 +3768,39 @@ export default class JiaZai extends cc.Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 抖音客服
|
||||||
|
onOpenKefu() {
|
||||||
|
// @ts-ignore
|
||||||
|
if (tt.canIUse('openCustomerServiceConversation.type.3')) {
|
||||||
|
// @ts-ignore
|
||||||
|
tt.openCustomerServiceConversation({
|
||||||
|
type: 3, // 新增枚举值3
|
||||||
|
success: () => {// 成功回调 拉起客服界面即成功
|
||||||
|
console.log("拉起客服界面成功");
|
||||||
|
},
|
||||||
|
fail: () => {// 失败回调
|
||||||
|
console.log("拉起客服界面失败");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 抖音检查必须功能
|
||||||
|
dyCheck() {
|
||||||
|
const sidebarBtn = this.node.getChildByName("Load")?.getChildByName("sidebarBtn");
|
||||||
|
const dy_kefu = this.node.getChildByName("Load")?.getChildByName("Top").getChildByName("dy_kefu");
|
||||||
|
if (cc.sys.platform === cc.sys.BYTEDANCE_GAME) {
|
||||||
|
sidebarBtn.active = true;
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.dy_sidebar) {
|
||||||
|
sidebarBtn.active = false;
|
||||||
|
}
|
||||||
|
dy_kefu.active = true;
|
||||||
|
} else {
|
||||||
|
sidebarBtn.active = false;
|
||||||
|
dy_kefu.active = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update(dt) {
|
update(dt) {
|
||||||
if (this.newbieGift && this.monthlyCardNode) {
|
if (this.newbieGift && this.monthlyCardNode) {
|
||||||
if (this.monthlyCardNode.active == true) {
|
if (this.monthlyCardNode.active == true) {
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export default class Revive extends cc.Component {
|
||||||
}
|
}
|
||||||
if (cc.sys.platform === cc.sys.BYTEDANCE_GAME && cc.sys.os === cc.sys.OS_IOS) {
|
if (cc.sys.platform === cc.sys.BYTEDANCE_GAME && cc.sys.os === cc.sys.OS_IOS) {
|
||||||
this.node.getChildByName("an").getChildByName("price").active = false;
|
this.node.getChildByName("an").getChildByName("price").active = false;
|
||||||
this.node.getChildByName("an1").getChildByName("price_dy").active = true;
|
this.node.getChildByName("an").getChildByName("price_dy").active = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init() {
|
init() {
|
||||||
|
|
|
||||||
|
|
@ -614,6 +614,12 @@ export default class SceneManager extends cc.Component {
|
||||||
|
|
||||||
if (isCheckboxChecked == 0 || isCheckboxChecked == "" || isCheckboxChecked == null || isCheckboxChecked == undefined) {
|
if (isCheckboxChecked == 0 || isCheckboxChecked == "" || isCheckboxChecked == null || isCheckboxChecked == undefined) {
|
||||||
shareTips.active = true;
|
shareTips.active = true;
|
||||||
|
let share_wx = shareTips.getChildByName("share_wx");
|
||||||
|
let share_dy = shareTips.getChildByName("share_dy");
|
||||||
|
if (cc.sys.platform === cc.sys.BYTEDANCE_GAME) {
|
||||||
|
share_wx.active = false;
|
||||||
|
share_dy.active = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.shareFriend2();
|
this.shareFriend2();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,7 @@ export class GameConfig {
|
||||||
randomLevel: number;
|
randomLevel: number;
|
||||||
endLevelNum: number; // 通关后 记录玩家随机游戏关卡数量
|
endLevelNum: number; // 通关后 记录玩家随机游戏关卡数量
|
||||||
GameplayType: number; //游戏类型
|
GameplayType: number; //游戏类型
|
||||||
|
dy_sidebar: boolean; // 是否显示侧边栏奖励
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -348,6 +349,7 @@ export class GameConfig {
|
||||||
randomLevel: 0,
|
randomLevel: 0,
|
||||||
endLevelNum: 1,
|
endLevelNum: 1,
|
||||||
GameplayType: 0, // 0 正常模式, 1无尽模式
|
GameplayType: 0, // 0 正常模式, 1无尽模式
|
||||||
|
dy_sidebar: false, // 是否显示侧边栏奖励
|
||||||
};
|
};
|
||||||
// this.setCode(this.getKey("scode"));
|
// this.setCode(this.getKey("scode"));
|
||||||
// this.GM_INFO.level = 0;
|
// this.GM_INFO.level = 0;
|
||||||
|
|
|
||||||
|
|
@ -1819,4 +1819,26 @@ export default class Utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static setSidebar(callBack) {
|
||||||
|
//@ts-ignore
|
||||||
|
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
||||||
|
let uid = cc.fx.StorageMessage.getStorage("uid");
|
||||||
|
//旧的读取数据设置数据方法,以强联网为主
|
||||||
|
if (uid != undefined && uid != "" && uid != null) {
|
||||||
|
cc.fx.GameConfig.GM_INFO.uid = uid;
|
||||||
|
}
|
||||||
|
let setData = {
|
||||||
|
uid: cc.fx.GameConfig.GM_INFO.uid,
|
||||||
|
}
|
||||||
|
Utils.POST("setDysidebar", setData, res => {
|
||||||
|
if (res.code === 1) {
|
||||||
|
console.log("设置侧边栏领取成功", res);
|
||||||
|
if (callBack) callBack(res);
|
||||||
|
} else {
|
||||||
|
console.log("设置侧边栏领取失败", res);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
assets/UI/UI/dy_kefu.png
Normal file
BIN
assets/UI/UI/dy_kefu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
38
assets/UI/UI/dy_kefu.png.meta
Normal file
38
assets/UI/UI/dy_kefu.png.meta
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"ver": "2.3.7",
|
||||||
|
"uuid": "0cef095d-5fde-47d5-bbdd-aeaef1456084",
|
||||||
|
"importer": "texture",
|
||||||
|
"type": "sprite",
|
||||||
|
"wrapMode": "clamp",
|
||||||
|
"filterMode": "bilinear",
|
||||||
|
"premultiplyAlpha": false,
|
||||||
|
"genMipmaps": false,
|
||||||
|
"packable": true,
|
||||||
|
"width": 153,
|
||||||
|
"height": 163,
|
||||||
|
"platformSettings": {},
|
||||||
|
"subMetas": {
|
||||||
|
"dy_kefu": {
|
||||||
|
"ver": "1.0.6",
|
||||||
|
"uuid": "0c3d98aa-50be-4458-aa8b-bf49c4340fcc",
|
||||||
|
"importer": "sprite-frame",
|
||||||
|
"rawTextureUuid": "0cef095d-5fde-47d5-bbdd-aeaef1456084",
|
||||||
|
"trimType": "auto",
|
||||||
|
"trimThreshold": 1,
|
||||||
|
"rotated": false,
|
||||||
|
"offsetX": 0,
|
||||||
|
"offsetY": 0,
|
||||||
|
"trimX": 0,
|
||||||
|
"trimY": 0,
|
||||||
|
"width": 153,
|
||||||
|
"height": 163,
|
||||||
|
"rawWidth": 153,
|
||||||
|
"rawHeight": 163,
|
||||||
|
"borderTop": 0,
|
||||||
|
"borderBottom": 0,
|
||||||
|
"borderLeft": 0,
|
||||||
|
"borderRight": 0,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/UI/UI/pop/shaare_dy.png
Normal file
BIN
assets/UI/UI/pop/shaare_dy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
38
assets/UI/UI/pop/shaare_dy.png.meta
Normal file
38
assets/UI/UI/pop/shaare_dy.png.meta
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"ver": "2.3.7",
|
||||||
|
"uuid": "78dbd153-d453-47a3-9d61-c70ff59ab547",
|
||||||
|
"importer": "texture",
|
||||||
|
"type": "sprite",
|
||||||
|
"wrapMode": "clamp",
|
||||||
|
"filterMode": "bilinear",
|
||||||
|
"premultiplyAlpha": false,
|
||||||
|
"genMipmaps": false,
|
||||||
|
"packable": true,
|
||||||
|
"width": 821,
|
||||||
|
"height": 221,
|
||||||
|
"platformSettings": {},
|
||||||
|
"subMetas": {
|
||||||
|
"shaare_dy": {
|
||||||
|
"ver": "1.0.6",
|
||||||
|
"uuid": "e4976367-7628-40b5-a72c-51039a888b28",
|
||||||
|
"importer": "sprite-frame",
|
||||||
|
"rawTextureUuid": "78dbd153-d453-47a3-9d61-c70ff59ab547",
|
||||||
|
"trimType": "auto",
|
||||||
|
"trimThreshold": 1,
|
||||||
|
"rotated": false,
|
||||||
|
"offsetX": 0,
|
||||||
|
"offsetY": 0,
|
||||||
|
"trimX": 0,
|
||||||
|
"trimY": 0,
|
||||||
|
"width": 821,
|
||||||
|
"height": 221,
|
||||||
|
"rawWidth": 821,
|
||||||
|
"rawHeight": 221,
|
||||||
|
"borderTop": 0,
|
||||||
|
"borderBottom": 0,
|
||||||
|
"borderLeft": 0,
|
||||||
|
"borderRight": 0,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user