-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewgift.lua
More file actions
378 lines (291 loc) ยท 8.65 KB
/
Copy pathviewgift.lua
File metadata and controls
378 lines (291 loc) ยท 8.65 KB
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
-----------------------------------------------------------------------------------------
--
-- view1.lua
--
-----------------------------------------------------------------------------------------
local composer = require( "composer" )
local scene = composer.newScene()
local loadsave = require( "loadsave" )
local json = require( "json" )
function scene:create( event )
local sceneGroup = self.view
local loadedSettings = loadsave.loadTable( "settings.json" )
local loadedItems= loadsave.loadTable( "items.json" )
mainName = loadedSettings.name
loadedSettings.gift_num = loadedSettings.gift_num+1
loadsave.saveTable(loadedSettings, "settings.json")
local color_char = composer.getVariable("color_char")
if color_char == "1" then
color = 1
elseif color_char == "2" then
color = 2
elseif color_char == "5" then
color = 3
elseif color_char == "4" then
color = 4
elseif color_char == "3" then
color = 5
end
local color_name = {
"๋ธ๋ฆฌ",
"์กฐ์ด",
"์๋ฆฌ",
"์์ฆ",
"๋ ์ด"
}
-- ๋ฐฐ๊ฒฝ ์ค์ --
local background ={}
local background_image = {
"์ด๋ฏธ์ง/๋ํ/์ฐ์ ๋ฐฐ๊ฒฝ/๋นจ๊ฐ.png",
"์ด๋ฏธ์ง/๋ํ/์ฐ์ ๋ฐฐ๊ฒฝ/๋
ธ๋.png",
"์ด๋ฏธ์ง/๋ํ/์ฐ์ ๋ฐฐ๊ฒฝ/์ด๋ก.png",
"์ด๋ฏธ์ง/๋ํ/์ฐ์ ๋ฐฐ๊ฒฝ/ํ๋.png",
"์ด๋ฏธ์ง/๋ํ/์ฐ์ ๋ฐฐ๊ฒฝ/๋ณด๋ผ.png"
}
for i = 1,5 do
background[i] = display.newImage(background_image[i])
background[i].x, background[i].y = display.contentWidth/2,display.contentHeight/2
sceneGroup:insert(background[i])
background[i].alpha = 0
end
background[color].alpha = 1
-- ์บ๋ฆญํฐ ์ค์ --
-- ๊ธฐ๋ณธ ์ผ๊ตด --
local default = {}
for i = 1,5 do
default[i] = display.newImage("์ด๋ฏธ์ง/์บ๋ฆญํฐ/" .. color_name[i] .. "/๊ธฐ๋ณธ.png")
default[i].x, default[i].y = display.contentWidth/2,display.contentHeight/2
sceneGroup:insert(default[i])
default[i].alpha = 0
end
default[color].alpha = 1
-- ๊ธฐ์จ --
local happy = {}
for i = 1,5 do
happy[i] = display.newImage("์ด๋ฏธ์ง/์บ๋ฆญํฐ/" .. color_name[i] .. "/๊ธฐ์จ.png")
happy[i].x,happy[i].y = display.contentWidth/2,display.contentHeight/2
sceneGroup:insert(happy[i])
happy[i].alpha = 0
end
-- ๋๊ฐ --
local awkward = {}
for i = 1,5 do
awkward[i] = display.newImage("์ด๋ฏธ์ง/์บ๋ฆญํฐ/" .. color_name[i] .. "/๋๊ฐ.png")
awkward[i].x,awkward[i].y = display.contentWidth/2,display.contentHeight/2
sceneGroup:insert(awkward[i])
awkward[i].alpha = 0
end
-- ์ฌํ --
local sad = {}
for i = 1,5 do
sad[i] = display.newImage("์ด๋ฏธ์ง/์บ๋ฆญํฐ/" .. color_name[i] .. "/์ฌํ.png")
sad[i].x,sad[i].y = display.contentWidth/2,display.contentHeight/2
sceneGroup:insert(sad[i])
sad[i].alpha = 0
end
-- ํ๋จ --
local angry = {}
for i = 1,5 do
angry[i] = display.newImage("์ด๋ฏธ์ง/์บ๋ฆญํฐ/" .. color_name[i] .. "/ํ๋จ.png")
angry[i].x,angry[i].y = display.contentWidth/2,display.contentHeight/2
sceneGroup:insert(angry[i])
angry[i].alpha = 0
end
-- ๋์ฌํ --
local daesapan = {}
for i = 1,5 do
daesapan[i] = display.newImage("์ด๋ฏธ์ง/๋ํ/๋ํ์ฐฝ/" .. color_name[i] .. ".png")
daesapan[i].x, daesapan[i].y = display.contentWidth*0.5,display.contentHeight*0.7176
daesapan[i].anchorY = 0
sceneGroup:insert(daesapan[i])
daesapan[i].alpha = 0
end
local my_daesapan = display.newImage("์ด๋ฏธ์ง/๋ํ/๋ํ์ฐฝ/์ฃผ์ธ๊ณต.png")
my_daesapan.x, my_daesapan.y = display.contentWidth*0.5,display.contentHeight*0.7176
my_daesapan.anchorY = 0
sceneGroup:insert(my_daesapan)
my_daesapan.alpha=1
-- ์ ํ์ง --
local choose1 = {}
local choose2 = {}
for i = 1,5 do
choose1[i] = display.newImage("์ด๋ฏธ์ง/๋ํ/์ ํ์ง/" .. color_name[i] .. ".png")
choose1[i].x, choose1[i].y = display.contentWidth*0.0998, display.contentHeight*0.3500
choose1[i].anchorY, choose1[i].anchorX = 0,0
sceneGroup:insert(choose1[i])
choose1[i].alpha = 0
choose2[i] = display.newImage("์ด๋ฏธ์ง/๋ํ/์ ํ์ง/" .. color_name[i] .. ".png")
choose2[i].x, choose2[i].y = display.contentWidth*0.6326, display.contentHeight*0.3500
choose2[i].anchorY, choose2[i].anchorX = 0,0
sceneGroup:insert(choose2[i])
choose2[i].alpha = 0
end
-- ๋ํ ๋ด์ฉ --
local option = {
text = mainName,
x = display.contentWidth*0.175,
y = display.contentHeight*0.73,
font = "font/NanumSquareRoundB",
fontSize =45,
align="center"
}
local my = display.newText(option)
my.anchorY = 0
my.size = 45
my.alpha = 1
my:setFillColor(1)
sceneGroup:insert(my)
local daewha ={}
local perfect = {}
local perfect_respone = 0
local soso_respone = 0
local bad_respone = 0
local text_1 = {
"์,์ ๊ธฐ ์์์....",
"์ค๋์ " .. color_name[color] .. "์ ์์ผ์ด์ผ. ์ถํํด์ค๊น?",
"์, ์๋ฌด๊ฒ๋ ์๋์ผ.",
"๋ญ์ผ, ์ฑ๊ฒ๊ธฐ๋.",
"์ค๋น๋ ์ ๋ฌผ์ด ์์ด."
}
option1 = {
text = "์ ๋ฌผ์ ์ฃผ์!",
x=233,
y=490,
width=438,
height=143,
align = "center",
font = "font/NanumSquareRoundB.ttf",
fontSize = 36
}
option2 = {
text = "์ฃผ์ง ๋ง์",
x=1254.73,
y=490,
width=438,
height=143,
align = "center",
font = "font/NanumSquareRoundB.ttf",
fontSize = 36
}
select_daewha1=display.newText(option1)
select_daewha1.anchorX,select_daewha1.anchorY = 0,0
sceneGroup:insert(select_daewha1)
select_daewha1.alpha = 0
select_daewha2=display.newText(option2)
select_daewha2.anchorX,select_daewha2.anchorY = 0,0
sceneGroup:insert(select_daewha2)
select_daewha2.alpha = 0
for i = 1,5 do
daewha[i] = display.newText(text_1[i],display.contentWidth*0.0833,display.contentHeight*0.8009,"font/NanumSquare_acB.ttf")
daewha[i].anchorX,daewha[i].anchorY = 0,0
daewha[i]:setFillColor(0)
daewha[i].alpha = 0
daewha[i].size = 30
sceneGroup:insert(daewha[i])
end
local j = 1
local function next2(event)
if event.phase == "began" then
end
end
u = 1
local function choice1(event)
if event.phase == "began" then
if u == 1 then
print(loadedItems.itemCount)
choose1[color].alpha = 0
choose2[color].alpha = 0
daewha[j].alpha = 0
select_daewha1.alpha = 0
select_daewha2.alpha = 0
my_daesapan:removeEventListener("touch",next)
my_daesapan:addEventListener("touch",choice1)
--local gift = 1
-- ์ ๋ฌผ์ด ์์ ๋
if loadedItems.itemCount == 0 then
daewha[5].alpha = 1
u =u +1
else
composer.setVariable("color",color)
composer.removeScene("viewgift")
composer.gotoScene("viewgift_bag")
end
elseif u == 2 then
composer.removeScene("viewgift")
composer.gotoScene("view01Map")
end
end
end
local function choice2(event)
if event.phase == "began" then
--3๋ฒ์งธ
choose1[color].alpha = 0
choose2[color].alpha = 0
select_daewha1.alpha = 0
select_daewha2.alpha = 0
daewha[j].alpha = 0
daewha[j+1].alpha = 1
j = j+1
end
end
local function next(event)
if event.phase == "began" then
--2๋ฒ์งธ ๋์ฌ--
if j ==1 then
daewha[j].alpha = 0
daewha[j+1].alpha = 1
choose1[color].alpha = 1
choose2[color].alpha = 1
select_daewha1.alpha = 1
select_daewha2.alpha = 1
j = j+1
--4๋ฒ์งธ ๋์ฌ--
elseif j==3 then
composer.removeScene("viewgift")
composer.gotoScene("view01Map")
end
end
end
--daesapan[color].alpha = 1
my_daesapan.alpha = 1
my_daesapan:addEventListener("touch",next)
choose1[color]:addEventListener("touch",choice1)
choose2[color]:addEventListener("touch",choice2)
daewha[1].alpha = 1
print("์์ฑ")
end
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if phase == "will" then
-- Called when the scene is still off screen and is about to move on screen
elseif phase == "did" then
end
end
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if event.phase == "will" then
-- Called when the scene is on screen and is about to move off screen
--
-- INSERT code here to pause the scene
-- e.g. stop timers, stop animation, unload sounds, etc.)
elseif phase == "did" then
-- Called when the scene is now off screen
end
end
function scene:destroy( event )
local sceneGroup = self.view
-- Called prior to the removal of scene's "view" (sceneGroup)
--
-- INSERT code here to cleanup the scene
-- e.g. remove display objects, remove touch listeners, save state, etc.
end
---------------------------------------------------------------------------------
-- Listener setup
scene:addEventListener( "create", scene )
scene:addEventListener( "show", scene )
scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )
-----------------------------------------------------------------------------------------
return scene