コード例 #1
0
ファイル: MahjongHard.cs プロジェクト: narakai/chessgame
        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));
        }
コード例 #2
0
        protected override MjIndex GetNextIndex(MjIndex mjIndex)
        {
            MjIndex next = new MjIndex(mjIndex);

            next.x++;
            return(next);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: MahjongHard.cs プロジェクト: narakai/chessgame
        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();
                }
            });
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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)));
        }
コード例 #7
0
        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);
        }
コード例 #8
0
ファイル: MahjongThrow.cs プロジェクト: narakai/chessgame
        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)));
        }
コード例 #9
0
 public MjIndex(MjIndex temp)
 {
     x = temp.x;
     y = temp.y;
     z = temp.z;
 }
コード例 #10
0
        public virtual void Reset()
        {
            NowIndex = new MjIndex();

            MahjongList.Clear();
        }
コード例 #11
0
        public virtual Vector3 GetNextMjPos()
        {
            MjIndex next = GetNextIndex(NowIndex);

            return(GetPos(next));
        }
コード例 #12
0
        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)));
        }