Example #1
0
    private IEnumerator joinRoom(CoroutineResult <bool> isSuccess)
    {
        SCJoinMatch response = null;

        _ui.IsJoiningMsgEnabled = true;

        NetworkManager.Instance.SendMessage <CSJoinMatch, SCJoinMatch>(
            MessageType.cs_join_match, new CSJoinMatch {
            nickname = _nickname
        },
            MessageType.sc_join_match, res => response = res);

        while (response == null)
        {
            yield return(null);
        }

        if (response.result != extichu_messages.ErrorCode.EC_OK)
        {
            isSuccess.Set(false);
            yield break;
        }

        _ui.IsJoiningMsgEnabled = false;
        this.setNameTags(
            response.room_state.nickname_1,
            response.room_state.nickname_2,
            response.room_state.nickname_3,
            response.room_state.nickname_4);
    }
Example #2
0
    public IEnumerator WaitForNicknameInput(Func <string, bool> nicknameValidator, CoroutineResult <string> nickname)
    {
        var isOkButtonClicked = false;

        _nicknameInputPopup.OnOKButtonClicked
            += input =>
            {
            nickname.Set(input);
            isOkButtonClicked = true;
            };

        while (true)
        {
            if (isOkButtonClicked && nicknameValidator(nickname))
            {
                yield break;
            }

            isOkButtonClicked = false;
            yield return(null);
        }
    }