|
32 | 32 | using Orts.Simulation.RollingStocks.SubSystems.Controllers; |
33 | 33 | using Orts.Viewer3D.Common; |
34 | 34 | using Orts.Viewer3D.Popups; |
| 35 | +using Orts.Viewer3D.RollingStock.Subsystems; |
35 | 36 | using Orts.Viewer3D.RollingStock.Subsystems.ETCS; |
36 | 37 | using ORTS.Common; |
37 | 38 | using ORTS.Common.Input; |
@@ -1211,6 +1212,15 @@ public CabRenderer(Viewer viewer, MSTSLocomotive car) |
1211 | 1212 | count[(int)cvc.ControlType]++; |
1212 | 1213 | continue; |
1213 | 1214 | } |
| 1215 | + else if (screen.ControlType == CABViewControlTypes.ORTS_DISTRIBUTED_POWER) |
| 1216 | + { |
| 1217 | + var cvr = new DistributedPowerInterfaceRenderer(viewer, car, screen, _Shader); |
| 1218 | + cvr.SortIndex = controlSortIndex; |
| 1219 | + CabViewControlRenderersList[i].Add(cvr); |
| 1220 | + if (!ControlMap.ContainsKey(key)) ControlMap.Add(key, cvr); |
| 1221 | + count[(int)cvc.ControlType]++; |
| 1222 | + continue; |
| 1223 | + } |
1214 | 1224 | } |
1215 | 1225 | } |
1216 | 1226 | } |
@@ -1323,6 +1333,15 @@ public CabRenderer(Viewer viewer, MSTSLocomotive car, CabViewFile CVFFile) //use |
1323 | 1333 | count[(int)cvc.ControlType]++; |
1324 | 1334 | continue; |
1325 | 1335 | } |
| 1336 | + else if (screen.ControlType == CABViewControlTypes.ORTS_DISTRIBUTED_POWER) |
| 1337 | + { |
| 1338 | + var cvr = new DistributedPowerInterfaceRenderer(viewer, car, screen, _Shader); |
| 1339 | + cvr.SortIndex = controlSortIndex; |
| 1340 | + CabViewControlRenderersList[i].Add(cvr); |
| 1341 | + if (!ControlMap.ContainsKey(key)) ControlMap.Add(key, cvr); |
| 1342 | + count[(int)cvc.ControlType]++; |
| 1343 | + continue; |
| 1344 | + } |
1326 | 1345 | } |
1327 | 1346 | } |
1328 | 1347 | #endregion |
@@ -2100,6 +2119,13 @@ public int GetDrawIndex() |
2100 | 2119 | index = (int)data; |
2101 | 2120 | break; |
2102 | 2121 | case CABViewControlTypes.ORTS_SCREEN_SELECT: |
| 2122 | + case CABViewControlTypes.ORTS_DP_MOVE_TO_BACK: |
| 2123 | + case CABViewControlTypes.ORTS_DP_MOVE_TO_FRONT: |
| 2124 | + case CABViewControlTypes.ORTS_DP_TRACTION: |
| 2125 | + case CABViewControlTypes.ORTS_DP_IDLE: |
| 2126 | + case CABViewControlTypes.ORTS_DP_BRAKE: |
| 2127 | + case CABViewControlTypes.ORTS_DP_MORE: |
| 2128 | + case CABViewControlTypes.ORTS_DP_LESS: |
2103 | 2129 | index = ButtonState ? 1 : 0; |
2104 | 2130 | break; |
2105 | 2131 | case CABViewControlTypes.ORTS_STATIC_DISPLAY: |
@@ -2420,6 +2446,49 @@ public void HandleUserInput() |
2420 | 2446 | new TCSButtonCommand(Viewer.Log, !Locomotive.TrainControlSystem.TCSCommandButtonDown[commandIndex], commandIndex); |
2421 | 2447 | new TCSSwitchCommand(Viewer.Log, ChangedValue(Locomotive.TrainControlSystem.TCSCommandSwitchOn[commandIndex] ? 1 : 0) > 0, commandIndex); |
2422 | 2448 | break; |
| 2449 | + |
| 2450 | + case CABViewControlTypes.ORTS_DP_MOVE_TO_FRONT: |
| 2451 | + buttonState = ChangedValue(ButtonState ? 1 : 0) > 0; |
| 2452 | + if (!ButtonState && (ButtonState ? 1 : 0) != ChangedValue(ButtonState ? 1 : 0)) |
| 2453 | + new DPMoveToFrontCommand(Viewer.Log); |
| 2454 | + ButtonState = buttonState; |
| 2455 | + break; |
| 2456 | + case CABViewControlTypes.ORTS_DP_MOVE_TO_BACK: |
| 2457 | + buttonState = ChangedValue(ButtonState ? 1 : 0) > 0; |
| 2458 | + if (!ButtonState && (ButtonState ? 1 : 0) != ChangedValue(ButtonState ? 1 : 0)) |
| 2459 | + new DPMoveToBackCommand(Viewer.Log); |
| 2460 | + ButtonState = buttonState; |
| 2461 | + break; |
| 2462 | + case CABViewControlTypes.ORTS_DP_IDLE: |
| 2463 | + buttonState = ChangedValue(ButtonState ? 1 : 0) > 0; |
| 2464 | + if (!ButtonState && (ButtonState ? 1 : 0) != ChangedValue(ButtonState ? 1 : 0)) |
| 2465 | + new DPIdleCommand(Viewer.Log); |
| 2466 | + ButtonState = buttonState; |
| 2467 | + break; |
| 2468 | + case CABViewControlTypes.ORTS_DP_TRACTION: |
| 2469 | + buttonState = ChangedValue(ButtonState ? 1 : 0) > 0; |
| 2470 | + if (!ButtonState && (ButtonState ? 1 : 0) != ChangedValue(ButtonState ? 1 : 0)) |
| 2471 | + new DPTractionCommand(Viewer.Log); |
| 2472 | + ButtonState = buttonState; |
| 2473 | + break; |
| 2474 | + case CABViewControlTypes.ORTS_DP_BRAKE: |
| 2475 | + buttonState = ChangedValue(ButtonState ? 1 : 0) > 0; |
| 2476 | + if (!ButtonState && (ButtonState ? 1 : 0) != ChangedValue(ButtonState ? 1 : 0)) |
| 2477 | + new DPDynamicBrakeCommand(Viewer.Log); |
| 2478 | + ButtonState = buttonState; |
| 2479 | + break; |
| 2480 | + case CABViewControlTypes.ORTS_DP_MORE: |
| 2481 | + buttonState = ChangedValue(ButtonState ? 1 : 0) > 0; |
| 2482 | + if (!ButtonState && (ButtonState ? 1 : 0) != ChangedValue(ButtonState ? 1 : 0)) |
| 2483 | + new DPMoreCommand(Viewer.Log); |
| 2484 | + ButtonState = buttonState; |
| 2485 | + break; |
| 2486 | + case CABViewControlTypes.ORTS_DP_LESS: |
| 2487 | + buttonState = ChangedValue(ButtonState ? 1 : 0) > 0; |
| 2488 | + if (!ButtonState && (ButtonState ? 1 : 0) != ChangedValue(ButtonState ? 1 : 0)) |
| 2489 | + new DPLessCommand(Viewer.Log); |
| 2490 | + ButtonState = buttonState; |
| 2491 | + break; |
2423 | 2492 | } |
2424 | 2493 |
|
2425 | 2494 | } |
|
0 commit comments