Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
8a660e75f0
@ -250,7 +250,7 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
trainDepart:{ // 停车计时
|
||||
insideOffset:{ x: 25, y: -21}, // 内站台停车计时偏移量
|
||||
outsideOffset: { x: -25, y: 21}, // 外站台停车计时偏移量
|
||||
outsideOffset: { x: -25, y: -11}, // 外站台停车计时偏移量
|
||||
textFill: '#00FF00', // 文字颜色
|
||||
textBorderColor: '#00FF00', // 文字边框颜色
|
||||
fontSize: 10 // 字体大小
|
||||
|
@ -5,36 +5,31 @@ class ETrainDepart extends Group {
|
||||
constructor(model) {
|
||||
super();
|
||||
this.model = model;
|
||||
this.isNew = false;
|
||||
this.timeStart = 30;
|
||||
this.time = null;
|
||||
this.create();
|
||||
}
|
||||
|
||||
create(text) {
|
||||
if (!this.isNew) {
|
||||
const model = this.model;
|
||||
const style = this.model.style;
|
||||
this.isNew = true;
|
||||
this.trainDepart = new Text({
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
position: [0, 0],
|
||||
style: {
|
||||
x: model.x,
|
||||
y: model.y,
|
||||
text: text,
|
||||
textAlign: style.textStyle.textAlign,
|
||||
fontSize: style.StationStand.trainDepart.fontSize,
|
||||
fontFamily: style.fontFamily,
|
||||
textFill: style.StationStand.trainDepart.textFill,
|
||||
textVerticalAlign: style.textStyle.textVerticalAlign,
|
||||
textBorderColor: style.StationStand.trainDepart.textBorderColor,
|
||||
textPadding: 2,
|
||||
textBorderWidth: 1
|
||||
}
|
||||
});
|
||||
this.add(this.trainDepart);
|
||||
}
|
||||
create() {
|
||||
const model = this.model;
|
||||
const style = this.model.style;
|
||||
this.trainDepart = new Text({
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
position: [0, 0],
|
||||
style: {
|
||||
x: model.x,
|
||||
y: model.y,
|
||||
text: '000',
|
||||
textAlign: style.textStyle.textAlign,
|
||||
fontSize: style.StationStand.trainDepart.fontSize,
|
||||
fontFamily: style.fontFamily,
|
||||
textFill: style.StationStand.trainDepart.textFill,
|
||||
textVerticalAlign: style.textStyle.textVerticalAlign,
|
||||
textBorderColor: style.StationStand.trainDepart.textBorderColor,
|
||||
textPadding: 2,
|
||||
textBorderWidth: 1
|
||||
}
|
||||
});
|
||||
this.add(this.trainDepart);
|
||||
}
|
||||
|
||||
setColor(color) {
|
||||
@ -44,35 +39,17 @@ class ETrainDepart extends Group {
|
||||
|
||||
hideMode() {
|
||||
this.trainDepart && this.trainDepart.hide();
|
||||
// if (this.time) {
|
||||
// clearInterval(this.time);
|
||||
// this.timeStart = 30;
|
||||
// }
|
||||
}
|
||||
|
||||
showMode() {
|
||||
// this.timeStart = 30;
|
||||
this.create(`0${this.timeStart}`);
|
||||
showMode(remainTime) {
|
||||
if (remainTime < 10) {
|
||||
remainTime = '00' + remainTime;
|
||||
} else {
|
||||
remainTime = '0' + remainTime;
|
||||
}
|
||||
this.trainDepart.setStyle('text', remainTime);
|
||||
this.trainDepart.show();
|
||||
setTimeout(() => {
|
||||
this.animition();
|
||||
}, 1000);
|
||||
}
|
||||
animition() {
|
||||
this.time && clearInterval(this.time);
|
||||
this.time = setInterval(() => {
|
||||
this.timeStart--;
|
||||
if (this.timeStart >= 0) {
|
||||
if (this.timeStart < 10) {
|
||||
this.trainDepart.setStyle('text', `00${this.timeStart}`);
|
||||
} else {
|
||||
this.trainDepart.setStyle('text', `0${this.timeStart}`);
|
||||
}
|
||||
} else {
|
||||
clearInterval(this.time);
|
||||
this.timeStart = 30;
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ class StationStand extends Group {
|
||||
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.stopColor);
|
||||
} else {
|
||||
this.trainStop && this.trainStop.showMode();
|
||||
this.trainDepart && this.trainDepart.showMode();
|
||||
this.trainDepart && this.trainDepart.showMode(this.model.remainTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user