-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.vb
233 lines (142 loc) · 5.48 KB
/
Main.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
'Speed Show 1.1
Dim ItemArray as Array[String]
Dim ItemArrayPosX as Array[Double]
Dim ItemArrayPosY as Array[Double]
Dim ItemArrayScaleX as Array[Double]
Dim ItemArrayScaleY as Array[Double]
Dim PromoArray as Array[Integer]
Dim TextArray as Array[String]
Dim Counter as Integer
Counter = 1
Sub ResetArrays()
ItemArray.Clear
ItemArrayPosX.Clear
ItemArrayPosY.Clear
ItemArrayScaleX.Clear
ItemArrayScaleY.Clear
PromoArray.Clear
TextArray.Clear
End Sub
Sub LoadItems()
Counter = CInt(GetSmm("Speed_Show_Preview"))
ResetArrays()
ArrayLoadLoop()
PopulateGraphic(Counter)
End Sub
Sub UpdateItems()
ResetArrays()
ArrayLoadLoop()
Counter = CInt(GetSmm("Speed_Show_Preview"))
PopulateGraphic(Counter)
End Sub
Sub ArrayLoadLoop()
Dim ListContainer as String
Dim ListCount as Integer
ListContainer = CStr(Scene.FindContainer("Item_Input"))
ListCount = CInt(System.SendCommand("0 #" & ListContainer & "*FUNCTION*ControlList*exposed_count GET 0;"))
For i = 1 to ListCount
ItemArray.Push(GetItem(CStr(i)))
ItemArrayPosX.Push(GetPositionX(CStr(i)))
ItemArrayPosY.Push(GetPositionY(CStr(i)))
ItemArrayScaleX.Push(GetScaleX(CStr(i)))
ItemArrayScaleY.Push(GetScaleY(CStr(i)))
PromoArray.Push(CInt(GetPromo(CStr(i))))
TextArray.Push(GetText(CStr(i)))
Next
End Sub
Sub PopulateGraphic(StartLocation as Integer)
For i = 1 to 6
ClearItem(i)
Next
Dim EndLocation as Integer
EndLocation = ItemArray.UBound + 1
For i = 0 to 5
If StartLocation + i <= EndLocation Then SetItem(i + 1, StartLocation + i)
Next
If CInt(GetSmm("Item_1")) = 1 then
DpSetInt("Next_IO", 1)
Else
DpSetInt("Next_IO", 0)
End If
End Sub
Sub ClearItem(Value as Integer)
DpSetInt("Item_" & Value, 0)
DpSetInt("Item_" & Value & "_Promo", PromoArray[Value - 1])
SetImage("Item_" & Value & "_Image", "")
SetText("Label" & Value, "")
SetText("Text" & Value, "")
End Sub
Sub SetItem(Spot as Integer, Value as Integer)
DpSetInt("Item_" & Spot, 1)
DpSetInt("Item_" & Spot & "_Promo", PromoArray[Value - 1])
SetImage("Item_" & Spot & "_Image", "http://images.shophq.com/is/image/ShopHQ/" & ItemArray[Value - 1] & "?hei=600&wid=600&op_sharpen=1")
SetPositionX("Item_" & Spot & "_Image", ItemArrayPosX[Value - 1])
SetPositionY("Item_" & Spot & "_Image", ItemArrayPosY[Value - 1])
SetScaleX("Item_" & Spot & "_Image", ItemArrayScaleX[Value - 1])
SetScaleY("Item_" & Spot & "_Image", ItemArrayScaleY[Value - 1])
SetText("Label" & Spot, ItemArray[Value - 1])
SetText("Text" & Spot, TextArray[Value - 1])
End Sub
Sub NextItem()
Counter = Counter + 1
PopulateGraphic(Counter)
stage.finddirector("Item_Move").startanimation()
End Sub
Sub PreviewItem()
LoadItems()
Dim NumForPreview as Integer
NumForPreview = CInt(GetSmm("Speed_Show_Preview"))
PopulateGraphic(NumForPreview)
End Sub
Function GetSmm(VarName As String) As String
GetSmm = (string)Scene.Map[ VarName ]
End Function
Sub DpSet(Name as String,Value as String)
''Sets a DataPool variable AND Scene SMM to given value
Scene.GetScenePluginInstance("DataPool").SetParameterString("Data1", Name & "=\"\"" & Value & "\"\";")
Scene.Map[ Name ] = Value
End Sub
Sub DpSetInt(Name as String,Value as Integer)
''Sets a DataPool variable AND Scene SMM to given value
Scene.GetScenePluginInstance("DataPool").SetParameterString("Data1", Name & "=\"\"" & Value & "\"\";")
Scene.Map[ Name ] = Value
End Sub
Function GetItem(VarName As String) As String
GetItem = Scene.FindContainer("Item_Input").FindSubContainer(VarName).FindSubContainer("Item").geometry.text
End Function
Function GetText(VarName As String) As String
GetText = Scene.FindContainer("Item_Input").FindSubContainer(VarName).FindSubContainer("Text").geometry.text
End Function
Function GetPromo(VarName As String) As String
GetPromo = Scene.FindContainer("Item_Input").FindSubContainer(Name).FindSubContainer("Promo").geometry.text
End Function
Sub SetText(VarName as String,Value as String)
Scene.FindContainer(VarName).geometry.text = Value
End Sub
Sub SetImage(VarName as String,Value as String)
Scene.FindContainer(VarName).CreateTexture(Value)
End Sub
Function GetPositionX(Name as String) as Double
GetPositionX = Scene.FindContainer("Item_Input").FindSubContainer(Name).FindSubContainer("Item").position.x
End Function
Function GetPositionY(Name as String) as Double
GetPositionY = Scene.FindContainer("Item_Input").FindSubContainer(Name).FindSubContainer("Item").position.y
End Function
Function GetScaleX(Name as String) as Double
GetScaleX = Scene.FindContainer("Item_Input").FindSubContainer(Name).FindSubContainer("Item").scaling.x
End Function
Function GetScaleY(Name as String) as Double
GetScaleY = Scene.FindContainer("Item_Input").FindSubContainer(Name).FindSubContainer("Item").scaling.y
End Function
Sub SetPositionX(Name as String,Value as Double)
Scene.FindContainer(Name).position.x = Value
End Sub
Sub SetPositionY(Name as String,Value as Double)
Scene.FindContainer(Name).position.y = Value
End Sub
Sub SetScaleX(Name as String,Value as Double)
Scene.FindContainer(Name).scaling.x = Value
End Sub
Sub SetScaleY(Name as String,Value as Double)
Scene.FindContainer(Name).scaling.y = Value
End Sub