click to add/remove entry from playground selection
This commit is contained in:
@@ -166,6 +166,10 @@
|
|||||||
(defCommand SelectEntry [e OneEntry]
|
(defCommand SelectEntry [e OneEntry]
|
||||||
(set selectedEntries [e]) [])
|
(set selectedEntries [e]) [])
|
||||||
|
|
||||||
|
(defCommand ToggleEntrySelection [e OneEntry]
|
||||||
|
(unless (selectedEntries.remove e)
|
||||||
|
(selectedEntries.push e)) [])
|
||||||
|
|
||||||
(defCommand SelectEntries [entries (Entries null null)]
|
(defCommand SelectEntries [entries (Entries null null)]
|
||||||
(set selectedEntries entries) [])
|
(set selectedEntries entries) [])
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import flash.display.BitmapData;
|
|||||||
import flixel.addons.display.FlxExtendedSprite;
|
import flixel.addons.display.FlxExtendedSprite;
|
||||||
import nat.Entry;
|
import nat.Entry;
|
||||||
import nat.Archive;
|
import nat.Archive;
|
||||||
|
import nat.ArchiveController;
|
||||||
import nat.BoolExpInterp;
|
import nat.BoolExpInterp;
|
||||||
import nat.components.Images;
|
import nat.components.Images;
|
||||||
import nat.components.Positions;
|
import nat.components.Positions;
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
(defNew [:String positionKey
|
(defNew [:String positionKey
|
||||||
&prop :Archive archive
|
&prop :Archive archive
|
||||||
&prop :Entry e]
|
&prop :Entry e
|
||||||
|
&prop :ArchiveController controller]
|
||||||
|
[&mut :Bool selected false]
|
||||||
|
|
||||||
(let [images (readComponent archive e Images)]
|
(let [images (readComponent archive e Images)]
|
||||||
(case (dictGet (readComponent archive e Positions) positionKey)
|
(case (dictGet (readComponent archive e Positions) positionKey)
|
||||||
((object x x y y z z)
|
((object x x y y z z)
|
||||||
@@ -13,6 +16,20 @@
|
|||||||
(enableMouseClicks false)
|
(enableMouseClicks false)
|
||||||
(enableMouseDrag)
|
(enableMouseDrag)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
(set mousePressedCallback
|
||||||
|
->[self _x _y]
|
||||||
|
{
|
||||||
|
(controller.ToggleEntrySelection e)
|
||||||
|
(set selected !selected)
|
||||||
|
(if selected
|
||||||
|
{
|
||||||
|
(set color FlxColor.BLUE)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(set color FlxColor.WHITE)
|
||||||
|
})
|
||||||
|
})
|
||||||
(set mouseStopDragCallback
|
(set mouseStopDragCallback
|
||||||
->[self _dx _dy]
|
->[self _dx _dy]
|
||||||
(withWritableComponents archive e [positions Positions]
|
(withWritableComponents archive e [positions Positions]
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import kiss.Prelude;
|
|||||||
import kiss.List;
|
import kiss.List;
|
||||||
import nat.System;
|
import nat.System;
|
||||||
import nat.BoolExpInterp;
|
import nat.BoolExpInterp;
|
||||||
|
import nat.ArchiveController;
|
||||||
import nat.components.Positions;
|
import nat.components.Positions;
|
||||||
|
|
||||||
@:build(kiss.Kiss.build())
|
@:build(kiss.Kiss.build())
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
(prop :Map<String,EntrySprite> sprites (new Map))
|
(prop :Map<String,EntrySprite> sprites (new Map))
|
||||||
|
|
||||||
(defNew [:String tagFilterString :String positionKey :PlayState playState]
|
(defNew [:String tagFilterString
|
||||||
|
:String positionKey
|
||||||
|
:PlayState playState
|
||||||
|
&prop :ArchiveController controller]
|
||||||
(super
|
(super
|
||||||
->[archive e]
|
->[archive e]
|
||||||
?(and (tagsMatch archive e tagFilterString) (hasComponent e Images))
|
?(and (tagsMatch archive e tagFilterString) (hasComponent e Images))
|
||||||
@@ -14,7 +17,7 @@
|
|||||||
(withWritableComponents archive e [positions Positions]
|
(withWritableComponents archive e [positions Positions]
|
||||||
(when !(positions.exists positionKey)
|
(when !(positions.exists positionKey)
|
||||||
(dictSet positions positionKey (object x 0.0 y 0.0 z 0.0))))
|
(dictSet positions positionKey (object x 0.0 y 0.0 z 0.0))))
|
||||||
(let [sprite (new EntrySprite positionKey archive e)]
|
(let [sprite (new EntrySprite positionKey archive e controller)]
|
||||||
(playState.entryGroup.add sprite)
|
(playState.entryGroup.add sprite)
|
||||||
(dictSet sprites e.id sprite))
|
(dictSet sprites e.id sprite))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -16,9 +16,10 @@
|
|||||||
archive
|
archive
|
||||||
(new Archive archiveDir)]
|
(new Archive archiveDir)]
|
||||||
(set this.archive archive)
|
(set this.archive archive)
|
||||||
|
(set controller
|
||||||
(new ArchiveController
|
(new ArchiveController
|
||||||
archive
|
archive
|
||||||
this))
|
this)))
|
||||||
|
|
||||||
(prop &mut :FlxGroup uiGroup (new FlxGroup))
|
(prop &mut :FlxGroup uiGroup (new FlxGroup))
|
||||||
(add uiGroup)
|
(add uiGroup)
|
||||||
@@ -39,7 +40,7 @@
|
|||||||
// TODO allow configuring the tags at runtime and erasing/re-creating sprites later
|
// TODO allow configuring the tags at runtime and erasing/re-creating sprites later
|
||||||
// TODO allow using other position keys and erasing/re-creating sprites later
|
// TODO allow using other position keys and erasing/re-creating sprites later
|
||||||
(prop &mut :EntrySpriteSystem spriteSystem)
|
(prop &mut :EntrySpriteSystem spriteSystem)
|
||||||
(set spriteSystem (new EntrySpriteSystem "!done" "Playground-MAIN" this))
|
(set spriteSystem (new EntrySpriteSystem "!done" "Playground-MAIN" this controller))
|
||||||
(archive.addSystem spriteSystem)
|
(archive.addSystem spriteSystem)
|
||||||
(spriteSystem.process archive))
|
(spriteSystem.process archive))
|
||||||
|
|
||||||
@@ -114,6 +115,8 @@
|
|||||||
(set textInput.hasFocus true)
|
(set textInput.hasFocus true)
|
||||||
(set textInput.callback
|
(set textInput.callback
|
||||||
->:Void [text action]
|
->:Void [text action]
|
||||||
|
// Super weird that this check is necessary
|
||||||
|
(when textInput
|
||||||
(case [text action]
|
(case [text action]
|
||||||
([text FlxInputText.ENTER_ACTION]
|
([text FlxInputText.ENTER_ACTION]
|
||||||
(set textInput.callback null)
|
(set textInput.callback null)
|
||||||
@@ -123,7 +126,7 @@
|
|||||||
(hideUI textInputLabel)
|
(hideUI textInputLabel)
|
||||||
(resolve text))
|
(resolve text))
|
||||||
//([_ FlxInputText.])
|
//([_ FlxInputText.])
|
||||||
(otherwise {})))
|
(otherwise {}))))
|
||||||
(showUI textInput))
|
(showUI textInput))
|
||||||
|
|
||||||
(method :Void enterNumber [prompt resolve min max &opt inStepsOf]
|
(method :Void enterNumber [prompt resolve min max &opt inStepsOf]
|
||||||
|
|||||||
Reference in New Issue
Block a user