Spaces:
Running
Running
Corentin Cailleaud
commited on
Commit
•
5e44513
1
Parent(s):
d0e9bce
cubzh.lua
CHANGED
@@ -24,6 +24,21 @@ easy_onboarding.startOnboarding = function(self, config)
|
|
24 |
stopCallbackData = steps[1].start(self, currentStep)
|
25 |
end
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
easy_onboarding.next = function(self)
|
28 |
if not steps[currentStep] then
|
29 |
return
|
@@ -39,29 +54,15 @@ end
|
|
39 |
local onboardingConfig = {
|
40 |
steps = {
|
41 |
{
|
42 |
-
start = function(onboarding
|
43 |
-
local ui = require("uikit")
|
44 |
local data = {}
|
45 |
-
data.ui =
|
46 |
-
local text = ui:createText("1/3 - Hold click and drag to move the camera.", Color.White)
|
47 |
-
text:setParent(data.ui)
|
48 |
-
data.ui.parentDidResize = function()
|
49 |
-
data.ui.Width = text.Width + text.Height
|
50 |
-
data.ui.Height = text.Height * 2
|
51 |
-
text.pos = { data.ui.Width * 0.5 - text.Width * 0.5, data.ui.Height * 0.5 - text.Height * 0.5 }
|
52 |
-
data.ui.pos =
|
53 |
-
{ Screen.Width * 0.5 - data.ui.Width * 0.5, Screen.Height * 0.2 - data.ui.Height * 0.5 }
|
54 |
-
end
|
55 |
-
data.ui:parentDidResize()
|
56 |
-
|
57 |
data.listener = LocalEvent:Listen(LocalEvent.Name.PointerDrag, function()
|
58 |
Timer(1, function()
|
59 |
-
print("next")
|
60 |
onboarding:next()
|
61 |
end)
|
62 |
data.listener:Remove()
|
63 |
end)
|
64 |
-
|
65 |
return data
|
66 |
end,
|
67 |
stop = function(_, data)
|
@@ -69,21 +70,9 @@ local onboardingConfig = {
|
|
69 |
end,
|
70 |
},
|
71 |
{
|
72 |
-
start = function(onboarding
|
73 |
-
local ui = require("uikit")
|
74 |
local data = {}
|
75 |
-
data.ui =
|
76 |
-
local text = ui:createText("2/3 - Use WASD/ZQSD to move", Color.White)
|
77 |
-
text:setParent(data.ui)
|
78 |
-
data.ui.parentDidResize = function()
|
79 |
-
data.ui.Width = text.Width + text.Height
|
80 |
-
data.ui.Height = text.Height * 2
|
81 |
-
text.pos = { data.ui.Width * 0.5 - text.Width * 0.5, data.ui.Height * 0.5 - text.Height * 0.5 }
|
82 |
-
data.ui.pos =
|
83 |
-
{ Screen.Width * 0.5 - data.ui.Width * 0.5, Screen.Height * 0.2 - data.ui.Height * 0.5 }
|
84 |
-
end
|
85 |
-
data.ui:parentDidResize()
|
86 |
-
|
87 |
data.listener = LocalEvent:Listen(LocalEvent.Name.KeyboardInput, function()
|
88 |
Timer(1, function()
|
89 |
onboarding:next()
|
@@ -98,31 +87,12 @@ local onboardingConfig = {
|
|
98 |
end,
|
99 |
},
|
100 |
{
|
101 |
-
start = function(onboarding
|
102 |
-
local ui = require("uikit")
|
103 |
local data = {}
|
104 |
-
data.ui =
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
data.ui.Width = text.Width + text.Height
|
109 |
-
data.ui.Height = text.Height * 2
|
110 |
-
text.pos = { data.ui.Width * 0.5 - text.Width * 0.5, data.ui.Height * 0.5 - text.Height * 0.5 }
|
111 |
-
data.ui.pos =
|
112 |
-
{ Screen.Width * 0.5 - data.ui.Width * 0.5, Screen.Height * 0.2 - data.ui.Height * 0.5 }
|
113 |
-
end
|
114 |
-
data.ui:parentDidResize()
|
115 |
-
|
116 |
-
data.listener = LocalEvent:Listen(LocalEvent.Name.KeyboardInput, function(_, keycode, _, down)
|
117 |
-
if keycode == require("inputcodes").RETURN then
|
118 |
-
print("triggered")
|
119 |
-
Timer(1, function()
|
120 |
-
onboarding:next()
|
121 |
-
end)
|
122 |
-
data.listener:Remove()
|
123 |
-
end
|
124 |
-
end, { topPriority = true })
|
125 |
-
|
126 |
return data
|
127 |
end,
|
128 |
stop = function(_, data)
|
|
|
24 |
stopCallbackData = steps[1].start(self, currentStep)
|
25 |
end
|
26 |
|
27 |
+
easy_onboarding.createTextStep = function(_, str)
|
28 |
+
local ui = require("uikit")
|
29 |
+
local node = ui:createFrame(Color(0, 0, 0, 0.5))
|
30 |
+
local text = ui:createText(str, Color.White)
|
31 |
+
text:setParent(node)
|
32 |
+
node.parentDidResize = function()
|
33 |
+
node.Width = text.Width + text.Height
|
34 |
+
node.Height = text.Height * 2
|
35 |
+
text.pos = { node.Width * 0.5 - text.Width * 0.5, node.Height * 0.5 - text.Height * 0.5 }
|
36 |
+
node.pos = { Screen.Width * 0.5 - node.Width * 0.5, Screen.Height * 0.2 - node.Height * 0.5 }
|
37 |
+
end
|
38 |
+
node:parentDidResize()
|
39 |
+
return node
|
40 |
+
end
|
41 |
+
|
42 |
easy_onboarding.next = function(self)
|
43 |
if not steps[currentStep] then
|
44 |
return
|
|
|
54 |
local onboardingConfig = {
|
55 |
steps = {
|
56 |
{
|
57 |
+
start = function(onboarding)
|
|
|
58 |
local data = {}
|
59 |
+
data.ui = onboarding:createTextStep("1/3 - Hold click and drag to move the camera.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
data.listener = LocalEvent:Listen(LocalEvent.Name.PointerDrag, function()
|
61 |
Timer(1, function()
|
|
|
62 |
onboarding:next()
|
63 |
end)
|
64 |
data.listener:Remove()
|
65 |
end)
|
|
|
66 |
return data
|
67 |
end,
|
68 |
stop = function(_, data)
|
|
|
70 |
end,
|
71 |
},
|
72 |
{
|
73 |
+
start = function(onboarding)
|
|
|
74 |
local data = {}
|
75 |
+
data.ui = onboarding:createTextStep("2/3 - Use WASD/ZQSD to move")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
data.listener = LocalEvent:Listen(LocalEvent.Name.KeyboardInput, function()
|
77 |
Timer(1, function()
|
78 |
onboarding:next()
|
|
|
87 |
end,
|
88 |
},
|
89 |
{
|
90 |
+
start = function(onboarding)
|
|
|
91 |
local data = {}
|
92 |
+
data.ui = onboarding:createTextStep("3/3 - Press Enter in front of a NPC to chat")
|
93 |
+
Timer(10, function()
|
94 |
+
onboarding:next()
|
95 |
+
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
return data
|
97 |
end,
|
98 |
stop = function(_, data)
|