private void SelectRoleFrom_Load(object sender, EventArgs e) { initView(); ClientDAL.GetInstance().Register(new ClientDAL.ShowHandler(this.InvokeShowState)); ClientDAL.GetInstance().Register(new ClientDAL.OperateWithConditionHandler(this.startgame)); ClientDAL.GetInstance().SendMessage("ShowState"); }
/// <summary> /// 创建完毕,切换到角色选择界面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { if (!checkInput()) { return; } ClientDAL.GetInstance().SendMessage("CreateRoom," + UserHelper.sceneId + "," + txtName.Text + "," + txtPwd.Text); new SelectRoleFrom().ShowDialog(); this.Close(); }
private void btnLogin_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(roleId)) { MessageBox.Show("请选择角色!", "基于虚拟现实的铁路综合运输训练系统", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ClientDAL.GetInstance().SendMessage("Login," + roleId); ClientDAL.GetInstance().SendMessage("ShowState"); pnls.Enabled = false; btn_login.Enabled = false; }
private void button1_Click(object sender, EventArgs e) { if (this._pwd.Equals(textBox1.Text)) { ClientDAL.GetInstance().SendMessage("EnterRoom," + _name); new SelectRoleFrom().ShowDialog(); this.Close(); } else { lbl.Text = "密码错误"; } }
/// <summary> /// 创建img多选 /// </summary> /// <param name="taskmode"></param> public void creatImageBy(ResouresModel resmode) { ImageControl IC = new ImageControl(resmode); IC.Size = this.panel1.Size; IC.qr += (ImageControl v, int tag) => { //1、创建一个新的元素时,将当前这个删除 v.Dispose(); //2、创建 if (GameHelper.mode == GameHelper.Mode.Online) { ClientDAL.GetInstance().SendMessage("Next"); } else { //3、创建下一个 this.button2_Click(this, new EventArgs()); } }; this.panel1.Controls.Add(IC); }
private void wait(bool exit) { if (this.InvokeRequired) { WaitDelegate w = new WaitDelegate(wait); this.Invoke(w, exit); } else { if (exit) { //游戏结束,退出 MessageBox.Show("演练流程结束", "基于虚拟现实的铁路综合运输训练系统", MessageBoxButtons.OK, MessageBoxIcon.Warning); ClientDAL.GetInstance().stopThread(); this.DialogResult = DialogResult.OK; } else { //游戏未结束,等待 this.panel1.Controls.Add(lblWait); } } }
//////////////////////////////////////////////////////////////////////////////////////////////////// private void loadSceneForm_Load(object sender, EventArgs e) { if (GameHelper.mode == GameHelper.Mode.Offline) { this.InItdata(); panel2.Show(); lblWait.Hide(); } else { ClientDAL.GetInstance().Register(new ClientDAL.ShowHandler(this.refreshData)); ClientDAL.GetInstance().Register(new ClientDAL.OperateWithConditionHandler(this.wait)); ClientDAL.GetInstance().startThread(); if (_condition) { ClientDAL.GetInstance().SendMessage("Next"); } //界面相关展示 panel2.Hide(); lblWait.Show(); lblName.Text = UserHelper.user.name; lblMajor.Text = UserHelper.user.major; } }
private void button2_Click(object sender, EventArgs e) { ClientDAL.GetInstance().SendMessage("Logout"); ClientDAL.GetInstance().SendMessage("ShowState"); this.Close(); }
private void CreateRoomForm_Load(object sender, EventArgs e) { ClientDAL.GetInstance().Register(new ClientDAL.ShowHandler(this.showRoom)); ClientDAL.GetInstance().SendMessage("ShowRoom," + UserHelper.sceneId); }