|
@@ -7,6 +7,7 @@ import { NoticeManager } from '../../../engines/notices/NoticeManager';
|
|
import StringUtils from '../../../engines/utils/StringUtils';
|
|
import StringUtils from '../../../engines/utils/StringUtils';
|
|
import { PlatformManager } from '../../../Platform/PlatformManager';
|
|
import { PlatformManager } from '../../../Platform/PlatformManager';
|
|
import AccelerateBuffer from '../../buffers/AccelerateBuffer';
|
|
import AccelerateBuffer from '../../buffers/AccelerateBuffer';
|
|
|
|
+import GameConfigManager from '../../models/GameConfigManager';
|
|
import { GameModel } from '../../models/GameModel';
|
|
import { GameModel } from '../../models/GameModel';
|
|
import { UIConst } from '../UIConst';
|
|
import { UIConst } from '../UIConst';
|
|
const { ccclass, property } = _decorator;
|
|
const { ccclass, property } = _decorator;
|
|
@@ -24,13 +25,27 @@ export class AccelerateMediator extends GUIMediator {
|
|
})
|
|
})
|
|
timeLabel:LabelComponent=null;
|
|
timeLabel:LabelComponent=null;
|
|
|
|
|
|
|
|
+ @property({
|
|
|
|
+ type:LabelComponent
|
|
|
|
+ })
|
|
|
|
+ diamondLabel:LabelComponent=null;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 最大时间
|
|
* 最大时间
|
|
*/
|
|
*/
|
|
private max:number=150*1000*10;
|
|
private max:number=150*1000*10;
|
|
|
|
+ private time:number=150*1000;
|
|
|
|
+ private consume:number=20;
|
|
|
|
+ start():void{
|
|
|
|
+ this.time=GameConfigManager.getGlobalValue("accelerateTime")*1000;
|
|
|
|
+ this.max=GameConfigManager.getGlobalValue("accelerateMaxTime")*1000;
|
|
|
|
+ this.consume=GameConfigManager.getGlobalValue("accelerateDiamondConsume");
|
|
|
|
+ }
|
|
|
|
|
|
OnShow(data?:any):void{
|
|
OnShow(data?:any):void{
|
|
super.OnShow(data);
|
|
super.OnShow(data);
|
|
|
|
+ //消耗
|
|
|
|
+ this.diamondLabel.string=this.consume.toString();
|
|
}
|
|
}
|
|
|
|
|
|
OnHide():void{
|
|
OnHide():void{
|
|
@@ -39,14 +54,14 @@ export class AccelerateMediator extends GUIMediator {
|
|
|
|
|
|
|
|
|
|
DiamondButtonClickHandler():void{
|
|
DiamondButtonClickHandler():void{
|
|
- if(GameModel.single.diamond>20){
|
|
|
|
|
|
+ if(GameModel.single.diamond>this.consume){
|
|
if(this.CurrentBufferTime>=this.max){
|
|
if(this.CurrentBufferTime>=this.max){
|
|
NoticeManager.ShowPrompt("加速时间已满!");
|
|
NoticeManager.ShowPrompt("加速时间已满!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if(this.AddBuffer()){
|
|
if(this.AddBuffer()){
|
|
//扣钱
|
|
//扣钱
|
|
- GameModel.single.diamond-=20;
|
|
|
|
|
|
+ GameModel.single.diamond-=this.consume;
|
|
this.CloseButtonClickHandler();
|
|
this.CloseButtonClickHandler();
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
@@ -78,7 +93,7 @@ export class AccelerateMediator extends GUIMediator {
|
|
}
|
|
}
|
|
|
|
|
|
private AddBuffer():boolean{
|
|
private AddBuffer():boolean{
|
|
- let buffer:AccelerateBuffer=new AccelerateBuffer("Accelerate",150*1000);
|
|
|
|
|
|
+ let buffer:AccelerateBuffer=new AccelerateBuffer("Accelerate",this.time);
|
|
BufferManager.RunBuffer(buffer);
|
|
BufferManager.RunBuffer(buffer);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -89,12 +104,12 @@ export class AccelerateMediator extends GUIMediator {
|
|
if(buffers==null||buffers.length==0){
|
|
if(buffers==null||buffers.length==0){
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
- return buffers[0].GetTime();
|
|
|
|
|
|
+ return buffers[0].GetTimeRemaining();
|
|
}
|
|
}
|
|
|
|
|
|
update(dt:number):void{
|
|
update(dt:number):void{
|
|
this.progressBar.progress=this.CurrentBufferTime/this.max;
|
|
this.progressBar.progress=this.CurrentBufferTime/this.max;
|
|
- this.timeLabel.string=StringUtils.TimeFormatting(this.CurrentBufferTime,":",":",":","");
|
|
|
|
|
|
+ this.timeLabel.string=StringUtils.TimeFormatting(this.CurrentBufferTime,":",":",":",":",":","");
|
|
super.update(dt);
|
|
super.update(dt);
|
|
}
|
|
}
|
|
}
|
|
}
|