Beispiel #1
0
        /// <summary>
        /// the list of objects should just be the room's data in the same order as the create message
        /// </summary>
        /// <param name="availableRooms"></param>
        public void ListRooms(Dictionary <RoomId, List <object> > availableRooms, RoomId currentRoomId)
        {
            //we need to procedurally populate the scroll frame with the names of the available rooms from the server
            foreach (KeyValuePair <RoomId, List <object> > room in availableRooms)
            {
                RoomType roomtype = CheckType.TryAssignType <RoomType>(room.Value[2]);
                if (roomtype == RoomType.GreenScreenRoom)
                {
                    IGuiFrame roomListing = (IGuiFrame)mRoomListingPrototypeFrame.Clone();

                    Label roomNameLabel = roomListing.SelectSingleElement <Label>("RoomNameLabel");
                    roomNameLabel.Text = CheckType.TryAssignType <string>(room.Value[5]);

                    Label privacyLevelLabel = roomListing.SelectSingleElement <Label>("PrivacyLevelLabel");
                    privacyLevelLabel.Text = CheckType.TryAssignType <PrivacyLevel>(room.Value[4]).ToString();

                    Label populationLevelLabel = roomListing.SelectSingleElement <Label>("PopulationLabel");
                    populationLevelLabel.Text = CheckType.TryAssignType <uint>(room.Value[6]).ToString();

                    RoomId newRoomId      = new RoomId(room.Key);
                    Button joinRoomButton = roomListing.SelectSingleElement <Button>("JoinRoomButton");
                    joinRoomButton.Text = Translation.JOIN_ROOM;

                    joinRoomButton.AddOnPressedAction
                    (
                        delegate()
                    {
                        mSendSwitchingToRoomTypeNotification(roomtype);
                        RoomAPICommands.SwitchRoom(newRoomId, mCurrentRoomRequestType);
                        mMainWindow.Showing = false;
                    }
                    );

                    mRoomListScrollFrame.AddChildWidget(roomListing, new HorizontalAutoLayout());
                }
            }
        }
Beispiel #2
0
 private void JoinRoom(RoomId roomIdToJoin)
 {
     RoomAPICommands.SwitchRoom(roomIdToJoin, MessageSubType.ClientOwnedRooms);
 }