/// <summary> /// расставляем все карты на игровом поле /// </summary> public static void SetCardInPole(List <UserModel> fakeUsers, List <CardModel> realUserCards, Transform realPlayer, Transform realPlayer2Row, Transform player1, Transform player3, Transform player4, Transform selectedCards, int count) { try { var xSize = realPlayer.transform.localPosition.x; var ySize = realPlayer.transform.localPosition.y; InternalManager.SetRealUserCardsTwo(realPlayer, realPlayer2Row, realUserCards, selectedCards); InternalManager.SetFakeUserCards(fakeUsers, count, xSize, ySize, player1, player3, player4); } catch (Exception ex) { Debug.Log(ex.Message); } }
public void CancelShag() { try { if (ApiClientScript.IsBlocked) { return; } go.interactable = true; // получаем данные с апишки var data = HttpQueryManager.CanselShag(); var information = Manager.GetInfoAboutPlayers(data); if (information == null || information.RealUser == null) { return; } ApiClientScript.GameModel .Users.First(a => a.UserId == ApiClientScript.CurrentUserId) .CardsModel.ForEach(a => { Destroy(a.Card.gameObject); }); ApiClientScript.GameModel.Users.First(a => a.UserId == ApiClientScript.CurrentUserId).CardsModel.Clear(); ApiClientScript.SelectedCardsIds.Clear(); ApiClientScript.GameModel.Users.First(a => a.UserId == ApiClientScript.CurrentUserId).CardsModel = information.RealUser.CardsModel; InternalManager.SetRealUserCardsTwo(main, mainTwoRow, information.RealUser.CardsModel, selectedCard); } catch (Exception ex) { Debug.Log("CancelShag" + ex.Message); MessageManager.ErrorMessage(ok, lose, message, panel, $" Произошла внутренняя \n ошибка, " + $"\n попробуйте еще раз!" + $" {ex.Message}", Assets.Enums.TypeNotificationEnum.Error); } }
public void TaskOnClick() { if (ApiClientScript.IsBlocked) { return; } var userId = ApiClientScript.GameModel .Users.First(a => a.UserId == ApiClientScript.CurrentUserId).UserId; if (ApiClientScript.GameModel.Users.First(a => a.UserId == userId).CountCards < 12) { ApiClientScript.modell = HttpQueryManager.GetCardsFromPack(1, userId, ApiClientScript.SessionId); var information = Manager.GetInfoAboutPlayers(ApiClientScript.modell); if (information == null || information.RealUser == null) { MessageManager.ErrorMessage(ok, lose, message, panel, $" Произошла внутренняя \n ошибка, " + $"\n попробуйте еще раз!", Assets.Enums.TypeNotificationEnum.Error); return; } ApiClientScript.GameModel .Users.First(a => a.UserId == userId) .CardsModel.ForEach(a => { Destroy(a.Card.gameObject); }); ApiClientScript.GameModel.Users.First(a => a.UserId == userId).CardsModel.Clear(); ApiClientScript.GameModel.Users.First(a => a.UserId == userId).CardsModel = information.RealUser.CardsModel; ApiClientScript.GameModel.Users.First(a => a.UserId == userId).CountCards = information.RealUser.CardsModel.Count(); InternalManager.SetRealUserCardsTwo(main, mainTwoRow, information.RealUser.CardsModel, selectedCard); if (information.RealUser.IsLoser) { ApiClientScript.IsTryToStayAlive = false; MessageManager.ErrorMessage(ok, lose, message, panel, $" Вы проиграли!", Assets.Enums.TypeNotificationEnum.Boomb, cansel, toSbros, take, go ); ApiClientScript.IsBlocked = true; } else { ApiClientScript.modell = HttpQueryManager.ChangeActiveUser(ApiClientScript.SessionId); ApiClientScript.buff = 110; } koloda.text = "Колода: " + ApiClientScript.modell.pack.count; sbros.text = "Сброс: " + ApiClientScript.modell.sbros.count; } }
public void TaskOnClick() { try { if (ApiClientScript.IsBlocked) { return; } var userId = ApiClientScript.GameModel.Users.First(user => user.UserId == ApiClientScript.CurrentUserId).UserId; if (ApiClientScript.GameModel.Users.First(a => a.UserId == userId).CountCards <= 0) { MessageManager.ErrorMessage(ok, lose, message, panel, $" Произошла внутренняя \n ошибка, " + $"\n попробуйте еще раз!", Assets.Enums.TypeNotificationEnum.Error); return; } if (ApiClientScript.SelectedCardsIds.Count != 0) { var finResult = HttpQueryManager.FinishShag(); var data = finResult.Data; if (!finResult.StatusShag) { MessageManager.ErrorMessage(ok, lose, message, panel, $" Нельзя использовать карту!", Assets.Enums.TypeNotificationEnum.Error); return; } data = HttpQueryManager.PutCardsInSbros(); var information = Manager.GetInfoAboutPlayers(data); if (information == null || information.RealUser == null) { MessageManager.ErrorMessage(ok, lose, message, panel, $" Произошла внутренняя \n ошибка, " + $"\n попробуйте еще раз!", Assets.Enums.TypeNotificationEnum.Error); return; } ApiClientScript.GameModel .Users.First(a => a.UserId == userId) .CardsModel.ForEach(a => { Destroy(a.Card.gameObject); }); ApiClientScript.GameModel.Users.First(a => a.UserId == userId).CardsModel.Clear(); ApiClientScript.GameModel.Users.First(a => a.UserId == userId).CardsModel = information.RealUser.CardsModel; ApiClientScript.GameModel.Users.First(a => a.UserId == userId).CountCards = information.RealUser.CardsModel.Count(); InternalManager.SetRealUserCardsTwo(realPlayer, realPlayerTwoRow, information.RealUser.CardsModel, selectedCard); ApiClientScript.SelectedCard = ""; ApiClientScript.SelectedCardsIds.Clear(); koloda.text = "Колода: " + data.pack.count; sbros.text = "Сброс: " + data.sbros.count; go.interactable = true; } } catch (Exception ex) { Debug.Log(ex.Message); MessageManager.ErrorMessage(ok, lose, message, panel, $" Произошла внутренняя \n ошибка, " + $"\n попробуйте еще раз! " + $"{ ex.Message}", Assets.Enums.TypeNotificationEnum.Error); } }