public MainForm(UserModel userModel, UserModel f_userModel, string drawthing, string gameModeStr) { InitializeComponent(); if (this.timer1.Enabled == false) button6.Enabled = false; lines = new List<Line>(); this.userModel = userModel; this.f_userModel = f_userModel; this.drawthing = drawthing; this.gameMode = gameModeStr; if (gameMode == "guess") { this.label_friendinfo.Text = "您正在猜,字符长度为 "+drawthing.Length.ToString() + " ,猜对可得10分。"; this.label_senderinfo.Text = "这幅图来自 " + Util.getsenderusername(userModel.uid) + " ,答案长度为 " + drawthing.Length.ToString(); this.label_score.Text = userModel.score; this.label_status.Visible = false; this.panel1.Visible = false; this.panel2.Visible = true; this.panel3.Visible = false; this.panel4.Visible = false; this.label1.Visible = false; this.textBox1.Visible = false; this.button8.Visible = false; } else { this.label_friendinfo.Text = "您正在画 " + drawthing + " 给 " + f_userModel.username; this.label_score.Text = userModel.score; this.panel1.Visible = true; this.panel2.Visible = false; this.panel3.Visible = false; this.panel4.Visible = false; } }
private void button1_Click(object sender, EventArgs e) { string friend_username = this.textBox1.Text; if (friend_username == "") { MessageBox.Show("不能为空"); this.panel1.Visible = false; } else { string url = @"http://hackecho.com/drawsomething/index.php/User/findpartner?username="******"0") { this.label_findstatus.Text = "没有此用户,请重新查找。"; this.panel1.Visible = false; this.textBox1.Text = ""; this.textBox1.Focus(); } else { this.label_findstatus.Text = ":)找到啦~~开始游戏吧"; f_userModel = new UserModel(); f_userModel.username = friend_username; f_userModel.uid = result; f_userModel.score = Util.getScoreByUid(result); this.panel1.Visible = true; } } catch (Exception exp) { } } }
private void button1_Click(object sender, EventArgs e) { string username = this.textBox1.Text; string password = this.textBox2.Text; if (checkLogin(username,password)) { UserModel userModel = new UserModel(); userModel.username = username; userModel.uid = uid; userModel.score = score; if (int.Parse(Util.getmydrawnum(uid)) > 0) { if (MessageBox.Show("有朋友给您发送了未猜的图画,是否要开始猜图?(一次只能猜测一幅画)", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { string drawthing = Util.getdrawthing(uid); MainForm mainForm = new MainForm(userModel, userModel, drawthing, "guess"); mainForm.Show(); this.Hide(); } else { FindPartnerForm findPartnerForm = new FindPartnerForm(userModel); findPartnerForm.Show(); this.Hide(); } } else { FindPartnerForm findPartnerForm = new FindPartnerForm(userModel); findPartnerForm.Show(); this.Hide(); } } else { MessageBox.Show("登陆失败,请再填写用户名和密码并重新登陆。"); } }
public FindPartnerForm(UserModel userModel) { InitializeComponent(); this.panel1.Visible = false; this.userModel = userModel; }