protected override Vector3 GetPos(MjIndex index) { Vector3 mahjongSize = MahjongManager.MagjongSize; float Dis = -MahjongList.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)); }
protected override MjIndex GetNextIndex(MjIndex mjIndex) { MjIndex next = new MjIndex(mjIndex); next.x++; return(next); }
protected override Vector3 GetPos(MjIndex index) { Vector3 mahjongSize = MahjongManager.MagjongSize; Vector3 pos = base.GetPos(index); pos.x = pos.x - (RowCnt - MahjongList.Count) / 2 * mahjongSize.x / 2; return(pos); }
public virtual void PickUpMahjongAction(MahjongItem item) { if (LastGetIn == null) { SetMahjongPos(); return; } //扔出的牌 是刚刚抓上来的 不需要处理 if (item == LastGetIn) { return; } //获得 最后麻将 应该在的位子 var index = new MjIndex(); foreach (var mjItem in MahjongList) { if (mjItem == LastGetIn) { break; } index = GetNextIndex(index); } //如果在最后 直接排序 不要动作 if (index.x + 1 == MahjongList.Count) { SetMahjongPos(); return; } var pos = GetPos(index); LastGetIn.GetInMjAction(pos, (s) => { //移动结束后 所有的麻将 要移动到相对应的位子 if (s.Equals("MoveFinish")) { index = new MjIndex(); foreach (var mahjongItem in MahjongList) { if (mahjongItem != LastGetIn) { var mjPos = GetPos(index); mahjongItem.MoveToAction(mjPos, GameConfig.PickUpTime); } index = GetNextIndex(index); } } else if (s.Equals("PutDownFinish")) { SetMahjongPos(); } }); }
protected virtual void SetMahjongPos() { NowIndex = new MjIndex(); for (int i = 0; i < MahjongList.Count; i++) { Transform mahjongTf = MahjongList[i].transform; Vector3 pos = GetPos(NowIndex); mahjongTf.localPosition = pos; NowIndex = GetNextIndex(NowIndex); } }
protected override Vector3 GetPos(MjIndex index) { Vector3 mahjongSize = MahjongManager.MagjongSize; 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))); }
protected virtual MjIndex GetNextIndex(MjIndex index) { MjIndex next = new MjIndex(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(MjIndex index) { Vector3 mahjongSize = MahjongManager.MagjongSize; return(new Vector3(mahjongSize.x * (index.x + 0.5f), -mahjongSize.y * (index.y + 0.5f), -mahjongSize.z * (index.z + 0.5f))); }
public MjIndex(MjIndex temp) { x = temp.x; y = temp.y; z = temp.z; }
public virtual void Reset() { NowIndex = new MjIndex(); MahjongList.Clear(); }
public virtual Vector3 GetNextMjPos() { MjIndex next = GetNextIndex(NowIndex); return(GetPos(next)); }
protected virtual Vector3 GetPos(MjIndex index) { Vector3 mahjongSize = MahjongManager.MagjongSize; return(new Vector3(mahjongSize.x * (index.x + 0.5f), -mahjongSize.y * (0.5f + NowIndex.z), -mahjongSize.z * (index.y + 0.5f))); }