public void Init(ComBox box) { this.box = box; boxX = box.x; desIndex = 0; Invoke("Explode", 1f); }
public List <Vector2> LinkTwoBox(ComBox one, ComBox two) { List <Vector2> list = new List <Vector2>(); if (CheckDirectLink(one.x, one.y, two.x, two.y)) { list.Add(new Vector2(one.x, one.y)); list.Add(new Vector2(two.x, two.y)); return(list); } Vector2 tmpV = CheckTwoPoint(one.x, one.y, two.x, two.y); if (tmpV.x > -1) { list.Add(new Vector2(one.x, one.y)); list.Add(tmpV); list.Add(new Vector2(two.x, two.y)); return(list); } List <Vector2> tmpList = CheckThreePoint(one.x, one.y, two.x, two.y); if (tmpList != null) { list.Add(new Vector2(one.x, one.y)); list.Add(tmpList[0]); list.Add(tmpList[1]); list.Add(new Vector2(two.x, two.y)); return(list); } return(null); }
private void cmdRegionType_SelectedIndexChanged(object sender, EventArgs e) { ComBox box = sender as ComBox; if (box != null) { if ("1".Equals(box.SelectedValue.ToString())) { this.lblLon12.Text = "半径:"; this.lblLat12.Visible = false; this.txtLat12.Visible = false; this.lblRadius1.Visible = true; } else { this.lblLon12.Text = "到"; this.lblLat12.Visible = true; this.txtLat12.Visible = true; this.lblRadius1.Visible = false; } this.txtLat11.Text = ""; this.txtLat12.Text = ""; this.txtLon11.Text = ""; this.txtLon12.Text = ""; } }
private void cmbDistrict1_SelectedValueChanged(object sender, EventArgs e) { int num = Convert.ToInt32(((ComBox)sender).Tag); if (num < 3) { ComBox box = this.grpDistrict.Controls[string.Format("cmbDistrict{0}", num)] as ComBox; if (this.grpDistrict.Controls[string.Format("cmbDistrict{0}", num + 1)] != null) { ComBox box2 = this.grpDistrict.Controls[string.Format("cmbDistrict{0}", num + 1)] as ComBox; if (box2 != null) { box2.clearItems(); if (box.SelectedIndex > 0) { object regionNames = GisService.GetRegionNames(box.SelectedValue.ToString()); if (regionNames != null) { string[] strArray = regionNames as string[]; box2.addItems("请选择行政区", ""); foreach (string str in strArray) { string[] strArray2 = str.Split(new char[] { ':' }); if (strArray2.Length >= 2) { box2.addItems(strArray2[1], strArray2[0]); } } } } } } } }
void AddBox(ComBox box, int x, int y) { BoxObject bo = new BoxObject(x, y, box.index); if (box != null) { bo.gameObject = box.gameObject; } m_BoxList.Add(bo); }
//取和当前box相同类型的box, 不包括自己 public List <ComBox> GetSameBoxs(ComBox box) { List <ComBox> bbs = new List <ComBox> (); List <BoxObject> tmpList = m_BoxList.FindAll(p => p.index == box.index && (p.x != box.x || p.y != box.y)); for (int i = 0; i < tmpList.Count; i++) { bbs.Add(tmpList[i].gameObject.GetComponent <ComBox>()); } return(bbs); }
void UsingProp(ComBox hitBox) { GamePlaying.Instance().isPlaying = true; m_CanTouch = false; background.transform.localPosition = new Vector3(10f, 10f, 0f); switch (usingPropID) { case GamePropsId.Bomb: SetMoveSpeed(0f); GameObject bomb = Instantiate(m_resource.GetResFromName(ConstValue.GAME_PROP_BOMB), Vector3.zero, Quaternion.identity) as GameObject; bomb.transform.parent = transform; bomb.transform.localPosition = hitBox.gameObject.transform.localPosition; bomb.GetComponent <PropBomb>().Init(hitBox); break; case GamePropsId.Rocket: SetMoveSpeed(0f); GameObject rocket = Instantiate(m_resource.GetResFromName(ConstValue.GAME_PROP_ROCKET), Vector3.zero, Quaternion.identity) as GameObject; rocket.transform.parent = transform; rocket.transform.localPosition = hitBox.gameObject.transform.localPosition; rocket.GetComponent <PropRocket>().Init(hitBox); break; case GamePropsId.Shock: GameObject shock = Instantiate(m_resource.GetResFromName(ConstValue.GAME_PROP_SHOCK), Vector3.zero, Quaternion.identity) as GameObject; shock.transform.parent = transform; shock.transform.position = new Vector3(0f, -ScreenInfo.h / 2 + ConstValue.BOTTOM_BAN_HEIGHT, 0f); SetMoveSpeed(0.2f); Invoke("BackMoveSpeed", 0.5f); break; case GamePropsId.Same: SetMoveSpeed(0f); GameObject same = Instantiate(m_resource.GetResFromName(ConstValue.GAME_PROP_SAME), Vector3.zero, Quaternion.identity) as GameObject; same.transform.parent = transform; same.transform.localPosition = hitBox.gameObject.transform.localPosition; same.GetComponent <PropSame>().Init(hitBox); break; } }
void CheckFallBall(ComBox box) { if (box.check) { return; } box.check = true; box.link = true; List <ComBox> neighbors = boxManager.GetNeighborBoxs(box); foreach (ComBox boxTemp in neighbors) { CheckFallBall(boxTemp); } }
/// <summary> /// Inits the boxs. /// </summary> /// <param name="downRow">Down row. 从多少行开始</param> /// <param name="numRow">Number row. 往上加载多少行</param> public void InitBoxs(int downRow, int numRow) { lock (_lock) { topRow = downRow - numRow + 1; if (topRow == 0) { //加载banner和boss GameObject banner = Instantiate(m_resource.GetResFromName(ConstValue.GAME_T_BANNER), Vector3.zero, Quaternion.identity) as GameObject; banner.transform.parent = transform; banner.transform.position = new Vector3(0, GetTopPosition() + ConstValue.TopBannerHeight / 2, 0); if (ConstValue.currentLevel.boss > 0) { boss = Instantiate(m_resource.GetResFromName(ConstValue.bosses[ConstValue.currentLevel.boss]), Vector3.zero, Quaternion.identity) as GameObject; boss.transform.parent = transform; boss.transform.position = new Vector3(0, banner.transform.position.y + ConstValue.BossHeight / 2, 0); InvokeRepeating("BossFight", 1f, 3f); } } for (int i = downRow; i >= topRow; i--) { for (int j = 0; j < m_level.width; j++) { int index = i * m_level.width + j; Debug.Log(downRow + "," + topRow + "," + index); if (m_level.data[index] != 0) { GameObject boxClone = Instantiate(m_resource.GetResFromName(ConstValue.GAME_LIAN_PRE + m_level.data[index]), GetPosFromXY(j, i), Quaternion.identity) as GameObject; boxClone.transform.parent = transform; boxClone.transform.position += transform.position; ComBox cb = boxClone.GetComponent <ComBox>(); cb.index = m_level.data[index]; cb.ice = m_level.meta[index]; cb.x = j; cb.y = i; cb.fall = false; boxManager[j, i] = cb; } } } bottomRow = boxManager.GetBottomNullRow(); } }
private bool getParam() { try { if (this.rdoCancel.Checked) { this.m_sContent = base.OrderCode.ToString() + "-类型:取消"; this.m_sExecSql = string.Format("exec GpsPicServer_DelAdminRegoionAlarm '{0}'", base.sCarSimNum); return(true); } string str = ""; string text = ""; int num = 1; while (true) { ComBox box = this.grpDistrict.Controls[string.Format("cmbDistrict{0}", num)] as ComBox; if ((box == null) || (box.SelectedIndex <= 0)) { break; } str = box.SelectedValue.ToString(); text = box.Text; num++; } if (string.IsNullOrEmpty(str)) { MessageBox.Show("选择行政区!"); this.cmbDistrict1.Focus(); return(false); } if (this.rdoIn.Checked) { this.m_sContent = base.OrderCode.ToString() + "-类型:禁入-行政区:" + text; this.m_sExecSql = string.Format("exec GpsPicServer_UpdateAdminRegoionAlarm '{0}', '{1}', '{2}', 0", base.sCarSimNum, str, text); } else { this.m_sContent = base.OrderCode.ToString() + "-类型:禁出-行政区:" + text; this.m_sExecSql = string.Format("exec GpsPicServer_UpdateAdminRegoionAlarm '{0}', '{1}', '{2}', 1", base.sCarSimNum, str, text); } } catch { return(false); } return(true); }
void ClickComBox(ComBox hitBox) { if (hitBox.index != 10 && !hitBox.fall) { if (m_SelectBox == null) { m_SelectBox = hitBox; background.transform.localPosition = m_SelectBox.gameObject.transform.localPosition; } else { m_OtherBox = hitBox; if (m_SelectBox != m_OtherBox && m_SelectBox.index == m_OtherBox.index) { List <Vector2> lineList = boxManager.LinkTwoBox(m_SelectBox, m_OtherBox); if (lineList != null) { m_SelectBox.Explode(); m_SelectBox = null; m_OtherBox.Explode(); m_OtherBox = null; background.transform.localPosition = new Vector3(10f, 10f, 0f); DrawLine(lineList); GameStaticData.Combo += 1; CheckPanelState(); } else { GameStaticData.Combo = 0; m_SelectBox = m_OtherBox; background.transform.localPosition = m_SelectBox.gameObject.transform.localPosition; } } else { GameStaticData.Combo = 0; m_SelectBox = m_OtherBox; background.transform.localPosition = m_SelectBox.gameObject.transform.localPosition; } } } }
// 取邻居8个方块 public List <ComBox> GetNeighborBoxs(ComBox box) { List <ComBox> boxs = new List <ComBox>(); ComBox boxTemp = null; if ((boxTemp = this[box.x - 1, box.y - 1]) != null) { boxs.Add(boxTemp); } if ((boxTemp = this[box.x, box.y - 1]) != null) { boxs.Add(boxTemp); } if ((boxTemp = this[box.x + 1, box.y - 1]) != null) { boxs.Add(boxTemp); } if ((boxTemp = this[box.x - 1, box.y]) != null) { boxs.Add(boxTemp); } if ((boxTemp = this[box.x + 1, box.y]) != null) { boxs.Add(boxTemp); } if ((boxTemp = this[box.x - 1, box.y + 1]) != null) { boxs.Add(boxTemp); } if ((boxTemp = this[box.x, box.y + 1]) != null) { boxs.Add(boxTemp); } if ((boxTemp = this[box.x + 1, box.y + 1]) != null) { boxs.Add(boxTemp); } return(boxs); }
public void MyUpdate() { if (m_CanTouch && Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit2D hit = Physics2D.GetRayIntersection(ray, Mathf.Infinity); if (hit.collider != null) { ComBox hitBox = hit.transform.gameObject.GetComponent <ComBox>(); if (hitBox != null) { if (isUsingProp) { UsingProp(hitBox); } else { ClickComBox(hitBox); } } } } }
public void Init(ComBox box) { this.box = box; Invoke("Explode", 1f); }
public void RemoveBox(ComBox box) { this[box.x, box.y] = null; }
private void initDistrict() { try { this.cmbDistrict1.clearItems(); this.cmbDistrict1.addItems("请选择行政区", ""); object regionNames = GisService.GetRegionNames(""); if (regionNames != null) { string[] strArray = regionNames as string[]; foreach (string str in strArray) { string[] strArray2 = str.Split(new char[] { ':' }); if (strArray2.Length >= 2) { this.cmbDistrict1.addItems(strArray2[1], strArray2[0]); } } try { DataTable table = RemotingClient.ExecSql(string.Format("exec GpsPicServer_FindAdminRegoionAlarm {0}", base.sCarSimNum)); if ((table != null) && (table.Rows.Count > 0)) { string str2 = table.Rows[0]["AlarmStatus"].ToString(); string[] strArray3 = table.Rows[0]["AdminRegionId"].ToString().Split(new char[] { '/' }); if ("0".Equals(str2)) { this.rdoIn.Checked = true; } else { this.rdoOut.Checked = true; } string str4 = ""; int index = 0; while (index <= strArray3.Length) { if (!string.IsNullOrEmpty(str4)) { str4 = str4 + "/"; } str4 = str4 + strArray3[index]; index++; ComBox sender = this.grpDistrict.Controls[string.Format("cmbDistrict{0}", index)] as ComBox; if (sender == null) { return; } sender.SelectedValue = str4; this.cmbDistrict1_SelectedValueChanged(sender, new EventArgs()); } } } catch { } } } catch (Exception exception) { Record.execFileRecord(string.Format("{0}-初始化行政区域", base.OrderCode.ToString()), exception.Message); } }