コード例 #1
0
    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
ファイル: Room.cs プロジェクト: CrispyServal/GameOff2020
 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
            });
        });
    }