private static void CreateEmptyDC(int index, UIWidget w) { SimpleDC dc = new SimpleDC(true, null, w.panel); dcList.Insert(index, dc); DrawCallData dcData = new DrawCallData(); dcData.simple = dc; dcData.AddW(w); allWidgetDic.Add(dc, dcData); }
private static void CreateEmptyDC(UIWidget w) { for (int j = 0; j < dcList.Count; j++) { var d = allWidgetDic[dcList[j]]; bool needCreate = true; if (w.panel != d.simple.manager) { continue; } if (w.depth <= d.DepthStart) { if (d.simple.isEmpty) { d.AddW(w); return; } if (needCreate && j > 0) { DrawCallData dpre = null; for (int k = j - 1; k >= 0; k--) { if (dcList[k].manager == w.panel) { dpre = allWidgetDic[dcList[k]]; break; } } if (dpre != null && dpre.simple.isEmpty) { if (dpre.simple.manager == w.panel) { dpre.AddW(w); return; } } } CreateEmptyDC(j, w); return; } else { if (w.depth > d.DepthStart && w.depth < d.DepthEnd) { if (d.simple.isEmpty) //空 { d.AddW(w); return; } else { CreateEmptyDC(j + 1, w); //depth大的 移到后一个新dc中 SimpleDC newDC = new SimpleDC(false, d.simple.dc); dcList.Insert(j + 2, newDC); DrawCallData dcData = new DrawCallData(); dcData.simple = newDC; allWidgetDic.Add(newDC, dcData); for (int k = 0; k < d.widgets.Count; k++) { UIWidget temp = d.widgets[k]; if (temp.depth > w.depth) { dcData.AddW(temp); } } for (int k = 0; k < dcData.widgets.Count; k++) { d.RemoveW(dcData.widgets[k]); } return; } } } } CreateEmptyDC(dcList.Count, w); }