diff --git a/desktop/src-common/advent/screens/dialogue.clj b/desktop/src-common/advent/screens/dialogue.clj index d0ddbf75..b225b1e6 100644 --- a/desktop/src-common/advent/screens/dialogue.clj +++ b/desktop/src-common/advent/screens/dialogue.clj @@ -309,18 +309,20 @@ (cond-> entities 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) (= :main action-cursor)) (assoc :action-icon nil) - (and utils/mobile? (or item-cursor action-cursor) - (not= :main action-cursor)) + item-cursor + (assoc :action-icon nil) + + (and utils/mobile? action-cursor (not item-cursor) (not= :main action-cursor)) (assoc-in [:action-icon] (assoc (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))) (not utils/mobile?) (update-in [:label] assoc :x scene-x :y scene-y) diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index fd5b17e7..6ee4ff2d 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -1536,21 +1536,35 @@ (defn appear-transition [item hide-or-show in-or-out] (reify ITransition (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] 0.0 1.0 0.5 :ease tween/ease-linear)) - move-tween (condp = in-or-out - :far-out - (tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 45) (* utils/ui-scale 50) 0.5 :ease tween/ease-linear) - :out - (tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 40) (* utils/ui-scale 45) 0.5 :ease tween/ease-linear) + move-tween (if upright? + (condp = in-or-out + :far-out + (tween/tween :appear-item-y screen [:selected-item :y] (* utils/ui-scale 35) (* utils/ui-scale 40) 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 - (tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 45) (* utils/ui-scale 40) 0.5 :ease tween/ease-linear) + :in + (tween/tween :appear-item-y screen [:selected-item :y] (* utils/ui-scale 35) (* utils/ui-scale 30) 0.5 :ease tween/ease-linear) - :none - (tween/tween :appear-item-y screen [:selected-item :x] (* utils/ui-scale 45) (* utils/ui-scale 45) 0.5 :ease tween/ease-linear))] + :none + (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 (assoc :selected-item (assoc (texture (aget (get-in entities [:all-items]) 0 (.indexOf utils/+all-cursors+ (:cursor item)))) @@ -1558,16 +1572,31 @@ :origin-y 0 :scale-x utils/ui-scale :scale-y utils/ui-scale - :x (* utils/ui-scale (condp = in-or-out - :in - 35 - :out - 30 - :none - 35 - :far-out - 35)) - :y (* utils/ui-scale 0) :baseline 9000 :opacity (if (= :hide hide-or-show) 1.0 0.0) + :x (if upright? + (* utils/ui-scale 12) + (* utils/ui-scale (condp = in-or-out + :in + 40 + :out + 35 + :none + 40 + :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)) (assoc-in [:tweens :appear-item] fade-tween) @@ -1580,9 +1609,9 @@ (accept-state entities state state-data [(reify ITransition (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) - y-tween (tween/tween :y-pack screen [:inventory :y] (* utils/ui-scale 21) (* utils/ui-scale 5) 0.25 :ease tween/ease-linear) - x-tween (tween/tween :x-pack screen [:inventory :x] (* utils/ui-scale 24) (* utils/ui-scale 15) 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 27) (* utils/ui-scale 5) 0.35 :ease tween/ease-in-cubic) + 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 (assoc-in [:tweens :rotate-pack] rotate-tween) (assoc-in [:tweens :y-pack] y-tween) @@ -1611,11 +1640,18 @@ (accept-state entities state state-data [(reify ITransition (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] (animation! (get-in entities [:inventory :anim]) :is-animation-finished - (- ^double (:total-time screen) ^double (get-in entities [:inventory :anim-start]))))) + (- ^double (:total-time screen) ^double (get-in entities [:inventory :anim-start]))))) (reify ITransition (start-transition [this screen entities] @@ -1631,11 +1667,23 @@ (defmethod transition-hud [:selected :none] [screen 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] - (update-in entities [:inventory] (fn [i] (actions/start-animation screen i :closing)))) - (transition-done? [this screen entities] true)) - (appear-transition (or state-data (get-in entities [:inv-fsm :state-data])) :hide :in) + (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] + (animation! (get-in entities [:inventory :anim]) + :is-animation-finished + (- ^double (:total-time screen) ^double (get-in entities [:inventory :anim-start]))))) + + (reify ITransition (start-transition [this screen entities]