-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview02Map.lua
More file actions
527 lines (469 loc) ยท 16.5 KB
/
Copy pathview02Map.lua
File metadata and controls
527 lines (469 loc) ยท 16.5 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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
-- ๋ง์ ํด๋ฆญ ์ ๋จ๋ ํ์
์ฐฝ.
local composer = require( "composer" )
local scene = composer.newScene()
local loadsave = require( "loadsave" )
function scene:create( event )
local sceneGroup = self.view
-- ๋ฐฐ๊ฒฝ ๊ฐ์ฒด
local background = display.newImageRect("์ด๋ฏธ์ง/๋ง์/๋ฐฐ๊ฒฝ2.png",display.contentWidth, display.contentHeight)
background.x,background.y = display.contentWidth/2,display.contentHeight/2
sceneGroup:insert(background)
-- ๋ง์ ์ด๋ฏธ์ง ๊ฐ์ฒด
local red = display.newImage("์ด๋ฏธ์ง/๋ง์/๋นจ๊ฐ.png")
red.x,red.y = display.contentWidth*0.223,display.contentHeight*0.297
red.name = "1"
sceneGroup:insert(red)
local click1 = audio.loadStream( "์์
/ํด๋ฆญ1.wav" )
local blue = display.newImage("์ด๋ฏธ์ง/๋ง์/ํ๋.png")
blue.x,blue.y = display.contentWidth*0.794,display.contentHeight*0.29
blue.name = "2"
sceneGroup:insert(blue)
local yellow = display.newImage("์ด๋ฏธ์ง/๋ง์/๋
ธ๋.png")
yellow.x,yellow.y = display.contentWidth*0.5,display.contentHeight*0.185
yellow.name = "3"
sceneGroup:insert(yellow)
local purple = display.newImage("์ด๋ฏธ์ง/๋ง์/๋ณด๋ผ.png")
purple.x,purple.y = display.contentWidth*0.217,display.contentHeight*0.698
purple.name = "4"
sceneGroup:insert(purple)
local green = display.newImage("์ด๋ฏธ์ง/๋ง์/์ด๋ก.png")
green.x,green.y = display.contentWidth*0.785,display.contentHeight*0.713
green.name = "5"
sceneGroup:insert(green)
local em = display.newImage("์ด๋ฏธ์ง/๋ง์/์์๊ฑฐ์ฒ.png")
em.x,em.y = display.contentWidth*0.5,display.contentHeight*0.829
em.name = "6"
sceneGroup:insert(em)
local store = display.newImage("์ด๋ฏธ์ง/๋ง์/์์ .png")
store.x,store.y = display.contentWidth*0.5,display.contentHeight*0.505
store.name = "7"
sceneGroup:insert(store)
--์ฅ๋ฉด์ ํ
local options={
effect="crossFade",
time=1000
}
local optioned = {
isModal = true
}
-- ์ด์ view01Map.lua ์์ ๊ฐ์ ธ์จ ํ๊ฒ ๊ฐ์ฒด์ ๊ฐ์ ๋ฐ์์ค.
color = composer.getVariable("color")
local loadedSettings = loadsave.loadTable( "settings.json" )
-- ๋ง์ ๋ฐฉ๋ฌธ
-- ์ ๋ณ๋ก ์คํฌ๋ฆฝํธ๊ฐ ๋ณํํ๋ฏ๋ก ๋ฌ์ ๋ฐ๋ผ ์คํฌ๋ฆฝํธ.lua๋ ๋ฌ๋ผ์ ธ์ผ ํจ.
local function touch1(event)
if event.phase == "began" then
if loadedSettings.month == 5 then
if loadedSettings.month6_event == 0 then
loadedSettings.month6_event = loadedSettings.month6_event + 1
loadsave.saveTable(loadedSettings,"settings.json")
end
end
if loadedSettings.month ==0 then
if loadedSettings.limited_num ~=2 then
if color == "1" then
if (loadedSettings.red_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth1_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "2" then
if (loadedSettings.blue_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth1_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "3" then
if (loadedSettings.yellow_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth1_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "4" then
if (loadedSettings.purple_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth1_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "5" then
if (loadedSettings.green_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth1_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
end
else
composer.showOverlay("zopup_limited",optioned)
end
elseif loadedSettings.month ==1 then
if loadedSettings.limited_num ~=2 then
if color == "1" then
if (loadedSettings.red_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth2_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "2" then
if (loadedSettings.blue_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth2_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "3" then
if (loadedSettings.yellow_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth2_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "4" then
if (loadedSettings.purple_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth2_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "5" then
if (loadedSettings.green_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth2_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
end
else
composer.showOverlay("zopup_limited",optioned)
end
elseif loadedSettings.month ==2 then
if loadedSettings.limited_num ~=2 then
if color == "1" then
if (loadedSettings.red_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth3_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "2" then
if (loadedSettings.blue_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth3_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "3" then
if (loadedSettings.yellow_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth3_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "4" then
if (loadedSettings.purple_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth3_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "5" then
if (loadedSettings.green_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth3_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
end
else
composer.showOverlay("zopup_limited",optioned)
end
elseif loadedSettings.month ==3 then
if loadedSettings.limited_num ~=2 then
if color == "1" then
if (loadedSettings.red_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth4_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "2" then
if (loadedSettings.blue_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth4_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "3" then
if (loadedSettings.yellow_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth4_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "4" then
if (loadedSettings.purple_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth4_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "5" then
if (loadedSettings.green_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth4_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
end
else
composer.showOverlay("zopup_limited",optioned)
end
elseif loadedSettings.month ==4 then
if loadedSettings.limited_num ~=2 then
if color == "1" then
if (loadedSettings.red_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth5_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "2" then
if (loadedSettings.blue_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth5_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "3" then
if (loadedSettings.yellow_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth5_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "4" then
if (loadedSettings.purple_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth5_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "5" then
if (loadedSettings.green_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth5_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
end
else
composer.showOverlay("zopup_limited",optioned)
end
elseif loadedSettings.month ==5 then
if loadedSettings.limited_num ~=2 then
if color == "1" then
if (loadedSettings.red_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth6_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "2" then
if (loadedSettings.blue_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth6_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "3" then
if (loadedSettings.yellow_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth6_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "4" then
if (loadedSettings.purple_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth6_script",options)
else
composer.showOverlay("zopup_limited",optioned)
end
elseif color == "5" then
if (loadedSettings.green_num ~= 1) then
composer.removeScene("view02Map")
composer.gotoScene("viewmonth6_script",options)
else
--composer.removeScene("view02Map")
composer.showOverlay("zopup_limited",optioned)
end
end
else
--composer.removeScene("view02Map")
composer.showOverlay("zopup_limited",optioned)
end
end
end
end
-- ๋ง์ ๋ณ ๊ฒ์ ์ด๋.
local function touch2(event)
if ( event.phase == "began" ) then
if loadedSettings.game_num ~= 1 then
-- ๋ด ํผ๋ ๊ฝ ๋ฌ
if loadedSettings.month==1 then
if loadedSettings.month2_event==0 then
loadedSettings.month2_event = loadedSettings.month2_event + 1
loadsave.saveTable(loadedSettings,"settings.json")
end
end
if loadedSettings.month == 5 then
if loadedSettings.month6_event == 0 then
loadedSettings.month6_event = loadedSettings.month6_event + 1
loadsave.saveTable(loadedSettings,"settings.json")
end
end
if color == "1" then
--๋นจ๊ฐ๊ฒ์ ์ด๋
composer.removeScene("view02Map")
composer.gotoScene( "view02Map2" )
elseif color == "2" then
-- ํ๋๊ฒ์ ์ด๋
composer.removeScene("view02Map")
composer.gotoScene( "view02Map2" )
elseif color == "3" then
composer.removeScene("view02Map")
composer.gotoScene( "view02Map2" )
elseif color == "4" then
-- ๋ณด๋ผ๊ฒ์ ์ด๋
composer.removeScene("view02Map")
composer.gotoScene( "view02Map2" )
elseif color == "5" then
-- ์ด๋ก๊ฒ์ ์ด๋
composer.removeScene("view02Map")
composer.gotoScene( "view02Map2" )
end
else
--composer.removeScene("view02Map")
composer.showOverlay( "zopup_limited" ,optioned)
end
end
end
local loadedItems= loadsave.loadTable( "items.json" )
local function go_present(event)
if event.phase == "began" then
print(loadedSettings.gift_num)
if loadedItems.itemCount == 0 then
print("์์ดํ
์")
composer.showOverlay("zopup_noitem",optioned)
elseif loadedSettings.gift_num == 1 then
print("dfasd")
composer.showOverlay("zopup_gift_limited",optioned)
else
composer.setVariable("color_char",color)
composer.removeScene("view02Map")
composer.gotoScene("viewgift_bag")
end
end
end
-- ๋ง์ ๋ณ ๋ฒํผ
local function button()
maeulbt = display.newImage("์ด๋ฏธ์ง/๋ง์/๋ฐฉ๋ฌธ์ฐฝ/๋ฐฉ๋ฌธ๋ฒํผ.png")
maeulbt.x,maeulbt.y = display.contentWidth*0.467,display.contentHeight*0.506
sceneGroup:insert(maeulbt)
gamebt = display.newImage("์ด๋ฏธ์ง/๋ง์/๋ฐฉ๋ฌธ์ฐฝ/ํ๋ฐฉ๋ฒํผ.png")
gamebt.x,gamebt.y = display.contentWidth*0.467,display.contentHeight*0.582
sceneGroup:insert(gamebt)
presentbt = display.newImage("์ด๋ฏธ์ง/๋ง์/๋ฐฉ๋ฌธ์ฐฝ/์ ๋ฌผ๋ฒํผ.png")
presentbt.x,presentbt.y = display.contentWidth*0.585,display.contentHeight*0.544
presentbt:addEventListener("touch",go_present)
sceneGroup:insert(presentbt)
maeulbt:addEventListener("touch",touch1)
gamebt:addEventListener("touch",touch2)
end
-- ํ์
์ฐฝ ๋ซ๊ธฐ ํจ์
local function gotohome(event)
if event.phase == "cancelled" then
event.target.width,event.target.height = 74,74
elseif event.phase == "ended" then
event.target.width,event.target.height = 74,74
composer.removeScene("view02Map")
composer.gotoScene("view01Map")
end
end
-- ํ๊ฒ ๋ค์์ ๋ฐ๋ผ ํ์
ui๋์ฐ๊ธฐ
if color =="1" then
redui = display.newImage("์ด๋ฏธ์ง/๋ง์/๋ฐฉ๋ฌธ์ฐฝ/๋นจ๊ฐ.png")
redui.x,redui.y = display.contentWidth/2,display.contentHeight*0.496
sceneGroup:insert(redui)
button()
elseif color =="2" then
blueui = display.newImage("์ด๋ฏธ์ง/๋ง์/๋ฐฉ๋ฌธ์ฐฝ/ํ๋.png")
blueui.x,blueui.y = display.contentWidth/2,display.contentHeight*0.496
sceneGroup:insert(blueui)
button()
elseif color =="3" then
yellowui = display.newImage("์ด๋ฏธ์ง/๋ง์/๋ฐฉ๋ฌธ์ฐฝ/๋
ธ๋.png")
yellowui.x,yellowui.y = display.contentWidth/2,display.contentHeight*0.496
sceneGroup:insert(yellowui)
button()
elseif color =="4" then
purpleui = display.newImage("์ด๋ฏธ์ง/๋ง์/๋ฐฉ๋ฌธ์ฐฝ/๋ณด๋ผ.png")
purpleui.x,purpleui.y = display.contentWidth/2,display.contentHeight*0.496
sceneGroup:insert(purpleui)
button()
elseif color =="5" then
greenui = display.newImage("์ด๋ฏธ์ง/๋ง์/๋ฐฉ๋ฌธ์ฐฝ/์ด๋ก.png")
greenui.x,greenui.y = display.contentWidth/2,display.contentHeight*0.496
sceneGroup:insert(greenui)
button()
end
local exit = display.newImage("์ด๋ฏธ์ง/๊ณตํต/x๋ฒํผ.png")
sceneGroup:insert(exit)
exit.x, exit.y = display.contentWidth*0.625, display.contentHeight*0.34
exit:addEventListener("touch",gotohome)
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
-- Called when the scene is now on screen
--
-- INSERT code here to make the scene come alive
-- e.g. start timers, begin animation, play audio, etc.
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
composer.removeScene("view02Map")
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