mirror of
https://github.com/lubosz/overte.git
synced 2025-04-09 14:34:02 +02:00
removed startup/unload apis from the 3 main modules
This commit is contained in:
parent
d316f014eb
commit
79b7271729
5 changed files with 56 additions and 97 deletions
|
@ -388,11 +388,13 @@ function playPopAnimation() {
|
|||
var emojiCodeMap;
|
||||
var customEmojiCodeMap;
|
||||
var signalsConnected = false;
|
||||
function init() {
|
||||
var _this;
|
||||
function startup() {
|
||||
// make a map of just the utf codes to help with accesing
|
||||
emojiCodeMap = emojiList.reduce(function (codeMap, currentEmojiInList, index) {
|
||||
if (
|
||||
currentEmojiInList &&
|
||||
|
||||
currentEmojiInList.code &&
|
||||
currentEmojiInList.code.length > 0 &&
|
||||
currentEmojiInList.code[UTF_CODE]) {
|
||||
|
@ -414,9 +416,22 @@ function init() {
|
|||
|
||||
pruneOldAvimojis();
|
||||
|
||||
Script.scriptEnding.connect(unload);
|
||||
Window.domainChanged.connect(onDomainChanged);
|
||||
MyAvatar.scaleChanged.connect(onScaleChanged);
|
||||
signalsConnected = true;
|
||||
|
||||
function AviMoji() {
|
||||
_this = this;
|
||||
this._avimojiQMLWindow;
|
||||
}
|
||||
|
||||
AviMoji.prototype = {
|
||||
addEmoji: addEmojiFromQML,
|
||||
registerAvimojiQMLWindow: registerAvimojiQMLWindow
|
||||
};
|
||||
|
||||
return new AviMoji();
|
||||
}
|
||||
|
||||
|
||||
|
@ -440,12 +455,6 @@ function init() {
|
|||
// *************************************
|
||||
// #region API
|
||||
|
||||
var _this;
|
||||
function AviMoji() {
|
||||
_this = this;
|
||||
this._avimojiQMLWindow;
|
||||
}
|
||||
|
||||
function registerAvimojiQMLWindow(avimojiQMLWindow) {
|
||||
this._avimojiQMLWindow = avimojiQMLWindow;
|
||||
}
|
||||
|
@ -471,17 +480,7 @@ function unload() {
|
|||
}
|
||||
}
|
||||
|
||||
function startup() {
|
||||
init();
|
||||
}
|
||||
|
||||
AviMoji.prototype = {
|
||||
startup: startup,
|
||||
addEmoji: addEmojiFromQML,
|
||||
unload: unload,
|
||||
registerAvimojiQMLWindow: registerAvimojiQMLWindow
|
||||
};
|
||||
|
||||
var AviMoji = startup();
|
||||
|
||||
module.exports = AviMoji;
|
||||
|
||||
|
|
|
@ -544,8 +544,7 @@ function onDisplayModeChanged(isHMDMode) {
|
|||
}
|
||||
|
||||
|
||||
var EmojiAPI = Script.require("./emojiApp/simplifiedEmoji.js");
|
||||
var emojiAPI = new EmojiAPI();
|
||||
var emojiAPI = Script.require("./emojiApp/simplifiedEmoji.js");
|
||||
var keyPressSignalsConnected = false;
|
||||
var emojiCodeMap;
|
||||
var customEmojiCodeMap;
|
||||
|
@ -578,7 +577,6 @@ function init() {
|
|||
Window.minimizedChanged.connect(onWindowMinimizedChanged);
|
||||
Window.geometryChanged.connect(onGeometryChanged);
|
||||
HMD.displayModeChanged.connect(onDisplayModeChanged);
|
||||
emojiAPI.startup();
|
||||
|
||||
getSounds();
|
||||
handleEmoteIndicatorVisibleChanged(true);
|
||||
|
@ -586,11 +584,11 @@ function init() {
|
|||
Controller.keyPressEvent.connect(keyPressHandler);
|
||||
Controller.keyReleaseEvent.connect(keyReleaseHandler);
|
||||
keyPressSignalsConnected = true;
|
||||
|
||||
Script.scriptEnding.connect(unload);
|
||||
}
|
||||
|
||||
|
||||
function shutdown() {
|
||||
function unload() {
|
||||
if (emoteAppBarWindow) {
|
||||
emoteAppBarWindow.fromQml.disconnect(onMessageFromEmoteAppBar);
|
||||
emoteAppBarWindow.close();
|
||||
|
@ -605,7 +603,6 @@ function shutdown() {
|
|||
endReactionWrapper(react);
|
||||
});
|
||||
|
||||
emojiAPI.unload();
|
||||
maybeClearClapSoundInterval();
|
||||
maybeClearReticleUpdateLimiterTimeout();
|
||||
maybeDeleteRemoteIndicatorTimeout();
|
||||
|
@ -758,37 +755,4 @@ function toggleEmojiApp() {
|
|||
// END EMOJI
|
||||
// *************************************
|
||||
|
||||
// *************************************
|
||||
// START API
|
||||
// *************************************
|
||||
// #region API
|
||||
|
||||
|
||||
function startup() {
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
function unload() {
|
||||
shutdown();
|
||||
}
|
||||
|
||||
var _this;
|
||||
function EmoteBar() {
|
||||
_this = this;
|
||||
}
|
||||
|
||||
|
||||
EmoteBar.prototype = {
|
||||
startup: startup,
|
||||
unload: unload
|
||||
};
|
||||
|
||||
module.exports = EmoteBar;
|
||||
|
||||
|
||||
// #endregion
|
||||
// *************************************
|
||||
// END API
|
||||
// *************************************
|
||||
|
||||
init();
|
|
@ -47,15 +47,24 @@ function onAvatarAdded(uuid) {
|
|||
}
|
||||
|
||||
|
||||
// Called on init
|
||||
// Create a new nametag list manager, connect signals, and return back a new Nametag object.
|
||||
var avatarNametagMode;
|
||||
function startup() {
|
||||
nameTagListManager.create();
|
||||
handleAvatarNametagMode(Settings.getValue("simplifiedNametag/avatarNametagMode", "on"));
|
||||
|
||||
Script.scriptEnding.connect(unload);
|
||||
Window.domainChanged.connect(onDomainChange);
|
||||
AvatarManager.avatarRemovedEvent.connect(onAvatarRemoved);
|
||||
AvatarManager.avatarAddedEvent.connect(onAvatarAdded);
|
||||
|
||||
function NameTag() {}
|
||||
|
||||
NameTag.prototype = {
|
||||
handleAvatarNametagMode: handleAvatarNametagMode
|
||||
};
|
||||
|
||||
return new NameTag();
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,15 +91,10 @@ function handleAvatarNametagMode(newAvatarNameTagMode) {
|
|||
// *************************************
|
||||
// #region api
|
||||
|
||||
function NameTag() {}
|
||||
|
||||
NameTag.prototype = {
|
||||
startup: startup,
|
||||
unload: unload,
|
||||
handleAvatarNametagMode: handleAvatarNametagMode
|
||||
};
|
||||
var nameTag = startup();
|
||||
|
||||
module.exports = NameTag;
|
||||
module.exports = nameTag;
|
||||
|
||||
|
||||
// #endregion
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
|
||||
function simplifiedStatusIndicator(properties) {
|
||||
function SimplifiedStatusIndicator() {
|
||||
var that = this;
|
||||
var DEBUG = false;
|
||||
|
||||
|
@ -125,6 +125,16 @@ function simplifiedStatusIndicator(properties) {
|
|||
|
||||
// #region SIGNALS
|
||||
|
||||
function updateProperties(properties) {
|
||||
// Overwrite with the given properties
|
||||
var overwriteableKeys = ["statusChanged"];
|
||||
Object.keys(properties).forEach(function (key) {
|
||||
if (overwriteableKeys.indexOf(key) > -1) {
|
||||
that[key] = properties[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var currentStatus = "available"; // Default is available
|
||||
function toggleStatus() {
|
||||
if (currentStatus === "busy") {
|
||||
|
@ -207,6 +217,8 @@ function simplifiedStatusIndicator(properties) {
|
|||
Window.domainChanged.connect(onDomainChanged);
|
||||
|
||||
getStatus(setStatus);
|
||||
|
||||
Script.scriptEnding.connect(unload);
|
||||
}
|
||||
|
||||
|
||||
|
@ -224,20 +236,13 @@ function simplifiedStatusIndicator(properties) {
|
|||
|
||||
// #endregion APP LIFETIME
|
||||
|
||||
that.startup = startup;
|
||||
that.unload = unload;
|
||||
that.toggleStatus = toggleStatus;
|
||||
that.setStatus = setStatus;
|
||||
that.getLocalStatus = getLocalStatus;
|
||||
that.statusChanged = statusChanged;
|
||||
|
||||
// Overwrite with the given properties
|
||||
var overwriteableKeys = ["statusChanged"];
|
||||
Object.keys(properties).forEach(function (key) {
|
||||
if (overwriteableKeys.indexOf(key) > -1) {
|
||||
that[key] = properties[key];
|
||||
}
|
||||
});
|
||||
that.updateProperties = updateProperties;
|
||||
|
||||
startup();
|
||||
}
|
||||
|
||||
module.exports = simplifiedStatusIndicator;
|
||||
module.exports = new SimplifiedStatusIndicator();
|
|
@ -583,12 +583,11 @@ function restoreLODSettings() {
|
|||
}
|
||||
|
||||
|
||||
var SimplifiedNametag = Script.require("./simplifiedNametag/simplifiedNametag.js?" + Date.now());
|
||||
var SimplifiedStatusIndicator = Script.require("./simplifiedStatusIndicator/simplifiedStatusIndicator.js?" + Date.now());
|
||||
var SimplifiedEmote = Script.require("../simplifiedEmote/simplifiedEmote.js?" + Date.now());
|
||||
var si;
|
||||
var nametag;
|
||||
var emote;
|
||||
var nametag = Script.require("./simplifiedNametag/simplifiedNametag.js?" + Date.now());
|
||||
var si = Script.require("./simplifiedStatusIndicator/simplifiedStatusIndicator.js?" + Date.now())
|
||||
var emote = Script.require("../simplifiedEmote/simplifiedEmote.js?" + Date.now());
|
||||
// var nametag;
|
||||
// var emote;
|
||||
var oldShowAudioTools;
|
||||
var oldShowBubbleTools;
|
||||
var keepExistingUIAndScriptsSetting = Settings.getValue("simplifiedUI/keepExistingUIAndScripts", false);
|
||||
|
@ -607,16 +606,8 @@ function startup() {
|
|||
|
||||
loadSimplifiedTopBar();
|
||||
|
||||
si = new SimplifiedStatusIndicator({
|
||||
statusChanged: onStatusChanged
|
||||
});
|
||||
si.startup();
|
||||
|
||||
nametag = new SimplifiedNametag();
|
||||
nametag.startup();
|
||||
|
||||
emote = new SimplifiedEmote();
|
||||
emote.startup();
|
||||
si.updateProperties({ statusChanged: onStatusChanged });
|
||||
|
||||
updateInputDeviceMutedOverlay(Audio.muted);
|
||||
updateOutputDeviceMutedOverlay(isOutputMuted());
|
||||
|
@ -665,10 +656,6 @@ function shutdown() {
|
|||
maybeDeleteInputDeviceMutedOverlay();
|
||||
maybeDeleteOutputDeviceMutedOverlay();
|
||||
|
||||
nametag.unload();
|
||||
si.unload();
|
||||
emote.unload();
|
||||
|
||||
Audio.mutedDesktopChanged.disconnect(onDesktopInputDeviceMutedChanged);
|
||||
Audio.mutedHMDChanged.disconnect(onHMDInputDeviceMutedChanged);
|
||||
Window.geometryChanged.disconnect(onGeometryChanged);
|
||||
|
|
Loading…
Reference in a new issue