@quenty/settings-inputkeymap 1.0.1-canary.281.b720162.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/LICENSE.md +21 -0
- package/README.md +21 -0
- package/default.project.json +6 -0
- package/package.json +43 -0
- package/src/Client/InputKeyMapSettingClient.lua +74 -0
- package/src/Client/SettingsInputKeyMapServiceClient.lua +42 -0
- package/src/Server/InputKeyMapSetting.lua +46 -0
- package/src/Server/SettingsInputKeyMapService.lua +41 -0
- package/src/Shared/InputKeyMapSettingConstants.lua +11 -0
- package/src/Shared/InputKeyMapSettingUtils.lua +88 -0
- package/src/node_modules.project.json +7 -0
- package/test/default.project.json +21 -0
- package/test/scripts/Client/ClientMain.client.lua +27 -0
- package/test/scripts/Server/ServerMain.server.lua +14 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## 1.0.1-canary.281.b720162.0 (2022-08-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add Settings-InputKeyMap package which saves keybinds for the user into the setting system. ([225254b](https://github.com/Quenty/NevermoreEngine/commit/225254bf28744c1bd476d9882c9edafa800a7998))
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2022 Quenty
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
## SettingsInputKeyMap
|
|
2
|
+
<div align="center">
|
|
3
|
+
<a href="http://quenty.github.io/NevermoreEngine/">
|
|
4
|
+
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
|
|
5
|
+
</a>
|
|
6
|
+
<a href="https://discord.gg/mhtGUS8">
|
|
7
|
+
<img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
|
|
8
|
+
</a>
|
|
9
|
+
<a href="https://github.com/Quenty/NevermoreEngine/actions">
|
|
10
|
+
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
|
|
11
|
+
</a>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
Input key map setting saving for players
|
|
15
|
+
|
|
16
|
+
<div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/Signal">View docs →</a></div>
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
```
|
|
20
|
+
npm install @quenty/settings-inputkeymap --save
|
|
21
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quenty/settings-inputkeymap",
|
|
3
|
+
"version": "1.0.1-canary.281.b720162.0",
|
|
4
|
+
"description": "Input key map setting saving for players",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Roblox",
|
|
7
|
+
"Nevermore",
|
|
8
|
+
"Lua",
|
|
9
|
+
"Settings"
|
|
10
|
+
],
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/Quenty/NevermoreEngine/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/Quenty/NevermoreEngine.git",
|
|
17
|
+
"directory": "src/settings-inputkeymap/"
|
|
18
|
+
},
|
|
19
|
+
"funding": {
|
|
20
|
+
"type": "patreon",
|
|
21
|
+
"url": "https://www.patreon.com/quenty"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"contributors": [
|
|
25
|
+
"Quenty"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@quenty/baseobject": "5.1.0",
|
|
32
|
+
"@quenty/enumutils": "1.0.1-canary.281.b720162.0",
|
|
33
|
+
"@quenty/inputkeymaputils": "5.3.2-canary.281.b720162.0",
|
|
34
|
+
"@quenty/inputmode": "5.2.1-canary.281.b720162.0",
|
|
35
|
+
"@quenty/jsonutils": "5.1.0",
|
|
36
|
+
"@quenty/loader": "5.0.0",
|
|
37
|
+
"@quenty/maid": "2.4.0",
|
|
38
|
+
"@quenty/servicebag": "5.1.0",
|
|
39
|
+
"@quenty/settings": "2.3.2-canary.281.b720162.0",
|
|
40
|
+
"@quenty/string": "2.3.1-canary.281.b720162.0"
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "b720162ac53aede1f77664ccea0982b86127d824"
|
|
43
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class InputKeyMapSettingClient
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local BaseObject = require("BaseObject")
|
|
8
|
+
local InputKeyMapSettingUtils = require("InputKeyMapSettingUtils")
|
|
9
|
+
local SettingsServiceClient = require("SettingsServiceClient")
|
|
10
|
+
local InputKeyMapSettingConstants = require("InputKeyMapSettingConstants")
|
|
11
|
+
|
|
12
|
+
local InputKeyMapSettingClient = setmetatable({}, BaseObject)
|
|
13
|
+
InputKeyMapSettingClient.ClassName = "InputKeyMapSettingClient"
|
|
14
|
+
InputKeyMapSettingClient.__index = InputKeyMapSettingClient
|
|
15
|
+
|
|
16
|
+
function InputKeyMapSettingClient.new(serviceBag, inputKeyMapList)
|
|
17
|
+
local self = setmetatable(BaseObject.new(), InputKeyMapSettingClient)
|
|
18
|
+
|
|
19
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
20
|
+
self._settingService = self._serviceBag:GetService(SettingsServiceClient)
|
|
21
|
+
|
|
22
|
+
self._inputKeyMapList = assert(inputKeyMapList, "No inputKeyMapList")
|
|
23
|
+
|
|
24
|
+
self._maid:GiveTask(self._settingService:ObserveLocalPlayerSettingsBrio():Subscribe(function(settingsBrio)
|
|
25
|
+
if settingsBrio:IsDead() then
|
|
26
|
+
return
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
local settingMaid = settingsBrio:ToMaid()
|
|
30
|
+
local settings = settingsBrio:GetValue()
|
|
31
|
+
|
|
32
|
+
settingMaid:GiveTask(self._inputKeyMapList:ObservePairsBrio():Subscribe(function(brio)
|
|
33
|
+
if brio:IsDead() then
|
|
34
|
+
return
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
local maid = brio:ToMaid()
|
|
38
|
+
local inputModeType, inputKeyMap = brio:GetValue()
|
|
39
|
+
|
|
40
|
+
local settingName = InputKeyMapSettingUtils.getSettingName(inputKeyMapList, inputModeType)
|
|
41
|
+
local settingProperty = settings:GetSettingProperty(settingName, InputKeyMapSettingConstants.DEFAULT_VALUE)
|
|
42
|
+
|
|
43
|
+
-- Try to retrieve
|
|
44
|
+
maid:GiveTask(settingProperty:Observe():Subscribe(function(currentValue)
|
|
45
|
+
if currentValue == InputKeyMapSettingConstants.DEFAULT_VALUE or currentValue == nil then
|
|
46
|
+
inputKeyMap:RestoreDefault()
|
|
47
|
+
elseif type(currentValue) == "string" and currentValue ~= InputKeyMapSettingConstants.DEFAULT_VALUE then
|
|
48
|
+
local decoded = InputKeyMapSettingUtils.decodeInputTypeList(currentValue)
|
|
49
|
+
if decoded then
|
|
50
|
+
inputKeyMap:SetInputTypesList(decoded)
|
|
51
|
+
else
|
|
52
|
+
warn(("[InputKeyMapSettingClient] - Failed to decode setting value from %q"):format(tostring(currentValue)))
|
|
53
|
+
end
|
|
54
|
+
else
|
|
55
|
+
warn(("[InputKeyMapSettingClient] - Failed to decode setting value from %q"):format(tostring(currentValue)))
|
|
56
|
+
end
|
|
57
|
+
end))
|
|
58
|
+
|
|
59
|
+
maid:GiveTask(inputKeyMap:ObserveInputTypesList():Subscribe(function(inputTypeList)
|
|
60
|
+
-- Store
|
|
61
|
+
local encoded = InputKeyMapSettingUtils.encodeInputTypeList(inputTypeList)
|
|
62
|
+
if encoded ~= InputKeyMapSettingUtils.encodeInputTypeList(inputKeyMap:GetDefaultInputTypesList()) then
|
|
63
|
+
settings:SetValue(settingName, encoded)
|
|
64
|
+
else
|
|
65
|
+
settings:SetValue(settingName, InputKeyMapSettingConstants.DEFAULT_VALUE)
|
|
66
|
+
end
|
|
67
|
+
end))
|
|
68
|
+
end))
|
|
69
|
+
end))
|
|
70
|
+
|
|
71
|
+
return self
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
return InputKeyMapSettingClient
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class SettingsInputKeyMapServiceClient
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local Maid = require("Maid")
|
|
8
|
+
local InputKeyMapSettingClient = require("InputKeyMapSettingClient")
|
|
9
|
+
|
|
10
|
+
local SettingsInputKeyMapServiceClient = {}
|
|
11
|
+
SettingsInputKeyMapServiceClient.ServiceName = "SettingsInputKeyMapServiceClient"
|
|
12
|
+
|
|
13
|
+
function SettingsInputKeyMapServiceClient:Init(serviceBag)
|
|
14
|
+
assert(not self._serviceBag, "Already initialized")
|
|
15
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
16
|
+
self._maid = Maid.new()
|
|
17
|
+
|
|
18
|
+
-- External
|
|
19
|
+
self._serviceBag:GetService(require("SettingsServiceClient"))
|
|
20
|
+
self._serviceBag:GetService(require("InputModeServiceClient"))
|
|
21
|
+
self._serviceBag:GetService(require("InputKeyMapServiceClient"))
|
|
22
|
+
self._inputKeyMapRegistry = self._serviceBag:GetService(require("InputKeyMapRegistryServiceShared"))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
function SettingsInputKeyMapServiceClient:Start()
|
|
26
|
+
self._maid:GiveTask(self._inputKeyMapRegistry:ObserveInputKeyMapListsBrio():Subscribe(function(brio)
|
|
27
|
+
if brio:IsDead() then
|
|
28
|
+
return
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
local maid = brio:ToMaid()
|
|
32
|
+
local inputKeyMapList = brio:GetValue()
|
|
33
|
+
|
|
34
|
+
maid:GiveTask(InputKeyMapSettingClient.new(self._serviceBag, inputKeyMapList))
|
|
35
|
+
end))
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
function SettingsInputKeyMapServiceClient:Destroy()
|
|
39
|
+
self._maid:DoCleaning()
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
return SettingsInputKeyMapServiceClient
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
Registers the settings automatically so we can validate on the server.
|
|
3
|
+
@class InputKeyMapSetting
|
|
4
|
+
]=]
|
|
5
|
+
|
|
6
|
+
local require = require(script.Parent.loader).load(script)
|
|
7
|
+
|
|
8
|
+
local BaseObject = require("BaseObject")
|
|
9
|
+
local InputKeyMapSettingUtils = require("InputKeyMapSettingUtils")
|
|
10
|
+
local SettingsService = require("SettingsService")
|
|
11
|
+
local InputKeyMapSettingConstants = require("InputKeyMapSettingConstants")
|
|
12
|
+
local SettingDefinition = require("SettingDefinition")
|
|
13
|
+
local SettingRegistryServiceShared = require("SettingRegistryServiceShared")
|
|
14
|
+
|
|
15
|
+
local InputKeyMapSetting = setmetatable({}, BaseObject)
|
|
16
|
+
InputKeyMapSetting.ClassName = "InputKeyMapSetting"
|
|
17
|
+
InputKeyMapSetting.__index = InputKeyMapSetting
|
|
18
|
+
|
|
19
|
+
function InputKeyMapSetting.new(serviceBag, inputKeyMapList)
|
|
20
|
+
local self = setmetatable(BaseObject.new(), InputKeyMapSetting)
|
|
21
|
+
|
|
22
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
23
|
+
self._settingService = self._serviceBag:GetService(SettingsService)
|
|
24
|
+
self._settingRegistryServiceShared = self._serviceBag:GetService(SettingRegistryServiceShared)
|
|
25
|
+
|
|
26
|
+
self._inputKeyMapList = assert(inputKeyMapList, "No inputKeyMapList")
|
|
27
|
+
|
|
28
|
+
self._maid:GiveTask(self._inputKeyMapList:ObservePairsBrio():Subscribe(function(brio)
|
|
29
|
+
if brio:IsDead() then
|
|
30
|
+
return
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
-- Register settings
|
|
34
|
+
local maid = brio:ToMaid()
|
|
35
|
+
local inputModeType, _ = brio:GetValue()
|
|
36
|
+
|
|
37
|
+
local settingName = InputKeyMapSettingUtils.getSettingName(inputKeyMapList, inputModeType)
|
|
38
|
+
local definition = SettingDefinition.new(settingName, InputKeyMapSettingConstants.DEFAULT_VALUE)
|
|
39
|
+
|
|
40
|
+
maid:GiveTask(self._settingRegistryServiceShared:RegisterSettingDefinition(definition))
|
|
41
|
+
end))
|
|
42
|
+
|
|
43
|
+
return self
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
return InputKeyMapSetting
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class SettingsInputKeyMapService
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local Maid = require("Maid")
|
|
8
|
+
local InputKeyMapSetting = require("InputKeyMapSetting")
|
|
9
|
+
|
|
10
|
+
local SettingsInputKeyMapService = {}
|
|
11
|
+
SettingsInputKeyMapService.ServiceName = "SettingsInputKeyMapService"
|
|
12
|
+
|
|
13
|
+
function SettingsInputKeyMapService:Init(serviceBag)
|
|
14
|
+
assert(not self._serviceBag, "Already initialized")
|
|
15
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
16
|
+
self._maid = Maid.new()
|
|
17
|
+
|
|
18
|
+
-- External
|
|
19
|
+
self._serviceBag:GetService(require("SettingsService"))
|
|
20
|
+
self._inputKeyMapRegistry = self._serviceBag:GetService(require("InputKeyMapRegistryServiceShared"))
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
function SettingsInputKeyMapService:Start()
|
|
25
|
+
self._maid:GiveTask(self._inputKeyMapRegistry:ObserveInputKeyMapListsBrio():Subscribe(function(brio)
|
|
26
|
+
if brio:IsDead() then
|
|
27
|
+
return
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
local maid = brio:ToMaid()
|
|
31
|
+
local inputKeyMapList = brio:GetValue()
|
|
32
|
+
|
|
33
|
+
maid:GiveTask(InputKeyMapSetting.new(self._serviceBag, inputKeyMapList))
|
|
34
|
+
end))
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
function SettingsInputKeyMapService:Destroy()
|
|
38
|
+
self._maid:DoCleaning()
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
return SettingsInputKeyMapService
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
Helper methods for encoding and decoding input lists into network storage
|
|
3
|
+
@class InputKeyMapSettingUtils
|
|
4
|
+
]=]
|
|
5
|
+
|
|
6
|
+
local require = require(script.Parent.loader).load(script)
|
|
7
|
+
|
|
8
|
+
local HttpService = game:GetService("HttpService")
|
|
9
|
+
|
|
10
|
+
local EnumUtils = require("EnumUtils")
|
|
11
|
+
local JSONUtils = require("JSONUtils")
|
|
12
|
+
local InputTypeUtils = require("InputTypeUtils")
|
|
13
|
+
local String = require("String")
|
|
14
|
+
|
|
15
|
+
local InputKeyMapSettingUtils = {}
|
|
16
|
+
|
|
17
|
+
--[=[
|
|
18
|
+
Returns the canonical setting name for this input key map list.
|
|
19
|
+
|
|
20
|
+
@param inputKeyMapList InputKeyMapList
|
|
21
|
+
@param inputModeType InputModeType
|
|
22
|
+
@return string
|
|
23
|
+
]=]
|
|
24
|
+
function InputKeyMapSettingUtils.getSettingName(inputKeyMapList, inputModeType)
|
|
25
|
+
return ("Keybind_%s_%s"):format(String.toCamelCase(inputKeyMapList:GetListName()), inputModeType.Name)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
--[=[
|
|
29
|
+
Encodes the list into a string which can be decoded later.
|
|
30
|
+
|
|
31
|
+
@param list { InputType }
|
|
32
|
+
@return string
|
|
33
|
+
]=]
|
|
34
|
+
function InputKeyMapSettingUtils.encodeInputTypeList(list)
|
|
35
|
+
local newList = {}
|
|
36
|
+
|
|
37
|
+
for _, inputType in pairs(list) do
|
|
38
|
+
if typeof(inputType) == "EnumItem" then
|
|
39
|
+
table.insert(newList, EnumUtils.encodeAsString(inputType))
|
|
40
|
+
elseif InputTypeUtils.isKnownInputType(inputType) then
|
|
41
|
+
table.insert(newList, inputType)
|
|
42
|
+
else
|
|
43
|
+
warn(("[InputKeyMapSettingUtils] - Unknown inputType %q"):format(tostring(inputType)))
|
|
44
|
+
table.insert(newList, inputType) -- Encode anyway
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
return HttpService:JSONEncode(newList)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
--[=[
|
|
52
|
+
Decodes the list from a string into a safe value.
|
|
53
|
+
|
|
54
|
+
@param encoded string?
|
|
55
|
+
@return string
|
|
56
|
+
]=]
|
|
57
|
+
function InputKeyMapSettingUtils.decodeInputTypeList(encoded)
|
|
58
|
+
if type(encoded) ~= "string" then
|
|
59
|
+
return nil
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
local ok, result = JSONUtils.jsonDecode(encoded)
|
|
63
|
+
if not ok then
|
|
64
|
+
return nil
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
if type(result) ~= "table" then
|
|
68
|
+
warn("[InputKeyMapSettingUtils] - Failed to decode table")
|
|
69
|
+
return nil
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
local decodedList = {}
|
|
73
|
+
|
|
74
|
+
for _, inputType in pairs(result) do
|
|
75
|
+
if EnumUtils.isEncodedEnum(inputType) then
|
|
76
|
+
table.insert(decodedList, EnumUtils.decodeFromString(inputType))
|
|
77
|
+
elseif InputTypeUtils.isKnownInputType(inputType) then
|
|
78
|
+
table.insert(decodedList, inputType)
|
|
79
|
+
else
|
|
80
|
+
warn(("[InputKeyMapSettingUtils] - Unknown inputType %q"):format(tostring(inputType)))
|
|
81
|
+
table.insert(decodedList, inputType) -- Decode anyway
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
return decodedList
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
return InputKeyMapSettingUtils
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SettingsInputKeyMapTest",
|
|
3
|
+
"tree": {
|
|
4
|
+
"$className": "DataModel",
|
|
5
|
+
"ServerScriptService": {
|
|
6
|
+
"settings-inputkeymap": {
|
|
7
|
+
"$path": ".."
|
|
8
|
+
},
|
|
9
|
+
"Script": {
|
|
10
|
+
"$path": "scripts/Server"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"StarterPlayer": {
|
|
14
|
+
"StarterPlayerScripts": {
|
|
15
|
+
"Main": {
|
|
16
|
+
"$path": "scripts/Client"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
@class ClientMain
|
|
3
|
+
]]
|
|
4
|
+
local packages = game:GetService("ReplicatedStorage"):WaitForChild("Packages")
|
|
5
|
+
|
|
6
|
+
local serviceBag = require(packages.ServiceBag).new()
|
|
7
|
+
serviceBag:GetService(packages.SettingsInputKeyMapServiceClient)
|
|
8
|
+
|
|
9
|
+
-- Start game
|
|
10
|
+
serviceBag:Init()
|
|
11
|
+
serviceBag:Start()
|
|
12
|
+
|
|
13
|
+
local InputKeyMapList = require(packages.InputKeyMapList)
|
|
14
|
+
local InputModeTypes = require(packages.InputModeTypes)
|
|
15
|
+
local InputKeyMap = require(packages.InputKeyMap)
|
|
16
|
+
local SlottedTouchButtonUtils = require(packages.SlottedTouchButtonUtils)
|
|
17
|
+
|
|
18
|
+
local inputKeyMapList = InputKeyMapList.new("JUMP", {
|
|
19
|
+
InputKeyMap.new(InputModeTypes.KeyboardAndMouse, { Enum.KeyCode.Q });
|
|
20
|
+
InputKeyMap.new(InputModeTypes.Gamepads, { Enum.KeyCode.ButtonY });
|
|
21
|
+
InputKeyMap.new(InputModeTypes.Touch, { SlottedTouchButtonUtils.createSlottedTouchButton("primary3") });
|
|
22
|
+
}, {
|
|
23
|
+
bindingName = "Jump";
|
|
24
|
+
rebindable = true;
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
serviceBag:GetService(packages.SettingsInputKeyMapServiceClient):AddInputKeyMapList(inputKeyMapList)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
@class ServerMain
|
|
3
|
+
]]
|
|
4
|
+
local ServerScriptService = game:GetService("ServerScriptService")
|
|
5
|
+
|
|
6
|
+
local loader = ServerScriptService:FindFirstChild("LoaderUtils", true).Parent
|
|
7
|
+
local packages = require(loader).bootstrapGame(ServerScriptService["settings-inputkeymap"])
|
|
8
|
+
|
|
9
|
+
local serviceBag = require(packages.ServiceBag).new()
|
|
10
|
+
serviceBag:GetService(packages.SettingsInputKeyMapService)
|
|
11
|
+
|
|
12
|
+
-- Start game
|
|
13
|
+
serviceBag:Init()
|
|
14
|
+
serviceBag:Start()
|