public Promise <TeamStateData> JoinTeam(string teamId = "") { if (teamId.IsNullOrEmpty()) { teamId = "0"; } var teamData = new TeamData(); teamData.id = teamId; var promise = new Promise <TeamStateData>(); Action <ConnectionHandler.RequestResult, string> HandleJoinTeam = (result, response) => { logger.Log(Tag, "HandleJoinTeamResponse (result=" + result + ")\nresponse=" + response); if (result != ConnectionHandler.RequestResult.Ok) { promise.Reject(new Exception(response)); return; } TeamStateData teamStateData = JsonMapper.ToObject <TeamStateData>(response); teamStateModel.SetState(teamStateData); promise.Resolve(teamStateData); }; routineRunner.StartCoroutine(connectionHandler.SendRequest(TeamSyncConnectionHandler.TeamRequestType.JoinTeam, HandleJoinTeam, 0, teamData)); return(promise); }
public IStateData Clone() { TeamStateData c = new TeamStateData(); c.teamInfo = teamInfo; c.id = id; c.score = score; c.fansCount = fansCount; c.playerName = playerName; c.playerImage = playerImage; return(c); }