diff --git a/www/mods/_multiplayer/hostMenu.js b/www/mods/_multiplayer/hostMenu.js index 1ecfc8e8..b86a5dd7 100644 --- a/www/mods/_multiplayer/hostMenu.js +++ b/www/mods/_multiplayer/hostMenu.js @@ -29,9 +29,15 @@ MATTIE.scenes.multiplayer.host.prototype.create = function () { MATTIE.multiplayer.hostController.open(); this.addPlayerListWindow(); this.addOptionsBtns(); + this.addPeerDisplayWindow(); + const loadingAnimInterval = setInterval(() => { + this.animateTick(); + }, 500); + MATTIE.multiplayer.hostController.self.on('open', () => { - this.addPeerDisplayWindow(); this.initListController(); + clearInterval(loadingAnimInterval); + this.showHideCode(true); }); }; @@ -67,11 +73,17 @@ MATTIE.scenes.multiplayer.host.prototype.showHideCode = function (hidden) { if (this._peerWindow) this._peerWindow.updateText(text); }; +MATTIE.scenes.multiplayer.host.prototype.animateTick = function () { + const text = this._peerWindow.text; + text[1] = text[1].endsWith('...') ? text[1].replace('...', '') : `${text[1]}.`; + + if (this._peerWindow) this._peerWindow.updateText(text); +}; + MATTIE.scenes.multiplayer.host.prototype.addPeerDisplayWindow = function () { const text = [ 'People can join using this number:', - '*'.repeat(MATTIE.multiplayer.hostController.peerId.length), - + 'Please wait for connection to broker', ]; this._peerWindow = new MATTIE.windows.TextDisplay((Graphics.boxWidth - 600) / 2 + 100, 0, 600, 100, text); this.addWindow(this._peerWindow); diff --git a/www/mods/commonLibs/_common/menus/windows.js b/www/mods/commonLibs/_common/menus/windows.js index 14512709..720c328b 100644 --- a/www/mods/commonLibs/_common/menus/windows.js +++ b/www/mods/commonLibs/_common/menus/windows.js @@ -71,6 +71,7 @@ MATTIE.windows.TextDisplay.prototype = Object.create(Window_Base.prototype); MATTIE.windows.TextDisplay.prototype.constructor = MATTIE.windows.TextDisplay; MATTIE.windows.TextDisplay.prototype.initialize = function (x, y, width, height, text) { + this.text = text; Window_Base.prototype.initialize.call(this, x, y, width, height); this.mattieWidth = width; this.resetTextColor(); @@ -90,6 +91,7 @@ MATTIE.windows.TextDisplay.prototype.updatePlacement = function (xOffset = 0, yO MATTIE.windows.TextDisplay.prototype.updateText = function (text) { this.contents.clear(); + this.text = text; if (typeof text === typeof 'string') { text += '\n'; text = text.split('\n');