AddControlRepeat() private static method

Adds a control to be repeated
private static AddControlRepeat ( int controlIndex ) : void
controlIndex int The control index to repeat
return void
Beispiel #1
0
        internal static void TouchCheck(Vector2 Point)
        {
            if (!Loading.SimulationSetup)
            {
                return;
            }

            if (World.CameraMode != CameraViewMode.Interior && World.CameraMode != 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)
            {
                TrainManager.TouchElement[] TouchElements = Car.CarSections[0].Groups[add].TouchElements;

                if (TouchElements != null)
                {
                    foreach (var TouchElement in TouchElements)
                    {
                        int o = TouchElement.Element.ObjectIndex;
                        ShowObjectSelection(o);
                    }

                    int[] SelectBuffer = new int[2048];

                    PickPre(SelectBuffer, Point, new Vector2(5));

                    RenderSceneSelection();

                    int PickedObjectIndex = PickPost(SelectBuffer);

                    foreach (var TouchElement in TouchElements)
                    {
                        int o = TouchElement.Element.ObjectIndex;
                        HideObjectSelection(o);
                        if (o == PickedObjectIndex)
                        {
                            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);
                                }
                            }
                        }
                    }

                    PrePickedObjectIndex = PickedObjectIndex;
                }
            }
        }