public IEnumerator GetPlayerRoutine(IPlayerApi caller) { string uri = NetworkSettings.instance.BaseUri() + "/api/players/get"; var form = new WWWForm(); form.AddField("playerId", NetworkSettings.instance.username); form.AddField("authtoken", NetworkSettings.instance.authtoken); WWW www = new WWW(uri, form.data, form.headers); yield return www; if (www.error != null) { caller.OnPlayerError(www.error); } else { MemoryStream stream = new MemoryStream(www.bytes); Player player = Serializer.Deserialize<Player>(stream); caller.OnPlayer(player); } }
public IEnumerator GetPlayerRoutine(IPlayerApi caller) { string uri = NetworkSettings.instance.BaseUri() + "/api/players/get"; var form = new WWWForm(); form.AddField("playerId", NetworkSettings.instance.username); form.AddField("authtoken", NetworkSettings.instance.authtoken); WWW www = new WWW(uri, form.data, form.headers); yield return(www); if (www.error != null) { caller.OnPlayerError(www.error); } else { MemoryStream stream = new MemoryStream(www.bytes); Player player = Serializer.Deserialize <Player>(stream); caller.OnPlayer(player); } }