15
15
-- with this program; if not, write to the Free Software Foundation, Inc.,
16
16
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
17
18
+ local function current_game ()
19
+ local last_game_id = core .setting_get (" menu_last_game" )
20
+ local game , index = gamemgr .find_by_gameid (last_game_id )
21
+
22
+ return game
23
+ end
24
+
18
25
local function singleplayer_refresh_gamebar ()
19
26
20
27
local old_bar = ui .find_by_name (" game_button_bar" )
@@ -137,11 +144,11 @@ local function main_button_handler(this, fields, name, tabdata)
137
144
end
138
145
139
146
if fields [" world_create" ] ~= nil then
140
- print (" create world dialog" )
141
147
local create_world_dlg = create_create_world_dlg (true )
142
148
create_world_dlg :set_parent (this )
143
- create_world_dlg :show ()
144
149
this :hide ()
150
+ create_world_dlg :show ()
151
+ mm_texture .update (" singleplayer" ,current_game ())
145
152
return true
146
153
end
147
154
@@ -156,8 +163,9 @@ local function main_button_handler(this, fields, name, tabdata)
156
163
local index = menudata .worldlist :get_raw_index (selected )
157
164
local delete_world_dlg = create_delete_world_dlg (world .name ,index )
158
165
delete_world_dlg :set_parent (this )
159
- delete_world_dlg :show ()
160
166
this :hide ()
167
+ delete_world_dlg :show ()
168
+ mm_texture .update (" singleplayer" ,current_game ())
161
169
end
162
170
end
163
171
@@ -173,8 +181,9 @@ local function main_button_handler(this, fields, name, tabdata)
173
181
174
182
if (configdialog ~= nil ) then
175
183
configdialog :set_parent (this )
176
- configdialog :show ()
177
184
this :hide ()
185
+ configdialog :show ()
186
+ mm_texture .update (" singleplayer" ,current_game ())
178
187
end
179
188
end
180
189
@@ -191,13 +200,12 @@ local function on_change(type, old_tab, new_tab)
191
200
end
192
201
193
202
if (type == " ENTER" ) then
194
- local last_game_id = core .setting_get (" menu_last_game" )
195
- local game , index = gamemgr .find_by_gameid (last_game_id )
203
+ local game = current_game ()
196
204
197
205
if game then
198
206
menudata .worldlist :set_filtercriteria (game .id )
199
207
core .set_topleft_text (game .name )
200
- mm_texture .update (new_tab ,game )
208
+ mm_texture .update (" singleplayer " ,game )
201
209
end
202
210
buttonbar :show ()
203
211
else
0 commit comments