/**
 * Copyright(c) Live2D Inc. All rights reserved.
 *
 * Use of this source code is governed by the Live2D Open Software license
 * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
 */ import { CSM_ASSERT } from '../utils/cubismdebug' ; import { CubismModel } from './cubismmodel' ; /**
 * Mocデータの管理
 *
 * Mocデータの管理を行うクラス。
 */ export class CubismMoc { /**
     * Mocデータの作成
     */ public static create ( mocBytes ) { let cubismMoc = null ; const moc = Live2DCubismCore . Moc . fromArrayBuffer ( mocBytes ) ; if ( moc ) { cubismMoc = new CubismMoc ( moc ) ; } return cubismMoc ; } /**
     * Mocデータを削除
     *
     * Mocデータを削除する
     */ public static delete ( moc ) { moc . _moc . _release ( ) ; moc . _moc = null ; moc = null ; } return createModel ( ) { let cubismModel = null ; const model = Live2DCubismCore . Model . fromMoc ( this . _moc ) ; if ( model ) { cubismModel = new CubismModel ( model ) ; cubismModel . initialize ( ) ; ++ this . _modelCount ; } return cubismModel ; } /**
     * モデルを削除する
     */ deleteModel ( model ) { if ( model != null ) { model . release ( ) ; model = null ; -- this . _modelCount ; } } /**
     * コンストラクタ
     */ private constructor ( moc ) { this . _moc = moc ; this . _modelCount = 0 ; } /**
     * デストラクタ相当の処理
     */ public release ( ) { CSM_ASSERT ( this . _modelCount == 0 ) ; this . _moc . _release ( ) ; this . _moc = null ; } _moc : Live2DCubismCore . Moc ; _modelCount : number ; } import * as $ from './cubismmoc' ; export namespace Live2DCubismFramework { export const CubismMoc = $ . CubismMoc ; export type CubismMoc = $ . CubismMoc ; }