예제 #1
0
파일: Table.cs 프로젝트: alring/mahjong
        protected void debug_Click(object sender, EventArgs e)
        {
            BrandBox      b = (BrandBox)sender;
            StringBuilder s = new StringBuilder();

            s.Append(b.brand.getNumber() + "," + b.brand.getClass() + "\n");
            s.Append(Settings.Default.Debug_Number);
            s.Append(": " + b.brand.getNumber() + "\n");
            s.Append(Settings.Default.Debug_Class);
            s.Append(": " + b.brand.getClass() + "\n");
            s.Append(Settings.Default.Debug_Source);
            s.Append(": " + b.brand.Source + "\n");
            s.Append(Settings.Default.Debug_Team);
            s.Append(": " + b.brand.Team + "\n");
            s.Append(Settings.Default.Debug_IsCanSee);
            s.Append(": " + b.brand.IsCanSee + "\n");
            s.Append(Settings.Default.WhoPush);
            s.Append(": " + all.getLocation.location_to_string(b.brand.WhoPush) + "\n");
            s.Append(Settings.Default.Debug_Picture);
            s.Append(":\nX:" + b.Location.X + " Y: " + b.Location.Y + "\n");
            s.Append(Settings.Default.Debug_Picture_Width);
            s.Append(": " + b.Size.Width + "\n");
            s.Append(Settings.Default.Debug_Picture_Height);
            s.Append(": " + b.Size.Height + "\n");
            MessageBox.Show(s.ToString(), Settings.Default.Debug);
        }
예제 #2
0
 //delegate void add_flowLayoutBrands_delegate(location state, BrandBox brandbox);
 public override void add_flowLayoutBrands(location state, BrandBox brandbox)
 {
     if (fl_Table.InvokeRequired)
     {
         fl_Table.Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox });
     }
     else if (fl_Show_from_location(state).InvokeRequired)
     {
         fl_Show_from_location(state).Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox });
     }
     else if (fl_Hand_from_location(state).InvokeRequired)
     {
         fl_Hand_from_location(state).Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox });
     }
     else if (state == location.Table && brandbox.brand.IsCanSee == false)
     {
         fl_Table.Controls.Add(brandbox);
     }
     else if (brandbox.brand.IsCanSee == true && brandbox.brand.Team >= 1)
     {
         fl_Show_from_location(state).Controls.Add(brandbox);
     }
     else
     {
         fl_Hand_from_location(state).Controls.Add(brandbox);
     }
 }
예제 #3
0
        protected override void addimage(location state, Brand brand, RotateFlipType rotate)
        {
            Bitmap bitmap;
            // �p�G�O�i�����P�N�]�w��ܵP���ϫ��A�_�h�N��ܪ��ߪ��P Resources.upbarnd
            if (brand.IsCanSee || state == location.South || ShowAll)
                bitmap = new Bitmap(brand.image);
            else
                bitmap = new Bitmap(Resources.upbarnd);
            // �]�w�P
            BrandBox tempBrandbox = new BrandBox(brand);

            // �]�w�۰��Y��
            tempBrandbox.SizeMode = PictureBoxSizeMode.AutoSize;

            // �]�w��Z
            tempBrandbox.Margin = new Padding(0);
            tempBrandbox.Padding = new Padding(padding);

            // �n�઺����
            bitmap.RotateFlip(rotate);

            // ����
            if (ShowAll && ShowBrandInfo)
                tempBrandbox.Click += new EventHandler(debug_Click);

            // �ƹ��ƥ�
            if (
                state == location.South
                && brand.getClass() != Settings.Default.Flower
                && brand.Team < 1
                )
            {
                tempBrandbox.MouseMove += new MouseEventHandler(tempBrandbox_MouseMove);
                tempBrandbox.MouseLeave += new EventHandler(brandBox_MouseLeave);
                tempBrandbox.Click += new EventHandler(brandBox_MouseClick);

                // �@���ƥ�
                //if (ShowAll && ShowBrandInfo)
                //    tempBrandbox.MouseHover += new EventHandler(debug_Click);
                //else
                //    tempBrandbox.MouseHover -= new EventHandler(debug_Click);
            }
            else if (cheat && state != location.South)
            {
                tempBrandbox.MouseClick += new MouseEventHandler(cheat_MouseClick);
            }
            else
            {
                tempBrandbox.Click -= new EventHandler(brandBox_MouseClick);
                tempBrandbox.MouseClick -= new MouseEventHandler(cheat_MouseClick);

            }
            bitmap = ResizeBitmap(bitmap, Settings.Default.ResizePercentage);

            // �]�w�Ϥ�
            tempBrandbox.Image = bitmap;

            // �s�W�ܱ��
            add_flowLayoutBrands(state, tempBrandbox);
        }
