|
@@ -135,8 +135,7 @@ export class LevelAction extends Component {
|
|
|
if (show_num <= default_show_layer_num) {
|
|
|
if (layer_action.layer_status != 1) {
|
|
|
layer_action.set_status(1);
|
|
|
- this.check_pins_block();
|
|
|
- // this.set_pin_color();
|
|
|
+ // this.check_pins_block();
|
|
|
}
|
|
|
} else if (show_num == (default_show_layer_num + 1)) {
|
|
|
if (layer_action.layer_status != 2) {
|
|
@@ -148,46 +147,6 @@ export class LevelAction extends Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //动态给钉子上色
|
|
|
- private async set_pin_color() {
|
|
|
- const carSysterm = CarColorsGlobalInstance.instance.carSysterm;
|
|
|
- let layer_arr = this.get_all_layer();
|
|
|
- let canOutCars = carSysterm.findCanOutCars(); // 找到所有无障碍物的车子
|
|
|
-
|
|
|
- if (canOutCars.length === 0) {
|
|
|
- console.warn("没有可以开出的车,无法分配颜色");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- let allPins: any[] = [];
|
|
|
-
|
|
|
- // 获取所有可见钉子
|
|
|
- layer_arr.forEach(layer => {
|
|
|
- if (layer.layer_status === 1) {
|
|
|
- let pinArr: any[] = [];
|
|
|
- layer.get_pin_color(pinArr);
|
|
|
- allPins.push(...pinArr);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- console.log("总可见钉子数量:", allPins.length);
|
|
|
- if (allPins.length === 0) return;
|
|
|
-
|
|
|
- let pinIndex = 0; // 记录当前分配到哪个钉子
|
|
|
- for (let car of canOutCars) {
|
|
|
- let carComp = car.getComponent(CarCarColorsComponent);
|
|
|
- let carColor = carComp.carColor;
|
|
|
- let seatCount = this.getCarSeatCount(carComp.carType); // 获取车的载客量
|
|
|
-
|
|
|
- // 遍历当前车的座位数,依次给钉子赋值
|
|
|
- for (let i = 0; i < seatCount; i++) {
|
|
|
- if (pinIndex >= allPins.length) return; // 说明钉子已经全部分配完毕
|
|
|
- allPins[pinIndex].pin_color = carColor;
|
|
|
- pinIndex++;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/** 根据车辆类型获取对应的载客量 */
|
|
|
private getCarSeatCount(carType: CarTypes): number {
|
|
|
switch (carType) {
|