Browse Source

modding[#1498]: added the ability for mods to define custom login background renderers

tags/v0.8.0
Shaun 3 years ago
parent
commit
d59e640213
2 changed files with 25 additions and 1 deletions
  1. +24
    -1
      src/client/js/rendering/renderLoginBackground.js
  2. +1
    -0
      src/server/config/clientConfig.js

+ 24
- 1
src/client/js/rendering/renderLoginBackground.js View File

@@ -1,10 +1,33 @@
define([
'js/system/globals'
], function (
globals
) {
let mRandom = Math.random.bind(Math);

let customRenderer = null;

const renderCustomLoginBg = async (renderer, path) => {
if (!customRenderer) {
await (new Promise(res => {
require([path], loadedModule => {
customRenderer = loadedModule;
res();
});
}));
}

customRenderer(renderer);
};

const renderLoginBackground = renderer => {
const { loginBgGeneratorPath } = globals.clientConfig;
if (loginBgGeneratorPath) {
renderCustomLoginBg(renderer, loginBgGeneratorPath);

return;
}

const { width, height, layers } = renderer;

renderer.setPosition({


+ 1
- 0
src/server/config/clientConfig.js View File

@@ -5,6 +5,7 @@ const tos = require('./tos');

const config = {
logoPath: null,
loginBgGeneratorPath: null,
resourceList: [],
textureList: [
'tiles',


Loading…
Cancel
Save