private void getHostList() { string url = MVS.Host.MAIN_URL + MVS.Host.HOSTLIST + "?mac=0" + "&gameid=" + MVS.GameID + "&channel=" + MVS.Channel + "&platform=" + MVS.Platform + (MVS.isNeedWSS() ? "&useWSSProxy=1":""); var httpRequest = new HTTPRequest(new Uri(url), (HTTPRequest req, HTTPResponse rsp) => { if (rsp.IsSuccess) { Log.i("getHostList:{0}", rsp.DataAsText); JsonData jsonData = JsonMapper.ToObject(rsp.DataAsText);//这里的JsonFile.txt文件即为上面1中的文本文件 int status = int.Parse(jsonData["status"].ToString()); string engine = jsonData["data"]["engine"].ToString(); string vsopen = jsonData["data"]["vsopen"].ToString(); MVS.Host.HOST_GATWAY_ADDR = $"ws://{engine}:7001"; var http = "https://"; MVS.Host.VS_OPEN_URL = http + vsopen; Log.i("engine:{0}", MVS.Host.HOST_GATWAY_ADDR); callback("initResponse", 200); } else { Log.w("getHostList fail: {0}", rsp.Message); } }); httpRequest.MethodType = HTTPMethods.Post; httpRequest.Send(); }
private void connectWatch(JoinWatchRoomRsp d) { BookInfo bookInfo = d.BookInfo; MVS.Host.HOST_WATCH_ADDR = MVS.getHotelUrl(bookInfo); MVS.WatchRoomID = d.RoomID; frameWatchCache = new Queue <LiveFrameDataNotify>(); _mWNw = new NW(MVS.Host.HOST_WATCH_ADDR, this); var buf = _mPro.en(SDKWatchCmdID.EnterLiveRoomCmdid, bookInfo, d.RoomID, MVS.UserID, MVS.GameID, MVS.NodeID); _mWNw?.send(buf); lastJoinWatchRoomRsp = d; }
private void connectHotel(JoinRoomRsp d) { BookInfo bookInfo = d.BookInfo; MVS.Host.HOST_HOTEL_ADDR = MVS.getHotelUrl(bookInfo); MVS.RoomID = d.RoomInfo.RoomID; this.frameCache = new Queue <FrameDataNotify>(); this._mHNw = new NW(MVS.Host.HOST_HOTEL_ADDR, this); var buf = _mPro.en(SDKHotelCmdID.CheckinCmdid, bookInfo, d.RoomInfo, MVS.UserID, MVS.GameID); this._mHNw?.send(buf); this.lastJoinRoomRsp = d; }