/// Handler for succesfull player account creation. Will persist the new /// players ChilliConnectID and ChilliConnectSecret and login the player /// /// @param response /// The CreatePlayerReponse from the ChilliConnect SDK /// private void OnChilliConnectAccountCreated(CreatePlayerResponse response) { PlayerPrefs.SetString("CCId", response.ChilliConnectId); PlayerPrefs.SetString("CCSecret", response.ChilliConnectSecret); Login(response.ChilliConnectId, response.ChilliConnectSecret); }
private void OnCreatePlayerCommandSuccess(CreatePlayerResponse response, EntityId playerCreatorEntityId) { var statusCode = (StatusCode)response.statusCode; if (statusCode != StatusCode.Success) { Debug.LogWarningFormat("PlayerCreator failed to create the player entity. Status code = {0}. Try again in a few seconds.", statusCode.ToString()); RetryCreatePlayerCommand(playerCreatorEntityId); } }
/// Called when a new ChilliConnect account is created and the player has already logged into FB. /// /// @param response /// Holds the Id and Secret required for future anonymouse logins /// private void OnChilliConnectAccountCreatedPostFB(CreatePlayerResponse response) { Debug.Log("Created new CC account post FB"); PlayerPrefs.SetString("CCId", response.ChilliConnectId); PlayerPrefs.SetString("CCSecret", response.ChilliConnectSecret); //Once we've created a new player we need to log them in m_chilliConnect.PlayerAccounts.LogInUsingChilliConnect(response.ChilliConnectId, response.ChilliConnectSecret, (loginRequest) => OnChilliConnectAnonLoggedInPostFB(), (loginRequest, error) => Debug.LogError(error.ErrorDescription)); }
/// Called when player creation has completed allowing us to log the /// player in /// /// @param request /// Info on request made to create player /// @param response /// Holds the id and secret to log the player in /// private void OnPlayerCreated(CreatePlayerRequest request, CreatePlayerResponse response) { Debug.Log("Player created. Logging in"); //Save the credentials so we don't create a new player next time we launch the app PlayerPrefs.SetString("CCId", response.ChilliConnectId); PlayerPrefs.SetString("CCSecret", response.ChilliConnectSecret); PlayerPrefs.Save(); m_chilliConnect.PlayerAccounts.LogInUsingChilliConnect(response.ChilliConnectId, response.ChilliConnectSecret, (loginRequest) => OnLoggedIn(), (loginRequest, error) => Debug.LogError(error.ErrorDescription)); }
public async Task <ActionResult <CreatePlayerResponse> > CreatePlayer([FromBody] CreatePlayerRequest createPlayerRequest, CancellationToken cancellationToken) { var player = new Player() { Name = createPlayerRequest.Name, Surname = createPlayerRequest.Surname, Role = PlayerRole.GetByAcronym(createPlayerRequest.RoleAcronym) }; await _playersRepository.AddAsync(player, cancellationToken); var response = new CreatePlayerResponse(); response.Player = _mapper.Map <PlayerDto>(player); return(Ok(response)); }
void OnCreateNewCharacter(NetResponse msg) { ConnectionManager.Instance.SendACK(CreateNewPlayer, true); if (msg.Succeeded) { CreatePlayerResponse myMsg = (CreatePlayerResponse)msg; PlayerInfo.SetCurrentPlayer(myMsg.playerInfo); _playerInfos[_selectedRoleID] = myMsg.playerInfo; OnCreatePlayerComplete(myMsg.playerInfo.UID); } else { StepAt(EnumLoadingStep.step5); UIMessageBoxManager.Instance.ShowErrorMessageBox(msg.errorCode, ""); } }
public ActionResult <CreatePlayerResponse> CreatePlayer(CreatePlayerRequest request) { var response = new CreatePlayerResponse() { ResponseMessage = Models.ResponseMessage.Failure }; int?teamId = request.Player.TeamId == 0 ? null : request.Player.TeamId; _context.Players.Add(new Player(request.Player.FirstName, request.Player.LastName, request.Player.Height, request.Player.Weight, request.Player.Position, request.Player.DateOfBirth, teamId)); var success = _context.SaveChanges(); if (success > 0) { response.ResponseMessage = Models.ResponseMessage.Success; } return(Ok(response)); }
private void OnCreatePlayerCommandSuccess(CreatePlayerResponse response, EntityId playerCreatorEntityId) { switch (response.responseCode) { case ResponseCode.EntityForPlayerExists: Debug.Log("Player entity already exists, request was ignored."); break; case ResponseCode.ExistingRequestInProgress: Debug.Log("A request was already in progress, this request was ignored."); RetryCreatePlayerCommand(playerCreatorEntityId); break; case ResponseCode.Failure: var failureCode = (StatusCode)response.failureCode.Value; Debug.LogWarningFormat("PlayerCreator failed to create the player entity. Status code = {0}. Try again in a few seconds.", failureCode.ToString()); RetryCreatePlayerCommand(playerCreatorEntityId); break; } }
public void TestAdminCreateUserXmlGetAttributes() { string xml = @"<roar tick=""128455461333""> <admin> <create_user status=""ok""> <!-- Used to identify this session in subsequent calls --> <auth_token>2034623793</auth_token> <player_id>12312312312</player_id> </create_user> </admin> </roar>" ; System.Xml.XmlElement nn = RoarExtensions.CreateXmlElement(xml); Roar.DataConversion.Responses.Admin.CreatePlayer create_player_parser = new Roar.DataConversion.Responses.Admin.CreatePlayer(); CreatePlayerResponse response = create_player_parser.Build(nn); Assert.AreEqual(response.auth_token, "2034623793"); Assert.AreEqual(response.player_id, "12312312312"); }
private void Handle(CreatePlayerRequest request) { //throw new Exception(); //Thread.Sleep(TimeSpan.FromSeconds(30)); //- test aby sprawdzić, czy zrobi się dziecko aktora //tzn. że wiele osob będzie mogło w tym samym czasie korzystać z aplikacji try { if (CheckInputs(firstName: request.FirstName, lastName: request.LastName, nickName: request.NickName, age: request.Age, sex: request.Sex)) { _playerRepo.Insert(new Player { FirstName = request.FirstName, LastName = request.LastName, NickName = request.NickName, Age = request.Age, Sex = request.Sex, IsDeleted = false }); var response = new CreatePlayerResponse(true); Sender.Tell(response); _logger.Info("Create Player successfull: {0} {1}", request.FirstName, request.LastName); } else { var response = new CreatePlayerResponse(false); Sender.Tell(response); _logger.Error("Couldn't create Player: {0} {1}: Are fields are required", request.FirstName, request.LastName); } } catch (Exception ex) { var response = new CreatePlayerResponse(false); Sender.Tell(response); _logger.Error("Couldn't create Player: {0} {1}: {2}", request.FirstName, request.LastName, ex.Message); } }
public async Task <ActionResult <CreatePlayerResponse> > UpdatePlayer([FromRoute] int playerId, [FromBody] UpdatePlayerRequest createPlayerRequest, CancellationToken cancellationToken) { var player = await _playersRepository.GetByIdAsync(playerId, cancellationToken); if (player != null) { player.Name = createPlayerRequest.Name; player.Surname = createPlayerRequest.Surname; player.Role = PlayerRole.GetByAcronym(createPlayerRequest.RoleAcronym); await _playersRepository.UpdateAsync(player, cancellationToken); var response = new CreatePlayerResponse { Player = _mapper.Map <PlayerDto>(player) }; return(Ok(response)); } else { return(NotFound()); } }
/// Handler for succesfull player account creation. Will persist the new /// players ChilliConnectID and ChilliConnectSecret and login the player /// /// @param response /// The CreatePlayerReponse from the ChilliConnect SDK /// private void OnChilliConnectAccountCreated(CreatePlayerResponse response) { SavePlayer(response.ChilliConnectId, response.ChilliConnectSecret); Login(response.ChilliConnectId, response.ChilliConnectSecret); }
private static void HideSplashScreen(CreatePlayerResponse _) { SplashScreenController.HideSplashScreen(); }