Commit 3e8e286c authored by Nguyễn Quang Sáng's avatar Nguyễn Quang Sáng

12/8/2023 commit

parent 32b5400a
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
"_name": "Practice", "_name": "Practice",
"_objFlags": 0, "_objFlags": 0,
"_native": "", "_native": "",
"_duration": 5.983333333333333, "_duration": 3.0166666666666666,
"sample": 60, "sample": 60,
"speed": 1, "speed": 1,
"wrapMode": 2, "wrapMode": 54,
"curveData": { "curveData": {
"paths": {}, "paths": {},
"props": { "props": {
...@@ -42,30 +42,6 @@ ...@@ -42,30 +42,6 @@
203.38, 203.38,
0 0
] ]
},
{
"frame": 4,
"value": [
524.063,
327.639,
0
]
},
{
"frame": 5,
"value": [
351.704,
327.639,
0
]
},
{
"frame": 5.983333333333333,
"value": [
351.704,
206.587,
0
]
} }
] ]
} }
......
{
"__type__": "cc.SpriteAtlas"
}
\ No newline at end of file
{
"ver": "1.2.5",
"uuid": "38362a10-d327-4a06-8eba-26b8134b34e0",
"importer": "auto-atlas",
"maxWidth": 1024,
"maxHeight": 1024,
"padding": 2,
"compressionLevel": 6,
"allowRotation": true,
"forceSquared": false,
"powerOfTwo": false,
"algorithm": "MaxRects",
"format": "png",
"quality": 80,
"contourBleed": true,
"paddingBleed": true,
"filterUnused": true,
"packable": false,
"premultiplyAlpha": false,
"filterMode": "bilinear",
"platformSettings": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -804,8 +804,8 @@ ...@@ -804,8 +804,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
1.405, -2.748,
368.808, 356.342,
0, 0,
0, 0,
0, 0,
...@@ -829,6 +829,64 @@ ...@@ -829,6 +829,64 @@
"groupIndex": 0, "groupIndex": 0,
"_id": "50EUui8txFdpfAqkzmjuiO" "_id": "50EUui8txFdpfAqkzmjuiO"
}, },
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": -9.7,
"y": -99.9
},
{
"__type__": "cc.Vec2",
"x": -0.4,
"y": -99.9
},
{
"__type__": "cc.Vec2",
"x": 9.9,
"y": -100
},
{
"__type__": "cc.Vec2",
"x": 3.6,
"y": -79.6
},
{
"__type__": "cc.Vec2",
"x": -3.1,
"y": -60.3
},
{
"__type__": "cc.Vec2",
"x": -24.8,
"y": -45.2
},
{
"__type__": "cc.Vec2",
"x": -28.8,
"y": -64.8
}
],
"_id": "28OMGpZLpOjKDr+NNBfwOJ"
},
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
...@@ -871,7 +929,7 @@ ...@@ -871,7 +929,7 @@
"_enabled": true, "_enabled": true,
"_type": 2, "_type": 2,
"_allowSleep": false, "_allowSleep": false,
"_gravityScale": 0, "_gravityScale": 2,
"_linearDamping": 0, "_linearDamping": 0,
"_angularDamping": 0, "_angularDamping": 0,
"_linearVelocity": { "_linearVelocity": {
...@@ -896,44 +954,6 @@ ...@@ -896,44 +954,6 @@
"_enabled": true, "_enabled": true,
"_id": "dbIEDAURxEga5FLJd0fT5J" "_id": "dbIEDAURxEga5FLJd0fT5J"
}, },
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 1,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": -10,
"y": 100
},
{
"__type__": "cc.Vec2",
"x": -10,
"y": -100
},
{
"__type__": "cc.Vec2",
"x": 10,
"y": 0
}
],
"_id": "28OMGpZLpOjKDr+NNBfwOJ"
},
{ {
"__type__": "7aaccRSHlRDIJdCgIhB/vcq", "__type__": "7aaccRSHlRDIJdCgIhB/vcq",
"_name": "", "_name": "",
......
{
"ver": "1.1.3",
"uuid": "fe3a2be9-eaa4-4f21-af9a-ec6a60103de4",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
import Dog from "../Objects/Dog";
import Hole from "../Objects/Hole";
import LimitBar from "../Objects/LimitBar";
import LocalStorage from "../Data/LocalStorage";
import PracticeLine from "../Objects/PracticeLine";
import Utils from "../Utils";
import Drawer from "../Drawer";
const { ccclass, property } = cc._decorator;
@ccclass
export default class GamePlay extends cc.Component {
@property lineMinSegLength = 10;
@property lineWidth = 13;
@property(cc.Prefab) prefabToLoad: cc.Prefab = null;
@property(cc.Node) gameRegion: cc.Node = null;
@property(cc.Graphics) graphic: cc.Graphics = null;
@property(cc.Label) timerLabel: cc.Label = null;
@property(cc.Node) clock: cc.Node = null;
@property(cc.Node) levelLabel: cc.Node = null;
@property(cc.Node) levelComp: cc.Node = null;
@property(cc.Node) rewardSprite: cc.Node = null;
@property(cc.Node) shadow: cc.Node = null;
@property([cc.SpriteFrame]) starWinSprites: cc.SpriteFrame[] = [];
isDrawing: boolean = false;
draw: cc.Node = null;
rb: cc.RigidBody = null;
rbCol: cc.PhysicsPolygonCollider = null;
countdown: number = 7;
startCount: boolean = false;
lastTouchPos: cc.Vec2 = cc.v2(0, 0);
leftEdge: cc.Vec2 = null;
rightEdge: cc.Vec2 = null;
linePoints: Array<cc.Vec2> = new Array<cc.Vec2>();
leftEdgePoints: Array<cc.Vec2> = new Array<cc.Vec2>();
rightEdgePoints: Array<cc.Vec2> = new Array<cc.Vec2>();
protected onLoad(): void {
cc.director.getPhysicsManager().enabled = true;
cc.director.getCollisionManager().enabled = true;
cc.director.getPhysicsManager().debugDrawFlags = 1;
this.loadPrefab();
this.gameRegion.on(cc.Node.EventType.TOUCH_START, this.onTouchDown, this);
this.gameRegion.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
this.gameRegion.on(cc.Node.EventType.TOUCH_END, this.onTouchUp, this);
this.gameRegion.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchUp, this);
}
loadPrefab() {
const newNode = cc.instantiate(this.prefabToLoad);
this.node.addChild(newNode);
this.levelLabel.getComponent(
cc.Label
).string = `Level ${this.prefabToLoad.name}`;
}
onTouchDown(event: cc.Event.EventTouch) {
let touchPos = event.getLocation();
if (this.prefabToLoad.name == "1") {
PracticeLine.instance.node.active = false;
}
this.isDrawing = true;
this.draw = new cc.Node();
this.draw.parent = this.node;
let graphic = this.draw.addComponent(cc.Graphics);
graphic.lineCap = this.graphic.lineCap;
graphic.lineJoin = this.graphic.lineJoin;
this.rb = this.draw.addComponent(cc.RigidBody);
this.rb.type = cc.RigidBodyType.Static;
this.linePoints.length = 0;
this.linePoints.push(touchPos);
this.lastTouchPos = touchPos;
}
onTouchMove(event: cc.Event.EventTouch) {
let touchPos = event.getLocation();
if (
cc.Vec2.distance(touchPos, this.lastTouchPos) >= this.lineMinSegLength
) {
if (this.isDrawing) {
let touchNormal = touchPos.sub(this.lastTouchPos).normalize();
let leftEdgeNormal = Utils.RotateVec2CounterClockwise(touchNormal);
let rightEdgeNormal = Utils.RotateVec2Clockwise(touchNormal);
this.leftEdgePoints.push(
this.lastTouchPos.add(
leftEdgeNormal.multiplyScalar(this.lineWidth / 2)
)
);
this.rightEdgePoints.push(
this.lastTouchPos.add(
rightEdgeNormal.multiplyScalar(this.lineWidth / 2)
)
);
this.lastTouchPos = touchPos;
this.linePoints.push(touchPos);
LimitBar.instance.fillTheBar();
if (LimitBar.instance.progress <= 0) {
this.onTouchUp(event);
} else this.drawLine();
}
}
}
onTouchUp(event: cc.Event.EventTouch) {
if (this.isDrawing) {
let touchPos = event.getLocation();
let touchNormal = touchPos.sub(this.lastTouchPos).normalize();
let leftEdgeNormal = Utils.RotateVec2CounterClockwise(touchNormal);
let rightEdgeNormal = Utils.RotateVec2Clockwise(touchNormal);
this.rbCol = this.draw.addComponent(cc.PhysicsPolygonCollider);
this.leftEdgePoints.push(
touchPos.add(leftEdgeNormal.multiplyScalar(this.lineWidth / 2))
);
this.rightEdgePoints.push(
touchPos.add(rightEdgeNormal.multiplyScalar(this.lineWidth / 2))
);
this.rbCol.points.length = 0;
// this.rbCol.points.push(this.leftEdgePoints[0]);
this.rightEdgePoints.forEach((point) => {
this.rbCol.points.push(this.rbCol.node.convertToNodeSpaceAR(point));
});
this.leftEdgePoints.reverse();
this.leftEdgePoints.forEach((point) => {
this.rbCol.points.push(this.rbCol.node.convertToNodeSpaceAR(point));
});
Drawer.clear();
Drawer.drawArray(this.leftEdgePoints);
Drawer.drawArray(this.rightEdgePoints);
this.rbCol.apply();
this.rb.type = cc.RigidBodyType.Dynamic;
Dog.instance.getComponent(cc.RigidBody).type = cc.RigidBodyType.Dynamic;
Dog.instance.getComponent(cc.Animation).play("DogScare");
Hole.instance.isSpawnable = true;
this.clock.active = true;
this.startCount = true;
this.isDrawing = false;
}
}
protected update(dt: number): void {
if (this.startCount && this.countdown >= 1) {
this.countdown -= 1 * dt;
this.timerLabel.string = Math.floor(this.countdown).toString();
}
if (Dog.instance.attacked || this.countdown < 0) {
this.startCount = false;
this.scheduleOnce(() => {
this.onReloadLevel();
}, 2);
}
if (!Dog.instance.attacked && this.countdown <= 1) {
this.onLevelCompleted();
}
}
onReloadLevel() {
cc.director.loadScene("gameplay");
}
onLevelCompleted() {
Dog.instance.getComponent(cc.Animation).play("DogIdle");
this.levelComp.active = true;
this.shadow.active = true;
if (LimitBar.instance.winStar == 3) {
if (
LocalStorage.getStarAtLevel(parseInt(this.prefabToLoad.name)) <
LimitBar.instance.winStar
) {
LocalStorage.setStarAtLevel(parseInt(this.prefabToLoad.name), 3);
}
}
if (LimitBar.instance.winStar == 2) {
LocalStorage.setStarAtLevel(parseInt(this.prefabToLoad.name), 2);
this.rewardSprite.getComponent(cc.Sprite).spriteFrame =
this.starWinSprites[1];
}
if (LimitBar.instance.winStar == 1) {
LocalStorage.setStarAtLevel(parseInt(this.prefabToLoad.name), 1);
this.rewardSprite.getComponent(cc.Sprite).spriteFrame =
this.starWinSprites[0];
}
}
drawLine() {
let lineDrawer = this.draw.getComponent(cc.Graphics);
if (lineDrawer == null) lineDrawer = this.draw.addComponent(cc.Graphics);
lineDrawer.strokeColor = this.graphic.strokeColor;
lineDrawer.lineWidth = this.graphic.lineWidth;
for (let i = 0; i < this.linePoints.length - 1; i++) {
let p1 = this.linePoints[i];
let p2 = this.linePoints[i + 1];
let p1InLocal = lineDrawer.node.parent.convertToNodeSpaceAR(p1);
let p2InLocal = lineDrawer.node.parent.convertToNodeSpaceAR(p2);
lineDrawer.moveTo(p1InLocal.x, p1InLocal.y);
lineDrawer.lineTo(p2InLocal.x, p2InLocal.y);
lineDrawer.stroke();
}
}
}
{
"ver": "1.1.3",
"uuid": "18ee1e57-51ef-4d0f-971c-702ee96c8073",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
const { ccclass, property } = cc._decorator;
@ccclass
export default class LocalStorage extends cc.Component {
public static setCurrentLevel(value: number) {
cc.sys.localStorage.setItem("SaveTheDoge" + " - " + "CurrentLevel", value);
}
public static getCurrentLevel(): number {
if (
cc.sys.localStorage.getItem("SaveTheDoge" + " - " + "CurrentLevel") ==
null
) {
cc.sys.localStorage.setItem("SaveTheDoge" + " - " + "CurrentLevel", 0);
return 0;
} else
return JSON.parse(
cc.sys.localStorage.getItem("SaveTheDoge" + " - " + "CurrentLevel")
);
}
public static setHighestLevel(value: number) {
cc.sys.localStorage.setItem("SaveTheDoge" + " - " + "HighestLevel", value);
}
public static getHighestLevel(): number {
if (
cc.sys.localStorage.getItem("SaveTheDoge" + " - " + "HighestLevel") ==
null
) {
cc.sys.localStorage.setItem("SaveTheDoge" + " - " + "HighestLevel", 1);
return 1;
} else
return JSON.parse(
cc.sys.localStorage.getItem("SaveTheDoge" + " - " + "HighestLevel")
);
}
public static getStarAtLevel(level: number): number {
if (
cc.sys.localStorage.getItem(
"SaveTheDoge" + " - " + "Level " + level.toString()
) == null
) {
cc.sys.localStorage.setItem(
"SaveTheDoge" + " - " + "Level " + level.toString(),
0
);
return 0;
} else
return JSON.parse(
cc.sys.localStorage.getItem(
"SaveTheDoge" + " - " + "Level " + level.toString()
)
);
}
public static setStarAtLevel(level: number, starValue: number) {
cc.sys.localStorage.setItem(
"SaveTheDoge" + " - " + "Level " + level.toString(),
starValue
);
}
public static getAllStar(): number {
if (
cc.sys.localStorage.getItem("SaveTheDoge" + " - " + "AllStar") == null
) {
cc.sys.localStorage.setItem("SaveTheDoge" + " - " + "AllStar", 0);
return 0;
} else
return JSON.parse(
cc.sys.localStorage.getItem("SaveTheDoge" + " - " + "AllStar")
);
}
public static setAllStar() {
cc.sys.localStorage.setItem("SaveTheDoge" + " - " + "AllStar");
}
}
{
"ver": "1.1.0",
"uuid": "3e28f2cf-53dc-4963-8802-dc4427a93371",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
const { ccclass, property } = cc._decorator;
@ccclass
export default class Drawer extends cc.Component {
private static _graphic: cc.Graphics = null;
public static clear() {
if (this._graphic == null) return;
this._graphic.clear();
}
public static drawLine(
pointA: cc.Vec2,
pointB: cc.Vec2,
color: cc.Color = cc.Color.WHITE
) {
if (this._graphic == null) {
this._graphic = new cc.Node().addComponent(cc.Graphics);
this._graphic.node.parent = cc.Canvas.instance.node.parent;
}
this._graphic.strokeColor = color;
this._graphic.moveTo(pointA.x, pointA.y);
this._graphic.lineTo(pointB.x, pointB.y);
this._graphic.stroke();
}
public static drawLineOnY(yValue: number, color: cc.Color = cc.Color.WHITE) {
if (this._graphic == null) {
this._graphic = new cc.Node().addComponent(cc.Graphics);
this._graphic.node.parent = cc.Canvas.instance.node.parent;
}
this._graphic.strokeColor = color;
this._graphic.moveTo(0, yValue);
this._graphic.lineTo(cc.view.getDesignResolutionSize().width, yValue);
this._graphic.stroke();
}
public static drawRect(rect: cc.Rect) {
Drawer.drawLine(cc.v2(rect.x, rect.y), cc.v2(rect.x + rect.width, rect.y));
Drawer.drawLine(cc.v2(rect.x, rect.y), cc.v2(rect.x, rect.y + rect.height));
Drawer.drawLine(
cc.v2(rect.x + rect.width, rect.y + rect.height),
cc.v2(rect.x + rect.width, rect.y)
);
Drawer.drawLine(
cc.v2(rect.x + rect.width, rect.y + rect.height),
cc.v2(rect.x, rect.y + rect.height)
);
}
public static drawArray(array: Array<cc.Vec2>) {
for (let i = 1; i < array.length; i++) {
this.drawLine(array[i - 1], array[i]);
}
}
}
{
"ver": "1.1.0",
"uuid": "bc9b8781-2f27-4e4a-99a3-d68493af5f58",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import Bee from "./Bee";
import Dog from "./Dog";
import Hole from "./Hole";
import LimitBar from "./LimitBar";
const { ccclass, property } = cc._decorator;
@ccclass
export default class GamePlay extends cc.Component {
@property(cc.Prefab) prefabToLoad: cc.Prefab = null;
@property(cc.Node) gameRegion: cc.Node = null;
@property(cc.Graphics) graphic: cc.Graphics = null;
@property(cc.Label) timerLabel: cc.Label = null;
@property(cc.Node) clock: cc.Node = null;
@property(cc.Node) levelLabel: cc.Node = null;
@property(cc.Node) shadow: cc.Node = null;
@property(cc.Node) light: cc.Node = null;
@property(cc.Node) title: cc.Node = null;
@property(cc.Node) earnedCoin: cc.Node = null;
@property(cc.Node) earnedCoinLabel: cc.Node = null;
@property(cc.Node) buttonCollect: cc.Node = null;
@property(cc.Node) star: cc.Node = null;
@property(cc.Node) starLabel: cc.Node = null;
@property(cc.Node) rewardSprite: cc.Node = null;
@property(cc.SpriteFrame) win2Star: cc.SpriteFrame = null;
@property(cc.SpriteFrame) win1Star: cc.SpriteFrame = null;
isDrawing: boolean = true;
draw: cc.Node = null;
rb = null;
chain = null;
countdown: number = 7;
startCount: boolean = false;
protected onLoad(): void {
cc.director.getPhysicsManager().enabled = true;
cc.director.getCollisionManager().enabled = true;
// cc.director.getPhysicsManager().debugDrawFlags = 1;
this.loadPrefab();
this.gameRegion.on(cc.Node.EventType.TOUCH_START, this.onTouchDown, this);
this.gameRegion.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
this.gameRegion.on(cc.Node.EventType.TOUCH_END, this.onTouchUp, this);
this.gameRegion.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchUp, this);
}
loadPrefab() {
const newNode = cc.instantiate(this.prefabToLoad);
this.node.addChild(newNode);
this.levelLabel.getComponent(cc.Label).string = this.prefabToLoad.name;
}
onTouchDown(event) {
if (this.prefabToLoad.name == "Level 1") {
this.prefabToLoad.data.children[3].active = false;
}
console.log(this.prefabToLoad.data.getChildByName("PracticeLine").active);
this.draw = new cc.Node();
this.draw.parent = this.node;
this.draw.addComponent(cc.Graphics);
this.rb = this.draw.addComponent(cc.RigidBody);
this.rb.type = cc.RigidBodyType.Static;
this.chain = this.draw.addComponent(cc.PhysicsChainCollider);
this.chain.points = [event.getLocation()];
}
onTouchMove(event) {
if (this.isDrawing) {
this.chain.points.push(event.getLocation());
LimitBar.instance.fillTheBar();
if (LimitBar.instance.progress <= 0) {
this.onTouchUp();
} else this.drawLine();
}
}
onTouchUp() {
this.isDrawing = false;
// this.rb.type = cc.RigidBodyType.Dynamic;
this.rb.allowSleep = false;
this.rb.enabledContactListener = true;
Dog.instance.getComponent(cc.Animation).play("DogScare");
this.chain.apply();
Hole.instance.isSpawnable = true;
this.clock.active = true;
this.startCount = true;
}
protected update(dt: number): void {
if (this.startCount && this.countdown >= 1) {
this.countdown -= 1 * dt;
this.timerLabel.string = Math.floor(this.countdown).toString();
}
if (Dog.instance.attacked || this.countdown < 0) this.startCount == false;
if (Dog.instance.attacked == false && this.countdown <= 1) {
this.onLevelCompleted();
}
}
onLevelCompleted() {
Dog.instance.getComponent(cc.Animation).play("DogIdle");
this.shadow.active = true;
this.light.active = true;
this.title.active = true;
this.earnedCoin.active = true;
this.earnedCoinLabel.active = true;
this.buttonCollect.active = true;
this.star.active = true;
this.starLabel.active = true;
this.rewardSprite.active = true;
if (LimitBar.instance.winStar == 2) {
this.rewardSprite.getComponent(cc.Sprite).spriteFrame = this.win2Star;
}
if (LimitBar.instance.winStar == 1) {
this.rewardSprite.getComponent(cc.Sprite).spriteFrame = this.win1Star;
}
}
drawLine() {
if (this.chain.points.length < 3) return;
let lineComponent = this.draw.getComponent(cc.Graphics);
if (lineComponent == null)
lineComponent = this.draw.addComponent(cc.Graphics);
lineComponent.strokeColor = cc.Color.BLACK;
lineComponent.lineWidth = 13;
for (let i = 0; i < this.chain.points.length - 1; i++) {
let p1 = this.chain.points[i];
let p2 = this.chain.points[i + 1];
let p1InLocal = this.node.convertToNodeSpaceAR(p1);
let p2InLocal = this.node.convertToNodeSpaceAR(p2);
lineComponent.moveTo(p1InLocal.x, p1InLocal.y);
lineComponent.lineTo(p2InLocal.x, p2InLocal.y);
lineComponent.stroke();
}
}
}
{
"ver": "1.1.3",
"uuid": "53295653-608e-4c63-9e03-0342e432b298",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
import Dog from "./Dog";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
@ccclass @ccclass
......
const { ccclass, property } = cc._decorator;
@ccclass
export default class PracticeLine extends cc.Component {
static instance: PracticeLine;
protected onLoad(): void {
PracticeLine.instance = this;
}
}
{
"ver": "1.1.0",
"uuid": "5584a517-1f61-403d-aefe-04b26ee3f29a",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
...@@ -6,6 +6,4 @@ export default class TestPhysic extends cc.Component { ...@@ -6,6 +6,4 @@ export default class TestPhysic extends cc.Component {
cc.director.getPhysicsManager().enabled = true; cc.director.getPhysicsManager().enabled = true;
cc.director.getCollisionManager().enabled = true; cc.director.getCollisionManager().enabled = true;
} }
} }
This diff is collapsed.
{
"ver": "1.1.0",
"uuid": "28792beb-4323-4106-95b6-63bdd516bf20",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment