compile-guard hank which is incompatible with hscriptPos
This commit is contained in:
@@ -22,7 +22,9 @@ import flixel.input.mouse.FlxMouseEvent;
|
||||
import kiss_flixel.KissExtendedSprite;
|
||||
import flixel.addons.plugin.FlxMouseControl;
|
||||
import hx.strings.Strings;
|
||||
#if !hscriptPos
|
||||
import hank.Story;
|
||||
#end
|
||||
|
||||
using haxe.io.Path;
|
||||
using StringTools;
|
||||
|
||||
@@ -1066,32 +1066,33 @@
|
||||
(+ (or choiceWindow.selectionMarker?.width 0) (* textSize 2) (or choiceWindow.xText?.width 0) (apply max (for control choiceWindow.controls control.width)))
|
||||
(Std.int choiceWindow.nextControlY)))))
|
||||
|
||||
(function hankStoryWindow [:String file :ConstructorArgs args &opt :Map<String,HankChoiceTagEvent> onChoiceTags]
|
||||
(let [story (Story.FromFile file)
|
||||
window (SimpleWindow.create args)]
|
||||
(localFunction :Void showNextFrame []
|
||||
(let [frame (story.nextFrame)]
|
||||
(case frame
|
||||
(Finished
|
||||
(window.makeTextV2 "Done"
|
||||
(object
|
||||
onClick ->_ (window.hide))))
|
||||
((HasText text)
|
||||
(window.makeTextV2 text)
|
||||
(showNextFrame))
|
||||
((HasChoices choices tags)
|
||||
(doFor [idx choice] (enumerate choices)
|
||||
(window.makeTextV2 "[$(+ idx 1)] $choice"
|
||||
(object onClick
|
||||
->_ {
|
||||
// Call events for tags
|
||||
(doFor tag (nth tags idx)
|
||||
(when (onChoiceTags?.exists tag)
|
||||
((dictGet onChoiceTags tag) choice)))
|
||||
(story.choose idx)
|
||||
(window.clearControls)
|
||||
(showNextFrame)
|
||||
}))))
|
||||
(never null))))
|
||||
(showNextFrame)
|
||||
window))
|
||||
(#unless hscriptPos
|
||||
(function hankStoryWindow [:String file :ConstructorArgs args &opt :Map<String,HankChoiceTagEvent> onChoiceTags]
|
||||
(let [story (Story.FromFile file)
|
||||
window (SimpleWindow.create args)]
|
||||
(localFunction :Void showNextFrame []
|
||||
(let [frame (story.nextFrame)]
|
||||
(case frame
|
||||
(Finished
|
||||
(window.makeTextV2 "Done"
|
||||
(object
|
||||
onClick ->_ (window.hide))))
|
||||
((HasText text)
|
||||
(window.makeTextV2 text)
|
||||
(showNextFrame))
|
||||
((HasChoices choices tags)
|
||||
(doFor [idx choice] (enumerate choices)
|
||||
(window.makeTextV2 "[$(+ idx 1)] $choice"
|
||||
(object onClick
|
||||
->_ {
|
||||
// Call events for tags
|
||||
(doFor tag (nth tags idx)
|
||||
(when (onChoiceTags?.exists tag)
|
||||
((dictGet onChoiceTags tag) choice)))
|
||||
(story.choose idx)
|
||||
(window.clearControls)
|
||||
(showNextFrame)
|
||||
}))))
|
||||
(never null))))
|
||||
(showNextFrame)
|
||||
window)))
|
||||
Reference in New Issue
Block a user