Просмотр исходного кода

chore #1754: Upgraded socket.io, jquery and pixijs

tags/v0.10.0^2
Shaun 2 лет назад
Родитель
Сommit
9b3da83503
10 измененных файлов: 535 добавлений и 465 удалений
  1. +1
    -0
      src/client/index.html
  2. +3
    -12
      src/client/js/app.js
  3. +16
    -17
      src/client/js/rendering/renderer.js
  4. +4
    -6
      src/client/js/rendering/shaders/outline.js
  5. +3
    -3
      src/client/package.json
  6. +1
    -1
      src/client/plugins/pixi.particles.js
  7. +1
    -1
      src/client/plugins/pixi.particles.min.js
  8. +1
    -6
      src/client/ui/shared/renderItem.js
  9. +500
    -414
      src/server/package-lock.json
  10. +5
    -5
      src/server/package.json

+ 1
- 0
src/client/index.html Просмотреть файл

@@ -11,6 +11,7 @@
<link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/main.css">
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script> <script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
<script src="js/system/addons.js"></script> <script src="js/system/addons.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/6.1.2/browser/pixi.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="js/app"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="js/app"></script>
<script>if (window.module) module = window.module;</script> <script>if (window.module) module = window.module;</script>
<link rel="icon" href="images/favicon.ico"> <link rel="icon" href="images/favicon.ico">


+ 3
- 12
src/client/js/app.js Просмотреть файл

