Ejemplo n.º 1
0
    void OnClickTapBirdGame()
    {
        // 다중클릭 막음
        buttonTapBirdGame.interactable = false;

        // ===========================================================================================>>> GameAnvil
        // 게임 시작 프로토콜 데이터 정의
        var startGameReq = new Com.Nhn.Gameanvil.Sample.Protocol.StartGameReq
        {
            Deck       = UserInfo.Instance.CurrentDeck,
            Difficulty = Com.Nhn.Gameanvil.Sample.Protocol.DifficultyType.DifficultyNormal
        };

        Debug.Log("startGameReq" + startGameReq);
        gameUser.CreateRoom(Constants.SPACE_ROOM_TYPE_SINGLE, new Payload().Add(new Packet(startGameReq)), (UserAgent userAgent, ResultCodeCreateRoom result, int roomId, string roomName, Payload payload) =>
        {
            Debug.Log("CreateRoom " + result);

            if (result == ResultCodeCreateRoom.CREATE_ROOM_SUCCESS)
            {
                // 성공시 게임신으로 변경, 등록된 리스너 제거
                RemoveAllListeners();
                UserInfo.Instance.MoveScene(Constants.SCENE_GAME_TAPBIRD);
            }
            else
            {
                // 실패 처리
                MessageUi.Instance.SetTextMessage("onCreateRoom Fail..... " + result);
            }
        });
        // ===========================================================================================>>> GameAnvil

        buttonTapBirdGame.interactable = true;
    }