當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript babylonjs.Observable類代碼示例

本文整理匯總了TypeScript中babylonjs.Observable的典型用法代碼示例。如果您正苦於以下問題:TypeScript Observable類的具體用法?TypeScript Observable怎麽用?TypeScript Observable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Observable類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: dispose

    /**
     * dispose the manager and all of its associated viewers
     */
    public dispose() {
        delete this._onViewerAdded;

        for (let id in this._viewers) {
            this._viewers[id].dispose();
        }

        this.onViewerAddedObservable.clear();
        this.onViewerRemovedObservable.clear();
    }
開發者ID:Palmer-JC,項目名稱:Babylon.js,代碼行數:13,代碼來源:viewerManager.ts

示例2: dispose

 dispose() {
     this.onSceneInitObservable.clear();
     this.onEngineInitObservable.clear();
     this.onModelLoadedObservable.clear();
     this.onModelLoadProgressObservable.clear();
     this.onModelLoadErrorObservable.clear();
     this.onModelAddedObservable.clear();
     this.onModelRemovedObservable.clear();
     this.onViewerInitDoneObservable.clear();
     this.onLoaderInitObservable.clear();
     this.onFrameRenderedObservable.clear();
 }
開發者ID:NasimiAsl,項目名稱:Babylon.js,代碼行數:12,代碼來源:observablesManager.ts

示例3: Promise

 return new Promise((resolve, reject) => {
     let localViewer = this.getViewerById(id)
     if (localViewer) {
         return resolve(localViewer);
     }
     let viewerFunction = (viewer: AbstractViewer) => {
         if (viewer.getBaseId() === id) {
             resolve(viewer);
             this.onViewerAddedObservable.removeCallback(viewerFunction);
         }
     }
     this.onViewerAddedObservable.add(viewerFunction);
 });
開發者ID:nicolas-obre,項目名稱:Babylon.js,代碼行數:13,代碼來源:viewerManager.ts

示例4: GroupModelAnimation

        this.loader = SceneLoader.ImportMesh(undefined, base, filename, this._scene, (meshes, particleSystems, skeletons) => {
            meshes.forEach(mesh => {
                Tags.AddTagsTo(mesh, "viewerMesh");
            });
            this.meshes = meshes;
            this.particleSystems = particleSystems;
            this.skeletons = skeletons;

            // check if this is a gltf loader and load the animations
            if (this.loader.name === 'gltf') {
                this._scene.animationGroups.forEach(ag => {
                    // add animations that didn't exist before
                    if (animationsArray.indexOf(ag) === -1) {
                        this._animations.push(new GroupModelAnimation(ag));
                    }
                })
            } else {
                skeletons.forEach((skeleton, idx) => {
                    let ag = new BABYLON.AnimationGroup("animation-" + idx, this._scene);
                    skeleton.getAnimatables().forEach(a => {
                        if (a.animations[0]) {
                            ag.addTargetedAnimation(a.animations[0], a);
                        }
                    });
                    this._animations.push(new GroupModelAnimation(ag));
                });
            }

            if (this._modelConfiguration.animation) {
                if (this._modelConfiguration.animation.playOnce) {
                    this._animations.forEach(a => {
                        a.playMode = AnimationPlayMode.ONCE;
                    });
                }
                if (this._modelConfiguration.animation.autoStart && this._animations.length) {
                    let animationName = this._modelConfiguration.animation.autoStart === true ?
                        this._animations[0].name : this._modelConfiguration.animation.autoStart;
                    this.playAnimation(animationName);
                }
            }

            this.onLoadedObservable.notifyObserversWithPromise(this);
        }, (progressEvent) => {
開發者ID:nicolas-obre,項目名稱:Babylon.js,代碼行數:43,代碼來源:viewerModel.ts

示例5:

 }, (e, m, exception) => {
     this.onLoadErrorObservable.notifyObserversWithPromise({ message: m, exception: exception });
 }, plugin)!;
開發者ID:nicolas-obre,項目名稱:Babylon.js,代碼行數:3,代碼來源:viewerModel.ts

示例6: _onViewerAdded

 private _onViewerAdded(viewer: AbstractViewer) {
     this.onViewerAdded && this.onViewerAdded(viewer);
     this.onViewerAddedObservable.notifyObservers(viewer);
 }
開發者ID:nicolas-obre,項目名稱:Babylon.js,代碼行數:4,代碼來源:viewerManager.ts

示例7: resolve

 let viewerFunction = (viewer: AbstractViewer) => {
     if (viewer.getBaseId() === id) {
         resolve(viewer);
         this.onViewerAddedObservable.removeCallback(viewerFunction);
     }
 }
開發者ID:nicolas-obre,項目名稱:Babylon.js,代碼行數:6,代碼來源:viewerManager.ts

示例8: removeViewer

 /**
  * remove a viewer from the viewer manager
  * @param viewer the viewer to remove
  */
 public removeViewer(viewer: AbstractViewer) {
     let id = viewer.getBaseId();
     delete this._viewers[id];
     this.onViewerRemovedObservable.notifyObservers(id);
 }
開發者ID:Palmer-JC,項目名稱:Babylon.js,代碼行數:9,代碼來源:viewerManager.ts


注:本文中的babylonjs.Observable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。