@@ -2,15 +2,14 @@ require.config({
baseUrl: '', baseUrl: '',
waitSeconds: 120, waitSeconds: 120,
paths: { paths: {
socket: 'https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.slim',
jquery: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.slim.min',
socket: 'https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.3/socket.io.min',
jquery: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min',
text: 'https://cdnjs.cloudflare.com/ajax/libs/require-text/2.0.12/text.min', text: 'https://cdnjs.cloudflare.com/ajax/libs/require-text/2.0.12/text.min',
html: 'plugins/html', html: 'plugins/html',
css: 'https://cdnjs.cloudflare.com/ajax/libs/require-css/0.1.10/css.min', css: 'https://cdnjs.cloudflare.com/ajax/libs/require-css/0.1.10/css.min',
main: 'js/main', main: 'js/main',
helpers: 'js/misc/helpers', helpers: 'js/misc/helpers',
particles: 'plugins/pixi.particles.min',
pixi: 'https://cdnjs.cloudflare.com/ajax/libs/pixi.js/5.1.3/pixi.min',
particles: 'plugins/PIXI.particles.min',
howler: 'https://cdnjs.cloudflare.com/ajax/libs/howler/2.1.3/howler.core.min', howler: 'https://cdnjs.cloudflare.com/ajax/libs/howler/2.1.3/howler.core.min',
longPress: 'plugins/long.press.min' longPress: 'plugins/long.press.min'
}, },
@@ -29,14 +28,6 @@ require.config({
'jquery' 'jquery'
] ]
}, },
pixi: {
exports: 'PIXI'
},
particles: {
deps: [
'pixi'
]
},
main: { main: {
deps: [ deps: [
'helpers', 'helpers',


+ 16
- 17
src/client/js/rendering/renderer.js Просмотреть файл

@@ -21,7 +21,6 @@ define([
globals, globals,
renderLoginBackground renderLoginBackground
) { ) {
let pixi = PIXI;
let mRandom = Math.random.bind(Math); let mRandom = Math.random.bind(Math);


return { return {
@@ -98,11 +97,11 @@ define([


$(this.renderer.view).appendTo('.canvas-container'); $(this.renderer.view).appendTo('.canvas-container');


this.stage = new pixi.Container();
this.stage = new PIXI.Container();


let layers = this.layers; let layers = this.layers;
Object.keys(layers).forEach(l => { Object.keys(layers).forEach(l => {
layers[l] = new pixi.Container();
layers[l] = new PIXI.Container();
layers[l].layer = (l === 'tileSprites') ? 'tiles' : l; layers[l].layer = (l === 'tileSprites') ? 'tiles' : l;


this.stage.addChild(layers[l]); this.stage.addChild(layers[l]);
@@ -112,8 +111,8 @@ define([
const sprites = resources.sprites; const sprites = resources.sprites;


textureList.forEach(t => { textureList.forEach(t => {
this.textures[t] = new pixi.BaseTexture(sprites[t]);
this.textures[t].scaleMode = pixi.SCALE_MODES.NEAREST;
this.textures[t] = new PIXI.BaseTexture(sprites[t]);
this.textures[t].scaleMode = PIXI.SCALE_MODES.NEAREST;
}); });


particles.init({ particles.init({
@@ -128,12 +127,12 @@ define([
buildSpritesTexture: function () { buildSpritesTexture: function () {
const { clientConfig: { atlasTextureDimensions, atlasTextures } } = globals; const { clientConfig: { atlasTextureDimensions, atlasTextures } } = globals;


let container = new pixi.Container();
let container = new PIXI.Container();


let totalHeight = 0; let totalHeight = 0;
atlasTextures.forEach(t => { atlasTextures.forEach(t => {
let texture = this.textures[t]; let texture = this.textures[t];
let tile = new pixi.Sprite(new pixi.Texture(texture));
let tile = new PIXI.Sprite(new PIXI.Texture(texture));
tile.width = texture.width; tile.width = texture.width;
tile.height = texture.height; tile.height = texture.height;
tile.x = 0; tile.x = 0;
@@ -149,11 +148,11 @@ define([
totalHeight += tile.height; totalHeight += tile.height;
}); });


let renderTexture = pixi.RenderTexture.create(this.textures.tiles.width, totalHeight);
let renderTexture = PIXI.RenderTexture.create(this.textures.tiles.width, totalHeight);
this.renderer.render(container, renderTexture); this.renderer.render(container, renderTexture);


this.textures.sprites = renderTexture; this.textures.sprites = renderTexture;
this.textures.scaleMult = pixi.SCALE_MODES.NEAREST;
this.textures.scaleMult = PIXI.SCALE_MODES.NEAREST;
}, },


toggleScreen: function () { toggleScreen: function () {
@@ -213,7 +212,7 @@ define([
if (!cached) { if (!cached) {
let y = ~~(cell / 8); let y = ~~(cell / 8);
let x = cell - (y * 8); let x = cell - (y * 8);
cached = new pixi.Texture(this.textures[baseTex], new pixi.Rectangle(x * size, y * size, size, size));
cached = new PIXI.Texture(this.textures[baseTex], new PIXI.Rectangle(x * size, y * size, size, size));
textureCache[textureName] = cached; textureCache[textureName] = cached;
} }


@@ -222,14 +221,14 @@ define([


clean: function () { clean: function () {
this.stage.removeChild(this.layers.hiders); this.stage.removeChild(this.layers.hiders);
this.layers.hiders = new pixi.Container();
this.layers.hiders = new PIXI.Container();
this.layers.hiders.layer = 'hiders'; this.layers.hiders.layer = 'hiders';
this.stage.addChild(this.layers.hiders); this.stage.addChild(this.layers.hiders);


let container = this.layers.tileSprites; let container = this.layers.tileSprites;
this.stage.removeChild(container); this.stage.removeChild(container);


this.layers.tileSprites = container = new pixi.Container();
this.layers.tileSprites = container = new PIXI.Container();
container.layer = 'tiles'; container.layer = 'tiles';
this.stage.addChild(container); this.stage.addChild(container);


@@ -250,7 +249,7 @@ define([
let alpha = tileOpacity.map(c); let alpha = tileOpacity.map(c);
let canFlip = tileOpacity.canFlip(c); let canFlip = tileOpacity.canFlip(c);


let tile = new pixi.Sprite(this.getTexture('sprites', c));
let tile = new PIXI.Sprite(this.getTexture('sprites', c));


tile.alpha = alpha; tile.alpha = alpha;
tile.position.x = i * scale; tile.position.x = i * scale;
@@ -672,14 +671,14 @@ define([
}, },


buildContainer: function (obj) { buildContainer: function (obj) {
let container = new pixi.Container();
let container = new PIXI.Container();
this.layers[obj.layerName || obj.sheetName].addChild(container); this.layers[obj.layerName || obj.sheetName].addChild(container);


return container; return container;
}, },


buildRectangle: function (obj) { buildRectangle: function (obj) {
let graphics = new pixi.Graphics();
let graphics = new PIXI.Graphics();


let alpha = obj.alpha; let alpha = obj.alpha;
if (obj.has('alpha')) if (obj.has('alpha'))
@@ -716,7 +715,7 @@ define([
buildObject: function (obj) { buildObject: function (obj) {
const { sheetName, parent: container, layerName, visible = true } = obj; const { sheetName, parent: container, layerName, visible = true } = obj;


const sprite = new pixi.Sprite();
const sprite = new PIXI.Sprite();


obj.sprite = sprite; obj.sprite = sprite;


@@ -751,7 +750,7 @@ define([
}, },


buildText: function (obj) { buildText: function (obj) {
let textSprite = new pixi.Text(obj.text, {
let textSprite = new PIXI.Text(obj.text, {
fontFamily: 'bitty', fontFamily: 'bitty',
fontSize: (obj.fontSize || 14), fontSize: (obj.fontSize || 14),
fill: obj.color || 0xF2F5F5, fill: obj.color || 0xF2F5F5,


+ 4
- 6
src/client/js/rendering/shaders/outline.js Просмотреть файл

@@ -1,15 +1,13 @@
define([ define([
'pixi',
'js/rendering/shaders/outline/vert', 'js/rendering/shaders/outline/vert',
'js/rendering/shaders/outline/frag' 'js/rendering/shaders/outline/frag'
], function ( ], function (
pixi,
vert, vert,
frag frag
) { ) {
let OutlineFilter = function (viewWidth, viewHeight, thickness, color) { let OutlineFilter = function (viewWidth, viewHeight, thickness, color) {
thickness = thickness || 1; thickness = thickness || 1;
pixi.Filter.call(this,
PIXI.Filter.call(this,
vert, vert,
frag.replace(/%THICKNESS%/gi, (1.0 / thickness).toFixed(7)) frag.replace(/%THICKNESS%/gi, (1.0 / thickness).toFixed(7))
); );
@@ -23,16 +21,16 @@ define([
this.color = color; this.color = color;
}; };


OutlineFilter.prototype = Object.create(pixi.Filter.prototype);
OutlineFilter.prototype = Object.create(PIXI.Filter.prototype);
OutlineFilter.prototype.constructor = OutlineFilter; OutlineFilter.prototype.constructor = OutlineFilter;


Object.defineProperties(OutlineFilter.prototype, { Object.defineProperties(OutlineFilter.prototype, {
color: { color: {
get: function () { get: function () {
return pixi.utils.rgb2hex(this.uniforms.outlineColor);
return PIXI.utils.rgb2hex(this.uniforms.outlineColor);
}, },
set: function (value) { set: function (value) {
pixi.utils.hex2rgb(value, this.uniforms.outlineColor);
PIXI.utils.hex2rgb(value, this.uniforms.outlineColor);
} }
}, },




+ 3
- 3
src/client/package.json Просмотреть файл

@@ -5,8 +5,8 @@
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"eslint": "^7.12.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-requirejs": "^4.0.0"
"eslint": "^7.32.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-requirejs": "^4.0.1"
} }
} }

+ 1
- 1
src/client/plugins/pixi.particles.js Просмотреть файл

@@ -688,7 +688,7 @@ if (!Array.prototype.random) {
let i; let i;
for (i = art.length; i >= 0; --i) { for (i = art.length; i >= 0; --i) {
if (typeof art[i] === 'string') if (typeof art[i] === 'string')
art[i] = PIXI.Texture.fromImage(art[i]);
art[i] = PIXI.Texture.from(art[i]);
} }
//particles from different base textures will be slower in WebGL than if they //particles from different base textures will be slower in WebGL than if they
//were from one spritesheet //were from one spritesheet


+ 1
- 1
src/client/plugins/pixi.particles.min.js
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 1
- 6
src/client/ui/shared/renderItem.js Просмотреть файл

@@ -125,17 +125,12 @@ define([
} }


let size = 64; let size = 64;
let margin = '0px';


if (item.type === 'skin') {
if (item.type === 'skin')
size = 8; size = 8;
margin = '16px';
}


if (item.spriteSize) if (item.spriteSize)
size = item.spriteSize; size = item.spriteSize;
if (item.spriteMargin)
margin = item.margin;


if (spriteSizes[spritesheet]) if (spriteSizes[spritesheet])
size = spriteSizes[spritesheet]; size = spriteSizes[spritesheet];


+ 500
- 414
src/server/package-lock.json
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 5
- 5
src/server/package.json Просмотреть файл

@@ -8,16 +8,16 @@
"compression": "^1.7.4", "compression": "^1.7.4",
"express": "^4.17.1", "express": "^4.17.1",
"express-minify": "^1.0.0", "express-minify": "^1.0.0",
"image-size": "^0.9.2",
"image-size": "^1.0.0",
"rethinkdbdash": "^2.3.31", "rethinkdbdash": "^2.3.31",
"socket.io": "^2.4.1",
"socket.io": "^4.1.3",
"universal-analytics": "^0.4.23" "universal-analytics": "^0.4.23"
}, },
"devDependencies": { "devDependencies": {
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"eslint": "^7.12.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint": "^7.32.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-requirejs": "^4.0.1", "eslint-plugin-requirejs": "^4.0.1",
"sqlite3": "^5.0.0"
"sqlite3": "^5.0.2"
} }
} }

Загрузка…
Отмена
Сохранить