//返回是否是 combobox public bool Click() { if (BattleManager.Instance.isBattle == false) { return(false); } ClickBox topbox = null; //是否触碰到box if (touchBox.Count > 0) { //获得最上面的box for (int i = 0; i < touchBox.Count; i++) { if (topbox != null) { if (touchBox[i] != null) { ClickBox curbox = touchBox[i].GetComponent <ClickBox>(); if (topbox.sprite.depth < curbox.sprite.depth) { topbox = curbox; } } } else { if (touchBox[i] != null) { topbox = touchBox[i].GetComponent <ClickBox>(); } if (topbox == null && touchBox[i].gameObject != null && touchBox[i].gameObject.transform.parent.gameObject != null) { topbox = touchBox[i].gameObject.transform.parent.gameObject.GetComponent <ClickBox>(); } } } //处理click事件 if (topbox != null && topbox.type != ClickBox.BoxType.ComboBox) { touchBox.Remove(topbox.gameObject); topbox.Click(topbox.type); } else if (topbox != null && topbox.type == ClickBox.BoxType.ComboBox) { dragBox = topbox.GetComponent <DragBox>(); return(true); } else //有时候touchbox 没清干净 { BattleManager.Instance.ClickBoxOver(ClickBox.BoxType.None); } } else //什么都没点到 { BattleManager.Instance.ClickBoxOver(ClickBox.BoxType.None); } return(false); }
protected override void OnAfterPaint(PaintEventArgs e) { base.OnAfterPaint(e); if (DragBox.Visible) { DragBox.Draw(e); } }
private void button8_Click(object sender, EventArgs e) { DragBox dragBox = new DragBox(); foreach (Control control in panel3.Controls) { if (control is DataGridView) { dragBox.WireControl(control); } } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (StyleBrushCursor != null) { StyleBrushCursor.Dispose(); StyleBrushCursor = null; } DragBox.Dispose(); }
public void initializationBox() { var dbi = Instantiate(dragBoxPrefab, transform); dbi.transform.position = transform.position; dbi.gameObject.AddComponent <DestroyAction>().DestroyA += () => { DragBox = null; GameManager.Point++; AudioManager.PlayDestroySquare(); }; DragBox = dbi; ColorRandom.colorRandom.BoxColorRandomizer(dbi.GetComponent <SpriteRenderer>()); dbi.transform.localScale = Vector3.zero; dbi.transform.DOScale(Vector3.one, .25f); AudioManager.PlayCreateSquare(); }
public void getSceneCanvas(Scene scene, LoadSceneMode mode) { Debug.Log("UIMANAGER:getSceneCanvas:" + scene.buildIndex); sceneCanvas = CanvasProvider.canvas; if (sceneCanvas == null) { Debug.LogWarning("scene canvas not found. scene:" + scene.buildIndex); } else { dragSelect = null; if (dragSelect = sceneCanvas.GetComponentInChildren <DragBox>()) { dragSelect.onMouseUp = getObjectsInBox; // dragSelect.onStartDrag = ()=>{ // objectinputController = null; // }; } } cameraController = Camera.main.gameObject.GetComponent <InputController>(); }
protected override void OnChartKeyDown(KeyEventArgs e) { base.OnChartKeyDown(e); //System.Diagnostics.Debug.WriteLine(string.Format("KeyCode:{0} Control:{1} Alt:{2} Shift:{3}", e.KeyCode, e.Control, e.Alt, e.Shift)); //Keys keys = e.KeyCode; //if (e.Control) // keys |= Keys.Control; //if (e.Shift) // keys |= Keys.Shift; //if (e.Alt) // keys |= Keys.Alt; // if (ShortcutKeys.Haldle(e.KeyData)) { e.SuppressKeyPress = true; return; } if (e.Control && DragBox.Visible) { DragBox.Invalidate(); } //{ // switch (e.KeyCode) // { // case Keys.Tab: // case Keys.Insert: // if (!ReadOnly) // { // AddSubTopic(); // e.SuppressKeyPress = true; // } // break; // case Keys.Enter: // if (!ReadOnly) // { // AddTopic(); // e.SuppressKeyPress = true; // } // break; // case Keys.Space: // case Keys.F2: // if (!ReadOnly) // { // EditObject(); // e.SuppressKeyPress = true; // } // break; // case Keys.Delete: // DeleteObject(); // e.SuppressKeyPress = true; // break; // case Keys.Left: // SelectNextTopic(MoveVector.Left); // e.SuppressKeyPress = true; // break; // case Keys.Up: // SelectNextTopic(MoveVector.Up); // e.SuppressKeyPress = true; // break; // case Keys.Right: // SelectNextTopic(MoveVector.Right); // e.SuppressKeyPress = true; // break; // case Keys.Down: // SelectNextTopic(MoveVector.Down); // e.SuppressKeyPress = true; // break; // case Keys.Escape: // if (MouseState == ChartMouseState.Drag) // { // CancelDrag(); // e.SuppressKeyPress = true; // } // break; // } //} }
protected override bool OnDragStart(InputState state) { AddInternal(dragBox = new DragBox()); return(true); }