public void OnRequestCharacters(JsonRequest requested) { if (requested.success == "true") { Json_Content_Lobby contentAccount = JsonUtility.FromJson <Json_Content_Lobby>(requested.content); sessionData.Content_Lobby.characters = contentAccount.characters; for (int i = 0; i < contentAccount.characters.Count; i++) { Content_Lobby character = contentAccount.characters[i]; Button_Character_Session bSession = Instantiate(sampleCharacter, listCharacterParent); string urlPP = DataBaseManager.DataBase + "Sessions/" + sessionData.Master_Session + "/Pictures/" + character.Picture_Url; if (character.Picture_Url == "") { urlPP = ""; } bSession.SetCharacter(character.Name_Character, character.Class, character.Race, character.ID_Account.ToString(), urlPP); } LoadingScreen.StopLoading(); } else { Debug.Log(requested.error); } }
public void CreateCharacter(int connectionID, int id_Character, int id_Token) { Content_Lobby character = null; for (int i = 0; i < sessionData.Content_Lobby.characters.Count; i++) { if (sessionData.Content_Lobby.characters[i].ID_Character == id_Character) { character = sessionData.Content_Lobby.characters[i]; } } if (character != null) { Pawn.Server_PawnData data = new Pawn.Server_PawnData(); data.ID_Handler = connectionID; data.position = CastCenterCamera(); data.rotation = Vector3.zero; data.scale = Vector3.one; data.pawnType = Pawn.PawnPackets.P_Player; PlayerController.PlayerController_Data dataToParse = new PlayerController.PlayerController_Data(); dataToParse.id_Character = character.ID_Character; dataToParse.id_Token = character.ID_Token; dataToParse.className = character.Class; dataToParse.raceName = character.Race; data.classParsed = JsonUtility.ToJson(dataToParse); DataSender.SendNewPawn(data); } }
public void SessionCharacterList() { if (characterList.alpha == 1f) { HideCharacterList(); return; } CharacterSelector[] characters = listCharacters.GetComponentsInChildren <CharacterSelector>(); for (int i = 0; i < characters.Length; i++) { Destroy(characters[i].gameObject); } characterList.alpha = 1f; characterList.blocksRaycasts = true; characterList.interactable = true; for (int i = 0; i < sessionData.Content_Lobby.characters.Count; i++) { Content_Lobby character = sessionData.Content_Lobby.characters[i]; CharacterSelector characterSelect = Instantiate(characterSample, listCharacters); characterSelect.name = "Character_" + character.ID_Character; characterSelect.id_Character = character.ID_Character; characterSelect.SetVisual(character.ID_Token); } //SAMPLES for (int i = 0; i < 4; i++)// 4 samples enemy { EnemySelector enemySelect = Instantiate(enemySample, listCharacters); enemySelect.name = "Ennemy_" + i; enemySelect.SetVisual(i); } ItemSelector chestSelect = Instantiate(itemSample, listCharacters); chestSelect.name = "Chest"; chestSelect.SetVisual(0); }