コード例 #1
0
ファイル: BanCo.cs プロジェクト: tennoujikotarou/ludocsharp
        public void XuLyBanCo()
        {
            int UserHienTai = this.DLBC.UserHienTai;

            DuLieu.DuLieuUser UserInfo = (DuLieu.DuLieuUser) this.DLBC.arrUsers[UserHienTai - 1];
            for (int i = 0; i < UserInfo.SoQuanCo; i++)
            {
                XuLy.QuanCo qc = (XuLy.QuanCo)UserInfo.arrQC[i];
                qc.QCTH.dlbc           = this.DLBC;
                qc.QCTH.dlqc           = qc.QCDL;
                qc.QCTH.User           = UserInfo;
                qc.QCTH.TrangThaiClick = true;
            }
        }
コード例 #2
0
        //Da Quan
        public void DaQuan(int vtTrenBC)
        {
            int QuanMau = dlbc.arrBC[vtTrenBC];

            DuLieu.DuLieuUser User = (DuLieu.DuLieuUser)dlbc.arrUsers[QuanMau - 1];
            for (int i = 0; i < User.SoQuanCo; i++)
            {
                XuLy.QuanCo qc = (XuLy.QuanCo)User.arrQC[i];
                if (qc.QCDL.ViTriTrenBanCo == vtTrenBC)
                {
                    qc.QCTH.picQC.Location = new Point(qc.QCDL.ViTriTrongChuong.X, qc.QCDL.ViTriTrongChuong.Y);
                    qc.QCDL.ViTriTrenBanCo = -1;
                    return;
                }
            }
        }
コード例 #3
0
ファイル: BanCo.cs プロジェクト: tennoujikotarou/ludocsharp
        //tao cac quan tren bc
        public void TaoViTriQuan(Point vtCB, int i, DuLieu.DuLieuUser User, System.Windows.Forms.Panel panel)
        {
            Point p;
            int   X = -24, Y = -24;

            if (i == 1)
            {
                Y = -Y;
            }
            if (i == 2)
            {
                X = -X; Y = -Y;
            }
            if (i == 3)
            {
                X = -X;
            }
            for (int j = 0; j < User.SoQuanCo; j++)
            {
                if (j == 0 || j == 2 || j == 4)
                {
                    p = new Point(vtCB.X + (j / 2 * X), vtCB.Y);
                }
                else
                {
                    p = new Point(vtCB.X + ((j - 1) / 2 * X), vtCB.Y + Y);
                }
                XuLy.QuanCo qc = (XuLy.QuanCo)User.arrQC[j];
                qc.QCDL.ViTriTrongChuong = p;
                qc.QCDL.ViTriTrenBanCo   = -1;
                qc.QCDL.ViTriRaQuan      = i * 14;
                if (qc.QCDL.ViTriRaQuan == 0)
                {
                    qc.QCDL.ViTriVeDich = 55;
                }
                else
                {
                    qc.QCDL.ViTriVeDich = qc.QCDL.ViTriRaQuan - 1;
                }
                qc.QCDL.MauCo          = i + 1;
                qc.QCTH.picQC.Location = new Point(qc.QCDL.ViTriTrongChuong.X, qc.QCDL.ViTriTrongChuong.Y);
                qc.QCTH.HienThi(i + 1);
                panel.Controls.Add(qc.QCTH.picQC);
            }
        }
コード例 #4
0
        public void KhoiTaoMangVeDich(int iUser, DuLieu.DuLieuUser User)
        {
            Point p;
            int   d = 27;
            int   n = 6;
            int   t;

            if (iUser == 0)
            {
                p = new Point(224, 388);
                for (int i = 0; i < n; i++)
                {
                    t = p.Y + (-d * i);
                    User.arrVtDich[i] = new Point(p.X, t);
                }
            }

            if (iUser == 1)
            {
                p = new Point(395, 222);
                for (int i = 0; i < n; i++)
                {
                    t = p.X + (-d * i);
                    User.arrVtDich[i] = new Point(t, p.Y);
                }
            }
            if (iUser == 2)
            {
                p = new Point(224, 50);
                for (int i = 0; i < n; i++)
                {
                    t = p.Y + d * i;
                    User.arrVtDich[i] = new Point(p.X, t);
                }
            }
            if (iUser == 3)
            {
                p = new Point(58, 222);
                for (int i = 0; i < n; i++)
                {
                    t = p.X + d * i;
                    User.arrVtDich[i] = new Point(t, p.Y);
                }
            }
        }
コード例 #5
0
 public int LaySoQuanVeDich()
 {
     DuLieu.DuLieuUser User = (DuLieu.DuLieuUser) this.dlbc.arrUsers[dlqc.MauCo - 1];
     return(User.SoQuanVeDich);
 }
コード例 #6
0
        public int ThucHienNuocDi()
        {
            if (dlqc.ViTriTrenBanCo == -1)
            {
                if (this.KiemTraRaQuan() == true)
                {
                    if (dlbc.arrBC[dlqc.ViTriRaQuan] != dlqc.MauCo)
                    {
                        if (dlbc.arrBC[dlqc.ViTriRaQuan] != 0)
                        {
                            DaQuan(dlqc.ViTriRaQuan);
                        }
                        dlqc.ViTriTrenBanCo             = dlqc.ViTriRaQuan;
                        dlbc.arrBC[dlqc.ViTriTrenBanCo] = dlqc.MauCo;
                        dlqc.Count++;
                        XuLy.BanCo bc = new CoCaNgua.XuLy.BanCo();
                        Point      p  = bc.LayVT(dlqc.ViTriTrenBanCo);
                        this.picQC.Location = new Point(p.X, p.Y);

                        return(1);
                    }
                }
            }
            else
            {
                int gt = dlbc.LayGiaTriXN();

                if (dlqc.ViTriTrenBanCo == dlqc.ViTriVeDich)
                {
                    if (KiemTraVeDich() == true && dlqc.Bac == 0)
                    {
                        int n = LaySoQuanVeDich();
                        DuLieu.DuLieuUser User = (DuLieu.DuLieuUser)dlbc.arrUsers[dlqc.MauCo - 1];
                        Point             p    = (Point)User.arrVtDich[5 - n];
                        this.picQC.Location             = new Point(p.X, p.Y);
                        dlbc.arrBC[dlqc.ViTriTrenBanCo] = 0;
                        User.SoQuanVeDich++;
                        dlqc.Bac = 5 - n;
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                if (dlqc.Count + gt > dlbc.SoOBc)
                {
                    return(0);
                }
                if (this.KiemTraDiDuoc(gt, dlqc.ViTriTrenBanCo) == true)
                {
                    if (dlbc.arrBC[(dlqc.ViTriTrenBanCo + gt) % 56] != dlqc.MauCo)
                    {
                        if (dlbc.arrBC[(dlqc.ViTriTrenBanCo + gt) % 56] != 0)
                        {
                            DaQuan((dlqc.ViTriTrenBanCo + gt) % 56);
                        }
                        dlbc.arrBC[dlqc.ViTriTrenBanCo] = 0;
                        dlqc.ViTriTrenBanCo            += gt;
                        dlqc.ViTriTrenBanCo            %= 56;
                        dlbc.arrBC[dlqc.ViTriTrenBanCo] = dlqc.MauCo;
                        dlqc.Count += dlbc.LayGiaTriXN();
                        XuLy.BanCo bc = new CoCaNgua.XuLy.BanCo();
                        Point      p  = bc.LayVT(dlqc.ViTriTrenBanCo);
                        this.picQC.Location = new Point(p.X, p.Y);
                        return(1);
                    }
                }
            }
            return(0);
        }