欢迎来到天天文库
浏览记录
ID:38580295
大小:66.50 KB
页数:11页
时间:2019-06-15
《c# 连连看 frmMain 代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Threading;usingSystem.Timers;namespaceLLKAN{publicpartialclassfrmMain:Form{GameMyGame=newG
2、ame();stdFuncMystdFunc=newstdFunc();MapSelectMyMapSelect=newMapSelect();stringappPath="";PlaySoundspEarse;PlaySoundspSelect;privateinttime=100;privateconstintVALUE=1;publicintpn;privateintscore;privateSystem.Windows.Forms.ProgressBarpBar;GameStategs=Gam
3、eState.Start;publicfrmMain(){InitializeComponent();StartPosition=FormStartPosition.CenterScreen;}privateenumGameState{Start,Play,End,Win}//开始游戏privatevoidGameStart_Click(objectsender,EventArgse){LineTime.Enabled=true;LineTime.Start();GraphicsMyDraw=Pic1
4、.CreateGraphics();MyGame.GameStart(pn);DrawGame(MyDraw);//在窗体内绘制游戏的图片MyMapSelect.Clear();//清除前面游戏的图片?if(LineTime.Enabled==true){progressBar1.Value=100;time=100;}score=0;label2.Text=score.ToString();}//开始/重新开始privatevoidbutton1_Click(objectsender,EventAr
5、gse){this.button1.Text="重新开始";LineTime.Enabled=true;LineTime.Start();GraphicsMyDraw=Pic1.CreateGraphics();if(comboBox1.Text=="天才级")pn=49;elseif(comboBox1.Text=="困难级")pn=30;elseif(comboBox1.Text=="普通级")pn=25;elseif(comboBox1.Text=="入门级")pn=10;elsepn=5;My
6、Game.GameStart(pn);MyMapSelect.Clear();//清除前面游戏的图片?DrawGame(MyDraw);//在窗体内绘制游戏的图片//if(LineTime.Enabled==true)//{//MessageBox.Show("确定重新开始吗","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Information);//progressBar1.Value=100;time=100;//}score=0;label2.T
7、ext=score.ToString();}//////在窗体内绘制游戏的图片//////privatevoidDrawGame(GraphicsMyDraw){if(MyGame.Playflag){for(inti=0;i8、amePicList[i,j].Selected){MyDraw.DrawImage(IL2.Images[MyGame.GamePicList[i,j].PicIndex],MyGame.GamePicList[i,j].X,MyGame.GamePicList[i,j].Y);}else{MyDraw.DrawImage(IL1.Images[MyGame.GamePicList[i,j].PicIndex],MyGame.GamePicList[i
8、amePicList[i,j].Selected){MyDraw.DrawImage(IL2.Images[MyGame.GamePicList[i,j].PicIndex],MyGame.GamePicList[i,j].X,MyGame.GamePicList[i,j].Y);}else{MyDraw.DrawImage(IL1.Images[MyGame.GamePicList[i,j].PicIndex],MyGame.GamePicList[i
此文档下载收益归作者所有