Esempio n. 1
0
        private void ChecksAndWarning(DepthDrawCall depthDrawCall)
        {
            // if all function,warning
            bool allFunc = true;

            foreach (var w in depthDrawCall.uIWidgets)
            {
                if (!w.mIsFunction)
                {
                    allFunc = false;
                    break;
                }
            }
            if (allFunc && depthDrawCall.uIWidgets.Count > 0)
            {
                string widgetsname = "";
                int    i           = 1;
                foreach (var w in depthDrawCall.uIWidgets)
                {
                    widgetsname += string.Format("\t({0}){1}\n", i, w.name);
                }
                Debug.LogErrorFormat("Layer Check:[层级内全为功能控件!建议优化] Layer = {0}\n" +
                                     "优化策略:\n\t(1)UIPanel隔离\n\t(2)增加冗余非视窗内的控件以维持DrawCall不rebuild\n" +
                                     "Widgets:\n{1}"
                                     , Layer, widgetsname);
            }
        }
Esempio n. 2
0
        List <DepthDrawCall> GenerateDrawCalls()
        {
            List <DepthDrawCall> depthDrawCalls = new List <DepthDrawCall>();

            foreach (var w in uIWidgets)
            {
                bool hasAdd = false;
                foreach (var dc in depthDrawCalls)
                {
                    if (dc.TryAdd(w))
                    {
                        hasAdd = true;
                        break;
                    }
                }
                if (!hasAdd)
                {
                    var ndc = DepthDrawCall.CreateNewDC(w);
                    if (ndc != null)
                    {
                        depthDrawCalls.Add(ndc);
                    }
                    else
                    {
                        emptyDrawCall.TryAdd(w);
                    }
                }
            }

            return(depthDrawCalls);
        }
Esempio n. 3
0
            public static DepthDrawCall CreateNewDC(UIWidget w, bool Empty = false)
            {
                DepthDrawCall ret = null;

                if (Empty)
                {
                    ret         = new DepthDrawCall();
                    ret.isEmpty = true;
                }
                else if (w != null && w.drawCall != null)
                {
                    ret = new DepthDrawCall();
                    //ret.DrawCall = w.drawCall;
                    ret.mainTexture = w.mainTexture;
                    ret.shader      = w.shader;
                    ret.material    = w.material;
                }
                if (w != null && ret != null)
                {
                    ret.TryAdd(w);
                }
                return(ret);
            }