@quenty/observablecollection 12.20.4-canary.559.339cfa7.0 → 12.21.0-canary.0a5db80.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 +3 -11
- package/package.json +15 -15
- package/src/Shared/FilteredObservableListView.lua +12 -15
- package/src/Shared/ObservableCountingMap.lua +5 -5
- package/src/Shared/ObservableCountingMap.spec.lua +2 -3
- package/src/Shared/ObservableList.lua +1 -1
- package/src/Shared/ObservableList.spec.lua +2 -3
- package/src/Shared/ObservableMap.lua +1 -1
- package/src/Shared/ObservableMap.spec.lua +2 -3
- package/src/Shared/ObservableMapList.lua +3 -2
- package/src/Shared/ObservableMapList.spec.lua +2 -3
- package/src/Shared/ObservableSet.lua +7 -6
- package/src/Shared/SortedList/ObservableSortedList.lua +2 -2
- package/src/Shared/SortedList/ObservableSortedList.spec.lua +2 -3
- package/src/Shared/SortedList/ObservableSortedList.story.lua +59 -62
- package/src/Shared/SortedList/ObservableSortedList_Print.story.lua +15 -16
- package/src/Shared/SortedList/SortFunctionUtils.lua +3 -2
- package/src/Shared/SortedList/SortedNode.lua +1 -1
- package/src/Shared/SortedList/SortedNodeValue.lua +1 -1
- package/src/Shared/Utils/ListIndexUtils.lua +1 -1
- package/test/scripts/Server/ServerMain.server.lua +12 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,25 +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
|
-
|
|
6
|
+
# [12.21.0-canary.0a5db80.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@12.20.2...@quenty/observablecollection@12.21.0-canary.0a5db80.0) (2025-05-10)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
* Additional type checking updates ([
|
|
11
|
+
* Additional type checking updates ([7e008c5](https://github.com/Quenty/NevermoreEngine/commit/7e008c58547bd00b5904e56541454a38c8d72ccc))
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
### Features
|
|
15
15
|
|
|
16
|
-
* Add even more types ([
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## [12.20.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@12.20.2...@quenty/observablecollection@12.20.3) (2025-04-10)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @quenty/observablecollection
|
|
16
|
+
* Add even more types ([0a5db80](https://github.com/Quenty/NevermoreEngine/commit/0a5db8004684dc3e76fd5944599a22602d48cfa9))
|
|
25
17
|
|
|
26
18
|
|
|
27
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/observablecollection",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.21.0-canary.0a5db80.0",
|
|
4
4
|
"description": "A set of observable collections, such as sets, maps, sorted lists, and more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,24 +27,24 @@
|
|
|
27
27
|
"Quenty"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@quenty/baseobject": "10.
|
|
31
|
-
"@quenty/brio": "14.
|
|
32
|
-
"@quenty/ducktype": "5.
|
|
33
|
-
"@quenty/loader": "10.
|
|
34
|
-
"@quenty/maid": "3.
|
|
35
|
-
"@quenty/promise": "10.
|
|
36
|
-
"@quenty/rx": "13.
|
|
37
|
-
"@quenty/signal": "7.
|
|
38
|
-
"@quenty/steputils": "3.5.
|
|
39
|
-
"@quenty/symbol": "3.4.
|
|
40
|
-
"@quenty/table": "3.
|
|
41
|
-
"@quenty/valueobject": "13.
|
|
30
|
+
"@quenty/baseobject": "10.9.0-canary.0a5db80.0",
|
|
31
|
+
"@quenty/brio": "14.18.0-canary.0a5db80.0",
|
|
32
|
+
"@quenty/ducktype": "5.9.0-canary.0a5db80.0",
|
|
33
|
+
"@quenty/loader": "10.9.0-canary.0a5db80.0",
|
|
34
|
+
"@quenty/maid": "3.5.0-canary.0a5db80.0",
|
|
35
|
+
"@quenty/promise": "10.11.0-canary.0a5db80.0",
|
|
36
|
+
"@quenty/rx": "13.18.0-canary.0a5db80.0",
|
|
37
|
+
"@quenty/signal": "7.11.0-canary.0a5db80.0",
|
|
38
|
+
"@quenty/steputils": "3.5.5",
|
|
39
|
+
"@quenty/symbol": "3.4.2",
|
|
40
|
+
"@quenty/table": "3.8.0-canary.0a5db80.0",
|
|
41
|
+
"@quenty/valueobject": "13.18.0-canary.0a5db80.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@quenty/blend": "12.
|
|
44
|
+
"@quenty/blend": "12.19.0-canary.0a5db80.0"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "0a5db8004684dc3e76fd5944599a22602d48cfa9"
|
|
50
50
|
}
|
|
@@ -53,20 +53,17 @@ function FilteredObservableListView.new(observableList, observeScoreCallback, co
|
|
|
53
53
|
local observeScore = self._observeScoreCallback(entry)
|
|
54
54
|
assert(Observable.isObservable(observeScore), "Bad observeScore")
|
|
55
55
|
|
|
56
|
-
maid._add = self._scoredList:Add(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
end),
|
|
68
|
-
})
|
|
69
|
-
)
|
|
56
|
+
maid._add = self._scoredList:Add(entry, Rx.combineLatest({
|
|
57
|
+
score = observeScore;
|
|
58
|
+
index = self._baseList:ObserveIndexByKey(key);
|
|
59
|
+
}):Pipe({
|
|
60
|
+
Rx.map(function(state)
|
|
61
|
+
if state.score == nil then
|
|
62
|
+
return nil
|
|
63
|
+
end
|
|
64
|
+
return state
|
|
65
|
+
end)
|
|
66
|
+
}))
|
|
70
67
|
end))
|
|
71
68
|
|
|
72
69
|
return self
|
|
@@ -109,4 +106,4 @@ function FilteredObservableListView:ObserveCount()
|
|
|
109
106
|
return self._scoredList:ObserveCount()
|
|
110
107
|
end
|
|
111
108
|
|
|
112
|
-
return FilteredObservableListView
|
|
109
|
+
return FilteredObservableListView
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
|
+
local Signal = require("Signal")
|
|
10
|
+
local Observable = require("Observable")
|
|
11
|
+
local Maid = require("Maid")
|
|
9
12
|
local Brio = require("Brio")
|
|
13
|
+
local ValueObject = require("ValueObject")
|
|
10
14
|
local DuckTypeUtils = require("DuckTypeUtils")
|
|
11
|
-
local Maid = require("Maid")
|
|
12
|
-
local Observable = require("Observable")
|
|
13
15
|
local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
|
|
14
16
|
local Set = require("Set")
|
|
15
|
-
local Signal = require("Signal")
|
|
16
|
-
local ValueObject = require("ValueObject")
|
|
17
17
|
|
|
18
18
|
local ObservableCountingMap = {}
|
|
19
19
|
ObservableCountingMap.ClassName = "ObservableCountingMap"
|
|
@@ -412,4 +412,4 @@ function ObservableCountingMap.Destroy<T>(self: ObservableCountingMap<T>): ()
|
|
|
412
412
|
setmetatable(self :: any, nil)
|
|
413
413
|
end
|
|
414
414
|
|
|
415
|
-
return ObservableCountingMap
|
|
415
|
+
return ObservableCountingMap
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
@class ObservableCountingMap.spec.lua
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
6
|
-
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
5
|
+
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
7
6
|
|
|
8
7
|
local Jest = require("Jest")
|
|
9
8
|
local ObservableCountingMap = require("ObservableCountingMap")
|
|
@@ -39,4 +38,4 @@ describe("ObservableCountingMap.new()", function()
|
|
|
39
38
|
it("should clean up", function()
|
|
40
39
|
observableCountingMap:Destroy()
|
|
41
40
|
end)
|
|
42
|
-
end)
|
|
41
|
+
end)
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
@class ObservableList.spec.lua
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
6
|
-
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
5
|
+
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
7
6
|
|
|
8
7
|
local Jest = require("Jest")
|
|
9
8
|
local ObservableList = require("ObservableList")
|
|
@@ -132,4 +131,4 @@ describe("ObservableList.new()", function()
|
|
|
132
131
|
it("should clean up", function()
|
|
133
132
|
observableList:Destroy()
|
|
134
133
|
end)
|
|
135
|
-
end)
|
|
134
|
+
end)
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
@class ObservableMap.spec.lua
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
6
|
-
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
5
|
+
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
7
6
|
|
|
8
7
|
local Jest = require("Jest")
|
|
9
8
|
local ObservableMap = require("ObservableMap")
|
|
@@ -75,4 +74,4 @@ describe("ObservableMap.new()", function()
|
|
|
75
74
|
it("should clean up", function()
|
|
76
75
|
observableMap:Destroy()
|
|
77
76
|
end)
|
|
78
|
-
end)
|
|
77
|
+
end)
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
local require = require(script.Parent.loader).load(script)
|
|
9
9
|
|
|
10
|
-
local Brio = require("Brio")
|
|
11
10
|
local Maid = require("Maid")
|
|
12
11
|
local Observable = require("Observable")
|
|
13
12
|
local ObservableList = require("ObservableList")
|
|
@@ -15,6 +14,7 @@ local ObservableMap = require("ObservableMap")
|
|
|
15
14
|
local Rx = require("Rx")
|
|
16
15
|
local RxBrioUtils = require("RxBrioUtils")
|
|
17
16
|
local Signal = require("Signal")
|
|
17
|
+
local Brio = require("Brio")
|
|
18
18
|
|
|
19
19
|
local ObservableMapList = {}
|
|
20
20
|
ObservableMapList.ClassName = "ObservableMapList"
|
|
@@ -443,4 +443,5 @@ function ObservableMapList.Destroy<TKey, TValue>(self: ObservableMapList<TKey, T
|
|
|
443
443
|
setmetatable(self :: any, nil)
|
|
444
444
|
end
|
|
445
445
|
|
|
446
|
-
|
|
446
|
+
|
|
447
|
+
return ObservableMapList
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
@class ObservableMapList.spec.lua
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
6
|
-
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
5
|
+
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
7
6
|
|
|
8
7
|
local Jest = require("Jest")
|
|
9
8
|
local ObservableMapList = require("ObservableMapList")
|
|
@@ -25,4 +24,4 @@ describe("ObservableMapList.new()", function()
|
|
|
25
24
|
expect(observableMapList:GetAtListIndex("hello", -1)).toEqual("dragon")
|
|
26
25
|
expect(observableMapList:GetAtListIndex("fire", 1)).toEqual(nil)
|
|
27
26
|
end)
|
|
28
|
-
end)
|
|
27
|
+
end)
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
|
-
local
|
|
10
|
-
local DuckTypeUtils = require("DuckTypeUtils")
|
|
11
|
-
local Maid = require("Maid")
|
|
9
|
+
local Signal = require("Signal")
|
|
12
10
|
local Observable = require("Observable")
|
|
11
|
+
local Maid = require("Maid")
|
|
12
|
+
local Brio = require("Brio")
|
|
13
|
+
local ValueObject = require("ValueObject")
|
|
13
14
|
local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
|
|
15
|
+
local DuckTypeUtils = require("DuckTypeUtils")
|
|
14
16
|
local Set = require("Set")
|
|
15
|
-
local Signal = require("Signal")
|
|
16
|
-
local ValueObject = require("ValueObject")
|
|
17
17
|
|
|
18
18
|
local ObservableSet = {}
|
|
19
19
|
ObservableSet.ClassName = "ObservableSet"
|
|
@@ -290,6 +290,7 @@ function ObservableSet.GetRawSet<T>(self: ObservableSet<T>): Set.Set<T>
|
|
|
290
290
|
return self._set
|
|
291
291
|
end
|
|
292
292
|
|
|
293
|
+
|
|
293
294
|
--[=[
|
|
294
295
|
Cleans up the ObservableSet and sets the metatable to nil.
|
|
295
296
|
]=]
|
|
@@ -298,4 +299,4 @@ function ObservableSet.Destroy<T>(self: ObservableSet<T>)
|
|
|
298
299
|
setmetatable(self :: any, nil)
|
|
299
300
|
end
|
|
300
301
|
|
|
301
|
-
return ObservableSet
|
|
302
|
+
return ObservableSet
|
|
@@ -27,9 +27,9 @@ local Observable = require("Observable")
|
|
|
27
27
|
local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
|
|
28
28
|
local Rx = require("Rx")
|
|
29
29
|
local Signal = require("Signal")
|
|
30
|
-
local SortFunctionUtils = require("SortFunctionUtils")
|
|
31
30
|
local SortedNode = require("SortedNode")
|
|
32
31
|
local SortedNodeValue = require("SortedNodeValue")
|
|
32
|
+
local SortFunctionUtils = require("SortFunctionUtils")
|
|
33
33
|
local ValueObject = require("ValueObject")
|
|
34
34
|
|
|
35
35
|
local ObservableSortedList = {}
|
|
@@ -672,4 +672,4 @@ function ObservableSortedList.Destroy<T>(self: ObservableSortedList<T>)
|
|
|
672
672
|
setmetatable(self :: any, nil)
|
|
673
673
|
end
|
|
674
674
|
|
|
675
|
-
return ObservableSortedList
|
|
675
|
+
return ObservableSortedList
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
@class ObservableSortedList.spec.lua
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
6
|
-
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
5
|
+
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
7
6
|
|
|
8
7
|
local Jest = require("Jest")
|
|
9
8
|
local ObservableSortedList = require("ObservableSortedList")
|
|
@@ -57,4 +56,4 @@ describe("ObservableSortedList.new()", function()
|
|
|
57
56
|
expect(observableSortedList:Get(3)).toEqual("c")
|
|
58
57
|
expect(observableSortedList:GetCount()).toEqual(3)
|
|
59
58
|
end)
|
|
60
|
-
end)
|
|
59
|
+
end)
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
@class observableSortedList.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
6
|
-
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
5
|
+
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
7
6
|
|
|
8
|
-
local Blend = require("Blend")
|
|
9
7
|
local Maid = require("Maid")
|
|
8
|
+
local ValueObject = require("ValueObject")
|
|
10
9
|
local ObservableSortedList = require("ObservableSortedList")
|
|
11
|
-
local
|
|
10
|
+
local Blend = require("Blend")
|
|
12
11
|
local RxBrioUtils = require("RxBrioUtils")
|
|
13
|
-
local
|
|
12
|
+
local Rx = require("Rx")
|
|
14
13
|
|
|
15
14
|
local ENTRIES = 10
|
|
16
15
|
local CHANGE_TO_NEGATIVE_INDEX = false
|
|
@@ -23,22 +22,22 @@ return function(target)
|
|
|
23
22
|
local random = Random.new(35)
|
|
24
23
|
|
|
25
24
|
local values = {}
|
|
26
|
-
for i
|
|
25
|
+
for i=1, ENTRIES do
|
|
27
26
|
local scoreValue = maid:Add(ValueObject.new(0 or random:NextNumber(), "number"))
|
|
28
27
|
|
|
29
28
|
local data = {
|
|
30
|
-
originalIndex = i
|
|
31
|
-
scoreValue = scoreValue
|
|
29
|
+
originalIndex = i;
|
|
30
|
+
scoreValue = scoreValue;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
values[i] = data
|
|
35
34
|
|
|
36
|
-
maid:GiveTask(task.delay(i
|
|
35
|
+
maid:GiveTask(task.delay(i*0.05, function()
|
|
37
36
|
maid:Add(observableSortedList:Add(data, scoreValue:Observe()))
|
|
38
37
|
end))
|
|
39
38
|
|
|
40
39
|
if CHANGE_TO_NEGATIVE_INDEX then
|
|
41
|
-
maid:GiveTask(task.delay(ENTRIES
|
|
40
|
+
maid:GiveTask(task.delay(ENTRIES*0.05 + random:NextNumber()*3, function()
|
|
42
41
|
-- print("change", scoreValue.Value, " to", -1)
|
|
43
42
|
scoreValue.Value = -i
|
|
44
43
|
end))
|
|
@@ -72,60 +71,57 @@ return function(target)
|
|
|
72
71
|
|
|
73
72
|
maid:GiveTask(Blend.mount(target, {
|
|
74
73
|
Blend.New "Frame" {
|
|
75
|
-
Size = UDim2.new(1, 0, 1, 0)
|
|
76
|
-
BackgroundTransparency = 1
|
|
74
|
+
Size = UDim2.new(1, 0, 1, 0);
|
|
75
|
+
BackgroundTransparency = 1;
|
|
77
76
|
|
|
78
77
|
Blend.New "UIListLayout" {
|
|
79
|
-
Padding = UDim.new(0, 5)
|
|
80
|
-
HorizontalAlignment = Enum.HorizontalAlignment.Center
|
|
81
|
-
VerticalAlignment = Enum.VerticalAlignment.Top
|
|
82
|
-
}
|
|
78
|
+
Padding = UDim.new(0, 5);
|
|
79
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center;
|
|
80
|
+
VerticalAlignment = Enum.VerticalAlignment.Top;
|
|
81
|
+
};
|
|
83
82
|
|
|
84
83
|
Blend.New "UIPadding" {
|
|
85
|
-
PaddingTop = UDim.new(0, 10)
|
|
86
|
-
PaddingBottom = UDim.new(0, 10)
|
|
87
|
-
}
|
|
84
|
+
PaddingTop = UDim.new(0, 10);
|
|
85
|
+
PaddingBottom = UDim.new(0, 10);
|
|
86
|
+
};
|
|
88
87
|
|
|
89
88
|
observableSortedList:ObserveItemsBrio():Pipe({
|
|
90
89
|
RxBrioUtils.flatMapBrio(function(data, itemKey)
|
|
91
90
|
local valid = ValueObject.new(false, "boolean")
|
|
92
91
|
|
|
93
92
|
return Blend.New "Frame" {
|
|
94
|
-
Size = UDim2.fromOffset(100, 30)
|
|
95
|
-
BackgroundColor3 = Blend.Spring(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
5
|
|
104
|
-
),
|
|
105
|
-
LayoutOrder = observableSortedList:ObserveIndexByKey(itemKey),
|
|
93
|
+
Size = UDim2.fromOffset(100, 30);
|
|
94
|
+
BackgroundColor3 = Blend.Spring(Blend.Computed(valid, function(isValid)
|
|
95
|
+
if isValid then
|
|
96
|
+
return Color3.new(1, 1, 1)
|
|
97
|
+
else
|
|
98
|
+
return Color3.new(1, 0.5, 0.5)
|
|
99
|
+
end
|
|
100
|
+
end), 5);
|
|
101
|
+
LayoutOrder = observableSortedList:ObserveIndexByKey(itemKey);
|
|
106
102
|
|
|
107
103
|
Blend.New "UICorner" {
|
|
108
|
-
CornerRadius = UDim.new(0, 5)
|
|
109
|
-
}
|
|
104
|
+
CornerRadius = UDim.new(0, 5);
|
|
105
|
+
};
|
|
110
106
|
|
|
111
107
|
Blend.New "TextLabel" {
|
|
112
|
-
Name = "Score"
|
|
108
|
+
Name = "Score";
|
|
113
109
|
Text = data.scoreValue:Observe():Pipe({
|
|
114
|
-
Rx.map(tostring)
|
|
115
|
-
})
|
|
116
|
-
Size = UDim2.fromScale(1, 1)
|
|
117
|
-
BackgroundTransparency = 1
|
|
118
|
-
Position = UDim2.new(1, 10, 0.5, 0)
|
|
119
|
-
AnchorPoint = Vector2.new(0, 0.5)
|
|
120
|
-
TextColor3 = Color3.new(1, 1, 1)
|
|
121
|
-
TextXAlignment = Enum.TextXAlignment.Left
|
|
122
|
-
}
|
|
110
|
+
Rx.map(tostring)
|
|
111
|
+
});
|
|
112
|
+
Size = UDim2.fromScale(1, 1);
|
|
113
|
+
BackgroundTransparency = 1;
|
|
114
|
+
Position = UDim2.new(1, 10, 0.5, 0);
|
|
115
|
+
AnchorPoint = Vector2.new(0, 0.5);
|
|
116
|
+
TextColor3 = Color3.new(1, 1, 1);
|
|
117
|
+
TextXAlignment = Enum.TextXAlignment.Left;
|
|
118
|
+
};
|
|
123
119
|
|
|
124
120
|
Blend.New "TextBox" {
|
|
125
|
-
Name = "SetScore"
|
|
126
|
-
Size = UDim2.fromScale(1, 1)
|
|
127
|
-
Text = tostring(data.scoreValue.Value)
|
|
128
|
-
BackgroundTransparency = 1
|
|
121
|
+
Name = "SetScore";
|
|
122
|
+
Size = UDim2.fromScale(1, 1);
|
|
123
|
+
Text = tostring(data.scoreValue.Value);
|
|
124
|
+
BackgroundTransparency = 1;
|
|
129
125
|
[Blend.OnChange "Text"] = function(newValue)
|
|
130
126
|
if tonumber(newValue) then
|
|
131
127
|
data.scoreValue.Value = tonumber(newValue)
|
|
@@ -133,26 +129,27 @@ return function(target)
|
|
|
133
129
|
else
|
|
134
130
|
valid.Value = false
|
|
135
131
|
end
|
|
136
|
-
end
|
|
137
|
-
}
|
|
132
|
+
end;
|
|
133
|
+
};
|
|
138
134
|
|
|
139
135
|
Blend.New "TextLabel" {
|
|
140
|
-
Name = "OriginalIndex"
|
|
141
|
-
Text = data.originalIndex
|
|
142
|
-
Size = UDim2.fromScale(1, 1)
|
|
143
|
-
BackgroundTransparency = 1
|
|
144
|
-
Position = UDim2.new(0, -10, 0.5, 0)
|
|
145
|
-
AnchorPoint = Vector2.new(1, 0.5)
|
|
146
|
-
TextColor3 = Color3.new(1, 1, 1)
|
|
147
|
-
TextXAlignment = Enum.TextXAlignment.Right
|
|
148
|
-
}
|
|
136
|
+
Name = "OriginalIndex";
|
|
137
|
+
Text = data.originalIndex;
|
|
138
|
+
Size = UDim2.fromScale(1, 1);
|
|
139
|
+
BackgroundTransparency = 1;
|
|
140
|
+
Position = UDim2.new(0, -10, 0.5, 0);
|
|
141
|
+
AnchorPoint = Vector2.new(1, 0.5);
|
|
142
|
+
TextColor3 = Color3.new(1, 1, 1);
|
|
143
|
+
TextXAlignment = Enum.TextXAlignment.Right;
|
|
144
|
+
};
|
|
149
145
|
}
|
|
150
|
-
end)
|
|
151
|
-
})
|
|
152
|
-
}
|
|
146
|
+
end)
|
|
147
|
+
})
|
|
148
|
+
}
|
|
153
149
|
}))
|
|
154
150
|
|
|
151
|
+
|
|
155
152
|
return function()
|
|
156
153
|
maid:DoCleaning()
|
|
157
154
|
end
|
|
158
|
-
end
|
|
155
|
+
end
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
@class ObservableSortedList.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
6
|
-
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
5
|
+
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
7
6
|
|
|
8
7
|
local Maid = require("Maid")
|
|
9
8
|
local ObservableSortedList = require("ObservableSortedList")
|
|
@@ -28,8 +27,8 @@ return function(_target)
|
|
|
28
27
|
-- end
|
|
29
28
|
|
|
30
29
|
local random = Random.new()
|
|
31
|
-
for _i
|
|
32
|
-
add(math.floor(100
|
|
30
|
+
for _i=1, 10 do
|
|
31
|
+
add(math.floor(100*random:NextNumber()))
|
|
33
32
|
end
|
|
34
33
|
|
|
35
34
|
for index, node in observableSortedList._root:IterateNodesRange(3, 7) do
|
|
@@ -46,21 +45,21 @@ return function(_target)
|
|
|
46
45
|
observableSortedList:Destroy()
|
|
47
46
|
end)
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
-- for i=1, 10 do
|
|
49
|
+
-- add(-i)
|
|
50
|
+
-- add(i)
|
|
51
|
+
-- end
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
-- add(2)
|
|
54
|
+
-- add(1)
|
|
55
|
+
-- add(3)
|
|
56
|
+
-- add(4)
|
|
57
|
+
-- add(5)
|
|
58
|
+
-- add(0)
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
-- print(observableSortedList:GetList())
|
|
62
61
|
|
|
63
62
|
return function()
|
|
64
63
|
maid:DoCleaning()
|
|
65
64
|
end
|
|
66
|
-
end
|
|
65
|
+
end
|
|
@@ -8,8 +8,8 @@ local loader = ServerScriptService:FindFirstChild("LoaderUtils", true).Parent
|
|
|
8
8
|
local require = require(loader).bootstrapGame(ServerScriptService.observablecollection)
|
|
9
9
|
|
|
10
10
|
local ObservableSortedList = require("ObservableSortedList")
|
|
11
|
-
local Rx = require("Rx")
|
|
12
11
|
local RxInstanceUtils = require("RxInstanceUtils")
|
|
12
|
+
local Rx = require("Rx")
|
|
13
13
|
|
|
14
14
|
local observableSortedList = ObservableSortedList.new()
|
|
15
15
|
|
|
@@ -37,7 +37,7 @@ observableSortedList:ObserveItemsBrio():Subscribe(function(brio)
|
|
|
37
37
|
else
|
|
38
38
|
local tweenInfo = TweenInfo.new(0.2)
|
|
39
39
|
local tween = TweenService:Create(part, tweenInfo, {
|
|
40
|
-
CFrame = cframe
|
|
40
|
+
CFrame = cframe;
|
|
41
41
|
})
|
|
42
42
|
currentTween = tween
|
|
43
43
|
tween:Play()
|
|
@@ -51,24 +51,24 @@ observableSortedList:ObserveItemsBrio():Subscribe(function(brio)
|
|
|
51
51
|
|
|
52
52
|
if index then
|
|
53
53
|
part:SetAttribute("CurrentIndex", index)
|
|
54
|
-
setCFrame(CFrame.new(-5
|
|
54
|
+
setCFrame(CFrame.new(-5*index, 5, 0) * CFrame.Angles(0, math.pi/2, 0), first)
|
|
55
55
|
first = false
|
|
56
56
|
else
|
|
57
57
|
part:SetAttribute("CurrentIndex", "nil")
|
|
58
|
-
setCFrame(CFrame.new(part.CFrame.x, 10, 0) * CFrame.Angles(0, math.pi
|
|
58
|
+
setCFrame(CFrame.new(part.CFrame.x, 10, 0) * CFrame.Angles(0, math.pi/2, 0), first)
|
|
59
59
|
first = false
|
|
60
60
|
end
|
|
61
61
|
end))
|
|
62
62
|
|
|
63
63
|
maid:GiveTask(function()
|
|
64
64
|
part:SetAttribute("CurrentIndex", "nil")
|
|
65
|
-
setCFrame(CFrame.new(part.CFrame.x, 5, 5) * CFrame.Angles(0, math.pi
|
|
65
|
+
setCFrame(CFrame.new(part.CFrame.x, 5, 5) * CFrame.Angles(0, math.pi/2, 0), first)
|
|
66
66
|
first = false
|
|
67
67
|
end)
|
|
68
68
|
end)
|
|
69
69
|
|
|
70
70
|
local parts = {}
|
|
71
|
-
for i
|
|
71
|
+
for i=9, 1, -1 do
|
|
72
72
|
local part = Instance.new("Part")
|
|
73
73
|
part.TopSurface = Enum.SurfaceType.Smooth
|
|
74
74
|
part.BottomSurface = Enum.SurfaceType.Smooth
|
|
@@ -99,16 +99,14 @@ for i = 9, 1, -1 do
|
|
|
99
99
|
parts[i] = part
|
|
100
100
|
part.Parent = workspace
|
|
101
101
|
|
|
102
|
-
observableSortedList:Add(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
end),
|
|
108
|
-
})
|
|
109
|
-
)
|
|
102
|
+
observableSortedList:Add(part, RxInstanceUtils.observeProperty(part, "Name", nil):Pipe({
|
|
103
|
+
Rx.map(function(name)
|
|
104
|
+
return tonumber(name)
|
|
105
|
+
end)
|
|
106
|
+
}))
|
|
110
107
|
end
|
|
111
108
|
|
|
112
109
|
parts[5].Name = "25"
|
|
113
110
|
parts[9].Name = "3.1"
|
|
114
111
|
parts[2].Name = "remove"
|
|
112
|
+
|