49 lines
1.5 KiB
JavaScript
49 lines
1.5 KiB
JavaScript
// DJ_Dispatch_Zone_Client.js
|
|
//
|
|
// Created by Milad Nazeri on 2018-06-19
|
|
// Expanded on by Robin Wilson 2018-08-28
|
|
//
|
|
// Use with server script located:
|
|
// http://hifi-content.s3-us-west-1.amazonaws.com/Experiences/LoadTest/Checkin/ZoneEnter_LogAllUsers/Zone_LogAllUsers_EntityScripts/server_ZoneEnter_LogAllUsers.js
|
|
//
|
|
//
|
|
// Copyright 2018 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
|
|
/* global AccountServices */
|
|
|
|
(function () {
|
|
// Init
|
|
var entityID;
|
|
|
|
// Entity Definition
|
|
function EnterZoneClient() {
|
|
}
|
|
|
|
EnterZoneClient.prototype = {
|
|
preload: function (id) {
|
|
entityID = id;
|
|
if (AccountServices.loggedIn) {
|
|
this.collectUsername();
|
|
} else {
|
|
AccountServices.loggedInChanged.connect(this.loggedIn);
|
|
this.collectUsername();
|
|
}
|
|
},
|
|
loggedIn: function () {
|
|
AccountServices.loggedInChanged.disconnect(this.loggedIn);
|
|
this.collectUsername();
|
|
},
|
|
collectUsername: function () {
|
|
Entities.callEntityServerMethod(entityID, "sendInput", [AccountServices.username, MyAvatar.displayName]);
|
|
},
|
|
unload: function () {
|
|
AccountServices.loggedInChanged.disconnect(this.loggedIn);
|
|
}
|
|
};
|
|
|
|
return new EnterZoneClient();
|
|
});
|
|
|