• 大小: 1.03MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-30
  • 语言: C#
  • 标签: C#  KeyBoardMast  源码  

资源简介

C# KeyBoardMaster 源码, 加入了射击音效等,分享给大家

资源截图

代码片段和文件信息

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;
using System.Media;
namespace KeyoardMaster
{
    public partial class FrmGame : Form
    {
        Game myGame;
        

        public FrmGame()
        {
            InitializeComponent();
        }


        private void 开始ToolStripMenuItem_Click(object sender EventArgs e)
        {
            Txt.Enabled = true;
            Txt.Focus();
            myGame = new Game(PicShow1000);
            myGame.Start();
            if (timerPicShow.Enabled == false) timerPicShow.Start();

        }

        private void timerPicShow_Tick(object sender EventArgs e)
        {
            //清除bmp
            Graphics grb = Graphics.FromImage(myGame.bmp);
            grb.Clear(Color.Black);
            //画unit
            for (int i = 0; i < myGame.unitlist.Count; i++)
            {
                myGame.unitlist[i].Show(grb);
            }
            //画坦克
            myGame.myTank.Show(grb);
            //将bmp画到picshow
            Graphics grpic = PicShow.CreateGraphics();
            grpic.DrawImage(myGame.bmp 0 0);

            //更新lblScore
            LblScore.Text = “当前分数:“ + myGame.GetScore().ToString();
            //更新lblLevel
            LblLevel.Text = “Level:“ + myGame.GetLevel();
            
            if(myGame.GetLevel()<5)
            {
                LblLevel.Font = new Font(“宋体“ 10 + myGame.GetLevel()Fontstyle.Italic);
                LblLevel.ForeColor = Color.Black;
            }
            else if(myGame.GetLevel()<10)
            {
                LblLevel.Font = new Font(“宋体“ 10 + myGame.GetLevel()Fontstyle.Bold|Fontstyle.Italic);
                LblLevel.ForeColor = Color.Blue;
            }
            else 
            {
                LblLevel.Font = new Font(“楷体“ 10 + 2*myGame.GetLevel() Fontstyle.Bold | Fontstyle.Italic);
                LblLevel.ForeColor = Color.Red;

            }
        }

        private void Txt_TextChanged(object sender EventArgs e)
        {
            myGame.myTank.SetStr(Txt.Text);
        }

        private void FrmGame_Load(object sender EventArgs e)
        {
            Txt.Enabled = false;
        }

        private void Txt_KeyPress(object sender KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(13))
            {
                //判断txt.text是否等于某个unit的名字
                for (int i = 0; i < myGame.unitlist.Count; i++)
                {
                    if (myGame.unitlist[i].GetName() == Txt.Text)
                    {
                        //声音
                        myGame.ShootSound();
                        //激光动画
                        myGame.myTank.SetAim(myGame.unitlist[i].GetCenterX() myGame.unitlist[i].GetCenterY());
          

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        189  2016-12-29 19:37  KeyoardMaster\App.config

     文件      84992  2017-03-23 13:46  KeyoardMaster\bin\Debug\KeyoardMaster.exe

     文件        189  2016-12-29 19:37  KeyoardMaster\bin\Debug\KeyoardMaster.exe.config

     文件      38400  2017-03-23 13:46  KeyoardMaster\bin\Debug\KeyoardMaster.pdb

     文件      22696  2017-03-23 13:48  KeyoardMaster\bin\Debug\KeyoardMaster.vshost.exe

     文件        189  2016-12-29 19:37  KeyoardMaster\bin\Debug\KeyoardMaster.vshost.exe.config

     文件     308252  2016-12-24 15:07  KeyoardMaster\bin\Debug\Sound\升级.wav

     文件     328732  2016-12-24 15:07  KeyoardMaster\bin\Debug\Sound\失败.wav

     文件     186672  2016-12-30 13:02  KeyoardMaster\bin\Debug\Sound\开始.wav

     文件     138346  2016-12-30 12:36  KeyoardMaster\bin\Debug\Sound\激光1.wav

     文件     142954  2016-12-30 12:36  KeyoardMaster\bin\Debug\Sound\激光2.wav

     文件     189006  2016-12-30 12:35  KeyoardMaster\bin\Debug\Sound\激光3.wav

     文件      76468  2016-12-30 13:03  KeyoardMaster\bin\Debug\Sound\落水.wav

     文件       4027  2017-03-23 13:43  KeyoardMaster\FrmGame.cs

     文件       6734  2017-03-23 13:43  KeyoardMaster\FrmGame.Designer.cs

     文件     107988  2017-03-23 13:43  KeyoardMaster\FrmGame.resx

     文件       4243  2017-03-23 13:46  KeyoardMaster\Game.cs

     文件       4090  2017-03-23 13:43  KeyoardMaster\KeyoardMaster.csproj

     文件       1464  2016-12-30 11:22  KeyoardMaster\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7336  2017-03-23 13:43  KeyoardMaster\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        872  2017-03-23 13:48  KeyoardMaster\obj\Debug\KeyoardMaster.csproj.FileListAbsolute.txt

     文件       1136  2017-03-23 13:43  KeyoardMaster\obj\Debug\KeyoardMaster.csproj.GenerateResource.Cache

     文件       2542  2016-12-30 14:37  KeyoardMaster\obj\Debug\KeyoardMaster.csprojResolveAssemblyReference.cache

     文件      84992  2017-03-23 13:46  KeyoardMaster\obj\Debug\KeyoardMaster.exe

     文件      68212  2017-03-23 13:43  KeyoardMaster\obj\Debug\KeyoardMaster.FrmGame.resources

     文件      38400  2017-03-23 13:46  KeyoardMaster\obj\Debug\KeyoardMaster.pdb

     文件        180  2017-03-23 13:43  KeyoardMaster\obj\Debug\KeyoardMaster.Properties.Resources.resources

     文件          0  2016-12-29 19:37  KeyoardMaster\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2016-12-29 19:37  KeyoardMaster\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2016-12-29 19:37  KeyoardMaster\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

............此处省略21个文件信息

评论

共有 条评论