import ranking from "./ranking"; const { ccclass, property, requireComponent } = cc._decorator; @ccclass export default class NewClass extends cc.Component { @property(cc.Node) node1: cc.Node = null; @property(cc.Node) node2: cc.Node = null; @property(cc.Node) node3: cc.Node = null; @property(false) localTest: boolean = false; @property("") clientTestVersion: string = "1.0.0"; @property(cc.Label) testVersion: cc.Label = null; onLoad() { //@ts-ignore cc.internal.inputManager._maxTouches = 1 cc.debug.setDisplayStats(false); let manager = cc.director.getCollisionManager(); manager.enabled = true; this.setWX(); // let version = cc.fx.GameTool.getWechatGameVersion(); // if (version == "开发版" || version == "体验版") { // cc.debug.setDisplayStats(false); // } // else if (version == "正式版") { // cc.debug.setDisplayStats(false); // } // else { // cc.debug.setDisplayStats(false); // } //this.SubContext(); } // SubContext() { // if (typeof wx === 'undefined') { // return; // } // wx.getOpenDataContext().postMessage({ // message: 'show' // }); // console.log("加载子域"); // } setWX() { //@ts-ignore let isWeChat = typeof wx !== 'undefined' && wx !== null && cc.sys.platform === cc.sys.WECHAT_GAME; //@ts-ignore let isBytedance = typeof tt !== 'undefined' && tt !== null && cc.sys.platform === cc.sys.BYTEDANCE_GAME; if (isWeChat) { this.setWeChatPlatform(); } else if (isBytedance) { this.setBytedancePlatform(); } } setWeChatPlatform() { //@ts-ignore wx.setPreferredFramesPerSecond(60); let iphoneArr = [ "https://mmocgame.qpic.cn/wechatgame/Lf3SBqy9XpNkakoIZygRzXqww3HTibq6VyibazqmicwibjCS3YpgqbZtkdyABm4Y1wAr/0", "https://mmocgame.qpic.cn/wechatgame/TWKuFxnCn7ksT3KXfhCC4yOfZeD4b0hrptDSJ2DFmwz02Yc8SppcwyPAOoS1MsMr/0", "https://mmocgame.qpic.cn/wechatgame/dibaH2x79o1wSwBDymhyzXwfcyicaDb6R5icrFIO7251T4NgxIzXRXErHvAvn50vXFA/0", "https://mmocgame.qpic.cn/wechatgame/Pgxad80d8ws3o69OicV3DTuTkcP81upQeJ0JBNS1xib3pzYLTF1ZqGY3niciaI7ICKlL/0", "https://mmocgame.qpic.cn/wechatgame/SfB1vrRBIHKn9ffKFt5sib62yPLE31m2rCvk6DKlEicJNVZSoryEObD6ItwsQn4xibR/0", "https://mmocgame.qpic.cn/wechatgame/OiaWk33I6QjgWiatrb5YVUq2p0QRmQgO6rLUWxEQDZ4ib9Ny4Pr8iaHnHI6WdxibY2nPL/0", "https://mmocgame.qpic.cn/wechatgame/CG5xBibollws251aYD4msEPWCiafrcn4Fgtic4T2wME6sWmdfAUtfibgsWoxm59VadDD/0" ] let randomIphone = iphoneArr[Math.floor(Math.random() * iphoneArr.length)]; let img = randomIphone; const shareParams = { title: '快来一起玩这个超有趣的小游戏吧!', imageUrl: 'https://example.com/default_share_image.jpg' }; //@ts-ignore wx.onShareAppMessage(() => shareParams); //@ts-ignore wx.onShareTimeline(() => { return { title: '你想玩上怎样的游戏?' }; }); // 修复:改为标准的showShareMenu调用方式 //@ts-ignore wx.showShareMenu({ withShareTicket: true, menus: ['shareAppMessage', 'shareTimeline'] }); setTimeout(() => { //@ts-ignore wx.showShareMenu({ menus: ['shareAppMessage', 'shareTimeline'] }) }, 2000); setTimeout(() => { //@ts-ignore wx.showShareMenu({ menus: ['shareAppMessage', 'shareTimeline'] }) }, 4000); } setBytedancePlatform() { //@ts-ignore tt.setPreferredFramesPerSecond(60); let iphoneArr = [ "https://mmocgame.qpic.cn/wechatgame/Lf3SBqy9XpNkakoIZygRzXqww3HTibq6VyibazqmicwibjCS3YpgqbZtkdyABm4Y1wAr/0", "https://mmocgame.qpic.cn/wechatgame/TWKuFxnCn7ksT3KXfhCC4yOfZeD4b0hrptDSJ2DFmwz02Yc8SppcwyPAOoS1MsMr/0", "https://mmocgame.qpic.cn/wechatgame/dibaH2x79o1wSwBDymhyzXwfcyicaDb6R5icrFIO7251T4NgxIzXRXErHvAvn50vXFA/0", "https://mmocgame.qpic.cn/wechatgame/Pgxad80d8ws3o69OicV3DTuTkcP81upQeJ0JBNS1xib3pzYLTF1ZqGY3niciaI7ICKlL/0", "https://mmocgame.qpic.cn/wechatgame/SfB1vrRBIHKn9ffKFt5sib62yPLE31m2rCvk6DKlEicJNVZSoryEObD6ItwsQn4xibR/0", "https://mmocgame.qpic.cn/wechatgame/OiaWk33I6QjgWiatrb5YVUq2p0QRmQgO6rLUWxEQDZ4ib9Ny4Pr8iaHnHI6WdxibY2nPL/0", "https://mmocgame.qpic.cn/wechatgame/CG5xBibollws251aYD4msEPWCiafrcn4Fgtic4T2wME6sWmdfAUtfibgsWoxm59VadDD/0" ] let randomIphone = iphoneArr[Math.floor(Math.random() * iphoneArr.length)]; let img = randomIphone; const shareParams = { title: '快来一起玩这个超有趣的小游戏吧!', imageUrl: 'https://example.com/default_share_image.jpg' }; //@ts-ignore tt.onShareAppMessage(() => shareParams); // 添加抖音的onShareTimeline处理 // tt.onShareTimeline(() => { // return { // title: '你想玩上怎样的游戏?' // }; // }); //@ts-ignore tt.showShareMenu({ withShareTicket: true, success: (data) => { console.log('抖音分享菜单设置成功', data); }, fail: (data) => { console.log('抖音分享菜单设置失败', data); } }); setTimeout(() => { //@ts-ignore tt.showShareMenu({ withShareTicket: true }) }, 2000); setTimeout(() => { //@ts-ignore tt.showShareMenu({ withShareTicket: true }) }, 4000); } //判断来源 containsTrain(str) { return /from=train/i.test(str); } //开始游戏,跳转至引导页面 startGame() { cc.director.loadScene("GameScene"); // cc.director.loadScene("GuideScene"); } //备用,用来测试跳转 指定关卡 clickBtn(event, data) { cc.fx.GameConfig.GM_INFO.custom = parseInt(data); cc.director.loadScene("GameScene"); } //打开排行榜 openRank() { cc.director.loadScene("RankScene"); } protected update(dt: number): void { } // 3月17日 - 3月21日 工作完成内容 // 1:游戏框架搭建 // 2:制作18个基础方块预制体 (方块可编辑颜色与道具和状态) // 3:完成地图的搭建,可配置8*8以内,任意组合,包括可缺口和障碍物配置 // 4:完成地图墙面建立,根据 ↑3上面构建的地图自动生成墙体。 // 5:做完方块的基础移动,跟随手指,遇到方块或者墙壁或者障碍物阻碍移动。 // 6:方块的自动落点做完11个基础方块的(未做完还差11个) // 3月24日 - 3月28日 预计完成目标 // 1:完成全部方块的落点。 // 2:完成门的搭建,门可选颜色,可选开关或者星星等特殊状态 // 3:完成方块通过门的游戏逻辑,使游戏可以最基础运行玩起来 // 4:出5关版本,配合小白备案审核。 // 5:根据方块,地图,以及道具,制作地图编辑器 (方块和地图制作的时候都已经考虑到编辑器的需求了) // 优先制作,后续开发拓展玩法功能时,小白可同步进行制作关卡。 }