91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

怎么用C#實現winform版飛行棋

發布時間:2021-07-21 20:33:26 來源:億速云 閱讀:211 作者:chen 欄目:開發技術

本篇內容介紹了“怎么用C#實現winform版飛行棋”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

本文實例為大家分享了C#實現winform版飛行棋的具體代碼,供大家參考,具體內容如下

游戲界面

怎么用C#實現winform版飛行棋

怎么用C#實現winform版飛行棋

游戲規則:

1、兩個人輪流擲骰子紅人和綠人
2、投擲出2,4,6點出門,投擲出6點可以在出門后再次投擲行走
3、地圖長度共100步
4、地圖中除過普通地板之外,另設六種特殊功能地板

(1) 踩到香蕉皮,退6步
(2) 踩到時空,前進6步
(3) 踩到陷阱,暫停一回合
(4) 踩到星星,可以再投擲一次
(5) 踩到移魂大法,可以做出選擇與對方互換位置
(6) 踩到手槍,可以擊退對方3步
(7) 踩到大炮,可以直接將對方轟炸回家(需要重新出門)

5、如果踩到對方,則對方直接回到起點,

游戲策劃

1.地圖面積30*13
2.每個格子30像素
3.地面的代號=0,普通地板=1,香蕉皮=2,時空=3,陷阱=4,星星=5,大挪移=6,手槍=7
紅人=8,綠人=9
起點=10,終點=11
兩人在同一位置=12

