示例#1
0
    //返回是否是 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);
    }
示例#2
0
        protected override void OnAfterPaint(PaintEventArgs e)
        {
            base.OnAfterPaint(e);

            if (DragBox.Visible)
            {
                DragBox.Draw(e);
            }
        }
示例#3
0
        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);
                }
            }
        }
示例#4
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (StyleBrushCursor != null)
            {
                StyleBrushCursor.Dispose();
                StyleBrushCursor = null;
            }

            DragBox.Dispose();
        }
示例#5
0
    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();
    }
示例#6
0
 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>();
 }
示例#7
0
        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;
            //    }
            //}
        }
示例#8
0
 protected override bool OnDragStart(InputState state)
 {
     AddInternal(dragBox = new DragBox());
     return(true);
 }