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