|
@@ -23,7 +23,6 @@ export class UnitColorsSysterm extends Component {
|
|
|
|
|
|
registerEvent() {
|
|
|
EventDispatcher.instance.on(GameEvent.EVENT_MAGNET, this.onMagnet, this);
|
|
|
- // EventDispatcher.instance.on(GameEvent.EVENT_REFRESH_PIN_COLORS, this.changePinColor, this);
|
|
|
}
|
|
|
|
|
|
private onMagnet() {
|
|
@@ -92,42 +91,6 @@ export class UnitColorsSysterm extends Component {
|
|
|
this.clearpinsCar();
|
|
|
}
|
|
|
|
|
|
- // changePinColor() {
|
|
|
- // let activeLayerPins: PinComponent[] = [];
|
|
|
- // const level = CarColorsGlobalInstance.instance.levels.children[0];
|
|
|
- // const layer_arr = level.getComponent(LevelAction)!.get_all_layer();
|
|
|
-
|
|
|
- // // 当前剩余的所有颜色保存的数组
|
|
|
- // const carSeats: CarColors[] = CarColorsGlobalInstance.instance.carSysterm.carSeats;
|
|
|
- // const findAllCars: CarColors[] = this.findCanOutCars();
|
|
|
-
|
|
|
- // // 获取显示层上所有钉子组件
|
|
|
- // for (const layer of layer_arr) {
|
|
|
- // if (layer.layer_status !== 1) continue; // 只检查当前显示的层级
|
|
|
- // const pins = layer.getComponentsInChildren(PinComponent)!;
|
|
|
- // activeLayerPins.push(...pins);
|
|
|
- // }
|
|
|
-
|
|
|
- // // 初始化一个颜色设置数组,优先从 findAllCars 取颜色
|
|
|
- // let colorPool: CarColors[] = [...findAllCars];
|
|
|
-
|
|
|
- // // 如果 findAllCars 的颜色不够,用 carSeats 的颜色补充,但排除 findAllCars 里已有的颜色
|
|
|
- // for (const seatColor of carSeats) {
|
|
|
- // if (!findAllCars.includes(seatColor)) {
|
|
|
- // colorPool.push(seatColor);
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
- // // 给 activeLayerPins 逐个分配颜色
|
|
|
- // activeLayerPins.forEach((pin, index) => {
|
|
|
- // if (index < colorPool.length) {
|
|
|
- // pin.pin_color = colorPool[index]; // 假设 PinComponent 有 setColor 方法
|
|
|
- // } else {
|
|
|
- // console.warn(`Not enough colors to assign to pin at index ${index}`);
|
|
|
- // }
|
|
|
- // });
|
|
|
- // }
|
|
|
-
|
|
|
//返回所有可以出车的车辆和停车位车辆 所有车辆钉子数组
|
|
|
findCanOutCars() {
|
|
|
const canOutCar: CarColors[] = [];
|