|
@@ -102,7 +102,7 @@ var laya = (function (exports) {
|
|
|
new LoadView();
|
|
|
}
|
|
|
}
|
|
|
- Main.Ver = "1.0.0";
|
|
|
+ Main.Ver = "1.0.3";
|
|
|
Main.CFG = "123";
|
|
|
Main.SceneNum = "000";
|
|
|
new Main();
|
|
@@ -1494,37 +1494,60 @@ var laya = (function (exports) {
|
|
|
ball.anchorY = 0.5;
|
|
|
ball.height = size;
|
|
|
ball.width = size;
|
|
|
- let collider = ball.addComponent(Laya.CircleCollider);
|
|
|
- collider.restitution = AccountManager.Instance.curplayerData.Restitution;
|
|
|
- if (this.STAGE == 1 && GameManager.Instance.Wave < 3) {
|
|
|
- collider.restitution = 0;
|
|
|
- }
|
|
|
- collider.radius = size / 2;
|
|
|
- let rig = ball.addComponent(Laya.RigidBody);
|
|
|
- rig.allowRotation = true;
|
|
|
- rig.gravityScale = 3;
|
|
|
- let num = new Laya.FontClip();
|
|
|
- num.name = "num";
|
|
|
- num.skin = "Game/res/Ball/44.png";
|
|
|
- num.anchorX = 0.5;
|
|
|
- num.anchorY = 0.5;
|
|
|
- num.sheet = "0123456789";
|
|
|
- let zi = this.PrefabName[_index];
|
|
|
- num.value = zi;
|
|
|
- ball.addChild(num);
|
|
|
- num.centerX = 0;
|
|
|
- num.centerY = 0;
|
|
|
- let light = new Laya.Image();
|
|
|
- light.skin = "Game/res/Ball/" + zi + ".png";
|
|
|
- light.anchorX = 0.5;
|
|
|
- light.anchorY = 0.5;
|
|
|
- light.width = this.LightSize(size);
|
|
|
- light.height = this.LightSize(size);
|
|
|
- light.name = "light";
|
|
|
- ball.addChild(light);
|
|
|
- light.centerX = 0;
|
|
|
- light.centerY = 0;
|
|
|
- let script = ball.addComponent(Ball);
|
|
|
+ let _rig = ball.getComponent(Laya.RigidBody);
|
|
|
+ if (!_rig) {
|
|
|
+ let rig = ball.addComponent(Laya.RigidBody);
|
|
|
+ rig.allowRotation = true;
|
|
|
+ rig.gravityScale = 3;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ _rig.enabled = true;
|
|
|
+ }
|
|
|
+ let _collider = ball.getComponent(Laya.CircleCollider);
|
|
|
+ if (!_collider) {
|
|
|
+ let collider = ball.addComponent(Laya.CircleCollider);
|
|
|
+ collider.restitution = AccountManager.Instance.curplayerData.Restitution;
|
|
|
+ if (this.STAGE == 1 && GameManager.Instance.Wave < 3) {
|
|
|
+ collider.restitution = 0;
|
|
|
+ }
|
|
|
+ collider.radius = size / 2;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ _collider.enabled = true;
|
|
|
+ _collider.isSensor = false;
|
|
|
+ }
|
|
|
+ let _num = ball.getChildByName("num");
|
|
|
+ let zi;
|
|
|
+ if (!_num) {
|
|
|
+ let num = new Laya.FontClip();
|
|
|
+ num.name = "num";
|
|
|
+ num.skin = "Game/res/Ball/44.png";
|
|
|
+ num.anchorX = 0.5;
|
|
|
+ num.anchorY = 0.5;
|
|
|
+ num.sheet = "0123456789";
|
|
|
+ zi = this.PrefabName[_index];
|
|
|
+ num.value = zi;
|
|
|
+ ball.addChild(num);
|
|
|
+ num.centerX = 0;
|
|
|
+ num.centerY = 0;
|
|
|
+ }
|
|
|
+ let _light = ball.getChildByName("light");
|
|
|
+ if (!_light) {
|
|
|
+ let light = new Laya.Image();
|
|
|
+ light.skin = "Game/res/Ball/" + zi + ".png";
|
|
|
+ light.anchorX = 0.5;
|
|
|
+ light.anchorY = 0.5;
|
|
|
+ light.width = this.LightSize(size);
|
|
|
+ light.height = this.LightSize(size);
|
|
|
+ light.name = "light";
|
|
|
+ ball.addChild(light);
|
|
|
+ light.centerX = 0;
|
|
|
+ light.centerY = 0;
|
|
|
+ }
|
|
|
+ let _script = ball.getComponent(Ball);
|
|
|
+ if (!_script) {
|
|
|
+ let script = ball.addComponent(Ball);
|
|
|
+ }
|
|
|
ball.pos(pos.x, pos.y);
|
|
|
Laya.timer.once(1, this, () => {
|
|
|
EventManager.StageTrigger(StageMode.Clone, [ball]);
|
|
@@ -1539,37 +1562,60 @@ var laya = (function (exports) {
|
|
|
ball.anchorY = 0.5;
|
|
|
ball.height = size;
|
|
|
ball.width = size;
|
|
|
- let collider = ball.addComponent(Laya.CircleCollider);
|
|
|
- collider.restitution = AccountManager.Instance.curplayerData.Restitution;
|
|
|
- if (this.STAGE == 1 && GameManager.Instance.Wave < 3) {
|
|
|
- collider.restitution = 0;
|
|
|
- }
|
|
|
- collider.radius = size / 2;
|
|
|
- let rig = ball.addComponent(Laya.RigidBody);
|
|
|
- rig.allowRotation = true;
|
|
|
- rig.gravityScale = 3;
|
|
|
- let num = new Laya.FontClip();
|
|
|
- num.name = "num";
|
|
|
- num.skin = "Game/res/Ball/44.png";
|
|
|
- num.anchorX = 0.5;
|
|
|
- num.anchorY = 0.5;
|
|
|
- num.sheet = "0123456789";
|
|
|
- let zi = this.PrefabName[_index];
|
|
|
- num.value = zi;
|
|
|
- ball.addChild(num);
|
|
|
- num.centerX = 0;
|
|
|
- num.centerY = 0;
|
|
|
- let light = new Laya.Image();
|
|
|
- light.skin = "Game/res/Ball/" + zi + ".png";
|
|
|
- light.anchorX = 0.5;
|
|
|
- light.anchorY = 0.5;
|
|
|
- light.width = this.LightSize(size);
|
|
|
- light.height = this.LightSize(size);
|
|
|
- light.name = "light";
|
|
|
- ball.addChild(light);
|
|
|
- light.centerX = 0;
|
|
|
- light.centerY = 0;
|
|
|
- let script = ball.addComponent(Ball);
|
|
|
+ let _rig = ball.getComponent(Laya.RigidBody);
|
|
|
+ if (!_rig) {
|
|
|
+ let rig = ball.addComponent(Laya.RigidBody);
|
|
|
+ rig.allowRotation = true;
|
|
|
+ rig.gravityScale = 3;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ _rig.enabled = true;
|
|
|
+ }
|
|
|
+ let _collider = ball.getComponent(Laya.CircleCollider);
|
|
|
+ if (!_collider) {
|
|
|
+ let collider = ball.addComponent(Laya.CircleCollider);
|
|
|
+ collider.restitution = AccountManager.Instance.curplayerData.Restitution;
|
|
|
+ if (this.STAGE == 1 && GameManager.Instance.Wave < 3) {
|
|
|
+ collider.restitution = 0;
|
|
|
+ }
|
|
|
+ collider.radius = size / 2;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ _collider.enabled = true;
|
|
|
+ _collider.isSensor = false;
|
|
|
+ }
|
|
|
+ let _num = ball.getChildByName("num");
|
|
|
+ let zi;
|
|
|
+ if (!_num) {
|
|
|
+ let num = new Laya.FontClip();
|
|
|
+ num.name = "num";
|
|
|
+ num.skin = "Game/res/Ball/44.png";
|
|
|
+ num.anchorX = 0.5;
|
|
|
+ num.anchorY = 0.5;
|
|
|
+ num.sheet = "0123456789";
|
|
|
+ zi = this.PrefabName[_index];
|
|
|
+ num.value = zi;
|
|
|
+ ball.addChild(num);
|
|
|
+ num.centerX = 0;
|
|
|
+ num.centerY = 0;
|
|
|
+ }
|
|
|
+ let _light = ball.getChildByName("light");
|
|
|
+ if (!_light) {
|
|
|
+ let light = new Laya.Image();
|
|
|
+ light.skin = "Game/res/Ball/" + zi + ".png";
|
|
|
+ light.anchorX = 0.5;
|
|
|
+ light.anchorY = 0.5;
|
|
|
+ light.width = this.LightSize(size);
|
|
|
+ light.height = this.LightSize(size);
|
|
|
+ light.name = "light";
|
|
|
+ ball.addChild(light);
|
|
|
+ light.centerX = 0;
|
|
|
+ light.centerY = 0;
|
|
|
+ }
|
|
|
+ let _script = ball.getComponent(Ball);
|
|
|
+ if (!_script) {
|
|
|
+ let script = ball.addComponent(Ball);
|
|
|
+ }
|
|
|
this.SetPosition(ball, pos);
|
|
|
Laya.timer.once(1, this, () => {
|
|
|
EventManager.StageTrigger(StageMode.Clone, [ball]);
|
|
@@ -1751,6 +1797,72 @@ var laya = (function (exports) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ class GamePool {
|
|
|
+ constructor() {
|
|
|
+ this.modelpool = {};
|
|
|
+ this.maxAcount = 30;
|
|
|
+ GamePool.ins = this;
|
|
|
+ }
|
|
|
+ static get Instance() {
|
|
|
+ if (GamePool.ins) {
|
|
|
+ return GamePool.ins;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return new GamePool();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ GetModel(title) {
|
|
|
+ var poolname = title;
|
|
|
+ if (this.modelpool[poolname] != null && this.modelpool[poolname] != undefined) {
|
|
|
+ if (this.modelpool[poolname].length > 0) {
|
|
|
+ var model1 = this.modelpool[poolname][0];
|
|
|
+ this.modelpool[poolname].splice(0, 1);
|
|
|
+ if (!model1.active) {
|
|
|
+ model1.active = true;
|
|
|
+ }
|
|
|
+ model1.active = true;
|
|
|
+ return model1;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ var model = new Laya.Image();
|
|
|
+ return model;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ var model = new Laya.Image();
|
|
|
+ model.active = true;
|
|
|
+ return model;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RecoverModel(_image, title = "", modelstate = false) {
|
|
|
+ if (_image.destroyed) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!modelstate && _image.active == false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var poolname = title;
|
|
|
+ if (this.modelpool[poolname] != null && this.modelpool[poolname] != undefined) {
|
|
|
+ var modelnum = this.modelpool[poolname];
|
|
|
+ if (modelnum.length > this.maxAcount) {
|
|
|
+ _image.destroy();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ modelnum.push(_image);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ modelnum = [];
|
|
|
+ modelnum.push(_image);
|
|
|
+ this.modelpool[poolname] = modelnum;
|
|
|
+ }
|
|
|
+ _image.pos(-1000, 0);
|
|
|
+ _image.removeSelf();
|
|
|
+ _image.active = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var Vector2 = Laya.Vector2;
|
|
|
class Ball extends Laya.Script {
|
|
|
constructor() {
|
|
@@ -1779,6 +1891,8 @@ var laya = (function (exports) {
|
|
|
let score = this.owner.getChildByName("num");
|
|
|
this.score = Number(score.value);
|
|
|
}
|
|
|
+ onEnable() {
|
|
|
+ }
|
|
|
onUpdate() {
|
|
|
this.CheckLight();
|
|
|
if (this.mark) {
|
|
@@ -1835,9 +1949,10 @@ var laya = (function (exports) {
|
|
|
let _collider = this.owner.getComponent(Laya.CircleCollider);
|
|
|
_collider.enabled = false;
|
|
|
_rig.enabled = false;
|
|
|
- Laya.timer.clearAll(this.owner);
|
|
|
- this.owner.removeSelf();
|
|
|
- this.owner.destroy();
|
|
|
+ owner.removeSelf();
|
|
|
+ owner.destroy();
|
|
|
+ let _index = DropRule.Instance.GetBallIndex(this.score).toString();
|
|
|
+ GamePool.Instance.RecoverModel(owner, "img" + _index);
|
|
|
let id = DropRule.Instance.GetBallIndex(num);
|
|
|
let size = DropRule.Instance.GetBallSize(num);
|
|
|
GameManager.Instance.ScoreProgress += num;
|
|
@@ -1863,9 +1978,8 @@ var laya = (function (exports) {
|
|
|
let _collider = this.owner.getComponent(Laya.CircleCollider);
|
|
|
_collider.enabled = false;
|
|
|
_rig.enabled = false;
|
|
|
- Laya.timer.clearAll(owner);
|
|
|
- this.owner.removeSelf();
|
|
|
- this.owner.destroy();
|
|
|
+ owner.removeSelf();
|
|
|
+ owner.destroy();
|
|
|
InGameView.Instance.SkillNumRefresh();
|
|
|
EventManager.EventTrigger(PropEffecf.NONE);
|
|
|
InGameView.Instance.EffectMode(false);
|
|
@@ -1904,9 +2018,7 @@ var laya = (function (exports) {
|
|
|
})
|
|
|
}, AccountManager.Instance.curplayerData.MergeSpeed * 1000, Laya.Ease.linearInOut, Laya.Handler.create(this, () => {
|
|
|
move.clear();
|
|
|
- Laya.timer.clearAll(owner);
|
|
|
this.owner.removeSelf();
|
|
|
- this.owner.destroy();
|
|
|
if (!DropRule.Instance.Cloned) {
|
|
|
let num = DropRule.Instance.GetBallIndex(GameManager.Instance.ScoreRecord2);
|
|
|
let size = DropRule.Instance.GetBallSize(GameManager.Instance.ScoreRecord2);
|
|
@@ -2228,9 +2340,12 @@ var laya = (function (exports) {
|
|
|
if (ball.score == DropRule.Instance.MinBall) {
|
|
|
GameManager.Instance.ScoreProgress += ball.score;
|
|
|
DropRule.Instance.CreateEffect(ball.score, new Laya.Vector2(prefab.x, prefab.y));
|
|
|
+ let _rig = prefab.getComponent(Laya.RigidBody);
|
|
|
+ let _collider = prefab.getComponent(Laya.CircleCollider);
|
|
|
+ _collider.enabled = false;
|
|
|
+ _rig.enabled = false;
|
|
|
Laya.timer.clearAll(prefab);
|
|
|
prefab.removeSelf();
|
|
|
- prefab.destroy();
|
|
|
}
|
|
|
}
|
|
|
this.SkillNumRefresh();
|
|
@@ -2250,9 +2365,12 @@ var laya = (function (exports) {
|
|
|
if (ball.score == DropRule.Instance.MinNextBall) {
|
|
|
GameManager.Instance.ScoreProgress += ball.score;
|
|
|
DropRule.Instance.CreateEffect(ball.score, new Laya.Vector2(prefab.x, prefab.y));
|
|
|
+ let _rig = prefab.getComponent(Laya.RigidBody);
|
|
|
+ let _collider = prefab.getComponent(Laya.CircleCollider);
|
|
|
+ _collider.enabled = false;
|
|
|
+ _rig.enabled = false;
|
|
|
Laya.timer.clearAll(prefab);
|
|
|
prefab.removeSelf();
|
|
|
- prefab.destroy();
|
|
|
}
|
|
|
}
|
|
|
this.SkillNumRefresh();
|
|
@@ -2275,14 +2393,14 @@ var laya = (function (exports) {
|
|
|
ClearStage() {
|
|
|
if (!this.prefabbox.destroyed) {
|
|
|
for (let i = this.prefabbox.numChildren - 1; i > -1; i--) {
|
|
|
- let ball = this.prefabbox.getChildAt(i);
|
|
|
- let _rig = ball.getComponent(Laya.RigidBody);
|
|
|
- let _collider = ball.getComponent(Laya.CircleCollider);
|
|
|
+ let prefab = this.prefabbox.getChildAt(i);
|
|
|
+ let ball = prefab.getComponent(Ball);
|
|
|
+ let _rig = prefab.getComponent(Laya.RigidBody);
|
|
|
+ let _collider = prefab.getComponent(Laya.CircleCollider);
|
|
|
_collider.enabled = false;
|
|
|
_rig.enabled = false;
|
|
|
- Laya.timer.clearAll(ball);
|
|
|
- ball.removeSelf();
|
|
|
- ball.destroy();
|
|
|
+ Laya.timer.clearAll(prefab);
|
|
|
+ prefab.removeSelf();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2307,6 +2425,10 @@ var laya = (function (exports) {
|
|
|
let Score = DropRule.Instance.GetBallIndex(ball.score);
|
|
|
if (Score + 1 == Number(DropRule.Instance.BallNum[j])) {
|
|
|
DropRule.Instance.CreateEffect(ball.score, new Laya.Vector2(prefab.x, prefab.y));
|
|
|
+ let _rig = prefab.getComponent(Laya.RigidBody);
|
|
|
+ let _collider = prefab.getComponent(Laya.CircleCollider);
|
|
|
+ _collider.enabled = false;
|
|
|
+ _rig.enabled = false;
|
|
|
Laya.timer.clearAll(prefab);
|
|
|
prefab.removeSelf();
|
|
|
prefab.destroy();
|
|
@@ -2333,9 +2455,12 @@ var laya = (function (exports) {
|
|
|
let Score = DropRule.Instance.GetBallIndex(ball.score);
|
|
|
if (Score + 1 == Number(DropRule.Instance.BallNum[j])) {
|
|
|
DropRule.Instance.CreateEffect(ball.score, new Laya.Vector2(prefab.x, prefab.y));
|
|
|
+ let _rig = prefab.getComponent(Laya.RigidBody);
|
|
|
+ let _collider = prefab.getComponent(Laya.CircleCollider);
|
|
|
+ _collider.enabled = false;
|
|
|
+ _rig.enabled = false;
|
|
|
Laya.timer.clearAll(prefab);
|
|
|
prefab.removeSelf();
|
|
|
- prefab.destroy();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2356,9 +2481,12 @@ var laya = (function (exports) {
|
|
|
}
|
|
|
if (dispear) {
|
|
|
DropRule.Instance.CreateEffect(ball.score, new Laya.Vector2(prefab.x, prefab.y));
|
|
|
+ let _rig = prefab.getComponent(Laya.RigidBody);
|
|
|
+ let _collider = prefab.getComponent(Laya.CircleCollider);
|
|
|
+ _collider.enabled = false;
|
|
|
+ _rig.enabled = false;
|
|
|
Laya.timer.clearAll(prefab);
|
|
|
prefab.removeSelf();
|
|
|
- prefab.destroy();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3502,7 +3630,7 @@ var laya = (function (exports) {
|
|
|
new LoadView();
|
|
|
}
|
|
|
}
|
|
|
- Main$1.Ver = "1.0.0";
|
|
|
+ Main$1.Ver = "1.0.3";
|
|
|
Main$1.CFG = "123";
|
|
|
Main$1.SceneNum = "000";
|
|
|
new Main$1();
|