diff --git a/PalaceClient/PalaceClient.js b/PalaceClient/PalaceClient.js
index d54e573..6fdf5a3 100644
--- a/PalaceClient/PalaceClient.js
+++ b/PalaceClient/PalaceClient.js
@@ -199,6 +199,11 @@ function PalaceClient() // extends EventDispatcher
return roomList;
}
+ this.getUserList = getUserList;
+ function getUserList() {
+ return userList;
+ }
+
that.getUserName = function getUserName() {
return _userName;
};
@@ -650,6 +655,21 @@ function PalaceClient() // extends EventDispatcher
var leaveEventHandlers;
var requestedRoomId = 0;
+ this.gotoRoomByUser = gotoRoomByUser;
+ function gotoRoomByUser(userId) {
+ userListSize = userList.size();
+
+ for (var i = 0; i < userListSize; i++) {
+ var user = userList.getItemAt(i);
+ if (user instanceof PalaceUser) {
+ console.log("user.id" + user.id + " userId" + userId + " roomId " + user.roomID);
+ if (user.id == userId) {
+ gotoRoom(user.roomID)
+ }
+ }
+ }
+ }
+
this.gotoRoom = gotoRoom;
function gotoRoom(roomId) {
if (!connected || currentRoom.id == roomId) {
@@ -1865,6 +1885,9 @@ function PalaceClient() // extends EventDispatcher
//trace("User List - got user: " + user.name);
userList.addItem(user);
}
+
+ var userListEvent = new Event('userList');
+ dispatchEvent(userListEvent);
// trace("There are " + userList.length + " users in this palace.");
}
diff --git a/PalaceClient/palace/model/PalaceUser.js b/PalaceClient/palace/model/PalaceUser.js
index 0159d37..a9514e4 100644
--- a/PalaceClient/palace/model/PalaceUser.js
+++ b/PalaceClient/palace/model/PalaceUser.js
@@ -227,8 +227,8 @@ function PalaceUser(palaceClient, propStore)
function checkFaceProps()/* :void */ {
var showFace/* :Boolean */ = true;
- for (var i/* :int */ = 0; i < that.props.length; i++) {
- var prop/* :PalaceProp */ = PalaceProp(that.props.getItemAt(i));
+ for (var i/* :int */ = 0; i < that.props.size(); i++) {
+ var prop/* :PalaceProp */ = that.props.getItemAt(i);
if (prop.head) {
showFace = false;
}
diff --git a/WebClient/client.css b/WebClient/client.css
index 7a6c324..78cff99 100644
--- a/WebClient/client.css
+++ b/WebClient/client.css
@@ -52,19 +52,22 @@ body {
/*margin-right: 3px;*/
}
-#room-list-window
+#room-list-window,
+#user-list-window
#log-window {
margin: 5px 0 0 5px;
border: 1px solid silver;
}
-#room-list {
+#room-list,
+#user-list {
font-size: 13px;
width: 300px;
height: 100px;
background-color: #eeeeee;
overflow: scroll;
}
+
#log {
font-size: 13px;
width: 300px;
diff --git a/WebClient/client.js b/WebClient/client.js
index 4c93f8f..964b02b 100644
--- a/WebClient/client.js
+++ b/WebClient/client.js
@@ -27,6 +27,20 @@ function startSocket() {
});
});
+ socket.on('userList', function (data) {
+ var userList = $('#user-list');
+ var users = data.data;
+
+ for (var i = 0; i < users.length; i++) {
+ userList.append('' + '
');
+ }
+
+ userList.on('change', function (event) {
+ var userId = $("#user-list option:selected").val();
+ socket.emit('gotoRoomByUser', { 'userId': userId });
+ });
+ });
+
socket.on('chat', function (data) {
console.log(data);
var logWindow = $('#log');
diff --git a/WebClient/index.html b/WebClient/index.html
index 936fac3..70ef8dd 100644
--- a/WebClient/index.html
+++ b/WebClient/index.html
@@ -36,6 +36,9 @@