-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview02schedule.lua
More file actions
465 lines (369 loc) ยท 14.1 KB
/
Copy pathview02schedule.lua
File metadata and controls
465 lines (369 loc) ยท 14.1 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
-----------------------------------------------------------------------------------------
--
-- ์ค์ผ์ค.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
composer.removeHidden()
local loadedSettings = loadsave.loadTable( "settings.json" )
--ํฐ์น ์ ํ
local option = {
isModal = true
}
-- ๋ฐ์ดํฐ ๋ฒ ์ด์ค ๋ถ๋ฌ์ค๊ธฐ --
local game_num = loadedSettings.game_num
local stat_num = loadedSettings.activity_num
local friendly_num = loadedSettings.friend_num
local study = {
loadedSettings.study1_num,
loadedSettings.study2_num,
loadedSettings.study3_num,
loadedSettings.study4_num,
loadedSettings.study5_num
}
local play = {
loadedSettings.play1_num,
loadedSettings.play2_num,
loadedSettings.play3_num,
loadedSettings.play4_num,
loadedSettings.play5_num
}
local hobby = {
loadedSettings.hobby1_num,
loadedSettings.hobby2_num,
loadedSettings.hobby3_num,
loadedSettings.hobby4_num,
loadedSettings.hobby5_num
}
local loadedItems= loadsave.loadTable( "items.json" )
-- ํ๋ ์ ํ์ํ ์์ดํ
ํ์ธ์ ์ํ ๊ฐ์ฒด ์์ฑ
local items = {}
items[1] = loadedItems.item1--/loadedSettings.item1
items[2] = loadedItems.item2--/loadedSettings.item1
items[3] = loadedItems.item3--/loadedSettings.item1
items[4] = loadedItems.item4--/loadedSettings.item1
items[5] = loadedItems.item5--/loadedSettings.item1
items[6] = loadedItems.item6--/loadedSettings.item1
items[7] = loadedItems.item7--/loadedSettings.item1
items[8] = loadedItems.item8--/loadedSettings.item1
items[9] = loadedItems.item9--/loadedSettings.item1
items[10] = loadedItems.item10--/loadedSettings.item1
items[11] = loadedItems.item11--/loadedSettings.item1
items[12] = loadedItems.item12--/loadedSettings.item1
items[13] = loadedItems.item13--/loadedSettings.item1
items[14] = loadedItems.item14--/loadedSettings.item1
items[15] = loadedItems.item15--/loadedSettings.item1
items[16] = loadedItems.item16--/loadedSettings.item1
-- ํ๋ ๋๋ง์น๊ธฐ --
local function exit_month(event)
if event.phase == "began" then
composer.showOverlay("view02schedule_end",option)
end
end
-- ๊ฐ์ด๋ ์ฐฝ ๋ถ๋ฌ์ค๊ธฐ --
local function tutorial(event)
if event.phase == "began" then
composer.showOverlay("zopup_guide",option)
end
end
-- home ํ๋ฉด์ผ๋ก --
local function go_back(event)
if event.phase == "began" then
composer.removeScene("view02schedulee")
composer.gotoScene("view00Room")
end
end
-- ๋ฐฐ๊ฒฝ ์์ --
local background = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/๋ฐฐ๊ฒฝ์์/๋ฐฐ๊ฒฝ.png")
background.x, background.y = display.contentWidth/2, display.contentHeight/2
sceneGroup:insert(background)
local schedule = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/๋ฐฐ๊ฒฝ์์/์ ํ์ฐฝ๋ฐฐ๊ฒฝ.png")
schedule.x, schedule.y = display.contentWidth*0.02812,display.contentHeight*0.039
schedule.anchorX,schedule.anchorY = 0,0
sceneGroup:insert(schedule)
local pencil = display.newImage("์ด๋ฏธ์ง/์บ๋ฆญํฐ/์ฃผ์ธ๊ณต/๊ธฐ๋ณธ.png")
pencil.x, pencil.y = display.contentWidth*0.7288, display.contentHeight*0.4153
pencil.width, pencil.height = display.contentWidth*0.1826,display.contentHeight*0.5103
pencil.anchorX,pencil.anchorY = 0,0
sceneGroup:insert(pencil)
local exit = display.newImage("์ด๋ฏธ์ง/๊ณตํต/x๋ฒํผ.png")
exit.x, exit.y = display.contentWidth*0.9207, display.contentHeight*0.0438
exit.anchorX, exit.anchorY = 0,0
sceneGroup:insert(exit)
exit:addEventListener("touch",go_back)
-- ์คํฏ ๊ฒ์ด์ง --
local play_bar = display.newRect(display.contentWidth*0.7440,display.contentWidth*0.04583,display.contentHeight*0.25*(loadedSettings.fun/100) ,display.contentHeight*0.0146)
play_bar.anchorX,play_bar.anchorY = 0,0.5
play_bar:setFillColor(0.643,0.384,0.666)
sceneGroup:insert(play_bar)
local hobby_bar = display.newRect(display.contentWidth*0.7440,display.contentWidth*0.0718, display.contentHeight*0.25*(loadedSettings.hobby/100) ,display.contentHeight*0.0146)
hobby_bar.anchorX,hobby_bar.anchorY = 0,0.5
hobby_bar:setFillColor(0.98, 0.556 , 0.219)
sceneGroup:insert(hobby_bar)
local study_bar = display.newRect(display.contentWidth*0.7440,display.contentWidth*0.0979, display.contentHeight*0.25*(loadedSettings.study/100) ,display.contentHeight*0.0146)
study_bar.anchorX,study_bar.anchorY = 0,0.5
study_bar:setFillColor(0.46,0.537,0.752)
sceneGroup:insert(study_bar)
local friendly_bar = display.newRect(display.contentWidth*0.7440,display.contentWidth*0.1239, display.contentHeight*0.25*(loadedSettings.friendship/100) ,display.contentHeight*0.0146)
friendly_bar.anchorX,friendly_bar.anchorY = 0,0.5
friendly_bar:setFillColor(0.933,0.474,0.474)
sceneGroup:insert(friendly_bar)
local stat = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/๋ฐฐ๊ฒฝ์์/์คํฏ์ฐฝ.png")
stat.x, stat.y = display.contentWidth*0.675,display.contentHeight*0.039
stat.anchorX,stat.anchorY = 0,0
sceneGroup:insert(stat)
local guide_button = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/๋ฐฐ๊ฒฝ์์/๊ฐ์ด๋.png")
guide_button.x, guide_button.y = display.contentWidth*0.02812,display.contentHeight*0.8987
guide_button.anchorX,guide_button.anchorY = 0,0
sceneGroup:insert(guide_button)
guide_button:addEventListener("touch",tutorial)
local exit_butoon = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/์ ํ/๋ง์นจ๋ฒํผ.png")
exit_butoon.x, exit_butoon.y = display.contentWidth*0.2113,display.contentHeight*0.8847
exit_butoon.anchorX,exit_butoon.anchorY = 0,0
exit_butoon:addEventListener("touch",exit_month)
sceneGroup:insert(exit_butoon)
local text = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/๋ฐฐ๊ฒฝ์์/๋งํ์ .png")
text.x, text.y = display.contentWidth*0.7326,display.contentHeight*0.2885
text.anchorX,text.anchorY = 0,0
sceneGroup:insert(text)
-- ๋ฒํผ --
-- ์ ํ ํ๋ ํํฉ --
local game_button = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/ํ๋์ /๊ฒ์.png")
game_button.x, game_button.y = display.contentWidth*0.3634,display.contentHeight*0.1402
game_button.anchorX,game_button.anchorY = 0,0
sceneGroup:insert(game_button)
local gamed_button = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/ํ๋ํ/๊ฒ์.png")
gamed_button.x, gamed_button.y = display.contentWidth*0.3634,display.contentHeight*0.1402
gamed_button.anchorX,gamed_button.anchorY = 0,0
sceneGroup:insert(gamed_button)
gamed_button.alpha = game_num
local stat_button = {}
local stated_button = {}
for i= 1,4 do
stat_button[i] = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/ํ๋์ /์คํฏ.png")
stat_button[i].x, stat_button[i].y = display.contentWidth*0.40317+display.contentWidth*0.04193*(i-1),display.contentHeight*0.1402
stat_button[i].anchorX,stat_button[i].anchorY = 0,0
sceneGroup:insert(stat_button[i])
stated_button[i] = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/ํ๋ํ/์คํฏ.png")
stated_button[i].x, stated_button[i].y = display.contentWidth*0.40317+display.contentWidth*0.04193*(i-1),display.contentHeight*0.1402
stated_button[i].anchorX,stated_button[i].anchorY = 0,0
stated_button[i].alpha = 0
sceneGroup:insert(stated_button[i])
end
for i=1,stat_num do
stated_button[i].alpha = 1
end
local friend_button = {}
local friended_button = {}
for i = 1,2 do
friend_button[i] = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/ํ๋์ /์ฐ์ .png")
friend_button[i].x, friend_button[i].y = display.contentWidth*0.5718+display.contentWidth*0.04193*(i-1),display.contentHeight*0.1402
friend_button[i].anchorX,friend_button[i].anchorY = 0,0
sceneGroup:insert(friend_button[i])
friended_button[i] = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/ํ๋ํ/์ฐ์ .png")
friended_button[i].x, friended_button[i].y = display.contentWidth*0.5718+display.contentWidth*0.04193*(i-1),display.contentHeight*0.1402
friended_button[i].anchorX,friended_button[i].anchorY = 0,0
friended_button[i].alpha=0
sceneGroup:insert(friended_button[i])
end
for i=1,friendly_num do
friended_button[i].alpha = 1
end
-- ๊ณต๋ถ ํจ์
local function study_function(event)
if event.phase == "began" then
local i = event.target.name
if (stat_num>=4) then
composer.showOverlay("view02schedule_alarm",option)
elseif (study[i]>0) then
composer.showOverlay("zopup_same",option)
else
local location = 0
for i=1,16 do
if items[i] == "์ฐํ" then
location = i
break
end
end
composer.setVariable("number",i)
if (location == 0) or (loadedItems.itemCount == 0) then
composer.setVariable("useornot",0)
composer.removeScene("view02schedule")
composer.gotoScene("view03")
else
composer.setVariable("item","์ฐํ")
composer.setVariable("format",1)
composer.setVariable("location",location)
composer.showOverlay("view02schedule_item",option)
end
end
end
end
--๋์ด ํจ์--
local function play_function(event)
if event.phase == "began" then
local i = event.target.name
local item_name = event.target.id
if (stat_num>=4) then
composer.showOverlay("view02schedule_alarm",option)
elseif (play[i]>0) then
composer.showOverlay("zopup_same",option)
else
local location = 0
for i=1,16 do
if items[i] == item_name then
location = i
break
end
end
print(item_name .. ":" .. location)
composer.setVariable("number",i)
if (location == 0) or (loadedItems.itemCount == 0) then
composer.setVariable("useornot",0)
composer.removeScene("view02schedule")
composer.gotoScene("view03_fun")
else
composer.setVariable("item",item_name)
composer.setVariable("format",2)
composer.setVariable("location",location)
composer.showOverlay("view02schedule_item",option)
end
end
end
end
--์ทจ๋ฏธ ํจ์--
local function hobby_function(event)
if event.phase == "began" then
local i = event.target.name
local item_name = event.target.id
if (stat_num>=4) then
composer.showOverlay("view02schedule_alarm",option)
elseif (hobby[i]>0) then
composer.showOverlay("zopup_same",option)
else
local location = 0
for i=1,16 do
if items[i] == item_name then
location = i
break
end
end
composer.setVariable("number",i)
--composer.removeScene("view02schedule")
if (location == 0) or (loadedItems.itemCount == 0) then
composer.setVariable("useornot",0)
composer.removeScene("view02schedule")
composer.gotoScene("view03_hobby")
else
composer.setVariable("item",item_name)
composer.setVariable("format",3)
composer.setVariable("location",location)
composer.showOverlay("view02schedule_item",option)
end
end
end
end
-- ๊ณต๋ถ ๋ฒํผ
local study_button = {}
for i=1,5 do
study_button[i] = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/๊ณต๋ถ๋ฒํผ/๊ณต๋ถ" .. i .. ".png")
study_button[i].x, study_button[i].y = display.contentWidth*0.0553+display.contentWidth*0.1210*(i-1),display.contentHeight*0.3056
study_button[i].anchorX,study_button[i].anchorY = 0,0
study_button[i].name = i
sceneGroup:insert(study_button[i])
study_button[i]:addEventListener("touch",study_function)
end
-- ๋์ด ๋ฒํผ
local play_button = {}
local play_item = {
"๋จธ๋ฆฌํ",
"์ค๋ฆฌ",
"์ฌ๋ฃ",
"์๊ฒฝ๋ฆ์ด",
"๋งํ "
}
for i=1,5 do
play_button[i] = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/๋์ด๋ฒํผ/๋์ด" .. i .. ".png")
play_button[i].x, play_button[i].y = display.contentWidth*0.0560,display.contentHeight*0.4848+display.contentHeight*0.0722*(i-1)
play_button[i].anchorX,play_button[i].anchorY = 0,0
play_button[i].name = i
play_button[i].id = play_item[i]
sceneGroup:insert(play_button[i])
play_button[i]:addEventListener("touch",play_function)
end
-- ์ทจ๋ฏธ ๋ฒํผ
local hobby_button = {}
local hobby_item = {
"๋ฏผ์ด",
"์์๋ด",
"๋ธ๋ก",
"ํค๋์
",
"ํ์ด"
}
for i=1,5 do
hobby_button[i] = display.newImage("์ด๋ฏธ์ง/์ค์ผ์ค/์ทจ๋ฏธ๋ฒํผ/์ทจ๋ฏธ" .. i .. ".png")
hobby_button[i].x, hobby_button[i].y = display.contentWidth*0.3586,display.contentHeight*0.4848+display.contentHeight*0.0722*(i-1)
hobby_button[i].anchorX,hobby_button[i].anchorY = 0,0
sceneGroup:insert(hobby_button[i])
hobby_button[i].name = i
hobby_button[i].id = hobby_item[i]
hobby_button[i]:addEventListener("touch",hobby_function)
end
-- ์ด๋ฒ๋ฌ ์ผ์
local month_to_do = {}
local month_content = {
loadedSettings.former1,
loadedSettings.former2
}
for i = 1,2 do
month_to_do[i] = display.newText(month_content[i],display.contentWidth*0.0568,display.contentHeight*0.13+display.contentHeight*0.03472*(i-1),"font/NanumSquareRoundR")
month_to_do[i].size = 30
month_to_do[i].anchorX,month_to_do[i].anchorY = 0,0
month_to_do[i]:setFillColor(0)
sceneGroup:insert(month_to_do[i])
end
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
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