예제 #4
0
파일: Table.cs 프로젝트: alring/mahjong
        protected void tempBrandbox_MouseMove(object sender, MouseEventArgs e)
        {
            BrandBox b = (BrandBox)sender;

            if (pc.NowPlayer_is_Real_Player && all.State == place.Down)
            {
                b.BackColor = Color.Blue;
            }
        }
예제 #5
0
파일: Table.cs 프로젝트: alring/mahjong
 void add_flowLayoutBrands(int state, BrandBox brandbox)
 {
     if (flowLayoutBrands[state].InvokeRequired)
     {
         flowLayoutBrands[state].Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox });
     }
     else
     {
         flowLayoutBrands[state].Controls.Add(brandbox);
     }
 }
예제 #6
0
 public virtual void add_flowLayoutBrands(location state, BrandBox brandbox)
 {
     if (flowLayoutBrands[(int)state].InvokeRequired)
     {
         flowLayoutBrands[(int)state].Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox });
     }
     else
     {
         flowLayoutBrands[(int)state].Controls.Add(brandbox);
     }
 }
예제 #7
0
파일: NewTable.cs 프로젝트: alring/mahjong
 private void add_flowLayoutBrands(location state, BrandBox brandbox)
 {
     if (state == location.Table && brandbox.brand.IsCanSee == false)
     {
         fl_Table.Controls.Add(brandbox);
     }
     else if (brandbox.brand.IsCanSee == true && brandbox.brand.Team >= 1)
     {
         fl_Show_from_location(state).Controls.Add(brandbox);
     }
     else
     {
         fl_Hand_from_location(state).Controls.Add(brandbox);
     }
 }
예제 #8
0
파일: Table.cs 프로젝트: alring/mahjong
        /// <summary>
        /// 按下一張牌的事件
        /// </summary>
        /// <param name="sender">BrandBox</param>
        /// <param name="e"></param>
        protected void brandBox_MouseClick(object sender, EventArgs e)
        {
            BrandBox b = (BrandBox)sender;

            // 確定為玩家才發送事件
            if (pc.NowPlayer_is_Real_Player && all.State == place.Down)
            {
                if (pc.PlayerSound)
                {
                    PlaySound(b.brand);
                }
                pc.makeBrand(b.brand);
            }
            b.Click -= new EventHandler(debug_Click);
        }
예제 #9
0
        void addimage_to_FlowLayout(FlowLayoutPanel flow, BrandPlayer player, EventHandler ev)
        {
            for (int i = 0; i < player.getCount(); i++)
            {
                Bitmap   bitmap = new Bitmap(ResourcesTool.getImage(player.getBrand(i)));
                BrandBox b      = new BrandBox(player.getBrand(i));

                b.SizeMode = PictureBoxSizeMode.AutoSize;

                bitmap   = ResizeBitmap(bitmap, Mahjong.Properties.Settings.Default.ResizePercentage);
                b.Click += ev;

                b.Image = bitmap;
                flow.Controls.Add(b);
            }
        }
예제 #10
0
        void addimage_to_FlowLayout(FlowLayoutPanel flow,BrandPlayer player,EventHandler ev)
        {
            for (int i = 0; i < player.getCount(); i++)
            {
                Bitmap bitmap = new Bitmap(player.getBrand(i).image);
                BrandBox b = new BrandBox(player.getBrand(i));

                b.SizeMode = PictureBoxSizeMode.AutoSize;

                bitmap = ResizeBitmap(bitmap, Mahjong.Properties.Settings.Default.ResizePercentage);
                b.Click += ev;

                b.Image = bitmap;
                flow.Controls.Add(b);
            }
        }
