mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
layer bugfixing
This commit is contained in:
parent
d29c64385d
commit
1d3ad16a07
9 changed files with 56 additions and 9 deletions
|
|
@ -14,6 +14,8 @@ function (Abstract, DomController, Settings, Exception, Nc) {
|
|||
this.debugMode = false;
|
||||
|
||||
this.ncTokens = [
|
||||
Nc.on(Nc.ns.client.view.layer.createAndAdd, this.createLayer, this),
|
||||
|
||||
Nc.on(Nc.ns.client.view.mesh.create, this.createMesh, this),
|
||||
Nc.on(Nc.ns.client.view.animatedMesh.create, this.createAnimatedMesh, this),
|
||||
Nc.on(Nc.ns.client.view.mesh.add, this.addMesh, this),
|
||||
|
|
@ -41,6 +43,7 @@ function (Abstract, DomController, Settings, Exception, Nc) {
|
|||
}
|
||||
|
||||
Abstract.prototype.addMethod.call(AbstractView, 'render');
|
||||
Abstract.prototype.addMethod.call(AbstractView, 'createAndAddLayer', ['name']);
|
||||
Abstract.prototype.addMethod.call(AbstractView, 'createMesh', ['texturePath', 'callback', 'options']);
|
||||
Abstract.prototype.addMethod.call(AbstractView, 'createAnimatedMesh', ['texturePaths', 'callback', 'options']);
|
||||
Abstract.prototype.addMethod.call(AbstractView, 'addMesh', ['mesh']);
|
||||
|
|
|
|||
18
app/Game/Client/View/Views/Pixi/Layer.js
Normal file
18
app/Game/Client/View/Views/Pixi/Layer.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
define([
|
||||
"Lib/Vendor/Pixi",
|
||||
],
|
||||
|
||||
function (PIXI) {
|
||||
|
||||
function Layer (name, parallax) {
|
||||
this.name = name;
|
||||
this.container = new PIXI.DisplayObjectContainer();
|
||||
this.parallax = parallax;
|
||||
}
|
||||
|
||||
Layer.prototype.getContainer = function() {
|
||||
return this.container;
|
||||
};
|
||||
|
||||
return Layer;
|
||||
});
|
||||
|
|
@ -6,10 +6,11 @@ define([
|
|||
"Game/Config/Settings",
|
||||
"Lib/Utilities/NotificationCenter",
|
||||
"Lib/Utilities/Exception",
|
||||
"Game/Client/View/Views/Pixi/GameStats"
|
||||
"Game/Client/View/Views/Pixi/GameStats",
|
||||
"Game/Client/View/Views/Pixi/Layer"
|
||||
],
|
||||
|
||||
function (Parent, DomController, PIXI, ColorRangeReplaceFilter, Settings, Nc, Exception, GameStats) {
|
||||
function (Parent, DomController, PIXI, ColorRangeReplaceFilter, Settings, Nc, Exception, GameStats, Layer) {
|
||||
|
||||
var AVAILABLE_MESH_FILTERS = {
|
||||
"blur": PIXI.BlurFilter,
|
||||
|
|
@ -32,6 +33,7 @@ function (Parent, DomController, PIXI, ColorRangeReplaceFilter, Settings, Nc, Ex
|
|||
this.init();
|
||||
this.pixi = PIXI;
|
||||
this.currentZoom = Settings.ZOOM_DEFAULT;
|
||||
this.layers = [];
|
||||
|
||||
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST;
|
||||
}
|
||||
|
|
@ -72,6 +74,15 @@ function (Parent, DomController, PIXI, ColorRangeReplaceFilter, Settings, Nc, Ex
|
|||
this.renderer.render(this.stage);
|
||||
}
|
||||
|
||||
// Layers
|
||||
|
||||
PixiView.prototype.createAndAddLayer = function(name) {
|
||||
|
||||
var layer = new Layer(name, 1);
|
||||
this.layers.push(layer);
|
||||
this.stage.addChild(layer.getContainer());
|
||||
};
|
||||
|
||||
// Meshes
|
||||
|
||||
PixiView.prototype.addMesh = function(mesh) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue