cb/assets/Script/Load.ts
2025-07-01 19:39:23 +08:00

192 lines
5.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 () {
// cc.director.getPhysicsManager().enabled = true;
// cc.director.getPhysicsManager().debugDrawFlags = 1;
// cc.director.getPhysicsManager().enabledAccumulator = true;
// cc.PhysicsManager.VELOCITY_ITERATIONS = 20;
// cc.PhysicsManager.FIXED_TIME_STEP = 1 / 120;
// cc.PhysicsManager.POSITION_ITERATIONS = 20;
//@ts-ignore
cc.internal.inputManager._maxTouches = 1
let manager = cc.director.getCollisionManager();
manager.enabled = true;
this.setWX();
cc.debug.setDisplayStats(false);
cc.tween(this.node1)
.delay(0 * 0.3)
.to(0.3, {scale: 1})
.to(0.3, {scale: 1.3})
.to(0.3, {scale: 1})
.union()
.repeatForever()
.start();
cc.tween(this.node2)
.delay(1 * 0.3)
.to(0.3, {scale: 1})
.to(0.3, {scale: 1.3})
.to(0.3, {scale: 1})
.union()
.repeatForever()
.start();
cc.tween(this.node3)
.delay(2 * 0.3)
.to(0.3, {scale: 1})
.to(0.3, {scale: 1.3})
.to(0.3, {scale: 1})
.union()
.repeatForever()
.start();
}
setWX(){
//@ts-ignore
if (typeof wx !== 'undefined' && wx !== null) { // 判断是否在微信环境
wx.setPreferredFramesPerSecond(60);
// // 设置转发按钮点击后的回调
// wx.onShareAppMessage(() => {
// return {
// title: '你想玩上怎样的游戏?',
// imageUrl: '',
// query: ''
// };
// });
wx.onShareAppMessage(function () {
// 用户点击了“转发”按钮
return {
title: '你想玩上怎样的游戏?'
}
})
// 监听分享到朋友圈事件
//@ts-ignore
wx.onShareTimeline(() => {
return {
title: '你想玩上怎样的游戏?'
};
});
wx.showShareMenu(() => {
return {
title: '你想玩上怎样的游戏?',
imageUrl: '',
query: ''
};
});
setTimeout(() => {
wx.showShareMenu({
menus: ['shareAppMessage', 'shareTimeline']
})
}, 2000);
// 设置分享到朋友圈
//@ts-ignore
// wx.updateShareMenu({
// withShareTicket: true,
// success: (data) => {
// console.log('更新分享菜单成功', data);
// },
// fail: (data) => {
// console.log('更新分享菜单失败', data);
// },
// complete: (data) => {
// console.log('更新分享菜单完成', data);
// }
// });
//@ts-ignore
}
}
//判断来源
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根据方块地图以及道具制作地图编辑器 (方块和地图制作的时候都已经考虑到编辑器的需求了)
// 优先制作,后续开发拓展玩法功能时,小白可同步进行制作关卡。
}