Click or drag to resize

FindRoomsRequest Class

Retrieves a list of Rooms from the server which match the specified criteria.
Inheritance Hierarchy
SystemObject
  BaseRequest
    Sfs2X.RequestsFindRoomsRequest

Namespace:  Sfs2X.Requests
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: 1.8.0.0 (1.8.0)
Syntax
C#
public class FindRoomsRequest : BaseRequest
Constructors
  NameDescription
Public methodFindRoomsRequest(MatchExpression)
See FindRoomsRequest(MatchExpression, string, int) constructor.
Public methodFindRoomsRequest(MatchExpression, String)
See FindRoomsRequest(MatchExpression, string, int) constructor.
Public methodFindRoomsRequest(MatchExpression, String, Int32)
Creates a new FindRoomsRequest instance.
Top
Remarks
By providing a matching expression and a search scope (a Group or the entire Zone), SmartFoxServer can find those Rooms matching the passed criteria and return them by means of the ROOM_FIND_RESULT event.
Examples
The following example looks for all the server Rooms whose "country" Room Variable is set to Sweden:
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.ROOM_FIND_RESULT, OnRoomFindResult);

    // Create a matching expression to find Rooms with a "country" variable equal to "Sweden"
    MatchExpression expr = new MatchExpression('country', StringMatch.EQUALS, 'Sweden');

    // Find the Rooms
    sfs.Send( new FindRoomRequest(expr) );
}

void OnRoomFindResult(BaseEvent evt) {
    Console.WriteLine("Rooms found: " + (List<Room>)evt.Params["rooms"]);                         // .Net / Unity
    System.Diagnostics.Debug.WriteLine("Rooms found: " + (List<Room>)evt.Params["rooms"]);        // UWP
}
See Also