/// <summary> /// 部屋に参加する /// </summary> private static async Task <IResult <string, Unit> > JoinRoom(string roomName, bool createIfNoExists) { var joined = await PhotoTask.JoinRoom(roomName); if (joined.IsSuccess) { return(ToSuccess()); } if (!createIfNoExists) { return(ToFailure("No room.")); } // 部屋を作って参加する var created = await PhotoTask.CreateRoom(roomName, null, null, null); if (!created.IsSuccess) { //失敗 return(ToFailure(created.TryGetFailureValue.ToString())); } return(ToSuccess()); }
public async UniTask CreateRoom(string roomName, string anchorId) { if (string.IsNullOrWhiteSpace(roomName)) { return; } var option = RoomUtility.GetCloudRoomTemplate(anchorId); await FailureHandlingPhotonTask(PhotoTask.CreateRoom(roomName, option, null), _ => { RoomManager.Instance.Model.CreateRoom(roomName); RoomManager.Instance.Model.SetAnchorId(anchorId); }); }
public async UniTask CreateRoom(string roomName) { if (string.IsNullOrWhiteSpace(roomName)) { return; } var option = RoomUtility.GetCloudRoomTemplate(string.Empty); await FailureHandlingPhotonTask(PhotoTask.CreateRoom(roomName, option, null), _ => { RoomManager.Instance.Model.CreateRoom(roomName); if (option.CustomRoomProperties.TryGetValue(RoomDefine.ANCHOR_KEY, out var anchorId)) { RoomManager.Instance.Model.SetAnchorId(anchorId.ToString()); } }); }