Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Lua: UIMenu
- Removed "DisEnableControls".. old method.. stupid and confusing.. outrageous - Added cleaner menu:DisableNonMenuControls() method - Added Controls class to handle controls with cleaner interface. you can add remove controls in `Controls.NecessaryControlsKeyboard` and `Controls.NecessaryControlsGamePad`
- Loading branch information
Showing
2 changed files
with
102 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| Controls = setmetatable({ | ||
| NecessaryControlsKeyboard = { | ||
| 201, -- FrontendAccept | ||
| 195, -- FrontendAxisX | ||
| 196, -- FrontendAxisY | ||
| 187, -- FrontendDown | ||
| 188, -- FrontendUp | ||
| 189, -- FrontendLeft | ||
| 190, -- FrontendRight | ||
| 202, -- FrontendCancel | ||
| 217, -- FrontendSelect | ||
| 242, -- CursorScrollDown | ||
| 241, -- CursorScrollUp | ||
| 239, -- CursorX | ||
| 240, -- CursorY | ||
| 237, -- CursorAccept | ||
| 238, -- CursorCancel | ||
| 31, -- MoveUpDown | ||
| 30, -- MoveLeftRight | ||
| 21, -- Sprint | ||
| 22, -- Jump | ||
| 23, -- Enter | ||
| 75, -- VehicleExit | ||
| 71, -- VehicleAccelerate | ||
| 72, -- VehicleBrake | ||
| 59, -- VehicleMoveLeftRight | ||
| 89, -- VehicleFlyYawLeft | ||
| 9, -- FlyLeftRight | ||
| 8, -- FlyUpDown | ||
| 90, -- VehicleFlyYawRight | ||
| 76 -- VehicleHandbrake | ||
| }, | ||
|
|
||
| NecessaryControlsGamePad = { | ||
| 201, -- FrontendAccept | ||
| 195, -- FrontendAxisX | ||
| 196, -- FrontendAxisY | ||
| 187, -- FrontendDown | ||
| 188, -- FrontendUp | ||
| 189, -- FrontendLeft | ||
| 190, -- FrontendRight | ||
| 202, -- FrontendCancel | ||
| 217, -- FrontendSelect | ||
| 242, -- CursorScrollDown | ||
| 241, -- CursorScrollUp | ||
| 239, -- CursorX | ||
| 240, -- CursorY | ||
| 237, -- CursorAccept | ||
| 238, -- CursorCancel | ||
| 31, -- MoveUpDown | ||
| 30, -- MoveLeftRight | ||
| 21, -- Sprint | ||
| 22, -- Jump | ||
| 23, -- Enter | ||
| 75, -- VehicleExit | ||
| 71, -- VehicleAccelerate | ||
| 72, -- VehicleBrake | ||
| 59, -- VehicleMoveLeftRight | ||
| 89, -- VehicleFlyYawLeft | ||
| 9, -- FlyLeftRight | ||
| 8, -- FlyUpDown | ||
| 90, -- VehicleFlyYawRight | ||
| 76, -- VehicleHandbrake | ||
| 2, -- LookUpDown | ||
| 1, -- LookLeftRight | ||
| 25, -- Aim | ||
| 24, -- Attack | ||
| 71, -- VehicleAccelerate | ||
| 72, -- VehicleBrake | ||
| 59, -- VehicleMoveLeftRight | ||
| 31, -- MoveUpDown | ||
| 30, -- MoveLeftRight | ||
| 75, -- VehicleExit | ||
| } | ||
| }, Controls) | ||
|
|
||
|
|
||
| function Controls:ToggleAll(toggle) | ||
| if toggle then | ||
| EnableAllControlActions(0) | ||
| EnableAllControlActions(1) | ||
| EnableAllControlActions(2) | ||
| else | ||
| DisableAllControlActions(2) | ||
|
|
||
| local list = {} | ||
| if IsUsingKeyboard(2) then | ||
| list = self.NecessaryControlsKeyboard | ||
| else | ||
| list = self.NecessaryControlsGamePad | ||
| end | ||
| for _, control in pairs(list) do | ||
| EnableControlAction(0, control, true) | ||
| end | ||
| end | ||
| end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8b94bdeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DisableNonMenuControlsmaybeDisableGameControls? and likely it'll be best setfalseby default? Just "Non Menu" doesn't feel like it fits right.8b94bdeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8b94bdeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also.. no it should not be set to false.. but to
true.. as by default.. game controls are disabled and menu controls are enabled..8b94bdeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we have keep remembering to set it to false to use GamePlayCamera? worth adding comments to that effect
8b94bdeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DisableGameControlsit's already a good name.. it helps.. if true they're disabled.. if false they're not disabled8b94bdeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, name is fine now, its the default setting. So by default the menu when being used will always block typical gameplay inputs unless the developer specifies they don't want to, my view is that it would be better to say the menu doesn't block game play inputs by default and that the developer should state they want to block game play inputs.
8b94bdeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
menu blocks everything except the input specified in the tables above