Ejemplo n.º 1
0
        protected override void RenderPeng()
        {
            base.RenderPeng();

            Desk    desk = ((GameController)_controller).Desk;
            PGCards pg   = _putcards[_putidx];

            UnityEngine.Debug.Assert(pg.Cards.Count == 3);
            for (int i = 0; i < pg.Cards.Count - 1; i++)
            {
                _com.Remove(pg.Cards[i]);
            }
            float offset = _putrightoffset;

            for (int i = 0; i < _putidx; i++)
            {
                UnityEngine.Debug.Assert(_putcards[i].Width > 0.0f);
                offset += _putcards[i].Width + _putmargin;
            }

            _putmove = new Vector3(0.1f, 0.0f, 0.0f);
            for (int i = 0; i < pg.Cards.Count; i++)
            {
                float x = 0.0f;
                float y = Card.Height / 2.0f + Card.HeightMZ;
                float z = _putbottomoffset;
                if (i == pg.Hor)
                {
                    x         = desk.Width - (offset + Card.Length / 2.0f);
                    z         = _putbottomoffset + Card.Width / 2.0f;
                    offset   += Card.Length;
                    pg.Width += Card.Length;
                    pg.Cards[i].Go.transform.localRotation = _uph;
                }
                else
                {
                    x         = desk.Width - (offset + Card.Width / 2.0f);
                    z         = _putbottomoffset + Card.Length / 2.0f;
                    offset   += Card.Width;
                    pg.Width += Card.Width;
                    pg.Cards[i].Go.transform.localRotation = _upv;
                }
                pg.Cards[i].Go.transform.localPosition = new Vector3(x, y, z) - _putmove;
            }

            RenderPeng1();
        }
Ejemplo n.º 2
0
        protected override void RenderGang()
        {
            base.RenderGang();

            Desk    desk = ((GameController)_controller).Desk;
            PGCards pg   = _putcards[_putidx];

            UnityEngine.Debug.Assert(pg.Cards.Count == 4);

            float offset = _putrightoffset;

            for (int i = 0; i < _putidx; i++)
            {
                UnityEngine.Debug.Assert(_putcards[i].Width > 0.0f);
                offset += _putcards[i].Width + _putmargin;
            }

            _putmove = new Vector3(0.1f, 0.0f, 0.0f);

            if (pg.Opcode == OpCodes.OPCODE_ZHIGANG)
            {
                for (int i = 0; i < _cards.Count - 1; i++)
                {
                    _com.Remove(_cards[i]);
                }

                for (int i = 0; i < pg.Cards.Count; i++)
                {
                    float x = 0.0f;
                    float y = Card.Height / 2.0f + Card.HeightMZ;
                    float z = _putbottomoffset;
                    if (i == pg.Hor)
                    {
                        x         = desk.Width - (offset + Card.Length / 2.0f);
                        z         = _putbottomoffset + Card.Width / 2.0f;
                        offset   += Card.Length;
                        pg.Width += Card.Length;
                        pg.Cards[i].Go.transform.localRotation = _uph;
                    }
                    else
                    {
                        x         = desk.Width - (offset + Card.Width / 2.0f);
                        z         = _putbottomoffset + Card.Length / 2.0f;
                        offset   += Card.Width;
                        pg.Width += Card.Width;
                        pg.Cards[i].Go.transform.localRotation = _upv;
                    }
                    pg.Cards[i].Go.transform.localPosition = new Vector3(x, y, z) - _putmove;
                }

                RenderGang1(() => {
                    RenderSortCardsToDo(_pgsortcardsdelta, () => {
                        Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                        _ctx.Enqueue(cmd);
                    });
                });
            }
            else if (pg.Opcode == OpCodes.OPCODE_ANGANG)
            {
                for (int i = 0; i < pg.Cards.Count; i++)
                {
                    float x = desk.Width - (offset + Card.Width / 2.0f);
                    float y = Card.Height / 2.0f + Card.HeightMZ;
                    float z = _putbottomoffset + Card.Length / 2.0f;
                    offset   += Card.Width;
                    pg.Width += Card.Width;

                    if (i == pg.Hor)
                    {
                        pg.Cards[i].Go.transform.localRotation = _upv;
                    }
                    else
                    {
                        pg.Cards[i].Go.transform.localRotation = _backv;
                    }
                    pg.Cards[i].Go.transform.localPosition = new Vector3(x, y, z) - _putmove;
                }
                RenderGang1(() => {
                    Vector3 dst = _putcards[_putidx].Cards[3].Go.transform.localPosition;
                    ((GameController)_controller).Desk.RenderChangeCursor(new Vector3(dst.x, dst.y + desk.CurorMH, dst.z));

                    if (pg.Cards[3].Value == _holdcard.Value)
                    {
                        // 娓呴櫎go
                        for (int j = 0; j < pg.Cards.Count - 1; j++)
                        {
                            _com.Remove(pg.Cards[j]);
                        }
                        _com.HoldCard = null;

                        RenderSortCardsToDo(_pgsortcardsdelta, () => {
                            Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                            _ctx.Enqueue(cmd);
                        });
                    }
                    else
                    {
                        // 娓呴櫎go,鍔犲叆holdcard
                        for (int j = 0; j < pg.Cards.Count; j++)
                        {
                            _com.Remove(pg.Cards[j]);
                        }
                        _com.Add(_holdcard);

                        if (_holdcard.Pos == (_cards.Count - 1))
                        {
                            RenderSortCardsToDo(_pgsortcardsdelta, () => {
                                Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                                _ctx.Enqueue(cmd);
                            });
                        }
                        else
                        {
                            RenderFly(() => {
                                Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                                _ctx.Enqueue(cmd);
                            });
                        }
                    }
                });
            }
            else if (pg.Opcode == OpCodes.OPCODE_BUGANG)
            {
                float x = desk.Width - (offset + (Card.Width * pg.Hor) + (Card.Length / 2.0f));
                float y = Card.Height / 2.0f;
                float z = _putbottomoffset + Card.Width + Card.Width / 2.0f;
                pg.Cards[3].Go.transform.localPosition = new Vector3(x, y, z) - _putmove;
                pg.Cards[3].Go.transform.localRotation = _uph;

                RenderGang1(() => {
                    Vector3 dst = _putcards[_putidx].Cards[3].Go.transform.localPosition;
                    ((GameController)_controller).Desk.RenderChangeCursor(new Vector3(dst.x, dst.y + desk.CurorMH, +dst.z));

                    if (_holdcard.Value == pg.Cards[3].Value)
                    {
                        _com.HoldCard = null;
                        _holdcard     = null;
                        Command cmd   = new Command(MyEventCmd.EVENT_GANGCARD);
                        _ctx.Enqueue(cmd);
                    }
                    else
                    {
                        _com.Remove(pg.Cards[3]);
                        _com.Add(_holdcard);

                        if (_holdcard.Pos == (_cards.Count - 1))
                        {
                            RenderSortCardsToDo(_pgsortcardsdelta, () => {
                                Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                                _ctx.Enqueue(cmd);
                            });
                        }
                        else
                        {
                            RenderFly(() => {
                                Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                                _ctx.Enqueue(cmd);
                            });
                        }
                    }
                });
            }
            else
            {
                UnityEngine.Debug.Assert(false);
            }
        }
