@quenty/observablecollection 12.21.0-canary.ae8d76d.0 → 12.21.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 +2 -2
- package/package.json +15 -15
- package/src/Shared/FilteredObservableListView.lua +15 -12
- package/src/Shared/ObservableCountingMap.lua +5 -5
- package/src/Shared/ObservableCountingMap.spec.lua +3 -2
- package/src/Shared/ObservableList.lua +1 -1
- package/src/Shared/ObservableList.spec.lua +3 -2
- package/src/Shared/ObservableMap.lua +1 -1
- package/src/Shared/ObservableMap.spec.lua +3 -2
- package/src/Shared/ObservableMapList.lua +2 -3
- package/src/Shared/ObservableMapList.spec.lua +3 -2
- package/src/Shared/ObservableSet.lua +6 -7
- package/src/Shared/SortedList/ObservableSortedList.lua +2 -2
- package/src/Shared/SortedList/ObservableSortedList.spec.lua +3 -2
- package/src/Shared/SortedList/ObservableSortedList.story.lua +62 -59
- package/src/Shared/SortedList/ObservableSortedList_Print.story.lua +16 -15
- package/src/Shared/SortedList/SortFunctionUtils.lua +2 -3
- 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 +14 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
-
# [12.21.0
|
|
6
|
+
# [12.21.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@12.20.3...@quenty/observablecollection@12.21.0) (2025-05-10)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
@@ -13,7 +13,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
13
13
|
|
|
14
14
|
### Features
|
|
15
15
|
|
|
16
|
-
* Add even more types ([
|
|
16
|
+
* Add even more types ([b31717d](https://github.com/Quenty/NevermoreEngine/commit/b31717d8c9f7620c457f5018a2affa760a65334a))
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/observablecollection",
|
|
3
|
-
"version": "12.21.0
|
|
3
|
+
"version": "12.21.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.18.0
|
|
32
|
-
"@quenty/ducktype": "5.
|
|
33
|
-
"@quenty/loader": "10.
|
|
34
|
-
"@quenty/maid": "3.
|
|
35
|
-
"@quenty/promise": "10.11.0
|
|
36
|
-
"@quenty/rx": "13.18.0
|
|
37
|
-
"@quenty/signal": "7.
|
|
38
|
-
"@quenty/steputils": "3.
|
|
39
|
-
"@quenty/symbol": "3.
|
|
40
|
-
"@quenty/table": "3.
|
|
41
|
-
"@quenty/valueobject": "13.18.0
|
|
30
|
+
"@quenty/baseobject": "^10.9.0",
|
|
31
|
+
"@quenty/brio": "^14.18.0",
|
|
32
|
+
"@quenty/ducktype": "^5.9.0",
|
|
33
|
+
"@quenty/loader": "^10.9.0",
|
|
34
|
+
"@quenty/maid": "^3.5.0",
|
|
35
|
+
"@quenty/promise": "^10.11.0",
|
|
36
|
+
"@quenty/rx": "^13.18.0",
|
|
37
|
+
"@quenty/signal": "^7.11.0",
|
|
38
|
+
"@quenty/steputils": "^3.6.0",
|
|
39
|
+
"@quenty/symbol": "^3.5.0",
|
|
40
|
+
"@quenty/table": "^3.8.0",
|
|
41
|
+
"@quenty/valueobject": "^13.18.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@quenty/blend": "12.19.0
|
|
44
|
+
"@quenty/blend": "^12.19.0"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "20cff952c2cf06b959f2f11d2293bdef38acc604"
|
|
50
50
|
}
|
|
@@ -53,17 +53,20 @@ 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
|
-
|
|
56
|
+
maid._add = self._scoredList:Add(
|
|
57
|
+
entry,
|
|
58
|
+
Rx.combineLatest({
|
|
59
|
+
score = observeScore,
|
|
60
|
+
index = self._baseList:ObserveIndexByKey(key),
|
|
61
|
+
}):Pipe({
|
|
62
|
+
Rx.map(function(state)
|
|
63
|
+
if state.score == nil then
|
|
64
|
+
return nil
|
|
65
|
+
end
|
|
66
|
+
return state
|
|
67
|
+
end),
|
|
68
|
+
})
|
|
69
|
+
)
|
|
67
70
|
end))
|
|
68
71
|
|
|
69
72
|
return self
|
|
@@ -106,4 +109,4 @@ function FilteredObservableListView:ObserveCount()
|
|
|
106
109
|
return self._scoredList:ObserveCount()
|
|
107
110
|
end
|
|
108
111
|
|
|
109
|
-
return FilteredObservableListView
|
|
112
|
+
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")
|
|
12
9
|
local Brio = require("Brio")
|
|
13
|
-
local ValueObject = require("ValueObject")
|
|
14
10
|
local DuckTypeUtils = require("DuckTypeUtils")
|
|
11
|
+
local Maid = require("Maid")
|
|
12
|
+
local Observable = require("Observable")
|
|
15
13
|
local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
|
|
16
14
|
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,7 +2,8 @@
|
|
|
2
2
|
@class ObservableCountingMap.spec.lua
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
8
|
local Jest = require("Jest")
|
|
8
9
|
local ObservableCountingMap = require("ObservableCountingMap")
|
|
@@ -38,4 +39,4 @@ describe("ObservableCountingMap.new()", function()
|
|
|
38
39
|
it("should clean up", function()
|
|
39
40
|
observableCountingMap:Destroy()
|
|
40
41
|
end)
|
|
41
|
-
end)
|
|
42
|
+
end)
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
@class ObservableList.spec.lua
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
8
|
local Jest = require("Jest")
|
|
8
9
|
local ObservableList = require("ObservableList")
|
|
@@ -131,4 +132,4 @@ describe("ObservableList.new()", function()
|
|
|
131
132
|
it("should clean up", function()
|
|
132
133
|
observableList:Destroy()
|
|
133
134
|
end)
|
|
134
|
-
end)
|
|
135
|
+
end)
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
@class ObservableMap.spec.lua
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
8
|
local Jest = require("Jest")
|
|
8
9
|
local ObservableMap = require("ObservableMap")
|
|
@@ -74,4 +75,4 @@ describe("ObservableMap.new()", function()
|
|
|
74
75
|
it("should clean up", function()
|
|
75
76
|
observableMap:Destroy()
|
|
76
77
|
end)
|
|
77
|
-
end)
|
|
78
|
+
end)
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
local require = require(script.Parent.loader).load(script)
|
|
9
9
|
|
|
10
|
+
local Brio = require("Brio")
|
|
10
11
|
local Maid = require("Maid")
|
|
11
12
|
local Observable = require("Observable")
|
|
12
13
|
local ObservableList = require("ObservableList")
|
|
@@ -14,7 +15,6 @@ local ObservableMap = require("ObservableMap")
|
|
|
14
15
|
local Rx = require("Rx")
|
|
15
16
|
local RxBrioUtils = require("RxBrioUtils")
|
|
16
17
|
local Signal = require("Signal")
|
|
17
|
-
local Brio = require("Brio")
|
|
18
18
|
|
|
19
19
|
local ObservableMapList = {}
|
|
20
20
|
ObservableMapList.ClassName = "ObservableMapList"
|
|
@@ -443,5 +443,4 @@ function ObservableMapList.Destroy<TKey, TValue>(self: ObservableMapList<TKey, T
|
|
|
443
443
|
setmetatable(self :: any, nil)
|
|
444
444
|
end
|
|
445
445
|
|
|
446
|
-
|
|
447
|
-
return ObservableMapList
|
|
446
|
+
return ObservableMapList
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
@class ObservableMapList.spec.lua
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
8
|
local Jest = require("Jest")
|
|
8
9
|
local ObservableMapList = require("ObservableMapList")
|
|
@@ -24,4 +25,4 @@ describe("ObservableMapList.new()", function()
|
|
|
24
25
|
expect(observableMapList:GetAtListIndex("hello", -1)).toEqual("dragon")
|
|
25
26
|
expect(observableMapList:GetAtListIndex("fire", 1)).toEqual(nil)
|
|
26
27
|
end)
|
|
27
|
-
end)
|
|
28
|
+
end)
|
|
@@ -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")
|
|
12
9
|
local Brio = require("Brio")
|
|
13
|
-
local ValueObject = require("ValueObject")
|
|
14
|
-
local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
|
|
15
10
|
local DuckTypeUtils = require("DuckTypeUtils")
|
|
11
|
+
local Maid = require("Maid")
|
|
12
|
+
local Observable = require("Observable")
|
|
13
|
+
local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
|
|
16
14
|
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,7 +290,6 @@ function ObservableSet.GetRawSet<T>(self: ObservableSet<T>): Set.Set<T>
|
|
|
290
290
|
return self._set
|
|
291
291
|
end
|
|
292
292
|
|
|
293
|
-
|
|
294
293
|
--[=[
|
|
295
294
|
Cleans up the ObservableSet and sets the metatable to nil.
|
|
296
295
|
]=]
|
|
@@ -299,4 +298,4 @@ function ObservableSet.Destroy<T>(self: ObservableSet<T>)
|
|
|
299
298
|
setmetatable(self :: any, nil)
|
|
300
299
|
end
|
|
301
300
|
|
|
302
|
-
return ObservableSet
|
|
301
|
+
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")
|
|
30
31
|
local SortedNode = require("SortedNode")
|
|
31
32
|
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,7 +2,8 @@
|
|
|
2
2
|
@class ObservableSortedList.spec.lua
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
8
|
local Jest = require("Jest")
|
|
8
9
|
local ObservableSortedList = require("ObservableSortedList")
|
|
@@ -56,4 +57,4 @@ describe("ObservableSortedList.new()", function()
|
|
|
56
57
|
expect(observableSortedList:Get(3)).toEqual("c")
|
|
57
58
|
expect(observableSortedList:GetCount()).toEqual(3)
|
|
58
59
|
end)
|
|
59
|
-
end)
|
|
60
|
+
end)
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
@class observableSortedList.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
8
|
+
local Blend = require("Blend")
|
|
7
9
|
local Maid = require("Maid")
|
|
8
|
-
local ValueObject = require("ValueObject")
|
|
9
10
|
local ObservableSortedList = require("ObservableSortedList")
|
|
10
|
-
local Blend = require("Blend")
|
|
11
|
-
local RxBrioUtils = require("RxBrioUtils")
|
|
12
11
|
local Rx = require("Rx")
|
|
12
|
+
local RxBrioUtils = require("RxBrioUtils")
|
|
13
|
+
local ValueObject = require("ValueObject")
|
|
13
14
|
|
|
14
15
|
local ENTRIES = 10
|
|
15
16
|
local CHANGE_TO_NEGATIVE_INDEX = false
|
|
@@ -22,22 +23,22 @@ return function(target)
|
|
|
22
23
|
local random = Random.new(35)
|
|
23
24
|
|
|
24
25
|
local values = {}
|
|
25
|
-
for i=1, ENTRIES do
|
|
26
|
+
for i = 1, ENTRIES do
|
|
26
27
|
local scoreValue = maid:Add(ValueObject.new(0 or random:NextNumber(), "number"))
|
|
27
28
|
|
|
28
29
|
local data = {
|
|
29
|
-
originalIndex = i
|
|
30
|
-
scoreValue = scoreValue
|
|
30
|
+
originalIndex = i,
|
|
31
|
+
scoreValue = scoreValue,
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
values[i] = data
|
|
34
35
|
|
|
35
|
-
maid:GiveTask(task.delay(i*0.05, function()
|
|
36
|
+
maid:GiveTask(task.delay(i * 0.05, function()
|
|
36
37
|
maid:Add(observableSortedList:Add(data, scoreValue:Observe()))
|
|
37
38
|
end))
|
|
38
39
|
|
|
39
40
|
if CHANGE_TO_NEGATIVE_INDEX then
|
|
40
|
-
maid:GiveTask(task.delay(ENTRIES*0.05 + random:NextNumber()*3, function()
|
|
41
|
+
maid:GiveTask(task.delay(ENTRIES * 0.05 + random:NextNumber() * 3, function()
|
|
41
42
|
-- print("change", scoreValue.Value, " to", -1)
|
|
42
43
|
scoreValue.Value = -i
|
|
43
44
|
end))
|
|
@@ -71,57 +72,60 @@ return function(target)
|
|
|
71
72
|
|
|
72
73
|
maid:GiveTask(Blend.mount(target, {
|
|
73
74
|
Blend.New "Frame" {
|
|
74
|
-
Size = UDim2.new(1, 0, 1, 0)
|
|
75
|
-
BackgroundTransparency = 1
|
|
75
|
+
Size = UDim2.new(1, 0, 1, 0),
|
|
76
|
+
BackgroundTransparency = 1,
|
|
76
77
|
|
|
77
78
|
Blend.New "UIListLayout" {
|
|
78
|
-
Padding = UDim.new(0, 5)
|
|
79
|
-
HorizontalAlignment = Enum.HorizontalAlignment.Center
|
|
80
|
-
VerticalAlignment = Enum.VerticalAlignment.Top
|
|
81
|
-
}
|
|
79
|
+
Padding = UDim.new(0, 5),
|
|
80
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
|
81
|
+
VerticalAlignment = Enum.VerticalAlignment.Top,
|
|
82
|
+
},
|
|
82
83
|
|
|
83
84
|
Blend.New "UIPadding" {
|
|
84
|
-
PaddingTop = UDim.new(0, 10)
|
|
85
|
-
PaddingBottom = UDim.new(0, 10)
|
|
86
|
-
}
|
|
85
|
+
PaddingTop = UDim.new(0, 10),
|
|
86
|
+
PaddingBottom = UDim.new(0, 10),
|
|
87
|
+
},
|
|
87
88
|
|
|
88
89
|
observableSortedList:ObserveItemsBrio():Pipe({
|
|
89
90
|
RxBrioUtils.flatMapBrio(function(data, itemKey)
|
|
90
91
|
local valid = ValueObject.new(false, "boolean")
|
|
91
92
|
|
|
92
93
|
return Blend.New "Frame" {
|
|
93
|
-
Size = UDim2.fromOffset(100, 30)
|
|
94
|
-
BackgroundColor3 = Blend.Spring(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
Size = UDim2.fromOffset(100, 30),
|
|
95
|
+
BackgroundColor3 = Blend.Spring(
|
|
96
|
+
Blend.Computed(valid, function(isValid)
|
|
97
|
+
if isValid then
|
|
98
|
+
return Color3.new(1, 1, 1)
|
|
99
|
+
else
|
|
100
|
+
return Color3.new(1, 0.5, 0.5)
|
|
101
|
+
end
|
|
102
|
+
end),
|
|
103
|
+
5
|
|
104
|
+
),
|
|
105
|
+
LayoutOrder = observableSortedList:ObserveIndexByKey(itemKey),
|
|
102
106
|
|
|
103
107
|
Blend.New "UICorner" {
|
|
104
|
-
CornerRadius = UDim.new(0, 5)
|
|
105
|
-
}
|
|
108
|
+
CornerRadius = UDim.new(0, 5),
|
|
109
|
+
},
|
|
106
110
|
|
|
107
111
|
Blend.New "TextLabel" {
|
|
108
|
-
Name = "Score"
|
|
112
|
+
Name = "Score",
|
|
109
113
|
Text = data.scoreValue:Observe():Pipe({
|
|
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
|
-
}
|
|
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
|
+
},
|
|
119
123
|
|
|
120
124
|
Blend.New "TextBox" {
|
|
121
|
-
Name = "SetScore"
|
|
122
|
-
Size = UDim2.fromScale(1, 1)
|
|
123
|
-
Text = tostring(data.scoreValue.Value)
|
|
124
|
-
BackgroundTransparency = 1
|
|
125
|
+
Name = "SetScore",
|
|
126
|
+
Size = UDim2.fromScale(1, 1),
|
|
127
|
+
Text = tostring(data.scoreValue.Value),
|
|
128
|
+
BackgroundTransparency = 1,
|
|
125
129
|
[Blend.OnChange "Text"] = function(newValue)
|
|
126
130
|
if tonumber(newValue) then
|
|
127
131
|
data.scoreValue.Value = tonumber(newValue)
|
|
@@ -129,27 +133,26 @@ return function(target)
|
|
|
129
133
|
else
|
|
130
134
|
valid.Value = false
|
|
131
135
|
end
|
|
132
|
-
end
|
|
133
|
-
}
|
|
136
|
+
end,
|
|
137
|
+
},
|
|
134
138
|
|
|
135
139
|
Blend.New "TextLabel" {
|
|
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
|
-
}
|
|
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
|
+
},
|
|
145
149
|
}
|
|
146
|
-
end)
|
|
147
|
-
})
|
|
148
|
-
}
|
|
150
|
+
end),
|
|
151
|
+
}),
|
|
152
|
+
},
|
|
149
153
|
}))
|
|
150
154
|
|
|
151
|
-
|
|
152
155
|
return function()
|
|
153
156
|
maid:DoCleaning()
|
|
154
157
|
end
|
|
155
|
-
end
|
|
158
|
+
end
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
@class ObservableSortedList.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
8
|
local Maid = require("Maid")
|
|
8
9
|
local ObservableSortedList = require("ObservableSortedList")
|
|
@@ -27,8 +28,8 @@ return function(_target)
|
|
|
27
28
|
-- end
|
|
28
29
|
|
|
29
30
|
local random = Random.new()
|
|
30
|
-
for _i=1, 10 do
|
|
31
|
-
add(math.floor(100*random:NextNumber()))
|
|
31
|
+
for _i = 1, 10 do
|
|
32
|
+
add(math.floor(100 * random:NextNumber()))
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
for index, node in observableSortedList._root:IterateNodesRange(3, 7) do
|
|
@@ -45,21 +46,21 @@ return function(_target)
|
|
|
45
46
|
observableSortedList:Destroy()
|
|
46
47
|
end)
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
-- for i=1, 10 do
|
|
50
|
+
-- add(-i)
|
|
51
|
+
-- add(i)
|
|
52
|
+
-- end
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
-- add(2)
|
|
55
|
+
-- add(1)
|
|
56
|
+
-- add(3)
|
|
57
|
+
-- add(4)
|
|
58
|
+
-- add(5)
|
|
59
|
+
-- add(0)
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
-- print(observableSortedList:GetList())
|
|
61
62
|
|
|
62
63
|
return function()
|
|
63
64
|
maid:DoCleaning()
|
|
64
65
|
end
|
|
65
|
-
end
|
|
66
|
+
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 RxInstanceUtils = require("RxInstanceUtils")
|
|
12
11
|
local Rx = require("Rx")
|
|
12
|
+
local RxInstanceUtils = require("RxInstanceUtils")
|
|
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*index, 5, 0) * CFrame.Angles(0, math.pi/2, 0), first)
|
|
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/2, 0), first)
|
|
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/2, 0), first)
|
|
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=9, 1, -1 do
|
|
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,14 +99,16 @@ 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
|
-
|
|
102
|
+
observableSortedList:Add(
|
|
103
|
+
part,
|
|
104
|
+
RxInstanceUtils.observeProperty(part, "Name", nil):Pipe({
|
|
105
|
+
Rx.map(function(name)
|
|
106
|
+
return tonumber(name)
|
|
107
|
+
end),
|
|
108
|
+
})
|
|
109
|
+
)
|
|
107
110
|
end
|
|
108
111
|
|
|
109
112
|
parts[5].Name = "25"
|
|
110
113
|
parts[9].Name = "3.1"
|
|
111
114
|
parts[2].Name = "remove"
|
|
112
|
-
|