Corentin Cailleaud commited on
Commit
a7eab3d
1 Parent(s): 5e44513
Files changed (1) hide show
  1. cubzh.lua +53 -91
cubzh.lua CHANGED
@@ -4,6 +4,7 @@ Modules = {
4
  --gigax = "github.com/GigaxGames/integrations/cubzh:5025b99",
5
  pathfinding = "github.com/caillef/cubzh-library/pathfinding:f8c4315",
6
  floating_island_generator = "github.com/caillef/cubzh-library/floating_island_generator:82d22a5",
 
7
  }
8
 
9
  Config = {
@@ -12,96 +13,6 @@ Config = {
12
 
13
  math.randomseed(math.floor(Time.UnixMilli() % 100000))
14
 
15
- local easy_onboarding = {}
16
-
17
- local currentStep = 0
18
- local steps = {}
19
- local stopCallbackData
20
-
21
- easy_onboarding.startOnboarding = function(self, config)
22
- currentStep = 1
23
- steps = config.steps
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
45
- end
46
- steps[currentStep].stop(self, stopCallbackData)
47
- currentStep = currentStep + 1
48
- if not steps[currentStep] then
49
- return
50
- end
51
- stopCallbackData = steps[currentStep].start(self, currentStep)
52
- end
53
-
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)
69
- data.ui:remove()
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()
79
- end)
80
- data.listener:Remove()
81
- end)
82
-
83
- return data
84
- end,
85
- stop = function(_, data)
86
- data.ui:remove()
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)
99
- data.ui:remove()
100
- end,
101
- },
102
- },
103
- }
104
-
105
  Config = {
106
  Items = { "pratamacam.squirrel" },
107
  }
@@ -909,6 +820,57 @@ Client.OnChat = function(payload)
909
  content = msg,
910
  })
911
 
912
- print(payload.message)
913
  return true
914
  end
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  --gigax = "github.com/GigaxGames/integrations/cubzh:5025b99",
5
  pathfinding = "github.com/caillef/cubzh-library/pathfinding:f8c4315",
6
  floating_island_generator = "github.com/caillef/cubzh-library/floating_island_generator:82d22a5",
7
+ easy_onboarding = "github.com/caillef/cubzh-library/easy_onboarding:77728ee",
8
  }
9
 
10
  Config = {
 
13
 
14
  math.randomseed(math.floor(Time.UnixMilli() % 100000))
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  Config = {
17
  Items = { "pratamacam.squirrel" },
18
  }
 
820
  content = msg,
821
  })
822
 
823
+ print("User: " .. payload.message)
824
  return true
825
  end
826
+
827
+ onboardingConfig = {
828
+ steps = {
829
+ {
830
+ start = function(onboarding)
831
+ local data = {}
832
+ data.ui = onboarding:createTextStep("1/3 - Hold click and drag to move the camera.")
833
+ data.listener = LocalEvent:Listen(LocalEvent.Name.PointerDrag, function()
834
+ Timer(1, function()
835
+ onboarding:next()
836
+ end)
837
+ data.listener:Remove()
838
+ end)
839
+ return data
840
+ end,
841
+ stop = function(_, data)
842
+ data.ui:remove()
843
+ end,
844
+ },
845
+ {
846
+ start = function(onboarding)
847
+ local data = {}
848
+ data.ui = onboarding:createTextStep("2/3 - Use WASD/ZQSD to move.")
849
+ data.listener = LocalEvent:Listen(LocalEvent.Name.KeyboardInput, function()
850
+ Timer(1, function()
851
+ onboarding:next()
852
+ end)
853
+ data.listener:Remove()
854
+ end)
855
+
856
+ return data
857
+ end,
858
+ stop = function(_, data)
859
+ data.ui:remove()
860
+ end,
861
+ },
862
+ {
863
+ start = function(onboarding)
864
+ local data = {}
865
+ data.ui = onboarding:createTextStep("3/3 - Press Enter in front of the Pirate to chat.")
866
+ Timer(10, function()
867
+ onboarding:next()
868
+ end)
869
+ return data
870
+ end,
871
+ stop = function(_, data)
872
+ data.ui:remove()
873
+ end,
874
+ },
875
+ },
876
+ }