예제 #11
0
 //delegate void add_flowLayoutBrands_delegate(location state, BrandBox brandbox);
 public override void add_flowLayoutBrands(location state, BrandBox brandbox)
 {
     if (fl_Table.InvokeRequired)
     {
         fl_Table.Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox });
     }
     else if (fl_Show_from_location(state).InvokeRequired)
     {
         fl_Show_from_location(state).Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox });
     }
     else if (fl_Hand_from_location(state).InvokeRequired)
     {
         fl_Hand_from_location(state).Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox });
     }
     else if (state == location.Table && brandbox.brand.IsCanSee == false)
         fl_Table.Controls.Add(brandbox);
     else if (brandbox.brand.IsCanSee == true && brandbox.brand.Team >= 1)
         fl_Show_from_location(state).Controls.Add(brandbox);
     else
         fl_Hand_from_location(state).Controls.Add(brandbox);
 }
예제 #12
0
파일: Table.cs 프로젝트: alring/mahjong
        /// <summary>
        /// 作弊事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cheat_MouseClick(object sender, MouseEventArgs e)
        {
            BrandBox b = (BrandBox)sender;

            if (all.Show_Table.remove(b.brand))
            {
                all.Show_Table.add(all.NowPlayer.getBrand(all.NowPlayer.getCount() - 1));
                all.Show_Table.getBrand(all.Show_Table.getCount() - 1).IsCanSee = true;
            }
            else if (all.Table.remove(b.brand))
            {
                all.Table.add(all.NowPlayer.getBrand(all.NowPlayer.getCount() - 1));
                all.Table.getBrand(all.Show_Table.getCount() - 1).IsCanSee = false;
            }
            else if (all.Players[0].remove(b.brand))
            {
                all.Players[0].add(all.NowPlayer.getBrand(all.NowPlayer.getCount() - 1));
            }
            else if (all.Players[1].remove(b.brand))
            {
                all.Players[1].add(all.NowPlayer.getBrand(all.NowPlayer.getCount() - 1));
            }
            else if (all.Players[2].remove(b.brand))
            {
                all.Players[2].add(all.NowPlayer.getBrand(all.NowPlayer.getCount() - 1));
            }
            else if (all.Players[3].remove(b.brand))
            {
                all.Players[3].add(all.NowPlayer.getBrand(all.NowPlayer.getCount() - 1));
            }

            all.NowPlayer.remove(all.NowPlayer.getBrand(all.NowPlayer.getCount() - 1));
            all.NowPlayer.add(b.brand);
            cleanImage();
            addImage();
        }
예제 #13
0
파일: NewTable.cs 프로젝트: alring/mahjong
        protected override void addimage(location state, Brand brand, RotateFlipType rotate)
        {
            Bitmap bitmap;

            // 如果是可視的牌就設定顯示牌的圖型,否則就顯示直立的牌 Resources.upbarnd
            if (brand.IsCanSee || state == location.South || ShowAll)
            {
                bitmap = new Bitmap(brand.image);
            }
            else
            {
                bitmap = new Bitmap(Resources.upbarnd);
            }
            // 設定牌
            BrandBox tempBrandbox = new BrandBox(brand);

            // 設定自動縮放
            tempBrandbox.SizeMode = PictureBoxSizeMode.AutoSize;

            // 設定邊距
            tempBrandbox.Margin  = new Padding(0);
            tempBrandbox.Padding = new Padding(padding);

            // 要轉的角度
            bitmap.RotateFlip(rotate);

            // 提示
            if (ShowAll && ShowBrandInfo)
            {
                tempBrandbox.Click += new EventHandler(debug_Click);
            }

            // 滑鼠事件
            if (
                state == location.South &&
                brand.getClass() != Settings.Default.Flower &&
                brand.Team < 1
                )
            {
                tempBrandbox.MouseMove  += new MouseEventHandler(tempBrandbox_MouseMove);
                tempBrandbox.MouseLeave += new EventHandler(brandBox_MouseLeave);
                tempBrandbox.Click      += new EventHandler(brandBox_MouseClick);

                // 作弊事件
                //if (ShowAll && ShowBrandInfo)
                //    tempBrandbox.MouseHover += new EventHandler(debug_Click);
                //else
                //    tempBrandbox.MouseHover -= new EventHandler(debug_Click);
            }
            else if (cheat && state != location.South)
            {
                tempBrandbox.MouseClick += new MouseEventHandler(cheat_MouseClick);
            }
            else
            {
                tempBrandbox.Click      -= new EventHandler(brandBox_MouseClick);
                tempBrandbox.MouseClick -= new MouseEventHandler(cheat_MouseClick);
            }
            bitmap = ResizeBitmap(bitmap, Settings.Default.ResizePercentage);

            // 設定圖片
            tempBrandbox.Image = bitmap;

            // 新增至控制項
            add_flowLayoutBrands(state, tempBrandbox);
        }
