魔兽争霸系统

Posted 零星一点

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了魔兽争霸系统相关的知识,希望对你有一定的参考价值。

首先我们先编写魔兽系统中的用户信息类(LoginInfo)用来存放属性

封装属性代码:  

//电子邮箱 private string email;         public string Email         {             get { return email; }             set { email = value; }         }         //身份证号码 private string id;

        public string Id         {             get { return id; }             set { id = value; }         }         //姓名 private string name;

        public string Name         {             get { return name; }             set { name = value; }         }         //密码 private string password;

        public string Password         { get { return password; } set { password = value; }         }

登录界面

代码:

public static LoginInfo[] array; //创建对象数组

#region 窗体 private void FrmLogin_Load(object sender, EventArgs e)         {             //初始化用户信息               array = new LoginInfo[20];   LoginInfo infol = new LoginInfo();   infol.Name = "孙丽丽";   infol.Id = "120185198005088521";   infol.Email = "lili@sohu.com";   infol.Password = "lili1980";   array[0] = infol;

  this.lblValidation.Visible = false;         }         #endregion

        #region 登录验证 private void butLogin_Click(object sender, EventArgs e)         {   if (txtEmail.Text.Trim() == "" || txtpass.Text.Trim() == "")   {     MessageBox.Show("用户名或密码不能为空!", "提示");   }   else   {     string userName = txtEmail.Text;     string pwd = txtpass.Text;     bool isOK = false;     foreach (LoginInfo item in array)     {       if (item != null)       {         if (item.Email == userName && item.Password == pwd)         {           isOK = true;           FrmMain fm = new FrmMain();           fm.lblname.Text = "欢迎," + item.Name;           fm.Show();           this.Hide();           break;         }       }     }     if (isOK == false)     {       this.lblValidation.Visible = true;       lblValidation.Text = "用户或密码错误!";     }   }

        }         #endregion 

        #region 注册 private void linkLabel1_Click(object sender, EventArgs e)         {   FrmRegist fr = new FrmRegist();   fr.ShowDialog();         }         #endregion

        #region 关闭 private void pnlExit_Click(object sender, EventArgs e)         {   Application.Exit();         }         #endregion

        #region 窗体移动 int frmPlayX ;         int frmPlayY;         private void timer1_Tick(object sender, EventArgs e)         {   this.Location = new Point(MousePosition.X - frmPlayX, MousePosition.Y - frmPlayY);         }         private void panel1_MouseDown(object sender, MouseEventArgs e)         {   frmPlayX = e.X;   frmPlayY = e.Y;

  timer1.Enabled = true;         }         private void panel1_MouseUp(object sender, MouseEventArgs e)         {   timer1.Enabled = false;         }         #endregion

主窗体

把Lable的Modifiers改成Public直接接受登录成功以后传的值就行

注册页面

代码:

#region 注册 private void butzhuc_Click(object sender, EventArgs e)         {
  if (Bijiao()==true)   {     LoginInfo info = new LoginInfo();     info.Name = txtname.Text;     info.Id = txtId.Text;     info.Password = txtpassWord.Text;     info.Email = txtEmails.Text;

    for (int i = 1; i <= FrmLogin.array.Length; i++)     {        if (FrmLogin.array[i] == null)        {           FrmLogin.array[i] = info;           break;        }     }     this.Close(); //关闭本窗体               }         }

以上是关于魔兽争霸系统的主要内容,如果未能解决你的问题,请参考以下文章

魔兽争霸系统

魔兽争霸 玩RPG图退出程序的时候显示错误 :内存空间不足

每次打魔兽争霸总是出现,war3.exe已停止工作怎么办?

玩魔兽争霸 魔兽世界 f1键 不好使

魔兽争霸3,存储空间不足,无法处理此命令。

魔兽争霸3不能初始化DirectX问题