/// <summary> /// Khi có người chơi gửi phỏm /// </summary> /// <param name="index">Người gửi phỏm</param> /// <param name="indexTo">Gửi phỏm đến người chơi</param> /// <param name="cardValue">Card sẽ gửi</param> /// <param name="melds">Phỏm ké gửi vào</param> public static void AddMeld(int index, int indexTo, int cardValue, int[] melds) { Meld meld = GetPlayer(indexTo).GetMeld(melds); if (meld != null) { ECard card = GetCard_FromHandPlayer(index, cardValue); GetPlayer(index).mCardHand.Remove(card); meld.meld.Add(card); game.UpdateHand(index, 0.5f); game.UpdateHand(indexTo, 0.5f); CheckRemoveGiveCard(index); card.UpdateParent(indexTo); return; } if (YourController.slotServer == index) { game.canRequestSort = true; } Debug.Log(index); Debug.Log(indexTo); foreach (Meld m in GameModelTLMN.GetPlayer(indexTo).mCardMelds) { Debug.Log(m.meld); } Debug.Log(cardValue); Debug.Log(melds); Debug.LogError("LỖI: Không thể tìm thấy phỏm để gửi"); }
void _Discard(int index, int cardValue) { ECard card = GetCard_FromHandPlayer(index, cardValue); GetPlayer(index).mCardHand.Remove(card); GetPlayer(index).mCardTrash.Add(card); if (YourController.slotServer == index) { game.canRequestSort = true; } game.fullLaying = false; if (game.listGiveCard.Count > 0) { game.listGiveCard.Clear(); } if (YourController.slotServer == index) { GameModelPhom.IndexInTurn = GetNextPlayer(index).slotServer; GameModelPhom.IndexLastInTurn = index; } MiniState = EGameStateMini.stealCard_or_draw; card.UpdateParent(index); game.UpdateHand(index, 0.5f); SoundGamePhom.Instances.PlaySoundDisCard(GetPlayer(index), GetNextPlayer(index)); }
/// <summary> /// Khi có người chơi ăn bài /// </summary> /// <param name="index">Index Người chơi ăn</param> /// <param name="indexLast">Index người chơi đánh bài</param> public static void StealCard(int index, int indexLast) { int indexTrash = GetPlayer(indexLast).mCardTrash.Count - 1; ECard card = GetPlayer(indexLast).mCardTrash[indexTrash]; card.ChangeSide(index); GetPlayer(indexLast).mCardTrash.RemoveAt(indexTrash); GetPlayer(index).mCardHand.Add(card); if (YourController.slotServer == index) { game.canRequestSort = true; } game.stolen = false; game.HideClickCard(); MiniState = EGameStateMini.discard; if (YourController.slotServer == index) { game.OnClickSort(game.btSorted.gameObject); } else { game.UpdateHand(index, 0.5f); } game.UpdateHand(GameModelTLMN.IndexLastInTurn, 0.5f); card.UpdateParent(index); }
/// <summary> /// Khi có người chơi ăn bài /// </summary> /// <param name="index">Index Người chơi ăn</param> /// <param name="indexLast">Index người chơi đánh bài</param> public static void StealCard(int index, int indexLast) { int indexTrash = GetPlayer(indexLast).mCardTrash.Count - 1; ECard card = GetPlayer(indexLast).mCardTrash[indexTrash]; card.ChangeSide(index); bool isStealCard = SoundGamePhom.Instances.PlaySoundStealCard(GetPlayer(index), GetPlayer(indexLast)); GetPlayer(indexLast).mCardTrash.RemoveAt(indexTrash); GetPlayer(index).mCardHand.Add(card); if (YourController.slotServer == index) { game.canRequestSort = true; } game.stolen = false; game.HideClickCard(); MiniState = EGameStateMini.discard; if (YourController.slotServer == index) { if (isStealCard) { game.btSorted.gameObject.AddComponent <UIContainerAnonymous>(); } game.OnClickSort(game.btSorted.gameObject); } else { game.UpdateHand(index, 0.5f); } game.UpdateHand(GameModelPhom.IndexLastInTurn, 0.5f); card.UpdateParent(index); }