Skip to content

Commit 19465a1

Browse files
committed
Move control enable/disable to ShowConsole
1 parent 253e879 commit 19465a1

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

gtav_console/Console/DeveloperConsole.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -251,32 +251,6 @@ private void OnTick(object sender, EventArgs e) {
251251
_hasWarned = true;
252252
}
253253

254-
if (!_isHidden) {
255-
_disabledControls = GTAFuncs.DisableAllControls();
256-
GTAFuncs.EnableControlAction(Control.MoveLeftRight, true);
257-
GTAFuncs.EnableControlAction(Control.MoveUpDown, true);
258-
GTAFuncs.EnableControlAction(Control.VehicleAccelerate, true);
259-
GTAFuncs.EnableControlAction(Control.VehicleBrake, true);
260-
GTAFuncs.EnableControlAction(Control.VehicleDriveLook, true);
261-
GTAFuncs.EnableControlAction(Control.VehicleDriveLook2, true);
262-
GTAFuncs.EnableControlAction(Control.VehicleMoveLeftRight, true);
263-
GTAFuncs.EnableControlAction(Control.VehicleMoveUpDown, true);
264-
GTAFuncs.EnableControlAction(Control.LookLeftRight, true);
265-
GTAFuncs.EnableControlAction(Control.LookUpDown, true);
266-
GTAFuncs.EnableControlAction(Control.FlyUpDown, true);
267-
GTAFuncs.EnableControlAction(Control.FlyLeftRight, true);
268-
GTAFuncs.EnableControlAction(Control.VehicleFlyRollLeftRight, true);
269-
GTAFuncs.EnableControlAction(Control.VehicleFlyPitchUpDown, true);
270-
GTAFuncs.EnableControlAction(Control.VehicleFlyYawLeft, true);
271-
GTAFuncs.EnableControlAction(Control.VehicleFlyYawRight, true);
272-
GTAFuncs.EnableControlAction(Control.VehicleFlyThrottleDown, true);
273-
GTAFuncs.EnableControlAction(Control.VehicleFlyThrottleUp, true);
274-
}
275-
else {
276-
GTAFuncs.SetControlActions(false);
277-
GTAFuncs.EnableControls(_disabledControls);
278-
}
279-
280254
ObjectSelector.Tick();
281255

282256
DrawConsole();
@@ -610,6 +584,32 @@ public void ShowConsole(bool show) {
610584
_isHidden = !show;
611585
_lineOffset = 0;
612586
_historyCursor = -1;
587+
if (!_isHidden) {
588+
_disabledControls = GTAFuncs.DisableAllControls();
589+
GTAFuncs.EnableControlAction(Control.MoveLeftRight, true);
590+
GTAFuncs.EnableControlAction(Control.MoveUpDown, true);
591+
GTAFuncs.EnableControlAction(Control.VehicleAccelerate, true);
592+
GTAFuncs.EnableControlAction(Control.VehicleBrake, true);
593+
GTAFuncs.EnableControlAction(Control.VehicleDriveLook, true);
594+
GTAFuncs.EnableControlAction(Control.VehicleDriveLook2, true);
595+
GTAFuncs.EnableControlAction(Control.VehicleMoveLeftRight, true);
596+
GTAFuncs.EnableControlAction(Control.VehicleMoveUpDown, true);
597+
GTAFuncs.EnableControlAction(Control.LookLeftRight, true);
598+
GTAFuncs.EnableControlAction(Control.LookUpDown, true);
599+
GTAFuncs.EnableControlAction(Control.FlyUpDown, true);
600+
GTAFuncs.EnableControlAction(Control.FlyLeftRight, true);
601+
GTAFuncs.EnableControlAction(Control.VehicleFlyRollLeftRight, true);
602+
GTAFuncs.EnableControlAction(Control.VehicleFlyPitchUpDown, true);
603+
GTAFuncs.EnableControlAction(Control.VehicleFlyYawLeft, true);
604+
GTAFuncs.EnableControlAction(Control.VehicleFlyYawRight, true);
605+
GTAFuncs.EnableControlAction(Control.VehicleFlyThrottleDown, true);
606+
GTAFuncs.EnableControlAction(Control.VehicleFlyThrottleUp, true);
607+
}
608+
else {
609+
GTAFuncs.SetControlActions(false);
610+
GTAFuncs.EnableControls(_disabledControls);
611+
_disabledControls.Clear();
612+
}
613613
}
614614

615615
#endregion
@@ -649,4 +649,4 @@ private static List<string> Split(string str, int chunkSize) {
649649

650650
#endregion
651651
}
652-
}
652+
}

0 commit comments

Comments
 (0)