add looping to animation debug widget

This commit is contained in:
Nick Fisher
2024-06-04 13:16:16 +08:00
parent fd06424f28
commit dadd7d1f5d

View File

@@ -66,15 +66,38 @@ class _EntityListWidget extends State<EntityListWidget> {
SubmenuButton(
child: const Text("Animations"),
menuChildren: animations.data!
.map((a) => MenuItemButton(
child: Text(a),
onPressed: () async {
await widget.controller!
.addAnimationComponent(entity);
widget.controller!.playAnimation(
entity, animations.data!.indexOf(a));
},
))
.map((a) => SubmenuButton(
child: Text(a),
menuChildren: [
MenuItemButton(
child: Text("Play"),
onPressed: () async {
await widget.controller!
.addAnimationComponent(entity);
widget.controller!.playAnimation(entity,
animations.data!.indexOf(a));
},
),
MenuItemButton(
child: Text("Loop"),
onPressed: () async {
await widget.controller!
.addAnimationComponent(entity);
widget.controller!.playAnimation(
entity, animations.data!.indexOf(a),
loop: true);
},
),
MenuItemButton(
child: Text("Stop"),
onPressed: () async {
await widget.controller!
.addAnimationComponent(entity);
widget.controller!.stopAnimation(
entity, animations.data!.indexOf(a));
},
)
]))
.toList()),
ChildRenderableWidget(
controller: widget.controller!, entity: entity),