protected override MahjongVecter GetNextIndex(MahjongVecter mjIndex) { MahjongVecter next = new MahjongVecter(mjIndex); next.x++; return(next); }
public Vector3 AgainGetPos(MahjongVecter index, int mahjongCnt, int RowCnt) { Vector3 mahjongSize = MiscUtility.MahjongSize; float Dis = -mahjongCnt * mahjongSize.x / 2 - mahjongSize.x * 1.2f / 2; Vector3 pos = new Vector3(Dis + mahjongSize.x * (index.x + 0.5f), mahjongSize.y * 0.5f, mahjongSize.z * 0.5f); pos.x = pos.x - (RowCnt - MahjongList.Count) / 2 * mahjongSize.x / 2; return(pos); }
public virtual void OnReset() { mNowVecter = new MahjongVecter(); for (int i = 0; i < MahjongList.Count; i++) { GameCenter.Scene.MahjongCtrl.PushMahjongToPool(MahjongList[i]); } MahjongList.Clear(); }
protected override Vector3 GetPos(MahjongVecter index) { Vector3 mahjongSize = MiscUtility.MahjongSize; float dis = RowCnt * mahjongSize.x / 2; if (index.x % 2 == 0) { index.y = 1; } else { index.y = 0; } return(new Vector3(dis - mahjongSize.x * (index.x / 2 + 0.5f), mahjongSize.y * (0.5f), mahjongSize.z * (index.y + 0.5f))); }
public virtual void SetMahjongPos() { MahjongContainer item; mNowVecter = new MahjongVecter(); for (int i = 0; i < mMahjongList.Count; i++) { item = mMahjongList[i]; item.ResetPos(); Transform mahjongTf = item.transform; Vector3 pos = GetPos(mNowVecter); mahjongTf.localPosition = pos; mNowVecter = GetNextIndex(mNowVecter); } }
//换张之后再重新排序手牌 public void AgainSortHandCards() { var list = MahjongList; list.Sort((a, b) => { //先判断是否是赖子 if (a.Laizi && !b.Laizi) { return(-1); } if (!a.Laizi && b.Laizi) { return(1); } if (a.Value < b.Value) { return(-1); } if (a.Value > b.Value) { return(1); } if (a.Value == b.Value) { if (a.MahjongIndex > b.MahjongIndex) { return(-1); } if (a.MahjongIndex < b.MahjongIndex) { return(1); } } return(0); }); MahjongVecter NowIndex = new MahjongVecter(); for (int i = 0; i < list.Count; i++) { Transform mahjongTf = list[i].transform; Vector3 pos = AgainGetPos(NowIndex, list.Count, PlayerHand.RowCnt); mahjongTf.localPosition = pos; NowIndex = GetNextMjIndex(NowIndex, PlayerHand.RowCnt, PlayerHand.ColCnt); } }
protected override Vector3 GetPos(MahjongVecter index) { if ((Chair == 0 || Chair == 2) && !GameCenter.DataCenter.Config.SortByCenter) { Vector3 mahjongSize = MiscUtility.MahjongSize; float Dis = -mMahjongList.Count * mahjongSize.x / 2 - mahjongSize.x * 1.2f / 2; Vector3 pos = new Vector3(Dis + mahjongSize.x * (index.x + 0.5f), mahjongSize.y * 0.5f, mahjongSize.z * 0.5f); pos.x = (pos.x - (RowCnt - mMahjongList.Count) / 2 * mahjongSize.x / 2); return(pos); } else { Vector3 mahjongSize = MiscUtility.MahjongSize; float Dis = -mMahjongList.Count * mahjongSize.x / 2 - mahjongSize.x * 1.2f / 2; return(new Vector3(Dis + mahjongSize.x * (index.x + 0.5f), mahjongSize.y * 0.5f, mahjongSize.z * 0.5f)); } }
public MahjongVecter GetNextMjIndex(MahjongVecter index, int RowCnt, int ColCnt) { MahjongVecter next = new MahjongVecter(index); if (RowCnt != 0 && next.x >= RowCnt - 1) { next.x = 0; if (next.y++ >= ColCnt - 1) { next.z++; next.y = 0; } } else { next.x++; } return(next); }
protected virtual MahjongVecter GetNextIndex(MahjongVecter index) { MahjongVecter next = new MahjongVecter(index); if (RowCnt != 0 && next.x >= RowCnt - 1) { next.x = 0; if (next.y++ >= ColCnt - 1) { next.z++; next.y = 0; } } else { next.x++; } return(next); }
protected override Vector3 GetPos(MahjongVecter index) { Vector3 mahjongSize = MiscUtility.MahjongSize; return(new Vector3(mahjongSize.x * (index.x + 0.5f), -mahjongSize.y * (index.y + 0.5f), -mahjongSize.z * (index.z + 0.5f))); }
public MahjongVecter(MahjongVecter temp) { x = temp.x; y = temp.y; z = temp.z; }
protected virtual Vector3 GetPos(MahjongVecter index) { Vector3 mahjongSize = MiscUtility.MahjongSize; return(new Vector3(mahjongSize.x * (index.x + 0.5f), -mahjongSize.y * (0.5f + mNowVecter.z), -mahjongSize.z * (index.y + 0.5f))); }