avm2: Add private instance slots for `Scene`'s properties
This commit is contained in:
parent
97924d20ad
commit
5ba2421225
|
@ -2,6 +2,7 @@
|
|||
|
||||
use crate::avm2::activation::Activation;
|
||||
use crate::avm2::class::Class;
|
||||
use crate::avm2::globals::NS_RUFFLE_INTERNAL;
|
||||
use crate::avm2::method::{Method, NativeMethodImpl};
|
||||
use crate::avm2::names::{Namespace, QName};
|
||||
use crate::avm2::object::{Object, TObject};
|
||||
|
@ -32,19 +33,19 @@ pub fn instance_init<'gc>(
|
|||
|
||||
this.set_property(
|
||||
this,
|
||||
&QName::new(Namespace::Private("ruffle".into()), "name"),
|
||||
&QName::new(Namespace::Private(NS_RUFFLE_INTERNAL.into()), "name").into(),
|
||||
name.into(),
|
||||
activation,
|
||||
)?;
|
||||
this.set_property(
|
||||
this,
|
||||
&QName::new(Namespace::Private("ruffle".into()), "labels"),
|
||||
&QName::new(Namespace::Private(NS_RUFFLE_INTERNAL.into()), "labels").into(),
|
||||
labels,
|
||||
activation,
|
||||
)?;
|
||||
this.set_property(
|
||||
this,
|
||||
&QName::new(Namespace::Private("ruffle".into()), "numFrames"),
|
||||
&QName::new(Namespace::Private(NS_RUFFLE_INTERNAL.into()), "numFrames").into(),
|
||||
num_frames.into(),
|
||||
activation,
|
||||
)?;
|
||||
|
@ -71,7 +72,7 @@ pub fn labels<'gc>(
|
|||
if let Some(this) = this {
|
||||
this.get_property(
|
||||
this,
|
||||
&QName::new(Namespace::Private("ruffle".into()), "labels"),
|
||||
&QName::new(Namespace::Private(NS_RUFFLE_INTERNAL.into()), "labels").into(),
|
||||
activation,
|
||||
)
|
||||
} else {
|
||||
|
@ -88,7 +89,7 @@ pub fn name<'gc>(
|
|||
if let Some(this) = this {
|
||||
this.get_property(
|
||||
this,
|
||||
&QName::new(Namespace::Private("ruffle".into()), "name"),
|
||||
&QName::new(Namespace::Private(NS_RUFFLE_INTERNAL.into()), "name").into(),
|
||||
activation,
|
||||
)
|
||||
} else {
|
||||
|
@ -105,7 +106,7 @@ pub fn num_frames<'gc>(
|
|||
if let Some(this) = this {
|
||||
this.get_property(
|
||||
this,
|
||||
&QName::new(Namespace::Private("ruffle".into()), "numFrames"),
|
||||
&QName::new(Namespace::Private(NS_RUFFLE_INTERNAL.into()), "numFrames").into(),
|
||||
activation,
|
||||
)
|
||||
} else {
|
||||
|
@ -136,5 +137,12 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
|
|||
];
|
||||
write.define_public_builtin_instance_properties(mc, PUBLIC_INSTANCE_PROPERTIES);
|
||||
|
||||
const PRIVATE_INSTANCE_SLOTS: &[(&str, &str, &str, &str)] = &[
|
||||
(NS_RUFFLE_INTERNAL, "name", "", "String"),
|
||||
(NS_RUFFLE_INTERNAL, "labels", "", "Array"),
|
||||
(NS_RUFFLE_INTERNAL, "numFrames", "", "int"),
|
||||
];
|
||||
write.define_private_slot_instance_traits(PRIVATE_INSTANCE_SLOTS);
|
||||
|
||||
class
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue