public void Button_EDIT() { if (MainObjectToEdit.GetComponent <MeshCollider>()) { MainObjectToEdit.gameObject.GetComponent <MeshCollider> ().convex = true; } if (MainObjectToEdit.GetComponent <Rigidbody>()) { MainObjectToEdit.GetComponent <Rigidbody>().useGravity = false; MainObjectToEdit.GetComponent <Rigidbody>().isKinematic = true; } foreach (GameObject OnePoint in GameObject.FindGameObjectsWithTag("Point")) { OnePoint.GetComponent <MeshRenderer>().enabled = true; OnePoint.GetComponent <Collider>().enabled = true; } MainObjectToEdit.transform.position = MyFirstPos; MainObjectToEdit.transform.rotation = MyFirstRot; UI_InEdit.SetActive(true); UI_InTest.SetActive(false); }
public void Button_TEST() { if (AddCollider) { if (!MainObjectToEdit.GetComponent <MeshCollider>()) { MainObjectToEdit.AddComponent <MeshCollider>(); } if (MainObjectToEdit.GetComponent <MeshCollider>()) { MainObjectToEdit.gameObject.GetComponent <MeshCollider> ().convex = true; } } if (AddRigidbody) { if (!MainObjectToEdit.GetComponent <Rigidbody>()) { MainObjectToEdit.AddComponent <Rigidbody>(); } if (MainObjectToEdit.GetComponent <Rigidbody>()) { MainObjectToEdit.GetComponent <Rigidbody>().useGravity = true; MainObjectToEdit.GetComponent <Rigidbody>().isKinematic = false; } } foreach (GameObject OnePoint in GameObject.FindGameObjectsWithTag("Point")) { OnePoint.GetComponent <MeshRenderer>().enabled = false; OnePoint.GetComponent <Collider>().enabled = false; } UI_InEdit.SetActive(false); UI_InTest.SetActive(true); }
private void saveBtn_Click(object sender, EventArgs e) { pointList.Clear(); //保存前先清空点链表信息缓存 //先判断当前产品名称是否选择或是否存在 if (productCombo.SelectedIndex >= 0) { //再判断当前表格中输入的信息,扫描所有的30列 for (int col = 1; col < 31; col++) { string point = string.Empty; List <string> pointUnit = new List <string>(); //获取一个点的信息 for (int row = 0; row < rowN; row++) { string temp = dataGridView1.Rows[row].Cells[col].Value.ToString(); //判断当前单元格的内容是否为空,不为空时才加入单元点集合中去 if (!string.IsNullOrEmpty(temp) && temp != "") { pointUnit.Add(temp); if (row == (rowN - 1)) { point += temp; } else { point += temp + ','; } } } if (pointUnit.Count <= 0) { //当前扫描列输入为空时跳过 } else { if (pointUnit.Count < rowN) { MessageBox.Show("表中点位信息输入不全,请先补全!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } pointList.Add(point); //当输入全时再添加到链表中去 } } SavePointData(); //保存 UpdatePointComboItems(); //更新 } }
public void AfterLoginSucess(string username) { //登录成功。。。。。。。 string sID = Guid.NewGuid().ToString(); HttpContext.Response.Cookies.Add( new HttpCookie("markCookie", sID) { Expires = DateTime.Now.AddYears(1) } ); List <OnePoint> hOnline = (List <OnePoint>)HttpContext.Application["Online"];//读取全局变量 if (hOnline != null) { if (hOnline.Count() != 0) { for (int i = 0; i < hOnline.Count(); i++) { OnePoint point = hOnline[i]; if (point.LoginName != null && point.LoginName.Equals(username)) { //如果当前用户已经登录, point.LoginName = "XX"; //将当前用户已经在全局变量中的值设置为XX hOnline.Remove(hOnline[i]); hOnline.Add(point); break; } } } } else { hOnline = new List <OnePoint>(); } OnePoint pointLogin = new OnePoint() { SessionId = sID, LoginName = username }; hOnline.Add(pointLogin); HttpContext.Application.Lock(); HttpContext.Application["Online"] = hOnline; HttpContext.Application.UnLock(); }
/// <summary> /// 保存 /// </summary> private void SavePointData() { string product = string.Empty; string point = string.Empty; product = productCombo.SelectedItem.ToString(); pointCombo.Items.Clear();//更新前先清空 for (int i = 0; i < pointList.Count; i++) { point = string.Format("Point{0}", i + 1); pointCombo.Items.Add(point); iniFileOp.WriteString(product, point, pointList[i]); } pointCombo.SelectedIndex = 0; }
private void OnePointLogin() { List <OnePoint> hOnline = (List <OnePoint>)HttpContext.Current.Application["Online"];//获取已经存储的application值 bool hasCookie = HttpContext.Current.Request.Cookies["markCookie"] != null; if (hOnline != null && hasCookie == true) { string sID = HttpContext.Current.Request.Cookies["markCookie"].Value.ToString(); if (hOnline.Count != 0) { for (int i = 0; i < hOnline.Count(); i++) { OnePoint onepoint = hOnline[i]; if (onepoint.SessionId != null && onepoint.SessionId.Equals(sID)) { if (onepoint.LoginName != null && "XX".Equals(onepoint.LoginName.ToString()))//说明在别处登录 { hOnline.Remove(onepoint); HttpContext.Current.Application.Lock(); HttpContext.Current.Application["Online"] = hOnline; HttpContext.Current.Application.UnLock(); for (int z = 0; z < HttpContext.Current.Request.Cookies.Count; z++) { string cookieName = HttpContext.Current.Request.Cookies[z].Name; try { HttpContext.Current.Response.Cookies[cookieName].Expires = DateTime.Now.AddDays(-10); } catch { } } HttpContext.Current.Response.Write("<script>alert('你的帐号已在别处登陆,你被强迫下线!');top.location.href='/Home/login';window.close();</script>");//退出当前到登录页面 // Response.Redirect("Default.aspx"); HttpContext.Current.Response.End(); } } } } } }
private void ShowPointVal(string[] points) { OnePoint point = new OnePoint(); if (points.Length <= 0) { return; } try { switch (curReadCoordinate) { case ReadPointState.None: x1Pos.Text = points[0]; z1Pos.Text = points[1]; yPos.Text = points[2]; x2Pos.Text = points[3]; z2Pos.Text = points[4]; if (initialFlag) { curReadCoordinate = ReadPointState.ReadX1; } break; case ReadPointState.ReadX1: point.x1 = points[0]; curReadCoordinate = ReadPointState.ReadZ1; break; case ReadPointState.ReadZ1: point.z1 = points[0]; curReadCoordinate = ReadPointState.ReadY; break; case ReadPointState.ReadY: point.y = points[0]; curReadCoordinate = ReadPointState.ReadX2; break; case ReadPointState.ReadX2: point.x2 = points[0]; curReadCoordinate = ReadPointState.ReadZ2; break; case ReadPointState.ReadZ2: point.z2 = points[0]; curReadCoordinate = ReadPointState.ReadDp; break; case ReadPointState.ReadDp: point.dp = points[0]; curReadCoordinate = ReadPointState.Readm; break; case ReadPointState.Readm: point.m = points[0]; curReadCoordinate = ReadPointState.None; pointsList.Add(point); if (++pointIndex >= 30) { initialFlag = false; //30个点位数据读取完了就复位初始化标志 ClearTable(); //先清空表格再添加新的数据 //加载读取到的点位信息到表格中去 for (int i = 0; i < pointsList.Count; i++) { OnePoint apoint = pointsList[i]; dataGridView1.Rows[0].Cells[i + 1].Value = apoint.x1; dataGridView1.Rows[1].Cells[i + 1].Value = apoint.z1; dataGridView1.Rows[2].Cells[i + 1].Value = apoint.y; dataGridView1.Rows[3].Cells[i + 1].Value = apoint.x2; dataGridView1.Rows[4].Cells[i + 1].Value = apoint.z2; dataGridView1.Rows[5].Cells[i + 1].Value = apoint.dp; dataGridView1.Rows[6].Cells[i + 1].Value = apoint.m; } } break; default: break; } } catch (Exception ex) { } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { // Create an instance of the open file dialog box. OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "XML Files (.xml)|*.xml|All Files (*.*)|*.*"; openFileDialog1.FilterIndex = 1; openFileDialog1.InitialDirectory = path; openFileDialog1.RestoreDirectory = false; openFileDialog1.Multiselect = false; // Call the ShowDialog method to show the dialog box. DialogResult userClick = openFileDialog1.ShowDialog(); // Process input if the user clicked OK. if (userClick == System.Windows.Forms.DialogResult.OK) { ProfileType type = ProfileType.None; // Open the selected file to read. System.IO.Stream fileStream = openFileDialog1.OpenFile(); // save path path = System.IO.Path.GetDirectoryName(openFileDialog1.FileName); textBox1.Text = "Please Wait..."; textBox1.Visible = true; this.Refresh(); while (cascLoader.IsAlive) { Thread.Sleep(500); } if (!cascLoaded) { selectWowPath(); textBox1.Visible = false; return; } Settings.Default.Save(); XmlTextReader reader = new XmlTextReader(fileStream); while (reader.Read()) { if (reader.Name == "GathererProfile") { type = ProfileType.Gatherer; break; } if (reader.Name == "GrinderProfile") { type = ProfileType.Grinder; break; } if (reader.Name == "FisherbotProfile") { type = ProfileType.Fisher; break; } } reader.Close(); XmlDocument doc = new XmlDocument(); doc.Load(openFileDialog1.FileName); XmlNodeList AllPoints = null; switch (type) { case ProfileType.Gatherer: { AllPoints = doc.SelectNodes("/GathererProfile/Points/Point"); break; } case ProfileType.Grinder: { AllPoints = doc.SelectNodes("/GrinderProfile/GrinderZones/GrinderZone/Points/Point"); break; } case ProfileType.Fisher: { AllPoints = doc.SelectNodes("/FisherbotProfile/Points/Point"); break; } } Hops.Clear(); if (AllPoints != null) { foreach (XmlNode OnePoint in AllPoints) { float X = float.Parse(OnePoint.SelectSingleNode("X").InnerText); float Y = float.Parse(OnePoint.SelectSingleNode("Y").InnerText); float Z = float.Parse(OnePoint.SelectSingleNode("Z").InnerText); Hop h = new Hop { Location = new Vector3(X, Y, Z) }; Hops.Add(h); } Draw(false, true); } else { Draw(true, false); } SelectZoom(); } }