<commit_before>import { AVGScriptUnit } from "../script-unit";
import { Subtitle } from "../../data/screen-subtitle";
import { AVGGameRuntime, AVGMusicState } from "../../core/runtime";
import { ScreenImage } from "../../data/screen-image";
import { Sound } from "../../data/sound";
import { Dialogue, Avatar, Character } from "../..";

export class APIRuntime extends AVGScriptUnit {

    public static updateSubtitles(subtitles: Array<Subtitle>) {
        AVGGameRuntime.screenSubtitles = subtitles;
    }

    public static updateImages(images: Array<ScreenImage>) {
        AVGGameRuntime.screenImages = images;
    }

    public static updateBGM(sound: Sound, isStop: boolean) {
        AVGGameRuntime.bgm = new AVGMusicState(sound, isStop);
    }

    public static updateDialogue(dialogue: Dialogue) {
        AVGGameRuntime.dialogue = dialogue;
        if (dialogue.character !== null) {
            AVGGameRuntime.characters.push(dialogue.character);
        }
    }

    public static updateCharacters(characters: Array<Character>) {
        AVGGameRuntime.characters = characters;
    }
}<commit_msg>Modified judge null to use util.isNull in api-runtime<commit_after>import { AVGScriptUnit } from "../script-unit";
import { Subtitle } from "../../data/screen-subtitle";
import { AVGGameRuntime, AVGMusicState } from "../../core/runtime";
import { ScreenImage } from "../../data/screen-image";
import { Sound } from "../../data/sound";
import { Dialogue, Avatar, Character } from "../..";
import { isNull } from "util";

export class APIRuntime extends AVGScriptUnit {

    public static updateSubtitles(subtitles: Array<Subtitle>) {
        AVGGameRuntime.screenSubtitles = subtitles;
    }

    public static updateImages(images: Array<ScreenImage>) {
        AVGGameRuntime.screenImages = images;
    }

    public static updateBGM(sound: Sound, isStop: boolean) {
        AVGGameRuntime.bgm = new AVGMusicState(sound, isStop);
    }

    public static updateDialogue(dialogue: Dialogue) {
        AVGGameRuntime.dialogue = dialogue;
        if (!isNull(dialogue.character)) {
            AVGGameRuntime.characters.push(dialogue.character);
        }
    }

    public static updateCharacters(characters: Array<Character>) {
        AVGGameRuntime.characters = characters;
    }
}
{'fraction_non_alphanumeric': 0.12690798081116442, 'fraction_numerical': 0.0, 'mean_word_length': 3.248148148148148, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5377332', 'n_tokens_mistral': 658, 'n_tokens_neox': 656, 'n_words': 148}