@quenty/playerinputmode 1.1.0 → 2.0.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
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerinputmode@1.1.0...@quenty/playerinputmode@2.0.0) (2022-08-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add ServiceName to most services for faster debugging ([39fc3f4](https://github.com/Quenty/NevermoreEngine/commit/39fc3f4f2beb92fff49b2264424e07af7907324e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# 1.1.0 (2022-07-31)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/playerinputmode",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Service that takes active input modes from the player and exposes it to every other player via the server.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/attributeutils": "^
|
|
30
|
-
"@quenty/inputmode": "^
|
|
29
|
+
"@quenty/attributeutils": "^7.0.0",
|
|
30
|
+
"@quenty/inputmode": "^6.0.0",
|
|
31
31
|
"@quenty/loader": "^5.0.0",
|
|
32
32
|
"@quenty/remoting": "^5.2.0",
|
|
33
|
-
"@quenty/rx": "^
|
|
33
|
+
"@quenty/rx": "^6.0.0",
|
|
34
34
|
"@quenty/servicebag": "^5.1.0",
|
|
35
35
|
"@quenty/table": "^3.1.0"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "dbb62609f980983cc32da90acfef13e30ed41113"
|
|
41
41
|
}
|
|
@@ -6,8 +6,8 @@ local require = require(script.Parent.loader).load(script)
|
|
|
6
6
|
|
|
7
7
|
local Players = game:GetService("Players")
|
|
8
8
|
|
|
9
|
-
local
|
|
10
|
-
local
|
|
9
|
+
local InputModeTypes = require("InputModeTypes")
|
|
10
|
+
local InputModeTypeSelector = require("InputModeTypeSelector")
|
|
11
11
|
local Maid = require("Maid")
|
|
12
12
|
local PlayerInputModeServiceConstants = require("PlayerInputModeServiceConstants")
|
|
13
13
|
local PromiseGetRemoteEvent = require("PromiseGetRemoteEvent")
|
|
@@ -16,32 +16,35 @@ local PlayerInputModeUtils = require("PlayerInputModeUtils")
|
|
|
16
16
|
local PlayerInputModeTypes = require("PlayerInputModeTypes")
|
|
17
17
|
|
|
18
18
|
local PlayerInputModeServiceClient = {}
|
|
19
|
+
PlayerInputModeServiceClient.ServiceName = "PlayerInputModeServiceClient"
|
|
19
20
|
|
|
20
21
|
function PlayerInputModeServiceClient:Init(serviceBag)
|
|
21
22
|
assert(not self._serviceBag, "Already initialized")
|
|
22
23
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
23
24
|
|
|
25
|
+
self._serviceBag:GetService(require("InputModeServiceClient"))
|
|
26
|
+
|
|
24
27
|
self._maid = Maid.new()
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
function PlayerInputModeServiceClient:Start()
|
|
28
|
-
self._selector =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
self._selector = InputModeTypeSelector.new(self._serviceBag, {
|
|
32
|
+
InputModeTypes.Gamepads,
|
|
33
|
+
InputModeTypes.Keyboard,
|
|
34
|
+
InputModeTypes.Touch
|
|
32
35
|
})
|
|
33
36
|
self._maid:GiveTask(self._selector)
|
|
34
37
|
|
|
35
38
|
self:_promiseRemoteEvent():Then(function(remoteEvent)
|
|
36
|
-
self._maid:GiveTask(self._selector:
|
|
39
|
+
self._maid:GiveTask(self._selector:ObserveActiveInputType():Pipe({
|
|
37
40
|
Rx.throttleTime(1, { leading = true; trailing = true });
|
|
38
41
|
}):Subscribe(function(activeMode)
|
|
39
42
|
local modeType
|
|
40
|
-
if activeMode ==
|
|
43
|
+
if activeMode == InputModeTypes.Gamepads then
|
|
41
44
|
modeType = PlayerInputModeTypes.GAMEPAD
|
|
42
|
-
elseif activeMode ==
|
|
45
|
+
elseif activeMode == InputModeTypes.Keyboard then
|
|
43
46
|
modeType = PlayerInputModeTypes.KEYBOARD
|
|
44
|
-
elseif activeMode ==
|
|
47
|
+
elseif activeMode == InputModeTypes.Touch then
|
|
45
48
|
modeType = PlayerInputModeTypes.TOUCH
|
|
46
49
|
else
|
|
47
50
|
error("Bad activeMode")
|
|
@@ -10,6 +10,7 @@ local PlayerInputModeServiceConstants = require("PlayerInputModeServiceConstants
|
|
|
10
10
|
local PlayerInputModeUtils = require("PlayerInputModeUtils")
|
|
11
11
|
|
|
12
12
|
local PlayerInputModeService = {}
|
|
13
|
+
PlayerInputModeService.ServiceName = "PlayerInputModeService"
|
|
13
14
|
|
|
14
15
|
function PlayerInputModeService:Init(serviceBag)
|
|
15
16
|
assert(not self._serviceBag, "Already initialized")
|