Example #1
0
    public static void SetupUILayerOrder(Canvas canv, int s_order, int s_layer_id, bool need_ray)
    {
        //Canvas canv = go.GetComponent<Canvas>();
        if (canv == null)
        {
            //canv = go.AddComponent<Canvas>();
            return;
        }

        GameObject go = canv.gameObject;

        if (need_ray)
        {
            if (go.GetComponent <GraphicRaycaster>() == null)
            {
                go.AddComponent <GraphicRaycaster>();
            }
        }

        canv.overrideSorting = true;
        if (canv.overrideSorting)
        {
            canv.sortingOrder   = s_order;
            canv.sortingLayerID = s_layer_id;
        }
        else
        {
            GIACanvFixer ciaf = go.GetComponent <GIACanvFixer>();
            if (ciaf == null)
            {
                ciaf = go.AddComponent <GIACanvFixer>();
            }
            //ciaf.IsValid = true;
            //ciaf.HasLayer = true;
            ciaf.SLayerID = s_layer_id;
            ciaf.SOrder   = s_order;
            //ciaf.NeedBlock = need_ray;
            ciaf.enabled = true;
        }
    }
Example #2
0
    public static int GetUILayer(Canvas cvs)
    {
        int i_ret;

        if (cvs.overrideSorting)
        {
            i_ret = cvs.sortingLayerID;
        }
        else
        {
            GIACanvFixer giac = cvs.GetComponent <GIACanvFixer>();
            //if (giac != null && giac.HasLayer)
            //{
            i_ret = giac.SLayerID;
            //}
            //else
            //{
            //    i_ret = -1;
            //}
        }
        return(i_ret);
    }
Example #3
0
    //public static void SetupUIOrder(Canvas canv, int s_order)
    //{
    //    //Canvas canv = go.GetComponent<Canvas>();
    //    if (canv == null)
    //    {
    //        //canv = go.AddComponent<Canvas>();
    //        return;
    //    }

    //    GameObject go = canv.gameObject;
    //    canv.overrideSorting = true;
    //    if (canv.overrideSorting)
    //    {
    //        canv.sortingOrder = s_order;
    //    }
    //    else
    //    {
    //        GIACanvFixer ciaf = go.GetComponent<GIACanvFixer>();
    //        if (ciaf == null)
    //        {
    //            ciaf = go.AddComponent<GIACanvFixer>();
    //        }
    //        //ciaf.IsValid = true;
    //        ciaf.SOrder = s_order;
    //        ciaf.enabled = true;
    //    }
    //}

    //public static void SetupUILayer(Canvas canv, int s_layer)
    //{
    //    //Canvas canv = go.GetComponent<Canvas>();
    //    if (canv == null)
    //    {
    //        //canv = go.AddComponent<Canvas>();
    //        return;
    //    }

    //    GameObject go = canv.gameObject;
    //    canv.overrideSorting = true;
    //    if (canv.overrideSorting)
    //    {
    //        canv.sortingLayerID = s_layer;
    //    }
    //    else
    //    {
    //        GIACanvFixer ciaf = go.GetComponent<GIACanvFixer>();
    //        if (ciaf == null)
    //        {
    //            ciaf = go.AddComponent<GIACanvFixer>();
    //        }
    //        //ciaf.IsValid = true;
    //        ciaf.HasLayer = true;
    //        ciaf.SLayerID = s_layer;
    //        ciaf.enabled = true;
    //    }
    //}

    public static int GetUIOrder(Canvas cvs)
    {
        int i_ret;

        if (cvs.overrideSorting)
        {
            i_ret = cvs.sortingOrder;
        }
        else
        {
            GIACanvFixer giac = cvs.GetComponent <GIACanvFixer>();
            if (giac != null)
            {
                i_ret = giac.SOrder;
            }
            else
            {
                i_ret = -1;
            }
        }
        return(i_ret);
    }