程序代碼

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 飛行棋
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        Panel map = new Panel(); // 創建游戲區對象
        int[] mapList = new int[390];//存儲地圖數的數組
        PictureBox[] mapImg = new PictureBox[390];// 存儲圖片的數組
        const int size = 30;// 格子大小
        Label jiLu = new Label();
        RichTextBox msg = new RichTextBox(); //存儲近況
        Random r = new Random();
        PictureBox dice = new PictureBox(); //創建骰子對象
        Panel redplayHome = new Panel(); // 紅方飛機
        Panel greenplayHome = new Panel(); //綠方飛機
        private void Form1_Load(object sender, EventArgs e)
        {
            // 設置不可移動
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            // this.FormBorderStyle=FormBorderStyle.FixedToolWindow與Icon圖標不可連用
            this.BackColor =Color.Plum;
            this.Size = new Size(1200, 600);
            this.Location = new Point(Screen.PrimaryScreen.Bounds.Width / 2 - this.Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2 - this.Height / 2);
            // 地圖對象
            map.Width = 30 * size;
            map.Height = 13 * size;
            map.Location = new Point(10, 150);
            map.BorderStyle = BorderStyle.FixedSingle;
            this.Controls.Add(map);
            InitialGame(); //調用初始化地圖圖片方法
            // 紅方的家
            redplayHome.Size = new Size(100, 100);
            redplayHome.BackgroundImage = Image.FromFile("../../img/select_circle.png");
            redplayHome.Location = new Point(20, map.Top - 120);
            redplayHome.BackgroundImageLayout = ImageLayout.Stretch;
            this.Controls.Add(redplayHome);
            // 綠方的家
            greenplayHome.Size = new Size(100, 100);
            greenplayHome.BackgroundImage = Image.FromFile("../../img/select_circle.png");
            greenplayHome.Location = new Point(map.Left+map.Width-greenplayHome.Width, map.Top - 120);
            greenplayHome.BackgroundImageLayout = ImageLayout.Stretch;
            this.Controls.Add(greenplayHome);
            //紅飛機
            PictureBox redPlayer = new PictureBox();
            redPlayer.Size = new Size(80, 80);
            redPlayer.Image = Image.FromFile("../../img/red.png");
            redPlayer.Location = new Point(10, 10);
            redPlayer.SizeMode = PictureBoxSizeMode.StretchImage;
            redplayHome.Controls.Add(redPlayer);
            //綠飛機
            PictureBox greenPlayer = new PictureBox();
            greenPlayer.Size = new Size(80, 80);
            greenPlayer.Image = Image.FromFile("../../img/green.png");
            greenPlayer.Location = new Point(10, 10);
            greenPlayer.SizeMode = PictureBoxSizeMode.StretchImage;
            greenplayHome.Controls.Add(greenPlayer);
            // 記錄游戲近況框
            msg.Size = new Size(260, 390);
            msg.ReadOnly = true;//設置只讀
            msg.Location = new Point(map.Right,map.Top);
            msg.Font = new Font("微軟雅黑", 12);
            msg.BackColor = Color.LightPink;
            this.Controls.Add(msg);
            // 游戲近況字
            jiLu.Size = new Size(100, 30);
            jiLu.Text = "游戲近況";
            jiLu.Font = new Font("楷體", 16);
            jiLu.ForeColor = Color.Maroon;
            jiLu.BackColor = Color.Aquamarine;
            jiLu.Location = new Point(msg.Left+msg.Width/2-jiLu.Width/2, map.Top-jiLu.Height);
            this.Controls.Add(jiLu);
            //骰子
            dice.Size = new Size(100, 100);
            dice.Image = Image.FromFile("../../img/roll.png");
            dice.Location = new Point(map.Left+map.Width/2-dice.Width/2,map.Top-dice.Height);
            dice.SizeMode = PictureBoxSizeMode.StretchImage;
            this.Controls.Add(dice);
            dice.MouseClick += Dice_MouseClick;
            string startmsg = "請兩個人先輪流擲骰子,點大的先一步,紅方先手";
            ResultTell(startmsg); //調用
        }
        // 骰子點擊事件
        private void Dice_MouseClick(object sender, MouseEventArgs e)
        {
            PlayDice();
            PlayGame();
        }
        // 記錄誰可以投擲   索引0代表紅方,1代表綠方
        bool[] whoCan = new bool[2] { true, false };
        int[] startNum = new int[2]; // 記錄雙方投擲的點數
        string[] playeName = new string[2] { "紅方", "綠方" };
        int[] playPostion = new int[2] { -1, -1 };// 記錄兩個人現在位置 沒有出門默認-1
        int[] playStan = new int[2]{ -1,-1}; // 記錄上飛機上一個位置的坐標索引默認為-1
        private void PlayDice() // 輪流投擲的方法  此方法為投擲為一輪
        {
            //紅方先投   默認紅方先投擲
            if (whoCan[0]) //默認為true
            {
                startNum[0] = r.Next(1, 7);
                ResultTell(string.Format("紅方投擲出【{0}】點", startNum[0]));
                whoCan[0] = !whoCan[0]; // false賦給紅方
            }
            else
            {
                whoCan[0] = !whoCan[0]; //將false變為true
            }
            // 綠方投擲
            if (whoCan[1]) // 默認為false
            {
                startNum[1] = r.Next(1, 7);
                ResultTell(string.Format("綠方投擲出【{0}】點", startNum[1]));
                whoCan[1] = !whoCan[1]; // 將true變為false
            }
            else
            {
                whoCan[1] = !whoCan[1]; //將true變為false
            }
        }
        // 控制游戲剛開始誰先行
        bool start = true; 
        // 判斷是不是游戲剛開始,比點數確定先行
        private void PlayGame()
        {
            // 判斷是否投擲完一輪,投擲完一輪后才能判斷點數誰先行
            if (start)
            {
                // 雙方都投擲后,點數都相同的情況
                OutDoor();
                if (whoCan[0] && !whoCan[1]) // true && true
                {
                    ResultTell("請紅方投擲");
                }
                else if (!whoCan[0] && whoCan[1]) // false && true
                {
                    ResultTell("請綠方投擲");
                }
            }
            else
            {   // 判斷誰變成false,說明上次是誰投擲的
                if (whoCan[0]&&!whoCan[1]) //綠方
                {
                    PlayeReturn(1);
                }
                else if (!whoCan[0]&&whoCan[1])// 紅方
                {
                    PlayeReturn(0);
                }
            }
        }
        // 是否暫停判斷
        bool[] reclick = new bool[2] { false,false };
        //雙方開始游戲,playIndex為索引0,1來判斷是紅方還是綠方
        private void PlayeReturn(int playIndex)
        {   // 判斷此方位置為-1,則沒有出發
            if (playPostion[playIndex] == -1)
            {
                switch (startNum[playIndex]) //判斷點數 2,4,6 可以出發
                {
                    case 2:
                    case 4:
                        ResultTell(string.Format("{0}可以起步!", playeName[playIndex]));
                        playPostion[playIndex] = 0; //初始到開始位置
                        playStan[playIndex] = 0; //存儲上一次位置
                        // 如果位置相同 換兩個飛機的圖片
                        if (playPostion[1] == playPostion[0])
                        {
                            mapImg[road[playPostion[playIndex]]].Image = imageList1.Images[2];
                        }
                        else // 如果不同則位置對應的圖片
                        {
                            mapImg[road[playPostion[playIndex]]].Image = imageList1.Images[playIndex];
                        }
                        break;
                    case 6:
                        whoCan[playIndex] = true; //此方重新投擲
                        whoCan[1 - playIndex] = false;//對方不投擲
                        ResultTell(string.Format("{0}可以起步!", playeName[playIndex]));
                        playPostion[playIndex] = 0; // 初始到索引為0處
                        playStan[playIndex] = 0; // 數組存儲上一次位置為0
                        // 如果位置相同 換兩個飛機的圖片
                        if (playPostion[1] == playPostion[0])
                        {
                            mapImg[road[playPostion[playIndex]]].Image = imageList1.Images[2];
                        }
                        else // 如果不同則位置對應的圖片
                        {
                            mapImg[road[playPostion[playIndex]]].Image = imageList1.Images[playIndex];
                        }

                        ResultTell(string.Format("請{0}投擲骰子", playeName[playIndex]));
                        break;
                    default:
                        ResultTell(string.Format("很遺憾,{0}投擲出{1}點無法起步!輪到{2}投擲", playeName[playIndex], startNum[playIndex], playeName[1 - playIndex]));
                        break;
                }
                if (playPostion[0]!=-1) //紅色出門
                {
                    redplayHome.Controls.Clear(); // 紅色飛機的家中飛機消失
                }
                if (playPostion[1]!=-1) // 綠色出門
                {
                    greenplayHome.Controls.Clear(); //綠色飛機的家中飛機消失
                }
            }
            else // 不是-1則已經出發
            {
                // 將現在位置賦給記錄上一次位置的數組中
                playStan[playIndex] = playPostion[playIndex];
                playPostion[playIndex] += startNum[playIndex]; //將點數賦給位置
                ResultTell(string.Format("{0}移動{1}步", playeName[playIndex], startNum[playIndex]));
                if (playPostion[playIndex]>=99)
                {
                    ResultTell(string.Format("{0}獲勝!", playeName[playIndex]));
                    playPostion[playIndex] = 99;
                    ChangImg(playIndex);
                    return;
                }
                ChangImg(playIndex); // 改變圖片
                // 判斷移動完后位置
                if (playPostion[playIndex]==playPostion[1-playIndex])
                {
                    playPostion[1 - playIndex] = 0;
                    ResultTell(string.Format("厲害!{0}精準踩到{1},{0}的當前位置是{2},{1}的當前位置是{3}", playeName[playIndex], playeName[1 - playIndex], playPostion[playIndex], playPostion[1 - playIndex]));
                    playStan[1 - playIndex] = playPostion[1 - playIndex];
                    mapImg[road[playPostion[playIndex]]].Image = imageList1.Images[1 - playIndex];
                    mapImg[road[playPostion[1 - playIndex]]].Image = imageList1.Images[1 - playIndex];
                    ResultTell(string.Format("{0}開始投擲。", playeName[1 - playIndex]));
                }
                switch (mapList[road[playPostion[playIndex]]])
                {
                    case 1:  // 走到索引為1的地圖上時
                        ResultTell(string.Format("{0}安全到達!當前位置是{1}", playeName[playIndex],playPostion[playIndex]));
                        ResultTell(string.Format("{0}開始投擲。", playeName[1 - playIndex]));
                        break;
                    case 2: //香蕉皮
                        ResultTell(string.Format("很不幸,{0}踩中香蕉皮,退6步!當前位置是{1}", playeName[playIndex],playPostion[playIndex]));
                        playStan[playIndex] = playPostion[playIndex];
                        //記錄當前的位置 到上次位置數組中
                        playPostion[playIndex] -= 6; // 現在的位置后退6步
                        ChangImg(playIndex); // 添加對應的圖片
                        ResultTell(string.Format("{0}當前的位置是{1}",playeName[playIndex],playPostion[playIndex]));
                        ResultTell(string.Format("{0}開始投擲。", playeName[1 - playIndex]));
                        break;
                    case 3: // 時空隧道
                        ResultTell(string.Format("恭喜!{0}踩中時空隧道,前進6步!當前位置是{1}", playeName[playIndex],playPostion[playIndex]));
                        playStan[playIndex] = playPostion[playIndex];// 將現在坐標存儲到記錄上位置的數組中
                        playPostion[playIndex] += 6; // 現在的位置后退6步
                        ChangImg(playIndex); // 添加對應的圖片
                        ResultTell(string.Format("{0}當前位置是{1}", playeName[playIndex], playPostion[playIndex]));
                        ResultTell(string.Format("{0}開始投擲。", playeName[1 - playIndex]));
                        break;
                    case 4: //陷阱
                        ResultTell(string.Format("可惜!{0}踩中陷阱,暫停一回合!", playeName[playIndex]));

                        reclick[1 - playIndex] = true;
                        reclick[playIndex] = false;
                        break;
                      
                    case 5: // 幸運星
                        ResultTell(string.Format("恭喜!踩中幸運星,再玩一回合!當前位置是{1}", playeName[playIndex],playPostion[playIndex]));
                        whoCan[playIndex] = true; //開啟繼續搖骰子
                        whoCan[1 - playIndex] = false;
                        ResultTell(string.Format("{0}繼續投擲。", playeName[playIndex]));
                        break;
                    case 6: // 大羅移
                        ResultTell(string.Format("恭喜!{0}踩中大羅移,請選擇是否移動!當前位置是{1}", playeName[playIndex],playPostion[playIndex]));
                       DialogResult dr= MessageBox.Show("是否選擇移動!","大羅移!",MessageBoxButtons.YesNo);
                        if (dr==DialogResult.Yes)
                        {   //雙方位置互換
                            int temp = playPostion[playIndex];
                            playPostion[playIndex] = playPostion[1 - playIndex];
                            playPostion[1 - playIndex] = temp;
                            playStan[playIndex] = playPostion[playIndex]; // 將此方現在位置賦給記錄上次位置的數組
                            playStan[1 - playIndex] = playPostion[1 - playIndex];// 將另一方現在的位置賦給記錄上次位置的數組
                            mapImg[road[playPostion[playIndex]]].Image = imageList1.Images[playIndex];
                            mapImg[road[playPostion[1 - playIndex]]].Image = imageList1.Images[1-playIndex];
                        }
                        ResultTell(string.Format("{0}的當前位置是{1},{2}的當前位置是{3}", playeName[playIndex], playPostion[playIndex], playeName[1 - playIndex], playPostion[1 - playIndex]));
                        ResultTell(string.Format("{0}開始投擲。", playeName[1 - playIndex]));
                        break;
                    case 7: // 手槍
                        ResultTell(string.Format("恭喜!{0}獲得手槍,可選擇擊退對方3步!當前位置是{1}", playeName[playIndex],playPostion[playIndex]));
                        DialogResult drr = MessageBox.Show("是否選擇擊退對方!", "手槍!", MessageBoxButtons.YesNo);
                        if (drr==DialogResult.Yes)
                        {
                            playStan[1 - playIndex] = playPostion[1 - playIndex]; // 記錄對方位置
                            playPostion[1 - playIndex] -= 3; //對方現在位置后移3個
                            mapImg[road[playPostion[1 - playIndex]]].Image = imageList1.Images[1 - playIndex];// 添加圖片
                            ChangImg(1-playIndex);
                        }
                        ResultTell(string.Format("{0}被擊退對方3步!當前位置是{1}", playeName[1-playIndex], playPostion[1-playIndex]));
                        ResultTell(string.Format("{0}開始投擲。", playeName[1 - playIndex]));
                        break;
                }
                /*
                 第一輪:↓
                 紅色踩到后:     reclick[0紅色]=reclick=false; reclick[1綠色]=reclick=true;
                 此時紅色搖完,綠色搖   whcan[0]=false,whcan[1]=true;
                 reclick[playIndex] && !reclick[1-playIndex]=true:false;
                 第二輪↓ 
                 reclick[1綠色]=reclick=true;reclick[0紅色]=reclick=false;
                 whcan[0]=true,whcan[1]=false;
                 reclick[playIndex==綠色]&&!reclick[1-playIndex==紅色]=true:false;
             */
                
                if (reclick[playIndex]&&!reclick[1-playIndex])
                {
                    whoCan[playIndex] = true;
                    whoCan[1 - playIndex] = false;
                    reclick[playIndex] = false;
                    reclick[playIndex] = false;
                }
                /*
                 * 第二輪結束
                 whcan[0]=false,whcan[1]=true;
                 第三輪開始
                 whcan[0]=false,whcan[1]=true;
                 //三輪結束
                 whcan[0]=true,whcan[1]=false;
             */

            }
        }

        private void ChangImg(int playIndex)
        {
            // 如果位置相同 換成兩個飛機的圖片
            if (playPostion[1] == playPostion[0])
            {
                mapImg[road[playPostion[playIndex]]].Image = imageList1.Images[2];
            }
            else // 如果不同則位置對應的圖片
            {
                mapImg[road[playPostion[playIndex]]].Image = imageList1.Images[playIndex];
            }
            // 雙方已經出發,兩個人在同一位置,此方圖片離開后,顯示另一方圖片
            if (playStan[0]==playStan[1] &&playStan[0]!=-1&&playStan[0]!=-1) // 如果上次位置雙方相同
            {
                mapImg[road[playStan[playIndex]]].Image = imageList1.Images[1 - playIndex];
            }
            else // 上次雙方位置不同,變為之前默認的圖片
            {
                switch (mapList[road[playStan[playIndex]]]) //判斷上一次記錄的圖片
                {
                    case 0: // 地板
                        mapImg[road[playStan[playIndex]]].Image = Image.FromFile("../../img/floor.png");
                        break;
                    case 1: // 路
                        mapImg[road[playStan[playIndex]]].Image = Image.FromFile("../../img/water.gif");
                        break;
                    case 2: // 香蕉皮
                        mapImg[road[playStan[playIndex]]].Image = Image.FromFile("../../img/xj.jpg");
                        break;
                    case 3: // 時空
                        mapImg[road[playStan[playIndex]]].Image = Image.FromFile("../../img/sk.jpg");
                        break;
                    case 4: // 陷阱
                        mapImg[road[playStan[playIndex]]].Image = Image.FromFile("../../img/xianjing.jpg");
                        break;
                    case 5: // 星星
                        mapImg[road[playStan[playIndex]]].Image = Image.FromFile("../../img/xx.jpg");
                        break;
                    case 6: // 交換
                        mapImg[road[playStan[playIndex]]].Image = Image.FromFile("../../img/jh.jpg");
                        break;
                    case 7: // 手槍
                        mapImg[road[playStan[playIndex]]].Image = Image.FromFile("../../img/sq.jpg");
                        break;
                    case 10: // 開始位置
                        mapImg[road[playStan[playIndex]]].Image = Image.FromFile("../../img/game-out.jpg");
                        break;
                    case 11: // 結束位置
                        mapImg[road[playStan[playIndex]]].Image = Image.FromFile("../../img/game-over.jpg");
                        break;
                    default:
                        break;
                }
            }
        }

        // 判斷投擲完一輪,相同點數,誰點數大 誰再投擲
        private void OutDoor()
        {
            //投擲完一輪,并且雙方都存有點數
            if (whoCan[0] && !whoCan[1] && (startNum[0] != 0 || startNum[1] != 0))
            {   // 雙方點數相同
                if (startNum[0].Equals(startNum[1]))
                {
                    ResultTell("雙方點數相同,請重新投擲!");
                }
                else
                {
                    start = false; //不是第一回合
                    if (startNum[0] > startNum[1])
                    {
                        ResultTell("紅方點數較大,先行一步,紅方投擲");
                        whoCan[0] = true;  //紅方繼續投擲
                        whoCan[1] = false;
                    }
                    else
                    {
                        ResultTell("綠方點數較大,先行一步,綠方投擲");
                        whoCan[0] = false; 
                        whoCan[1] = true; //綠方繼續投擲
                    }
                }
            }
        }

        void InitialGame() //初始化地圖
        {
            for (int i = 0; i < mapImg.Length; i++)
            {
                CreateMap();// 調用存儲數字的圖片
                CreateGear(); // 調用創建機關的方法 必須向有路,才能調用機關的方法
                PictureBox picture = new PictureBox();
                picture.Size = new Size(size, size);
                mapImg[i] = picture; //圖片添加到數組
                switch (mapList[i]) // 判斷地圖數組中存儲的數字,添加圖片
                {
                    case 0: // 地板
                        picture.Image = Image.FromFile("../../img/floor.png");
                        break;
                    case 1: // 路
                        picture.Image = Image.FromFile("../../img/water.gif");
                        break;
                    case 2: // 香蕉皮
                        picture.Image = Image.FromFile("../../img/xj.jpg");
                        break;
                    case 3: // 時空
                        picture.Image = Image.FromFile("../../img/sk.jpg");
                        break;
                    case 4: // 陷阱
                        picture.Image = Image.FromFile("../../img/xianjing.jpg");
                        break;
                    case 5: // 星星
                        picture.Image = Image.FromFile("../../img/xx.jpg");
                        break;
                    case 6: // 交換
                        picture.Image = Image.FromFile("../../img/jh.jpg");
                        break;
                    case 7: // 手槍
                        picture.Image = Image.FromFile("../../img/sq.jpg");
                        break;
                    case 10: // 開始位置
                        picture.Image = Image.FromFile("../../img/game-out.jpg");
                        break;
                    case 11: // 結束位置
                        picture.Image = Image.FromFile("../../img/game-over.jpg");
                        break;
                    default:
                        break;
                }
                picture.SizeMode = PictureBoxSizeMode.StretchImage; //圖片適應大小
                picture.Location= new Point(i % 30 * size,i/30*size); 
                map.Controls.Add(picture);// 圖片添加到地圖中
            }
        }
        void CreateMap() //創建地圖
        {
            CreateRoed();//創建路
            for (int i = 0; i < road.Length; i++)
            {
                mapList[road[i]] = 1; // 路 將路對應的索引變為1
            }
            mapList[0] = 10; //開始位置
            mapList[mapList.Length - 1] = 11; //結束位置
        }
        int[] road = new int[100];// 記錄所有路的索引位置
        int[] back = {7,27,43,63,96}; // 記錄香蕉皮的索引位置
        int[] forword = {10,25,33,65,80,89 };// 記錄時空的索引位置
        int[] stop = { 3,20,35,50,60,70,90}; //記錄陷阱的索引位置
        int[] star = { 5,28,45,71,85}; //記錄星星的索引位置
        int[] change = { 4,55,75,98};//記錄交換的索引位置
        int[] gun = {22,32,66,82 };//記錄手槍的索引位置
        void CreateRoed() // 創建路
        {
            for (int i = 0; i < 30; i++) // 0-29的索引  向右
            {
                road[i] = i; 
            }
            for (int i = 30; i <=35; i++) // 59,89,119,149,179  右下五格
            {
                road[i] = road[i - 1] + 30; 
                // i=30; road[30]===>29
                // i=31; road[31-1]+30==>road[30]+30==>29+30==>59
                // i=32;road[32-1]+30==>road[31]+30==>59+30==>89
            }
            for (int i = 36; i <65 ; i++) // 向左
            {
                road[i] = road[i - 1] - 1;
                // i=36; road[36-1]-1=>road[35]-1=>179-1=>178 ...
            }
            for (int i = 65; i <=70; i++) // 左下五格
            {
                road[i] = road[i - 1] + 30; 
            }
            for (int i = 71; i <100; i++) // 向右
            {
                road[i] = road[i - 1] + 1;
            }
        }
        void CreateGear() // 創建機關
        {
            for (int i = 0; i < back.Length; i++)
            {
                mapList[road[back[i]]] = 2;  // 香蕉皮
            }
            for (int i = 0; i < forword.Length; i++)
            {
                mapList[road[forword[i]]] = 3; // 時空
            }
            for (int i = 0; i < stop.Length; i++)
            {
                mapList[road[stop[i]]] = 4; // 陷阱
            }
            for (int i = 0; i < star.Length; i++)
            {
                mapList[road[star[i]]] = 5;// 星星
            }
            for (int i = 0; i < change.Length; i++)
            {
                mapList[road[change[i]]] = 6; // 交換
            }
            for (int i = 0; i < gun.Length; i++)
            {
                mapList[road[gun[i]]] = 7; // 手槍
            }
        }
        void ResultTell(string str)
        {
            MessageBox.Show(str); 
            msg.AppendText(str + "\r\n"); // 將獲取的點數添加到文本框中
        }
    }
}

“怎么用C#實現winform版飛行棋”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

泗阳县| 同江市| 新邵县| 资中县| 衡南县| 桂林市| 沧源| 东山县| 肃南| 宜宾市| 漠河县| 波密县| 乐陵市| 沧州市| 福安市| 梧州市| 宁远县| 攀枝花市| 论坛| 墨玉县| 大同县| 河曲县| 宁武县| 个旧市| 大余县| 多伦县| 盐源县| 大埔县| 吉林市| 沙河市| 施秉县| 崇明县| 福贡县| 繁昌县| 安康市| 榕江县| 密云县| 惠来县| 澄城县| 枣强县| 霞浦县|