Exemple #1
0
        internal void TouchCheck(Vector2 Point)
        {
            if (!Loading.SimulationSetup)
            {
                return;
            }

            if (renderer.Camera.CurrentMode != CameraViewMode.Interior && renderer.Camera.CurrentMode != CameraViewMode.InteriorLookAhead)
            {
                return;
            }

            CarBase Car = TrainManager.PlayerTrain.Cars[TrainManager.PlayerTrain.DriverCar];
            int     add = Car.CarSections[0].CurrentAdditionalGroup + 1;

            if (add >= Car.CarSections[0].Groups.Length)
            {
                return;
            }

            TouchElement[] TouchElements = Car.CarSections[0].Groups[add].TouchElements;

            if (TouchElements == null)
            {
                return;
            }

            ObjectState pickedObject = renderer.AvailableNewRenderer ? ParseFBO(Point, 5, 5) : RenderSceneSelection(Point, new Vector2(5.0f));

            foreach (TouchElement TouchElement in TouchElements.Where(x => x.Element.internalObject == pickedObject))
            {
                foreach (int index in TouchElement.ControlIndices)
                {
                    Interface.CurrentControls[index].AnalogState  = 1.0;
                    Interface.CurrentControls[index].DigitalState = DigitalControlState.Pressed;
                    MainLoop.AddControlRepeat(index);
                }
            }

            prePickedObject = pickedObject;
        }
Exemple #2
0
        internal void TouchCheck(Vector2 Point)
        {
            if (!Loading.SimulationSetup)
            {
                return;
            }

            if (renderer.Camera.CurrentMode != CameraViewMode.Interior && renderer.Camera.CurrentMode != CameraViewMode.InteriorLookAhead)
            {
                return;
            }

            TrainManager.Car Car = TrainManager.PlayerTrain.Cars[TrainManager.PlayerTrain.DriverCar];
            int add = Car.CarSections[0].CurrentAdditionalGroup + 1;

            if (add >= Car.CarSections[0].Groups.Length)
            {
                return;
            }

            TrainManager.TouchElement[] TouchElements = Car.CarSections[0].Groups[add].TouchElements;

            if (TouchElements == null)
            {
                return;
            }

            ObjectState pickedObject = ParseFBO(Point, 5, 5);

            foreach (TrainManager.TouchElement TouchElement in TouchElements)
            {
                if (TouchElement.Element.internalObject != pickedObject)
                {
                    continue;
                }

                for (int i = 0; i < Interface.CurrentControls.Length; i++)
                {
                    if (Interface.CurrentControls[i].Method != Interface.ControlMethod.Touch)
                    {
                        continue;
                    }

                    bool EnableOption = false;

                    for (int j = 0; j < Translations.CommandInfos.Length; j++)
                    {
                        if (Interface.CurrentControls[i].Command == Translations.CommandInfos[j].Command)
                        {
                            EnableOption = Translations.CommandInfos[j].EnableOption;
                            break;
                        }
                    }

                    if (TouchElement.Command == Interface.CurrentControls[i].Command)
                    {
                        if (EnableOption && TouchElement.CommandOption != Interface.CurrentControls[i].Option)
                        {
                            continue;
                        }

                        Interface.CurrentControls[i].AnalogState  = 1.0;
                        Interface.CurrentControls[i].DigitalState = Interface.DigitalControlState.Pressed;
                        MainLoop.AddControlRepeat(i);
                    }
                }
            }

            prePickedObject = pickedObject;
        }