コード例 #1
0
 public override void OnViewFrameTime(float dt)
 {
     base.OnViewFrameTime(dt);
     if (!this.manualCullGUIObjects)
     {
         return;
     }
     if (this.Grid == null)
     {
         return;
     }
     foreach (UXElement current in this.Grid.GetElementList())
     {
         if (current != null)
         {
             Bounds    bounds       = UXUtils.CalculateAbsoluteWidgetBound(current.GetUIWidget.transform);
             Vector3[] worldCorners = base.NGUIPanel.worldCorners;
             Vector3   vector       = bounds.center - bounds.size * this.cullingFactor;
             Vector3   vector2      = bounds.center + bounds.size * this.cullingFactor;
             if (this.NGUIGrid.arrangement == UIGrid.Arrangement.Horizontal)
             {
                 if (vector.x > worldCorners[2].x || vector2.x < worldCorners[0].x)
                 {
                     current.GetUIWidget.gameObject.SetActive(false);
                 }
                 else
                 {
                     current.GetUIWidget.gameObject.SetActive(true);
                 }
             }
             else if (vector.y > worldCorners[2].y || vector2.y < worldCorners[0].y)
             {
                 current.GetUIWidget.gameObject.SetActive(false);
             }
             else
             {
                 current.GetUIWidget.gameObject.SetActive(true);
             }
         }
     }
 }