almost everything is functional again.

This commit is contained in:
Bryce Covert
2016-08-10 08:58:39 -07:00
parent 130d9e1b1f
commit ee59cbbbe8
6 changed files with 63 additions and 34 deletions

View File

@@ -70,8 +70,8 @@
(assoc :source-x source-x :source-y source-y)
(doto
(label! :set-wrap true)
(#(label! % :set-width (min 700 (+ 50 (label! % :get-width)))))
))
(#(label! % :set-width (min 700 (+ 50 (label! % :get-width))))))
(#(utils/add-actor-to-stage screen %)))
x (- x (/ (label! talk :get-width) 2))
talk (assoc talk :x x :y y :id id)
talk (ensure-on-screen talk)]
@@ -94,6 +94,7 @@
:stop-talk
(fn [screen entities {:keys [id]}]
(utils/remove-actor-from-stage entities (or id :fg-actions))
(dissoc entities (or id :fg-actions)))
@@ -154,7 +155,8 @@
(label! :set-x (:x e))
(label! :set-y (:y e))
(label! :set-height (:height e))
(label! :set-font-scale 0.25))]))
(label! :set-font-scale 0.25)
(#(utils/add-actor-to-stage screen %)))]))
(assoc-in [:state :choices] choices)
(assoc-in [:state :callback] callback)
(assoc-in [:state :np :height] (* choice-height (inc choice-count))))))
@@ -163,6 +165,7 @@
(let [[x y] (utils/unproject screen options)]
(when (seq (get-in entities [:state :choices]))
(when-let [choice (first (filter #(utils/intersects? % [x y]) (vals entities)))]
(utils/clear-stage screen)
((get-in entities [:state :callback]) (:index choice))
(-> entities
(assoc-in [:state :callback] nil)
@@ -211,16 +214,20 @@
talk (label message style :set-alignment Align/center :set-font-scale 0.25)
x (- x (/ (label! talk :get-width) 2))
talk (assoc talk :x x :y y :opacity 1.0)
talk (ensure-on-screen talk)]
#_#_talk (ensure-on-screen talk)]
(utils/add-actor-to-stage screen talk)
(-> entities
(assoc :dialogue talk)
(assoc-in [:tweens :fade-out-toast]
(tween/tween :fade-out-toast screen [:dialogue :opacity] 1.0 0.0 1.0
:finish #(dissoc % :dialogue))))))
:finish #(do
(utils/remove-actor-from-stage entities :dialogue)
(dissoc % :dialogue)))))))
:stop-talk
(fn [_ entities {:keys [target-id]}]
(utils/remove-actor-from-stage entities :dialogue)
(dissoc entities :dialogue))