Browse Source

more hider work

tags/v0.3.0
big bad waffle 6 years ago
parent
commit
89b87063db
4 changed files with 132 additions and 76 deletions
  1. +17
    -7
      src/client/js/components/lightPatch.js
  2. +5
    -4
      src/client/js/objects/objBase.js
  3. +3
    -6
      src/client/js/objects/objects.js
  4. +107
    -59
      src/server/config/maps/dungeon/map.json

+ 17
- 7
src/client/js/components/lightPatch.js View File

@@ -1,7 +1,7 @@
define([
'js/rendering/renderer',
'picture'
], function(
], function (
renderer,
picture
) {
@@ -15,7 +15,7 @@ define([
patches: [],
rays: [],

init: function(blueprint) {
init: function (blueprint) {
this.blueprint = this.blueprint || {};

var obj = this.obj;
@@ -78,7 +78,7 @@ define([
}
},

update: function() {
update: function () {
var rays = this.rays;
var rLen = rays.length;
for (var i = 0; i < rLen; i++) {
@@ -92,16 +92,26 @@ define([
}
},

destroy: function() {
this.patches.forEach(function(p) {
setVisible: function (visible) {
this.patches.forEach(function (p) {
p.visible = visible;
});

this.rays.forEach(function (r) {
r.visible = visible;
});
},

destroy: function () {
this.patches.forEach(function (p) {
p.parent.removeChild(p);
});
this.patches = [];

this.rays.forEach(function(r) {
this.rays.forEach(function (r) {
r.parent.removeChild(r);
});
this.rays = [];
}
};
});
});

+ 5
- 4
src/client/js/objects/objBase.js View File

@@ -128,15 +128,16 @@ define([
},

setVisible: function (visible) {
this.sprite.visible = visible;
if (this.sprite)
this.sprite.visible = visible;

if (this.nameSprite)
this.nameSprite.visible = ((visible) && (config.showNames));

this.components.forEach(function (c) {
if (c.setVisible)
c.setVisible(visible);
});

if (this.nameSprite)
this.nameSprite.visible = ((visible) && (config.showNames));
},

destroy: function () {


+ 3
- 6
src/client/js/objects/objects.js View File

@@ -171,8 +171,6 @@ define([

if (obj.sheetName) {
obj.sprite = renderer.buildObject(obj);
var isVisible = ((obj.self) || (renderer.sprites[obj.x][obj.y].length > 0));
obj.setVisible(isVisible, this.showNames);
if (template.hidden) {
obj.sprite.visible = false;
if (obj.nameSprite)
@@ -205,10 +203,11 @@ define([
x: (obj.x * scale) + (scale / 2),
y: (obj.y * scale) + scale
});
var isVisible = ((obj.self) || (renderer.sprites[obj.x][obj.y].length > 0));
obj.nameSprite.visible = ((this.showNames) && (isVisible));
}

var isVisible = ((obj.self) || (renderer.sprites[obj.x][obj.y].length > 0));
obj.setVisible(isVisible);

return obj;
},

@@ -365,8 +364,6 @@ define([
var oLen = objects.length;
for (var i = 0; i < oLen; i++) {
var o = objects[i];
if (!o.sprite)
continue;

var onPos = tiles.some(function (t) {
return ((t.x == o.x) && (t.y == o.y));


+ 107
- 59
src/server/config/maps/dungeon/map.json View File

@@ -48,6 +48,22 @@
"x":0,
"y":0
},
{
"x":0,
"y":32
},
{
"x":-8,
"y":32
},
{
"x":-8,
"y":72
},
{
"x":0,
"y":72
},
{
"x":0,
"y":120
@@ -188,6 +204,22 @@
"x":336,
"y":-24
},
{
"x":312,
"y":-24
},
{
"x":312,
"y":-32
},
{
"x":256,
"y":-32
},
{
"x":256,
"y":-24
},
{
"x":232,
"y":-24
@@ -402,11 +434,11 @@
},
{
"x":32,
"y":96
"y":104
},
{
"x":72,
"y":96
"y":104
},
{
"x":72,
@@ -639,62 +671,6 @@
"x":568,
"y":800
},
{
"height":0,
"id":1048,
"name":"",
"polyline":[
{
"x":0,
"y":0
},
{
"x":-104,
"y":0
},
{
"x":-104,
"y":120
},
{
"x":-96,
"y":120
},
{
"x":-96,
"y":128
},
{
"x":-8,
"y":128
},
{
"x":-8,
"y":120
},
{
"x":0,
"y":120
},
{
"x":0,
"y":0
}],
"properties":
{
"discoverable":"1"
},
"propertytypes":
{
"discoverable":"string"
},
"rotation":0,
"type":"",
"visible":true,
"width":0,
"x":256,
"y":672
},
{
"height":0,
"id":1049,
@@ -830,6 +806,78 @@
"width":0,
"x":152,
"y":688
},
{
"height":0,
"id":1053,
"name":"",
"polyline":[
{
"x":0,
"y":0
},
{
"x":-232,
"y":0
},
{
"x":-232,
"y":-24
},
{
"x":-336,
"y":-24
},
{
"x":-336,
"y":96
},
{
"x":-328,
"y":96
},
{
"x":-328,
"y":104
},
{
"x":-240,
"y":104
},
{
"x":-240,
"y":96
},
{
"x":-232,
"y":96
},
{
"x":-232,
"y":80
},
{
"x":0,
"y":80
},
{
"x":0,
"y":0
}],
"properties":
{
"discoverable":"1"
},
"propertytypes":
{
"discoverable":"string"
},
"rotation":0,
"type":"",
"visible":true,
"width":0,
"x":488,
"y":696
}],
"opacity":1,
"type":"objectgroup",
@@ -2127,7 +2175,7 @@
"x":0,
"y":0
}],
"nextobjectid":1050,
"nextobjectid":1054,
"orientation":"orthogonal",
"properties":
{


Loading…
Cancel
Save