properties: rewrite properties (whoops)

This commit is contained in:
Torrie Fischer
2024-12-15 19:27:27 +01:00
parent 3a49e7e390
commit 514c9defd6
19 changed files with 1051 additions and 715 deletions

View File

@@ -1,11 +1,11 @@
use core::fmt;
use crate::events::{Event, EventBus, Variant};
use crate::{events::{Event, EventBus}, properties::{Variant, PropertyID}};
pub trait Task: Send {
fn on_ready(&mut self, bus: &mut EventBus) {}
fn on_tick(&mut self, bus: &mut EventBus) {}
fn on_property_change(&mut self, key: &'static str, value: &Variant, bus: &mut EventBus) {}
fn on_property_change(&mut self, key: PropertyID, value: &Variant, bus: &mut EventBus) {}
fn start(&mut self, bus: &mut EventBus) {}
fn stop(&mut self, bus: &mut EventBus) {}
@@ -80,7 +80,7 @@ impl ScheduledTask {
match event {
Event::Tick => self.task.on_tick(bus),
Event::ReadyToRock => self.task.on_ready(bus),
Event::PropertyChange(key, value) => self.task.on_property_change(key, value, bus),
Event::PropertyChange(key, value) => self.task.on_property_change(key.clone(), value, bus),
_ => ()
}
},