creates saves order list.
This commit is contained in:
@@ -9,3 +9,6 @@
|
|||||||
:after-wisdom "The Wise Guy"
|
:after-wisdom "The Wise Guy"
|
||||||
:after-jail "Prisoner On The Loose"
|
:after-jail "Prisoner On The Loose"
|
||||||
:in-jail "In The Slammer"})
|
:in-jail "In The Slammer"})
|
||||||
|
|
||||||
|
(def name->save
|
||||||
|
(into {} (map vector (vals saves) (keys saves))))
|
||||||
|
|||||||
@@ -170,15 +170,13 @@
|
|||||||
(defn saves-menu []
|
(defn saves-menu []
|
||||||
(doto
|
(doto
|
||||||
(into {}
|
(into {}
|
||||||
(for [[save index] (map #(vector %1 %2)
|
(for [[name index] (map #(vector %1 %2)
|
||||||
(filter utils/has-save? (keys saves/saves))
|
(utils/snapshot-list) (range))]
|
||||||
(range))
|
|
||||||
:let [name (saves/saves save)]]
|
|
||||||
[name (-> (make-label name)
|
[name (-> (make-label name)
|
||||||
(stack-y 280 index)
|
(stack-y 280 index)
|
||||||
(assoc :z 8
|
(assoc :z 8
|
||||||
:interactable true
|
:interactable true
|
||||||
:save save))]))
|
:save (saves/name->save name)))]))
|
||||||
println))
|
println))
|
||||||
|
|
||||||
(defscreen title-screen
|
(defscreen title-screen
|
||||||
|
|||||||
@@ -58,9 +58,17 @@
|
|||||||
atlas (texture-atlas "packed/pack.atlas")]
|
atlas (texture-atlas "packed/pack.atlas")]
|
||||||
(texture (texture-atlas! atlas :find-region atlas-name))))
|
(texture (texture-atlas! atlas :find-region atlas-name))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn snapshot-list []
|
||||||
|
(let [prefs (.getPreferences (Gdx/app) "ticks-tales-saves")]
|
||||||
|
(if (.contains prefs "snapshot-list")
|
||||||
|
(edn/read-string (.getString prefs "snapshot-list"))
|
||||||
|
[])))
|
||||||
|
|
||||||
(defn snapshot-state [entities name]
|
(defn snapshot-state [entities name]
|
||||||
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
|
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
|
||||||
(.putString (saves/saves name) (pr-str (entities :state)))
|
(.putString (saves/saves name) (pr-str (entities :state)))
|
||||||
|
(.putString "snapshot-list" (pr-str (cons (saves/saves name) (filter (complement #{(saves/saves name)}) (snapshot-list)))))
|
||||||
.flush))
|
.flush))
|
||||||
|
|
||||||
(defn save [entities]
|
(defn save [entities]
|
||||||
|
|||||||
Reference in New Issue
Block a user