first steps to change overlay and savegames
This commit is contained in:
parent
d15fcd7583
commit
a06f947c39
3 changed files with 40 additions and 0 deletions
15
lib/yath_ex/data/savegame.ex
Normal file
15
lib/yath_ex/data/savegame.ex
Normal file
|
@ -0,0 +1,15 @@
|
|||
defmodule YathEx.Data.Savegame do
|
||||
def list_saves do
|
||||
Path.wildcard("savegame/*.sav")
|
||||
|> Enum.map(fn save ->
|
||||
String.replace(save,"savegame\/","")
|
||||
end)
|
||||
end
|
||||
|
||||
def mk_save_dir do
|
||||
if not File.exists?("savegame") do
|
||||
File.mkdir("savegame")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
17
lib/yath_ex/update.ex
Normal file
17
lib/yath_ex/update.ex
Normal file
|
@ -0,0 +1,17 @@
|
|||
defmodule YathEx.Update do
|
||||
|
||||
alias YathEx.Data.Savegame
|
||||
|
||||
def change_view(model, :savegame) do
|
||||
data = Savegame.list_saves()
|
||||
%{model | data: data}
|
||||
end
|
||||
|
||||
def change_view(model, view_id) do
|
||||
|
||||
end
|
||||
|
||||
def set_overlay(model, id) do
|
||||
%{model | overlay: id}
|
||||
end
|
||||
end
|
8
lib/yath_ex/views/menu.ex
Normal file
8
lib/yath_ex/views/menu.ex
Normal file
|
@ -0,0 +1,8 @@
|
|||
defmodule YathEx.Views.Menu do
|
||||
|
||||
import Ratatouille.View
|
||||
|
||||
def render do
|
||||
bar()
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue