public virtual MahjongItem ThrowOutByValue(int value) { MahjongItem Mahjong = null; for (int i = MahjongList.Count - 1; i >= 0; i--) { if (MahjongList[i].Value == value) { Mahjong = MahjongList[i]; } } if (Mahjong == null) { Mahjong = GetMahjongItemByValue(value); } Mahjong.ShowNormal(); MahjongManager.Instance.ExchangeByValue(value, Mahjong); MahjongList.Remove(Mahjong); SortMahjongForHand(); if (GameConfig.GetInEffect) { PickUpMahjongAction(Mahjong); } else { SetMahjongPos(); } MahjongManager.Instance.Recycle(Mahjong); LastGetIn = null; return(Mahjong); }
public virtual MahjongItem ThrowOut(int value) { MahjongItem Mahjong = GetMahjongItemByValue(value); Mahjong.ShowNormal(); MahjongManager.Instance.ExchangeByValue(value, Mahjong); MahjongList.Remove(Mahjong); SortMahjongForHand(); if (GameConfig.GetInEffect) { PickUpMahjongAction(Mahjong); } else { SetMahjongPos(); } MahjongManager.Instance.Recycle(Mahjong); LastGetIn = null; return(Mahjong); }
public override void SetLastCardPos(int value) { if (value == UtilDef.NullMj || MahjongList.Find(item => item.Value == value) == null)//当前不是抓牌 是吃碰杠后的 { base.SetLastCardPos(value); return; } if (MahjongList.Count > 1) { MahjongItem findItem = MahjongList.Find((item) => { return(item.Value == value); }); if (findItem != null) { MahjongList.Remove(findItem); } MahjongList.Add(findItem); SetMahjongPos(); findItem.transform.localPosition = GetHardLastMjPos(); } }
//当抢杠胡 public virtual void OnQiangganghu(int value) { MahjongItem findItem = MahjongList.Find((item) => { return(item.Value == value); }); MahjongManager.Instance.Recycle(findItem); MahjongList.Remove(findItem); SortMahjongForHand(); findItem.gameObject.SetActive(false); }
protected virtual void SortMahjongForHand() { if (MahjongList.Count < 2) { return; } //这里是假的排序 把最后一张牌 放在那里 是随机放的 var index = Random.Range(0, MahjongList.Count - 2); var last = MahjongList[MahjongList.Count - 1]; MahjongList.Remove(last); MahjongList.Insert(index, last); }
public void RemoveMahjong(int value, bool sort = true) { MahjongItem item = GetMahjongItemByValue(value); if (item != null) { MahjongList.Remove(item); MahjongManager.Instance.Recycle(item); } if (sort) { SetMahjongPos(); } }
public void RemoveMahjong(List <int> value, bool sort = true) { for (int i = 0; i < value.Count; i++) { MahjongItem item = GetMahjongItemByValue(value[i]); if (item != null) { MahjongList.Remove(item); MahjongManager.Instance.Recycle(item); } } if (sort) { SetMahjongPos(); } }
public virtual void RemoveMahjongByValue(int value, bool sort = true) { MahjongItem temp = MahjongList.Find((a) => { return(a.Value == value); }); if (temp != null) { MahjongList.Remove(temp); MahjongManager.Instance.Recycle(temp); } else { MahjongItem item = GetMahjongItemByValue(value); if (item != null) { MahjongList.Remove(item); MahjongManager.Instance.Recycle(item); } } if (sort) { SetMahjongPos(); } }