mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
non working layers
This commit is contained in:
parent
57135f3acc
commit
222fd09f3f
7 changed files with 58 additions and 30 deletions
|
|
@ -3,12 +3,14 @@ define([
|
|||
"Game/Config/Settings",
|
||||
"Lib/Utilities/NotificationCenter",
|
||||
"Lib/Utilities/Exception",
|
||||
"Lib/Utilities/ColorConverter"
|
||||
"Lib/Utilities/ColorConverter",
|
||||
"Game/Client/View/Abstract/Layer",
|
||||
],
|
||||
|
||||
function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||
function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
|
||||
|
||||
function Doll(physicsEngine, uid, player) {
|
||||
function Doll(physicsEngine, uid, player) {
|
||||
this.layerId = Layer.ID.SPAWN;
|
||||
this.animationDef = {
|
||||
"stand": [1,1],
|
||||
"walk": [2,28],
|
||||
|
|
@ -46,11 +48,13 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
if(this.animatedMeshes[this.actionState]) {
|
||||
Nc.trigger(
|
||||
Nc.ns.client.view.mesh.update,
|
||||
this.layerId,
|
||||
this.animatedMeshesContainer.withArms[this.actionState],
|
||||
{ visible: false }
|
||||
);
|
||||
Nc.trigger(
|
||||
Nc.ns.client.view.mesh.update,
|
||||
this.layerId,
|
||||
this.animatedMeshesContainer.withoutArms[this.actionState],
|
||||
{ visible: false }
|
||||
);
|
||||
|
|
@ -60,6 +64,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
|
||||
Nc.trigger(
|
||||
Nc.ns.client.view.mesh.update,
|
||||
this.layerId,
|
||||
this.animatedMeshes[this.actionState],
|
||||
{
|
||||
visible: true,
|
||||
|
|
@ -73,7 +78,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
var self = this;
|
||||
|
||||
var setShirtColor = function (mesh) {
|
||||
Nc.trigger(Nc.ns.client.view.mesh.addFilter, mesh, 'colorRangeReplace', {
|
||||
Nc.trigger(Nc.ns.client.view.mesh.addFilter, self.layerId, mesh, 'colorRangeReplace', {
|
||||
minColor: 0x3b4a31,
|
||||
maxColor: 0x657f54,
|
||||
newColor: self.primaryColor,
|
||||
|
|
@ -112,12 +117,12 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
|
||||
var callback = function(mesh) {
|
||||
self.animatedMeshesContainer[arm][key] = mesh;
|
||||
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
||||
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh);
|
||||
|
||||
setShirtColor(mesh);
|
||||
};
|
||||
|
||||
Nc.trigger(Nc.ns.client.view.animatedMesh.create, texturePaths, callback, {
|
||||
Nc.trigger(Nc.ns.client.view.animatedMesh.create, this.layerId, texturePaths, callback, {
|
||||
visible: false,
|
||||
pivot: {
|
||||
x: 35/2 * 4,
|
||||
|
|
@ -135,9 +140,9 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
var texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/head.png";
|
||||
var callback = function (mesh) {
|
||||
self.headMesh = mesh;
|
||||
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
||||
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh);
|
||||
}
|
||||
Nc.trigger(Nc.ns.client.view.mesh.create, texturePath, callback, {
|
||||
Nc.trigger(Nc.ns.client.view.mesh.create, this.layerId, texturePath, callback, {
|
||||
pivot: {
|
||||
x: 5,
|
||||
y: 12
|
||||
|
|
@ -151,11 +156,10 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/holdingArm.png";
|
||||
var callback = function (mesh) {
|
||||
self.holdingArmMesh = mesh;
|
||||
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
||||
|
||||
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh);
|
||||
setShirtColor(mesh);
|
||||
}
|
||||
Nc.trigger(Nc.ns.client.view.mesh.create, texturePath, callback, {
|
||||
Nc.trigger(Nc.ns.client.view.mesh.create, this.layerId, texturePath, callback, {
|
||||
visible: false,
|
||||
pivot: {
|
||||
x: 35/2 * 4,
|
||||
|
|
@ -175,6 +179,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
if(oldLookDirection != this.lookDirection) {
|
||||
for(var key in this.animatedMeshes) {
|
||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||
this.layerId,
|
||||
this.animatedMeshes[key],
|
||||
{
|
||||
xScale: this.lookDirection
|
||||
|
|
@ -183,6 +188,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
}
|
||||
|
||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||
this.layerId,
|
||||
this.holdingArmMesh,
|
||||
{
|
||||
xScale: this.lookDirection
|
||||
|
|
@ -193,6 +199,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
var angle = Math.atan2(this.lookAtXY.x, this.lookAtXY.y) / 2 - 0.7855 * this.lookDirection; // 0.7855 = 45°
|
||||
|
||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||
this.layerId,
|
||||
this.headMesh,
|
||||
{
|
||||
xScale: this.lookDirection,
|
||||
|
|
@ -205,22 +212,22 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
Parent.prototype.grab.call(this, item);
|
||||
this.animatedMeshes = this.animatedMeshesContainer.withoutArms;
|
||||
this.setActionState(this.actionState, true);
|
||||
Nc.trigger(Nc.ns.client.view.mesh.update, this.holdingArmMesh, { visible: true });
|
||||
Nc.trigger(Nc.ns.client.view.mesh.update, this.layerId, this.holdingArmMesh, { visible: true });
|
||||
};
|
||||
|
||||
Doll.prototype.throw = function(item, x, y) {
|
||||
Parent.prototype.throw.call(this, item, x, y);
|
||||
this.animatedMeshes = this.animatedMeshesContainer.withArms;
|
||||
this.setActionState(this.actionState, true);
|
||||
Nc.trigger(Nc.ns.client.view.mesh.update, this.holdingArmMesh, { visible: false });
|
||||
Nc.trigger(Nc.ns.client.view.mesh.update, this.layerId, this.holdingArmMesh, { visible: false });
|
||||
};
|
||||
|
||||
Doll.prototype.destroy = function () {
|
||||
for (var key in this.animatedMeshes) {
|
||||
Nc.trigger(Nc.ns.client.view.mesh.remove, this.animatedMeshes[key]);
|
||||
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.animatedMeshes[key]);
|
||||
}
|
||||
|
||||
Nc.trigger(Nc.ns.client.view.mesh.remove, this.headMesh);
|
||||
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.headMesh);
|
||||
|
||||
Parent.prototype.destroy.call(this);
|
||||
}
|
||||
|
|
@ -228,6 +235,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
Doll.prototype.render = function() {
|
||||
if(this.actionState) {
|
||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||
this.layerId,
|
||||
this.animatedMeshes[this.actionState],
|
||||
{
|
||||
x: this.body.GetPosition().x * Settings.RATIO,
|
||||
|
|
@ -237,6 +245,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
);
|
||||
|
||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||
this.layerId,
|
||||
this.headMesh,
|
||||
{
|
||||
x: this.body.GetPosition().x * Settings.RATIO,
|
||||
|
|
@ -245,6 +254,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
|||
)
|
||||
|
||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||
this.layerId,
|
||||
this.holdingArmMesh,
|
||||
{
|
||||
x: this.body.GetPosition().x * Settings.RATIO,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue