Ejemplo n.º 1
0
        public static AtsHandles Elapse(AtsVehicleState vehicleState, IntPtr panel, IntPtr sound)
        {
            var panelArray = new AtsIoArray(panel);
            var soundArray = new AtsIoArray(sound);

            return(new AtsHandles()
            {
                Power = 0, Brake = 0, ConstantSpeed = AtsCscInstruction.Continue, Reverser = 0
            });
        }
Ejemplo n.º 2
0
        public static AtsHandles Elapse(AtsVehicleState vehicleState, IntPtr panel, IntPtr sound)
        {
            try {
                PanelArray = new AtsIoArray(panel);
                SoundArray = new AtsIoArray(sound);
                bool firstElapse = !Instance.EData_Ready;
                if (firstElapse)
                {
                    for (int i = 0; i < SoundArray.Length; i++)
                    {
                        // Reset the sound states
                        // So that a sound can be played in loop at 100% volume from the very first Elapse
                        // Otherwise the behavior might be confusing to new developers
                        SoundArray[i] = -10000;
                    }
                }
                Instance.EData_Vehicle_Location    = vehicleState.Location;
                Instance.EData_Vehicle_Speed       = vehicleState.Speed;
                Instance.EData_TotalTime           = vehicleState.Time;
                Instance.EData_Vehicle_BcPressure  = vehicleState.BcPressure;
                Instance.EData_Vehicle_MrPressure  = vehicleState.MrPressure;
                Instance.EData_Vehicle_ErPressure  = vehicleState.ErPressure;
                Instance.EData_Vehicle_BpPressure  = vehicleState.BpPressure;
                Instance.EData_Vehicle_SapPressure = vehicleState.SapPressure;
                Instance.EData_Vehicle_Current     = vehicleState.Current;
                Instance.EData_Ready = true;
                TempHandle[0]        = Instance.EData_Handles_BrakeNotch;
                TempHandle[1]        = Instance.EData_Handles_PowerNotch;
                TempHandle[2]        = Instance.EData_Handles_Reverser;
                TempHandle[3]        = AtsCscInstruction.Continue;

                // Don't run the handlers yet, wait for the sound states to take effect
                if (!firstElapse)
                {
                    while (lateCallQueue.Count > 0)
                    {
                        lateCallQueue.Dequeue().Invoke();
                    }
                    Impl.Func_UpdateTimer();
                    Impl.Elapse();
                }
            } catch (Exception ex) {
                RuntimeException(ex);
            }
            return(new AtsHandles()
            {
                Power = TempHandle[1],
                Brake = TempHandle[0],
                ConstantSpeed = TempHandle[3],
                Reverser = TempHandle[2]
            });
        }
Ejemplo n.º 3
0
        public static AtsHandles Elapse(AtsVehicleState vehicleState, IntPtr panel, IntPtr sound)
        {
            var panelArray = new AtsIoArray(panel);
            var soundArray = new AtsIoArray(sound);

            soundArray[180] = AtsSoundControlInstruction.Stop;

            return(new AtsHandles()
            {
                Power = userPower,
                Brake = userBrake,
                ConstantSpeed = AtsCscInstruction.Continue,
                Reverser = userReverser
            });
        }
Ejemplo n.º 4
0
        public static AtsHandles Elapse(AtsVehicleState vehicleState, IntPtr panel, IntPtr sound)
        {
            var panelArray = new AtsIoArray(panel);
            var soundArray = new AtsIoArray(sound);

            // if (!soundInitialized) 要るかも??

            soundArray[181] // End key
                = userKey.Contains(AtsKey.B2)
                    ? AtsSoundControlInstruction.PlayLooping
                    : AtsSoundControlInstruction.Stop;

            return(new AtsHandles()
            {
                Power = userPower,
                Brake = userBrake,
                ConstantSpeed = AtsCscInstruction.Continue,
                Reverser = userReverser
            });
        }