Пример #1
0
        private CSharpGame CreateGameForm()
        {
            CSharpGame gameForm = new CSharpGame(this);

            // 首先创建4个logic
            myLogic = new Logic(1);
            myLogic.sendMsgEvent += SendGameData;

            otherPlayersLogic = new List <Logic>();
            for (int i = 0; i < 3; i++)
            {
                otherPlayersLogic.Add(new Logic(2));
            }

            // 将Logic的界面显示到gameForm中
            GameArea ga = myLogic.gameArea;

            gameForm.CreateMainArea(ga);
            // 游戏开始前隐藏btn
            ga.UnGameStatus();
            List <GameArea> ret = new List <GameArea>();

            foreach (Logic lg in otherPlayersLogic)
            {
                ret.Add(lg.gameArea);
                lg.gameArea.Hide();
            }
            gameForm.CreateOppeArea(ret);
            foreach (Logic lg in otherPlayersLogic)
            {
                lg.gameArea.UnGameStatus();
            }

            return(gameForm);
        }
Пример #2
0
        // public delegate void showFun(bool b);
        //显示游戏界面中其他玩家界面
        private void showGameRoom(int tableIdx, int seatIdx)
        {
            myLogic.gameArea.UnGameStatus();
            gameTable tablesInfo = hall.tables[tableIdx];
            int       mypos      = seatIdx;
            int       t          = 0;

            for (int i = mypos + 1; i < mypos + 4; i++)
            {
                int k = i % 4;
                if (tablesInfo.seatUser[k] != "")
                {
                    otherPlayersLogic[t].SetPlayer(tablesInfo.seatUser[k]);
                    GameArea ga = otherPlayersLogic[t].gameArea;
                    ga.UnGameStatus();
                    ga.Show();
                }
                else
                {
                    GameArea ga = otherPlayersLogic[t].gameArea;
                    ga.UnGameStatus();
                    //ga.Show();
                }
                t++;
            }
        }
Пример #3
0
 public bool CreateMainArea(object panel)//创建我的游戏区域
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new CreateArea(CreateMainArea), panel);
     }
     else
     {
         GameArea ga = (GameArea)panel;
         ga.Draw(new Point(0, 0), this.panelMyArea.Size);
         ga.picList = this.picList;
         //this.Controls.Add(ga);
         this.panelMyArea.Controls.Add(ga);
     }
     return(true);
 }
Пример #4
0
        public Logic(int type)
            : this()
        {
            switch (type)
            {
            case 1:
            {
                MyGameArea area = new MyGameArea();
                area.btnClickEvent      += PushButton;
                gameArea                 = area;
                gameArea.BackgroundImage = global::CSharpGame.Properties.Resources.background1;
            }
            break;

            case 2:
            {
                gameArea = new OtherGameArea();
            }
            break;
            }
        }
Пример #5
0
 public OtherGameArea()
 {
     gameArea = new GameArea();
 }