예제 #14
0
파일: Table.cs 프로젝트: Superbil/mahjong
 public virtual void add_flowLayoutBrands(location state, BrandBox brandbox)
 {
     if (flowLayoutBrands[(int)state].InvokeRequired)
     {
         flowLayoutBrands[(int)state].Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox });
     }
     else
         flowLayoutBrands[(int)state].Controls.Add(brandbox);
 }
예제 #15
0
파일: Table.cs 프로젝트: Superbil/mahjong
        protected virtual void addimage(location state, Brand brand, RotateFlipType rotate)
        {
            Bitmap bitmap;
            // 如果是可視的牌就設定顯示牌的圖型,否則就顯示直立的牌 Resources.upbarnd
            if (brand.IsCanSee || state == location.South || ShowAll)
                bitmap = new Bitmap(ResourcesTool.getImage(brand));
            else
                bitmap = new Bitmap(Resources.upbarnd);
            // 設定牌
            BrandBox tempBrandbox = new BrandBox(brand);

            // 設定自動縮放
            tempBrandbox.SizeMode = PictureBoxSizeMode.AutoSize;

            // 設定邊距            
            tempBrandbox.Margin = new Padding(0);
            tempBrandbox.Padding = new Padding(padding);

            // 要轉的角度
            bitmap.RotateFlip(rotate);

            // 提示
            if (ShowAll && ShowBrandInfo)
                tempBrandbox.Click += new EventHandler(debug_Click);

            // 滑鼠事件
            if (
                state == location.South
                && brand.getClass() != Settings.Default.Flower
                && brand.Team < 1
                )
            {
                tempBrandbox.MouseMove += new MouseEventHandler(tempBrandbox_MouseMove);
                tempBrandbox.MouseLeave += new EventHandler(brandBox_MouseLeave);
                tempBrandbox.Click += new EventHandler(brandBox_MouseClick);

                // 作弊事件
                //if (ShowAll && ShowBrandInfo)
                //    tempBrandbox.MouseHover += new EventHandler(debug_Click);
                //else
                //    tempBrandbox.MouseHover -= new EventHandler(debug_Click);
            }
            else if (brand.Team >= 1)
            {
                tempBrandbox.BackColor = Color.DarkGreen;
            }
            else if (cheat && state != location.South)
            {
                tempBrandbox.MouseClick += new MouseEventHandler(cheat_MouseClick);
            }
            else
            {
                tempBrandbox.Click -= new EventHandler(brandBox_MouseClick);
                tempBrandbox.MouseClick -= new MouseEventHandler(cheat_MouseClick);

            }
            bitmap = ResizeBitmap(bitmap, Settings.Default.ResizePercentage);

            // 設定圖片      
            tempBrandbox.Image = bitmap;

            // 新增至控制項
            add_flowLayoutBrands(state, tempBrandbox);
        }
예제 #16
0
 private void add_flowLayoutBrands(location state, BrandBox brandbox)
 {
     if (state == location.Table && brandbox.brand.IsCanSee == false)
         fl_Table.Controls.Add(brandbox);
     else if (brandbox.brand.IsCanSee == true && brandbox.brand.Team >= 1)
         fl_Show_from_location(state).Controls.Add(brandbox);
     else
         fl_Hand_from_location(state).Controls.Add(brandbox);
 }
예제 #17
0
파일: Table.cs 프로젝트: alring/mahjong
        protected void brandBox_MouseLeave(object sender, EventArgs e)
        {
            BrandBox b = (BrandBox)sender;

            b.BackColor = BackColor;
        }
예제 #18
0
파일: Table.cs 프로젝트: billteng/mahjong
 void add_flowLayoutBrands(int state, BrandBox brandbox)
 {
     if (flowLayoutBrands[state].InvokeRequired)
     {
         flowLayoutBrands[state].Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state,brandbox });
     }
     else
         flowLayoutBrands[state].Controls.Add(brandbox);
 }