mirror of
https://github.com/photonstorm/phaser
synced 2024-11-21 20:23:19 +00:00
Merge pull request #5766 from xiamidaxia/scenePlugins
Spine plugin multiple game instances support
This commit is contained in:
commit
9cfbe65bfa
2 changed files with 9 additions and 8 deletions
|
@ -15,8 +15,6 @@ var SpineGameObject = require('./gameobject/SpineGameObject');
|
|||
var SpineContainer = require('./container/SpineContainer');
|
||||
var NOOP = require('../../../src/utils/NOOP');
|
||||
|
||||
// Plugin specific instance of the Spine Scene Renderer
|
||||
var sceneRenderer;
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
|
@ -463,14 +461,15 @@ var SpinePlugin = new Class({
|
|||
}
|
||||
};
|
||||
|
||||
if (!sceneRenderer)
|
||||
{
|
||||
var sceneRenderer = this.renderer.spineSceneRenderer;
|
||||
if (!sceneRenderer) {
|
||||
sceneRenderer = new Spine.webgl.SceneRenderer(this.renderer.canvas, this.gl, true);
|
||||
sceneRenderer.batcher.setBlendMode = setBlendMode;
|
||||
sceneRenderer.shapes.setBlendMode = setBlendMode;
|
||||
this.renderer.spineSceneRenderer = sceneRenderer;
|
||||
}
|
||||
|
||||
// All share the same instance
|
||||
// All scene share the same instance
|
||||
this.sceneRenderer = sceneRenderer;
|
||||
this.skeletonRenderer = sceneRenderer.skeletonRenderer;
|
||||
this.skeletonDebugRenderer = sceneRenderer.skeletonDebugRenderer;
|
||||
|
@ -1136,12 +1135,13 @@ var SpinePlugin = new Class({
|
|||
|
||||
this.pluginManager = null;
|
||||
|
||||
var sceneRenderer = this.renderer.spineSceneRenderer;
|
||||
|
||||
if (sceneRenderer)
|
||||
{
|
||||
sceneRenderer.dispose();
|
||||
sceneRenderer = null;
|
||||
}
|
||||
|
||||
this.renderer.spineSceneRenderer = null;
|
||||
this.sceneRenderer = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,8 @@ var PluginManager = new Class({
|
|||
{
|
||||
// Plugin is freshly loaded
|
||||
PluginCache.register(key, plugin, mapping, true);
|
||||
|
||||
}
|
||||
if (this.scenePlugins.indexOf(key) === -1) {
|
||||
this.scenePlugins.push(key);
|
||||
}
|
||||
else if (!fromLoader && PluginCache.hasCore(key))
|
||||
|
|
Loading…
Reference in a new issue