-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview03.lua
More file actions
249 lines (201 loc) ยท 6.63 KB
/
Copy pathview03.lua
File metadata and controls
249 lines (201 loc) ยท 6.63 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
-----------------------------------------------------------------------------------------
--
-- view2.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 i = composer.getVariable("number")
local stat_num = loadedSettings.activity_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 friend_stat = {
loadedSettings.red,
loadedSettings.yellow,
loadedSettings.green,
loadedSettings.blue,
loadedSettings.purple
}
local function save()
loadedSettings.activity_num = stat_num
loadedSettings.study1_num = study[1]
loadedSettings.study2_num = study[2]
loadedSettings.study3_num = study[3]
loadedSettings.study4_num = study[4]
loadedSettings.study5_num = study[5]
loadedSettings.play1_num = play[1]
loadedSettings.play2_num = play[2]
loadedSettings.play3_num = play[3]
loadedSettings.play4_num = play[4]
loadedSettings.play5_num = play[5]
loadedSettings.hobby1_num = hobby[1]
loadedSettings.hobby2_num = hobby[2]
loadedSettings.hobby3_num = hobby[3]
loadedSettings.hobby4_num = hobby[4]
loadedSettings.hobby5_num = hobby[5]
loadedSettings.red = friend_stat[1]
loadedSettings.yellow = friend_stat[2]
loadedSettings.green = friend_stat[3]
loadedSettings.blue = friend_stat[4]
loadedSettings.purple = friend_stat[5]
loadsave.saveTable(loadedSettings,"settings.json")
end
study[i] = 1
stat_num = stat_num + 1
if friend_stat[i] <101 then
friend_stat[i] = friend_stat[i] + 3
end
if stat_num < 101 then
loadedSettings.study = loadedSettings.study +4
end
save()
local background = display.newImageRect("์ด๋ฏธ์ง/ํ/๋ฐฐ๊ฒฝ/๊ฐ๊ตฌํฌํจ.png",display.contentWidth, display.contentHeight)
background.x,background.y = display.contentWidth/2,display.contentHeight/2
sceneGroup:insert(background)
local black = display.newRect(display.contentWidth/2,display.contentHeight/2,display.contentWidth,display.contentHeight)
black.alpha = 0.5
black:setFillColor(0)
sceneGroup:insert(black)
local options = {
width = 1536,
height = 864,
numFrames = 30,
sheetContentWidth=7680, sheetContentHeight=5184
}
useornot = composer.getVariable("useornot")
print("useornot" .. useornot)
if useornot == 1 then
motion =graphics.newImageSheet("์ด๋ฏธ์ง/์์ /๊ณต๋ถ/" .. i .. "ํ
.png",options)
else
motion = graphics.newImageSheet("์ด๋ฏธ์ง/์์ /๊ณต๋ถ/" .. i .. ".png",options)
end
local data = {
name = "study",
start = 1,
count = 28,
time = 2000,
loopCount = 5,
loopDirection = "forward"
}
local study_motion = display.newSprite(motion,data)
study_motion.x, study_motion.y = display.contentWidth/2,display.contentHeight/2
--study_motion.width = study_motion.width*2
sceneGroup:insert(study_motion)
study_motion:play()
local function gotoback()
study_motion:pause()
study_motion:removeSelf()
study_motion=nil
motion=nil
if loadedSettings.month == 2 then
if loadedSettings.activity_num == 2 then
print(stat_num)
print("in")
loadedSettings.month3_event = 1
loadsave.saveTable(loadedSettings,"settings.json")
--composer.removeScene("view02schedule")
--composer.gotoScene("view03")
end
elseif loadedSettings.month == 4 then
if loadedSettings.activity_num == 3 then
print(stat_num)
print("in")
loadedSettings.month4_event = 1
loadsave.saveTable(loadedSettings,"settings.json")
--composer.removeScene("view02schedule")
--composer.gotoScene("view03")
end
end
--composer.removeScene("view03")
if loadedSettings.month3_event == 1 then
loadedSettings.month3_event = loadedSettings.month3_event + 1
loadsave.saveTable(loadedSettings,"settings.json")
composer.removeScene("view03")
audio.pause(loadedEndings.bgMusic)
composer.gotoScene("viewmonth3_event")
elseif loadedSettings.month4_event == 1 then
loadedSettings.month4_event = loadedSettings.month4_event + 1
loadsave.saveTable(loadedSettings,"settings.json")
composer.removeScene("view03")
audio.pause(loadedEndings.bgMusic)
composer.gotoScene("viewmonth4_event")
elseif loadedSettings.month5_event == 1 then
loadedSettings.month5_event = loadedSettings.month5_event + 1
loadsave.saveTable(loadedSettings,"settings.json")
composer.removeScene("view03")
audio.pause(loadedEndings.bgMusic)
composer.gotoScene("viewmonth5_event")
else
composer.removeScene("view03")
composer.gotoScene("view02schedule")
end
end
timer.performWithDelay(3000,gotoback)
--timer.performWithDelay(3000,gotobck)
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
--motion:removeSelf()
--composer.removeScene("view03")
-- 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