你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
lifereset
赞同来自: laya123
wudi199553
赞同来自:
laya123
要回复问题请先登录
3 个回复
lifereset
赞同来自: laya123
{
import app.TheGame;
import laya.display.Sprite;
import laya.maths.Rectangle;
public class CdSprite extends Sprite
{
public static const START:int = -90;
public static const COLOR:String = "#000000";
private var r:Number = BarCell.WID / Math.SQRT2;
private var rect:Rectangle = new Rectangle(0,0,BarCell.WID,BarCell.WID);
private var pos:int = BarCell.WID*0.5;
private var endTime:int;
private var cdTime:int;
public var isCd:Boolean = false;
public function CdSprite()
{
super();
this.scrollRect = rect;
this.alpha = 0.85;
}
public function setSize(bian:int):void{
r = bian / Math.SQRT2;
rect = new Rectangle(0,0,bian,bian);
this.scrollRect = rect;
pos = bian * 0.5;
}
public function set360(value:int):void {
this.graphics.clear();
if(value == -1){
return;
}
this.graphics.drawPie(pos,pos,r,START+(360 - value), 270 , COLOR ,null,0);
}
private function ef():void {
if( TheGame.GetServerTime() > endTime ){
this.stop();
return;
}
var now:int = ( endTime - TheGame.GetServerTime() )/cdTime * 360;
this.set360(now);
}
public function play(time:int,startTime_:int = 0):void
{
this.cdTime = time;
var startTime:int = ( (startTime_ == 0) ?TheGame.GetServerTime() : startTime_ );
this.endTime = startTime + time;
Laya.timer.loop(1,this,ef);
isCd = true;
}
public function stop():void
{
this.set360(-1);
Laya.timer.clear(this,ef);
isCd = false;
}
}
}
wudi199553
赞同来自:
laya123
赞同来自: