|
@@ -8,6 +8,7 @@ import { GameManager } from "../Main/GameManager";
|
|
import { DropRule } from "../Tool/DropRule";
|
|
import { DropRule } from "../Tool/DropRule";
|
|
import { ServerManager, BlastToMerge } from "../Net/ServerManager";
|
|
import { ServerManager, BlastToMerge } from "../Net/ServerManager";
|
|
import { GamePool } from "../Tool/GamePool";
|
|
import { GamePool } from "../Tool/GamePool";
|
|
|
|
+import Gift from "../Main/Gift";
|
|
|
|
|
|
export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
private static ins:InGameView;
|
|
private static ins:InGameView;
|
|
@@ -19,6 +20,12 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
public WinView = false;
|
|
public WinView = false;
|
|
//球是否溢出
|
|
//球是否溢出
|
|
public OverRun = false;
|
|
public OverRun = false;
|
|
|
|
+ //0.25时是否掉落礼盒
|
|
|
|
+ public lingdianerwu = false;
|
|
|
|
+ //0.50时是否掉落礼盒
|
|
|
|
+ public lingdianwu = false;
|
|
|
|
+ //0.75时是否掉落礼盒
|
|
|
|
+ public lingdianqiwu = false;
|
|
|
|
|
|
constructor(){
|
|
constructor(){
|
|
super();
|
|
super();
|
|
@@ -187,13 +194,33 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
}
|
|
}
|
|
this.NowScore.text = GameManager.Instance.ScoreProgress.toString();
|
|
this.NowScore.text = GameManager.Instance.ScoreProgress.toString();
|
|
}
|
|
}
|
|
|
|
+ if(DropRule.Instance.STAGE >= 7){
|
|
|
|
+ let X = GameTools.RandomANumber(100,500);
|
|
|
|
+ let pos = new Laya.Vector2(X, 10);
|
|
|
|
+ if(this.Ratio >= 0.25 && this.Ratio < 0.5 && !this.lingdianerwu){
|
|
|
|
+ DropRule.Instance.CreateGift(1,pos,DropRule.Instance.JudgePropNum(),1);
|
|
|
|
+ this.lingdianerwu = true;
|
|
|
|
+ }
|
|
|
|
+ if(this.Ratio >= 0.5 && this.Ratio < 0.75 && !this.lingdianwu){
|
|
|
|
+ DropRule.Instance.CreateGift(1,pos,DropRule.Instance.JudgePropNum(),1);
|
|
|
|
+ this.lingdianwu = true;
|
|
|
|
+ }
|
|
|
|
+ if(this.Ratio >= 0.75 && this.Ratio < 1 && !this.lingdianqiwu){
|
|
|
|
+ DropRule.Instance.CreateGift(1,pos,DropRule.Instance.JudgePropNum(),1);
|
|
|
|
+ this.lingdianqiwu =true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
//推球道具
|
|
//推球道具
|
|
ClickArrow(){
|
|
ClickArrow(){
|
|
console.log("点到了推球道具--");
|
|
console.log("点到了推球道具--");
|
|
|
|
+ // var agrs = [{ "t": AccountManager.Instance.ServerTime.toString() }];
|
|
|
|
+ // ServerManager.Instance.SendHttp(BlastToMerge.KaiShi,agrs,Laya.Handler.create(this, this.StartNextLevel), null);
|
|
|
|
+
|
|
if(Number(this.Func5num.text)>0){
|
|
if(Number(this.Func5num.text)>0){
|
|
- var args = [{"t":AccountManager.Instance.ServerTime.toString()},{"play_id":GameManager.Instance.play_id},{"fid":"5"}]
|
|
|
|
- ServerManager.Instance.SendHttp(BlastToMerge.Use,args,Laya.Handler.create(this,()=>{
|
|
|
|
|
|
+ let args = [{"t":AccountManager.Instance.ServerTime.toString()},{"play_id":GameManager.Instance.play_id},{"fid":"5"}]
|
|
|
|
+ ServerManager.Instance.SendHttp(BlastToMerge.Use,args,Laya.Handler.create(this,(res)=>{
|
|
for (let i = 0; i < this.prefabbox.numChildren; i++) {
|
|
for (let i = 0; i < this.prefabbox.numChildren; i++) {
|
|
let ball = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
let ball = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
if(ball.destroyed){
|
|
if(ball.destroyed){
|
|
@@ -205,8 +232,8 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.SkillNumRefresh();
|
|
this.SkillNumRefresh();
|
|
- }),Laya.Handler.create(this,()=>{
|
|
|
|
-
|
|
|
|
|
|
+ }),Laya.Handler.create(this,(res)=>{
|
|
|
|
+ console.log(res);
|
|
}))
|
|
}))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -221,7 +248,6 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
this.EffectMode(false);
|
|
this.EffectMode(false);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
if(Number(this.Func1num.text)>0){
|
|
if(Number(this.Func1num.text)>0){
|
|
EventManager.EventTrigger(PropEffecf.DOUBLE);
|
|
EventManager.EventTrigger(PropEffecf.DOUBLE);
|
|
console.log("切换为双倍模式");
|
|
console.log("切换为双倍模式");
|
|
@@ -313,6 +339,9 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
ServerManager.Instance.SendHttp(BlastToMerge.Use,args,Laya.Handler.create(this,()=>{
|
|
ServerManager.Instance.SendHttp(BlastToMerge.Use,args,Laya.Handler.create(this,()=>{
|
|
for (let i = this.prefabbox.numChildren-1; i >-1 ; i--) {
|
|
for (let i = this.prefabbox.numChildren-1; i >-1 ; i--) {
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
|
|
+ if(prefab.name == "Gift" || prefab.name == "TimeGift"){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
if(ball.score == DropRule.Instance.MinBall){
|
|
if(ball.score == DropRule.Instance.MinBall){
|
|
GameManager.Instance.ScoreProgress += ball.score;
|
|
GameManager.Instance.ScoreProgress += ball.score;
|
|
@@ -346,6 +375,9 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
ServerManager.Instance.SendHttp(BlastToMerge.Use,args,Laya.Handler.create(this,()=>{
|
|
ServerManager.Instance.SendHttp(BlastToMerge.Use,args,Laya.Handler.create(this,()=>{
|
|
for (let i = this.prefabbox.numChildren-1; i >-1 ; i--) {
|
|
for (let i = this.prefabbox.numChildren-1; i >-1 ; i--) {
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
|
|
+ if(prefab.name == "Gift" || prefab.name == "TimeGift"){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
if(ball.score == DropRule.Instance.MinNextBall){
|
|
if(ball.score == DropRule.Instance.MinNextBall){
|
|
GameManager.Instance.ScoreProgress += ball.score;
|
|
GameManager.Instance.ScoreProgress += ball.score;
|
|
@@ -369,9 +401,7 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
this.Effect.visible = false;
|
|
this.Effect.visible = false;
|
|
this.EffectBtn.clickHandler = null;
|
|
this.EffectBtn.clickHandler = null;
|
|
EventManager.PropState = PropEffecf.NONE;
|
|
EventManager.PropState = PropEffecf.NONE;
|
|
- }),Laya.Handler.create(this,()=>{
|
|
|
|
- console.log("道具使用失败");
|
|
|
|
- }))
|
|
|
|
|
|
+ }),null)
|
|
}
|
|
}
|
|
/**传入分数 获取球的icon */
|
|
/**传入分数 获取球的icon */
|
|
GetIcon(_score:number):string{
|
|
GetIcon(_score:number):string{
|
|
@@ -388,6 +418,20 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
if(!this.prefabbox.destroyed){
|
|
if(!this.prefabbox.destroyed){
|
|
for (let i = this.prefabbox.numChildren-1; i > -1; i--) {
|
|
for (let i = this.prefabbox.numChildren-1; i > -1; i--) {
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
|
|
+ if(prefab.name == "Gift" || prefab.name == "TimeGift"){
|
|
|
|
+ let giftscript = prefab.getComponent(Gift) as Gift;
|
|
|
|
+ let _rig = prefab.getComponent(Laya.RigidBody) as Laya.RigidBody;
|
|
|
|
+ let _collider = prefab.getComponent(Laya.CircleCollider) as Laya.CircleCollider;
|
|
|
|
+ _collider.enabled = false;
|
|
|
|
+ _rig.enabled = false;
|
|
|
|
+ _collider.destroy();
|
|
|
|
+ _rig.destroy();
|
|
|
|
+ Laya.timer.clearAll(prefab);
|
|
|
|
+ prefab.removeSelf();
|
|
|
|
+ let name = giftscript.type == 0?"Gift":"TimeGift";
|
|
|
|
+ GamePool.Instance.RecoverModel(prefab,name);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
let _rig = prefab.getComponent(Laya.RigidBody) as Laya.RigidBody;
|
|
let _rig = prefab.getComponent(Laya.RigidBody) as Laya.RigidBody;
|
|
let _collider = prefab.getComponent(Laya.CircleCollider) as Laya.CircleCollider;
|
|
let _collider = prefab.getComponent(Laya.CircleCollider) as Laya.CircleCollider;
|
|
@@ -397,7 +441,6 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
_rig.destroy();
|
|
_rig.destroy();
|
|
Laya.timer.clearAll(prefab);
|
|
Laya.timer.clearAll(prefab);
|
|
prefab.removeSelf();
|
|
prefab.removeSelf();
|
|
- // ball.destroy();
|
|
|
|
let _index = DropRule.Instance.GetBallIndex(ball.score);
|
|
let _index = DropRule.Instance.GetBallIndex(ball.score);
|
|
GamePool.Instance.RecoverModel(prefab,_index.toString());
|
|
GamePool.Instance.RecoverModel(prefab,_index.toString());
|
|
// Laya.Pool.recover("img"+_index.toString,ball);
|
|
// Laya.Pool.recover("img"+_index.toString,ball);
|
|
@@ -423,6 +466,9 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
Revive(){
|
|
Revive(){
|
|
for (let i = this.prefabbox.numChildren-1; i >-1 ; i--) {
|
|
for (let i = this.prefabbox.numChildren-1; i >-1 ; i--) {
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
|
|
+ if(prefab.name == "Gift" || prefab.name == "TimeGift"){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
for (let j = 0; j < DropRule.Instance.BallNum.length; j++) {
|
|
for (let j = 0; j < DropRule.Instance.BallNum.length; j++) {
|
|
let Score = DropRule.Instance.GetBallIndex(ball.score);
|
|
let Score = DropRule.Instance.GetBallIndex(ball.score);
|
|
@@ -462,6 +508,9 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
if(_data){
|
|
if(_data){
|
|
for (let i = this.prefabbox.numChildren-1; i >-1 ; i--) {
|
|
for (let i = this.prefabbox.numChildren-1; i >-1 ; i--) {
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
|
|
+ if(prefab.name == "Gift" || prefab.name == "TimeGift"){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
for (let j = 0; j < DropRule.Instance.BallNum.length; j++) {
|
|
for (let j = 0; j < DropRule.Instance.BallNum.length; j++) {
|
|
let Score = DropRule.Instance.GetBallIndex(ball.score);
|
|
let Score = DropRule.Instance.GetBallIndex(ball.score);
|
|
@@ -491,6 +540,9 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
}
|
|
}
|
|
for (let k = this.prefabbox.numChildren-1; k > -1; k--) {
|
|
for (let k = this.prefabbox.numChildren-1; k > -1; k--) {
|
|
let prefab = this.prefabbox.getChildAt(k) as Laya.Image;
|
|
let prefab = this.prefabbox.getChildAt(k) as Laya.Image;
|
|
|
|
+ if(prefab.name == "Gift" || prefab.name == "TimeGift"){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
let ball = prefab.getComponent(Ball) as Ball;
|
|
let dispear = true;
|
|
let dispear = true;
|
|
for (let l = 0; l < ballarray2.length; l++) {
|
|
for (let l = 0; l < ballarray2.length; l++) {
|
|
@@ -517,6 +569,9 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
}
|
|
}
|
|
Laya.timer.loop(5000,this,this.Save);
|
|
Laya.timer.loop(5000,this,this.Save);
|
|
this.WinView = false;
|
|
this.WinView = false;
|
|
|
|
+ this.lingdianerwu = false;
|
|
|
|
+ this.lingdianwu = false;
|
|
|
|
+ this.lingdianqiwu = false;
|
|
this.ScoreRefresh();
|
|
this.ScoreRefresh();
|
|
this.Progress();
|
|
this.Progress();
|
|
DropRule.Instance.FallDown(DropRule.Instance.StartNum);
|
|
DropRule.Instance.FallDown(DropRule.Instance.StartNum);
|
|
@@ -526,6 +581,9 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
this.ClearStage();
|
|
this.ClearStage();
|
|
this.LoseView = false;
|
|
this.LoseView = false;
|
|
this.WinView = false;
|
|
this.WinView = false;
|
|
|
|
+ this.lingdianerwu = false;
|
|
|
|
+ this.lingdianwu = false;
|
|
|
|
+ this.lingdianqiwu = false;
|
|
this.ScoreRefresh();
|
|
this.ScoreRefresh();
|
|
this.Progress();
|
|
this.Progress();
|
|
if(DropRule.Instance.STAGE == 1){
|
|
if(DropRule.Instance.STAGE == 1){
|
|
@@ -596,6 +654,10 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
|
|
|
|
//保存关卡进度
|
|
//保存关卡进度
|
|
Save(_data?){
|
|
Save(_data?){
|
|
|
|
+ let type;
|
|
|
|
+ let proptype;
|
|
|
|
+ let propnum;
|
|
|
|
+
|
|
let str = "";
|
|
let str = "";
|
|
let ball;
|
|
let ball;
|
|
let score;
|
|
let score;
|
|
@@ -607,18 +669,27 @@ export default class InGameView extends ui.InGameSceneUI implements SC{
|
|
if(!_data){
|
|
if(!_data){
|
|
for (let i = 0; i < this.prefabbox.numChildren; i++) {
|
|
for (let i = 0; i < this.prefabbox.numChildren; i++) {
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
let prefab = this.prefabbox.getChildAt(i) as Laya.Image;
|
|
- ball = prefab.getComponent(Ball) as Ball;
|
|
|
|
- //分数
|
|
|
|
- score = ball.score;
|
|
|
|
- index =(DropRule.Instance.GetBallIndex(score) + 1).toString();
|
|
|
|
- //尺寸
|
|
|
|
- size = prefab.width.toString();
|
|
|
|
- //坐标
|
|
|
|
- point = new Laya.Vector2(prefab.x,prefab.y);
|
|
|
|
- obj = {"index":index,"size":size,"pos":point};
|
|
|
|
|
|
+ if(prefab.name == "ball"){
|
|
|
|
+ ball = prefab.getComponent(Ball) as Ball;
|
|
|
|
+ //分数
|
|
|
|
+ score = ball.score;
|
|
|
|
+ index =(DropRule.Instance.GetBallIndex(score) + 1).toString();
|
|
|
|
+ //尺寸
|
|
|
|
+ size = prefab.width.toString();
|
|
|
|
+ //坐标
|
|
|
|
+ point = new Laya.Vector2(prefab.x,prefab.y);
|
|
|
|
+ obj = {"index":index,"size":size,"pos":point,"itemtype":0};//itemtype 0为球 1为礼盒
|
|
|
|
+ }
|
|
|
|
+ else if(prefab.name == "Gift"){
|
|
|
|
+ let giftscript = prefab.getComponent(Gift) as Gift;
|
|
|
|
+ type = giftscript.type;
|
|
|
|
+ proptype = giftscript.GiftIndex;
|
|
|
|
+ propnum = giftscript.GiftNum;
|
|
|
|
+ point = new Laya.Vector2(prefab.x,prefab.y);
|
|
|
|
+ obj = {"type":type,"proptype":proptype,"propnum":propnum,"pos":point,"itemtype":1};//itemtype 0为球 1为礼盒
|
|
|
|
+ }
|
|
objarray.push(obj);
|
|
objarray.push(obj);
|
|
}
|
|
}
|
|
-
|
|
|
|
let jindutiao = {"jindu":GameManager.Instance.ScoreProgress.toString()};
|
|
let jindutiao = {"jindu":GameManager.Instance.ScoreProgress.toString()};
|
|
let sizeindex = {"sizeindex":DropRule.Instance.SizeIndex};
|
|
let sizeindex = {"sizeindex":DropRule.Instance.SizeIndex};
|
|
let edgeindex = {"edgeindex":DropRule.Instance.EdgeIndex};
|
|
let edgeindex = {"edgeindex":DropRule.Instance.EdgeIndex};
|