supertext use textPlate & center

This commit is contained in:
2023-05-11 12:38:12 -06:00
parent ed8d756d2e
commit 2dfa9c2981
2 changed files with 15 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
# @install: lix --silent download "gh://github.com/kiss-lang/kiss-flixel#9d51d83e387ecb29cb4c3767f3a35aff7565fa86" into kiss-flixel/0.0.0/github/9d51d83e387ecb29cb4c3767f3a35aff7565fa86
# @install: lix --silent download "gh://github.com/kiss-lang/kiss-flixel#76e0502faf13dd8e188c815bb54834b910ce72db" into kiss-flixel/0.0.0/github/76e0502faf13dd8e188c815bb54834b910ce72db
-lib flixel
-lib flixel-addons
-lib flixel-ui
@@ -6,5 +6,5 @@
-lib kiss-tools
-lib lime
-lib openfl
-cp ${HAXE_LIBCACHE}/kiss-flixel/0.0.0/github/9d51d83e387ecb29cb4c3767f3a35aff7565fa86/src/
-cp ${HAXE_LIBCACHE}/kiss-flixel/0.0.0/github/76e0502faf13dd8e188c815bb54834b910ce72db/src/
-D kiss-flixel=0.0.0

View File

@@ -285,8 +285,10 @@
(var DIALOG_SIZE 24)
(prop &mut :FlxSprite dialogBox)
(prop &mut :FlxSprite superText)
(prop &mut :FlxText dialogText)
(prop &mut :FlxText speakerNameText)
(var SUPER_MARGIN 10)
(method showDialog [:String speakerName :SpeechType<ActorFlxSprite> type :String wryly :String text :Continuation cc]
// TODO handle text messages, wrylies, off-screen, from-phone, etc. via (case type)
@@ -295,6 +297,13 @@
// TODO allow sounds for wrylies, like the dispatch click
(localVar &mut nameOnRight false)
(case type
(Super
(set superText (SpriteTools.textPlate text DIALOG_SIZE SUPER_MARGIN))
(superText.screenCenter)
(set superText.y flxMovie.DIALOG_Y)
(FlxG.state.add superText)
(startWaitForInput cc)
(return))
((OnScreen character)
(when (> character.stagePosition.x (/ FlxG.width 2))
(set nameOnRight true))
@@ -346,9 +355,10 @@
(startWaitForInput cc))
(method :Void hideDialog []
(dialogText.kill)
(speakerNameText.kill)
(dialogBox.kill))
(dialogText?.kill)
(speakerNameText?.kill)
(dialogBox?.kill)
(when superText (FlxG.state.remove superText)))
(savedVar :Float soundVolume 1.0)