Skip to content

Commit

Permalink
rename script_references to behavior_references
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewdean authored and igorlira committed Aug 30, 2024
1 parent 6e495a3 commit 35db7c9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/views/ScoreInspector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function ScoreInspector() {
<div className={styles.container}>
<div className={styles.scriptHeader}>
{range(1, framesToRender + 1).map((frame) => {
const scriptRef = score?.scriptReferences?.find(
const scriptRef = score?.behaviorReferences?.find(
(element) =>
frame >= element.startFrame && frame <= element.endFrame
);
Expand Down
2 changes: 1 addition & 1 deletion src/vm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export interface ScoreSpriteSnapshot {

export interface ScoreSnapshot {
channelCount: number,
scriptReferences: IScoreBehaviorReference[]
behaviorReferences: IScoreBehaviorReference[]
}

export type MemberSnapshot = IBaseMemberSnapshot & (IFieldMemberSnapshot | IScriptMemberSnapshot | IBitmapMemberSnapshot | IPaletteMemberSnapshot | IUnknownMemberSnapshot)
4 changes: 2 additions & 2 deletions vm-rust/src/js_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ impl JsApi {
member_map.str_set("channelCount", &JsValue::from(score.get_channel_count()));

member_map.str_set(
"scriptReferences",
&js_sys::Array::from_iter(score.script_references.iter().map(|scr_ref| {
"behaviorReferences",
&js_sys::Array::from_iter(score.behavior_references.iter().map(|scr_ref| {
let script_ref_map = js_sys::Map::new();
script_ref_map.str_set("startFrame", &scr_ref.start_frame.to_js_value());
script_ref_map.str_set("endFrame", &scr_ref.end_frame.to_js_value());
Expand Down
8 changes: 4 additions & 4 deletions vm-rust/src/player/score.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct ScoreBehaviorReference {

pub struct Score {
pub channels: Vec<SpriteChannel>,
pub script_references: Vec<ScoreBehaviorReference>,
pub behavior_references: Vec<ScoreBehaviorReference>,
pub frame_labels: Vec<FrameLabel>,
}

Expand All @@ -53,13 +53,13 @@ impl Score {
pub fn empty() -> Score {
Score {
channels: vec![],
script_references: vec![],
behavior_references: vec![],
frame_labels: vec![],
}
}

pub fn get_script_in_frame(&self, frame: u32) -> Option<ScoreBehaviorReference> {
return self.script_references.iter()
return self.behavior_references.iter()
.find(|x| frame >= x.start_frame && frame <= x.end_frame)
.map(|x| x.clone())
}
Expand Down Expand Up @@ -119,7 +119,7 @@ impl Score {
continue;
};

self.script_references.push(
self.behavior_references.push(
ScoreBehaviorReference {
start_frame: primary.start_frame,
end_frame: primary.end_frame,
Expand Down

0 comments on commit 35db7c9

Please sign in to comment.