public virtual void Btn_MatchRoom()
    {
        AppendTxt("开始匹配房间\r\n");
        MatchRoomPara para = new MatchRoomPara()
        {
            MaxPlayers = 4,
            PlayerInfo = new PlayerInfoPara()
            {
                Name = "p" + UnityEngine.Random.Range(1, 100), CustomPlayerStatus = 1, CustomProfile = ""
            },
            RoomType = "1",
        };

        paintRoom.MatchRoom(para, eve =>
        {
            if (eve.Code != 0)
            {
                AppendTxt("room匹配失败\r\n");
            }
            else
            {
                AppendTxt("room匹配成功...\r\n");
                //匹配队友
                Btn_MatchPlayer();
                Debug.Log(eve.Data);
            }
        });
    }
Пример #2
0
 public void MatchRoom(MatchRoomPara para, Action <ResponseEvent> callback)
 {
     Sdk.MatchRoom(para, (eve) => {
         if (eve.Data != null)
         {
             var rsp  = (MatchRoomSimpleRsp)eve.Data;
             eve.Data = rsp.RoomInfo?.ToByteString();
             this.RoomUtil.SaveRoomInfo(eve);
             eve.Data = rsp;
         }
         callback?.Invoke(eve);
     });
 }
Пример #3
0
    public void Match()
    {
        var matchRoomPara = new MatchRoomPara()
        {
            PlayerInfo = new PlayerInfoPara()
            {
                Name               = Main.openId,
                CustomProfile      = "nil.png",
                CustomPlayerStatus = 1,
            },
            MaxPlayers = 2,
            RoomType   = "1",
        };

        room.MatchRoom(matchRoomPara, evt => {
            EventManager.Invoke(EventType.OnMatch, new BaseEventArgs()
            {
                Code = evt.Code
            });
        });
    }