looking pretty good as long as nothing is overriden.

This commit is contained in:
Bryce Covert
2017-02-09 21:37:03 -08:00
parent 99de5ea972
commit 592a609129
2 changed files with 83 additions and 33 deletions

View File

@@ -309,18 +309,20 @@
(cond-> entities (cond-> entities
true (assoc-in [:label :text] hover-text) true (assoc-in [:label :text] hover-text)
utils/mobile? (update-in [:label] assoc :x (* 20 4 utils/ui-scale) :y 12) utils/mobile? (update-in [:label] assoc :x (* 52 4 utils/ui-scale) :y 12)
(and utils/mobile? (or item-cursor action-cursor) (and utils/mobile? (or item-cursor action-cursor)
(= :main action-cursor)) (= :main action-cursor))
(assoc :action-icon nil) (assoc :action-icon nil)
(and utils/mobile? (or item-cursor action-cursor) item-cursor
(not= :main action-cursor)) (assoc :action-icon nil)
(and utils/mobile? action-cursor (not item-cursor) (not= :main action-cursor))
(assoc-in [:action-icon] (assoc-in [:action-icon]
(assoc (assoc
(texture (aget all-icons 0 (.indexOf utils/+all-cursors+ (or item-cursor action-cursor)))) (texture (aget all-icons 0 (.indexOf utils/+all-cursors+ (or item-cursor action-cursor))))
:x 4 :y 4 :x (* utils/ui-scale 32 4) :y (* utils/ui-scale 4)
:width (* 18 4 utils/ui-scale) :height (* 16 4 utils/ui-scale))) :width (* 18 4 utils/ui-scale) :height (* 16 4 utils/ui-scale)))
(not utils/mobile?) (update-in [:label] assoc :x scene-x :y scene-y) (not utils/mobile?) (update-in [:label] assoc :x scene-x :y scene-y)

View File

@@ -1536,21 +1536,35 @@
(defn appear-transition [item hide-or-show in-or-out] (defn appear-transition [item hide-or-show in-or-out]
(reify ITransition (reify ITransition
(start-transition [this screen entities] (start-transition [this screen entities]
(let [fade-tween (if (= :hide hide-or-show) (let [upright? (= 0.0 (get-in entities [:inventory :angle] 0.0))
fade-tween (if (= :hide hide-or-show)
(tween/tween :appear-item screen [:selected-item :opacity] 1.0 0.0 0.5 :ease tween/ease-linear) (tween/tween :appear-item screen [:selected-item :opacity] 1.0 0.0 0.5 :ease tween/ease-linear)
(tween/tween :appear-item screen [:selected-item :opacity] 0.0 1.0 0.5 :ease tween/ease-linear)) (tween/tween :appear-item screen [:selected-item :opacity] 0.0 1.0 0.5 :ease tween/ease-linear))
move-tween (condp = in-or-out move-tween (if upright?
:far-out (condp = in-or-out
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 45) (* utils/ui-scale 50) 0.5 :ease tween/ease-linear) :far-out
:out (tween/tween :appear-item-y screen [:selected-item :y] (* utils/ui-scale 35) (* utils/ui-scale 40) 0.5 :ease tween/ease-linear)
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 40) (* utils/ui-scale 45) 0.5 :ease tween/ease-linear) :out
(tween/tween :appear-item-y screen [:selected-item :y] (* utils/ui-scale 30) (* utils/ui-scale 35) 0.5 :ease tween/ease-linear)
:in :in
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 45) (* utils/ui-scale 40) 0.5 :ease tween/ease-linear) (tween/tween :appear-item-y screen [:selected-item :y] (* utils/ui-scale 35) (* utils/ui-scale 30) 0.5 :ease tween/ease-linear)
:none :none
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 45) (* utils/ui-scale 45) 0.5 :ease tween/ease-linear))] (tween/tween :appear-item-y screen [:selected-item :y] (* utils/ui-scale 35) (* utils/ui-scale 35) 0.5 :ease tween/ease-linear))
(condp = in-or-out
:far-out
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 40) (* utils/ui-scale 45) 0.5 :ease tween/ease-linear)
:out
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 35) (* utils/ui-scale 40) 0.5 :ease tween/ease-linear)
:in
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 40) (* utils/ui-scale 35) 0.5 :ease tween/ease-linear)
:none
(tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 40) (* utils/ui-scale 40) 0.5 :ease tween/ease-linear)))]
(-> entities (-> entities
(assoc :selected-item (assoc :selected-item
(assoc (texture (aget (get-in entities [:all-items]) 0 (.indexOf utils/+all-cursors+ (:cursor item)))) (assoc (texture (aget (get-in entities [:all-items]) 0 (.indexOf utils/+all-cursors+ (:cursor item))))
@@ -1558,16 +1572,31 @@
:origin-y 0 :origin-y 0
:scale-x utils/ui-scale :scale-x utils/ui-scale
:scale-y utils/ui-scale :scale-y utils/ui-scale
:x (* utils/ui-scale (condp = in-or-out :x (if upright?
:in (* utils/ui-scale 12)
35 (* utils/ui-scale (condp = in-or-out
:out :in
30 40
:none :out
35 35
:far-out :none
35)) 40
:y (* utils/ui-scale 0) :baseline 9000 :opacity (if (= :hide hide-or-show) 1.0 0.0) :far-out
40)))
:y (if upright?
(* utils/ui-scale (condp = in-or-out
:in
35
:out
30
:none
35
:far-out
35))
0)
:baseline 9000
:opacity (if (= :hide hide-or-show) 1.0 0.0)
:item item)) :item item))
(assoc-in [:tweens :appear-item] fade-tween) (assoc-in [:tweens :appear-item] fade-tween)
@@ -1580,9 +1609,9 @@
(accept-state entities state state-data (accept-state entities state state-data
[(reify ITransition [(reify ITransition
(start-transition [this screen entities] (start-transition [this screen entities]
(let [rotate-tween (tween/tween :rotate-pack screen [:inventory :angle] 0.0 -90.0 0.25 :ease tween/ease-linear) (let [rotate-tween (tween/tween :rotate-pack screen [:inventory :angle] 0.0 -90.0 0.35 :ease tween/ease-linear)
y-tween (tween/tween :y-pack screen [:inventory :y] (* utils/ui-scale 21) (* utils/ui-scale 5) 0.25 :ease tween/ease-linear) y-tween (tween/tween :y-pack screen [:inventory :y] (* utils/ui-scale 27) (* utils/ui-scale 5) 0.35 :ease tween/ease-in-cubic)
x-tween (tween/tween :x-pack screen [:inventory :x] (* utils/ui-scale 24) (* utils/ui-scale 15) 0.25 :ease tween/ease-linear)] x-tween (tween/tween :x-pack screen [:inventory :x] (* utils/ui-scale 21) (* utils/ui-scale 15) 0.35 :ease tween/ease-in-cubic)]
(-> entities (-> entities
(assoc-in [:tweens :rotate-pack] rotate-tween) (assoc-in [:tweens :rotate-pack] rotate-tween)
(assoc-in [:tweens :y-pack] y-tween) (assoc-in [:tweens :y-pack] y-tween)
@@ -1611,7 +1640,14 @@
(accept-state entities state state-data (accept-state entities state state-data
[(reify ITransition [(reify ITransition
(start-transition [this screen entities] (start-transition [this screen entities]
(update-in entities [:inventory] #(actions/start-animation screen % :closing))) (let [rotate-tween (tween/tween :rotate-pack screen [:inventory :angle] -90.0 0.0 0.35 :ease tween/ease-linear)
y-tween (tween/tween :y-pack screen [:inventory :y] (* utils/ui-scale 5) (* utils/ui-scale 27) 0.35 :ease tween/ease-in-cubic)
x-tween (tween/tween :x-pack screen [:inventory :x] (* utils/ui-scale 15) (* utils/ui-scale 21) 0.35 :ease tween/ease-in-cubic)]
(-> entities
(assoc-in [:tweens :rotate-pack] rotate-tween)
(assoc-in [:tweens :y-pack] y-tween)
(assoc-in [:tweens :x-pack] x-tween)
(update-in [:inventory] #(actions/start-animation screen % :closing)))))
(transition-done? [this screen entities] (transition-done? [this screen entities]
(animation! (get-in entities [:inventory :anim]) (animation! (get-in entities [:inventory :anim])
:is-animation-finished :is-animation-finished
@@ -1631,11 +1667,23 @@
(defmethod transition-hud [:selected :none] (defmethod transition-hud [:selected :none]
[screen entities state state-data] [screen entities state state-data]
(accept-state entities state state-data (accept-state entities state state-data
[(reify ITransition [(appear-transition (or state-data (get-in entities [:inv-fsm :state-data])) :hide :in)
(reify ITransition
(start-transition [this screen entities] (start-transition [this screen entities]
(update-in entities [:inventory] (fn [i] (actions/start-animation screen i :closing)))) (let [rotate-tween (tween/tween :rotate-pack screen [:inventory :angle] -90.0 0.0 0.35 :ease tween/ease-linear)
(transition-done? [this screen entities] true)) y-tween (tween/tween :y-pack screen [:inventory :y] (* utils/ui-scale 5) (* utils/ui-scale 27) 0.35 :ease tween/ease-in-cubic)
(appear-transition (or state-data (get-in entities [:inv-fsm :state-data])) :hide :in) x-tween (tween/tween :x-pack screen [:inventory :x] (* utils/ui-scale 15) (* utils/ui-scale 21) 0.35 :ease tween/ease-in-cubic)]
(-> entities
(assoc-in [:tweens :rotate-pack] rotate-tween)
(assoc-in [:tweens :y-pack] y-tween)
(assoc-in [:tweens :x-pack] x-tween)
(update-in [:inventory] #(actions/start-animation screen % :closing)))))
(transition-done? [this screen entities]
(animation! (get-in entities [:inventory :anim])
:is-animation-finished
(- ^double (:total-time screen) ^double (get-in entities [:inventory :anim-start])))))
(reify ITransition (reify ITransition
(start-transition [this screen entities] (start-transition [this screen entities]