public override void OnReceivedBroadcast(string fromAddress, string data) { if (isClient && !rooms.ContainsKey(fromAddress)) { string[] parsed = data.Split('@'); bool locked = int.Parse(parsed [1]) == 1; int maxPlyr = int.Parse(parsed [3]); rooms.Add(fromAddress, new RoomInfo(fromAddress, parsed [0], locked, int.Parse(parsed [2]), maxPlyr)); GameObject curEntry = (GameObject)Instantiate(netMan.roomEntry); RoomEntry entry = curEntry.GetComponent <RoomEntry> (); entry.address = fromAddress; entry.isNetGame = false; entry.SetLock(locked); entry.SetPlayerCount(parsed [2] + "/" + parsed [3]); entry.SetName(parsed [0]); entry.maxPlyr = maxPlyr; curEntry.transform.SetParent(netMan.lanListParent, false); } }
IEnumerator WaitForRoomRefresh() { WWWForm form = new WWWForm(); form.AddField("action", "getrooms"); form.AddField("phppass", secretKey); form.AddField("natcap", natHelper.natCapability); form.AddField("externalip", Network.player.ipAddress); WWW www = new WWW(phpUrl, form); yield return(www); string ret = www.text; Debug.Log(ret); if (!string.IsNullOrEmpty(ret) && ret != "-5") { string[] parsed = ret.Split('#'); foreach (string a in parsed) { string[] parsed2 = a.Split('@'); GameObject curEntry = (GameObject)Instantiate(roomEntry); RoomEntry entry = curEntry.GetComponent <RoomEntry> (); bool locked = int.Parse(parsed2 [2]) == 1; roomsClient.Add(parsed2[0], new NetRoomInfo(parsed2[0], parsed2[1], locked, int.Parse(parsed2[3]), int.Parse(parsed2[4]))); entry.isNetGame = true; entry.gameID = parsed2 [0]; entry.SetName(parsed2 [1]); entry.SetLock(locked); entry.SetPlayerCount(parsed2[3] + "/" + parsed2[4]); entry.SetPlaying(false); // change this later curEntry.transform.SetParent(netListParent, false); } } waitingForRefresh = false; }