コード例 #1
0
    // ========================================= PRIVATE FUNCS =========================================
    private void UpdateMouseDown()
    {
        if (Input.GetMouseButtonDown(0))
        {
            if (dragingElement == null)
            {
                GameObject touchedObj = GetTouchedUIElement();
                // if touched obj is draging element
                if (touchedObj && touchedObj.GetComponent <DragingElement>())
                {
                    dragingElement = touchedObj.GetComponent <DragingElement>();
                    // active draging title
                    if (dragingElement)
                    {
                        ActiveTitle(true);
                    }

                    // catch mouse position
                    rt.position = Input.mousePosition;
                }
            }

            // Turn off color bar if user touched out of it
            if (ColorBar.Instance.IsActive())
            {
                GameObject touchedObj = GetTouchedUIElement();
                if (touchedObj.tag != "color_bar" && touchedObj.tag != "color_bar_btn")
                {
                    ColorBar.Instance.SetActiveGameObject(false);
                }
            }
        }
    }
コード例 #2
0
    private void OnMouseUp()
    {
        ActiveTitle(false);

        // catch event
        // event [1]: from panel to panel
        GameObject touchedObj = GetTouchedUIElement(0);

        if (touchedObj)
        {
            GameObject cacheObj = null;
            if (IsTouchUIElement(out cacheObj, "rootpanel_attribute", "rootpanel_sentence"))
            {
                cacheObj = null;
                if (IsTouchUIElement(out cacheObj, "panel_common"))
                {
                    OnDragPanelToPanel(cacheObj.GetComponent <CommonPanel>());
                }
            }
            else if (IsTouchUIElement(out cacheObj, "rootpanel_result"))
            {
                if (cacheObj.GetComponent <OriginBoard>() && dragingElement is CommonPanel)
                {
                    cacheObj.GetComponent <OriginBoard>().ShowResult(dragingElement as CommonPanel);
                }
            }
        }

        // hide draging title & clear draging obj
        dragingElement = null;
    }