방 정보 업데이트

현재 방장도 속성을 일부 변경할 수 있습니다.

void SetRoom(long roomId, RoomProperties roomProperties, RoomSetEventHandler handler, FailureEventHandler failureHandler, RequestConfig config = null)
void SetRoom(long roomId, IDictionary<string, object> roomProperties, RoomSetEventHandler handler, FailureEventHandler failureHandler, RequestConfig config = null)

코드 예시

using SoftGear.Strix.Unity.Runtime;
using UnityEngine;

public class StrixSetRoomTest : MonoBehaviour
{
    void Start()
    {
        var strixNetwork = StrixNetwork.instance;

        // 플레이스홀더 값. 이것을 실제 애플리케이션 ID로 변경
        // Strix Cloud 애플리케이션 정보에서 확인 가능: https://www.strixcloud.net/app/applist
        strixNetwork.applicationId = "00000000-0000-0000-0000-000000000000";

        // 먼저 마스터 서버로 연결
        strixNetwork.ConnectMasterServer(
            // 플레이스홀더 값. 이것을 실제 마스터 호스트 이름으로 변경
            // Strix Cloud 애플리케이션 정보에서 확인 가능: https://www.strixcloud.net/app/applist
            host: "000000000000000000000000.game.strixcloud.net",
            connectEventHandler: _ => {
                Debug.Log("Connection established.");

                // 마스터 서버에 연결한 후에는 방 만들기 가능
                strixNetwork.CreateRoom(
                    roomProperties: new RoomProperties {
                        name = "Wildwood",
                        password = "66e3f2nk",                          // 이 방에는 비밀번호가 설정되어 있어 비밀번호가 없는 클라이언트는 입장 불가
                        capacity = 20                                   // 방이 수용할 수 있는 클라이언트 최대수
                    },
                    memberProperties: new RoomMemberProperties {
                        name = "Artemis"                                // 이것이 플레이어 이름이 됨
                    },
                    handler: __ => {
                        Debug.Log("Room created. Current capacity: " + strixNetwork.room.GetCapacity());

                        // 이제 방이 만들어졌으니 정원을 변경해 봅시다
                        strixNetwork.SetRoom(
                            roomId: strixNetwork.roomSession.room.GetPrimaryKey(),   // 현재 방의 ID
                            roomProperties: new RoomProperties {
                                capacity = 15                                        // 방 정원을 20에서 15로 변경
                            },
                            handler: setRoomResult => Debug.Log("Capacity changed. Current capacity: " + strixNetwork.room.GetCapacity()),  // 새 정원 인쇄
                            failureHandler: setRoomError => Debug.LogError("Search failed. Reason: " + setRoomError.cause)
                        );
                    },
                    failureHandler: createRoomError => Debug.LogError("Could not create room. Reason: " + createRoomError.cause)
                );
            },
            errorEventHandler: connectError => Debug.LogError("Connection failed. Reason: " + connectError.cause)
        );
    }
}

참고

applicationIdhost의 플레이스홀더 값은 Strix Cloud 애플리케이션 정보 탭에서 볼 수 있는 실제값으로 바꿔야 합니다.