Ejemplo n.º 3
0
        protected override void RenderGang()
        {
            base.RenderGang();

            Desk    desk = ((GameController)_controller).Desk;
            PGCards pg   = _putcards[_putidx];

            UnityEngine.Debug.Assert(pg.Cards.Count > 0.0f);

            float offset = _putrightoffset;

            for (int i = 0; i < _putidx; i++)
            {
                UnityEngine.Debug.Assert(_putcards[i].Width > 0.0f);
                offset += _putcards[i].Width + _putmargin;
            }
            _putmove = new Vector3(0.0f, 0.0f, 1.0f);

            if (pg.Opcode == OpCodes.OPCODE_ZHIGANG)
            {
                for (int i = 0; i < pg.Cards.Count; i++)
                {
                    float x = _putbottomoffset;
                    float y = Card.Height / 2.0f + Card.HeightMZ;
                    float z = 0.0f;
                    if (i == pg.Hor)
                    {
                        x         = desk.Width - (_putbottomoffset + Card.Width / 2.0f);
                        z         = desk.Length - (offset + Card.Length / 2.0f);
                        offset   += Card.Length;
                        pg.Width += Card.Length;
                        pg.Cards[i].Go.transform.localRotation = _uph;
                    }
                    else
                    {
                        x         = desk.Width - (_putbottomoffset + Card.Length / 2.0f);
                        z         = desk.Length - (offset + Card.Width / 2.0f);
                        offset   += Card.Width;
                        pg.Width += Card.Width;
                        pg.Cards[i].Go.transform.localRotation = _upv;
                    }
                    pg.Cards[i].Go.transform.localPosition = new Vector3(x, y, z) - _putmove;
                }

                RenderGang1(() => {
                    RenderSortCardsToDo(_sortcardsdelta, () => {
                        Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                        _ctx.Enqueue(cmd);
                    });
                });
            }
            else if (pg.Opcode == OpCodes.OPCODE_ANGANG)
            {
                for (int i = 0; i < pg.Cards.Count; i++)
                {
                    float x = _putbottomoffset + Card.Length / 2.0f;
                    float y = Card.Height / 2.0f + Card.HeightMZ;
                    float z = desk.Length - (offset + Card.Width / 2.0f);
                    offset   += Card.Width;
                    pg.Width += Card.Width;

                    if (i == 0)
                    {
                        pg.Cards[i].Go.transform.localRotation = _upv;
                    }
                    else
                    {
                        pg.Cards[i].Go.transform.localRotation = _downv;
                    }
                    pg.Cards[i].Go.transform.localPosition = new Vector3(x, y, z) - _putmove;
                }

                RenderGang1(() => {
                    if (pg.Cards[3].Value == _holdcard.Value)
                    {
                        RenderSortCardsToDo(_sortcardsdelta, () => {
                            Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                            _ctx.Enqueue(cmd);
                        });
                    }
                    else
                    {
                        if (_holdcard.Pos == (_cards.Count - 1))
                        {
                            RenderSortCardsToDo(_sortcardsdelta, () => {
                                Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                                _ctx.Enqueue(cmd);
                            });
                        }
                        else
                        {
                            RenderFly(() => {
                                Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                                _ctx.Enqueue(cmd);
                            });
                        }
                    }
                });
            }
            else if (pg.Opcode == OpCodes.OPCODE_BUGANG)
            {
                float x = _putbottomoffset + Card.Width / 2.0f + Card.Width;
                float y = Card.Height / 2.0f;
                float z = desk.Length - (offset + Card.Width * pg.Hor + Card.Width / 2.0f);
                pg.Cards[3].Go.transform.localPosition = new Vector3(x, y, z) - _putmove;
                pg.Cards[3].Go.transform.localRotation = _uph;

                RenderGang1(() => {
                    if (_holdcard.Value == pg.Cards[3].Value)
                    {
                        _holdcard   = null;
                        Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                        _ctx.Enqueue(cmd);
                    }
                    else
                    {
                        RenderFly(() => {
                            Command cmd = new Command(MyEventCmd.EVENT_GANGCARD);
                            _ctx.Enqueue(cmd);
                        });
                    }
                });
            }
        }