Exemplo n.º 1
0
        RenderDataList OnFilterMinMax(RenderDataList rdl, ParamList pl)
        {
            float minV = pl.Get <float>("min", 0f);
            float maxV = pl.Get <float>("max", 0f);

            minV = EditorGUILayout.FloatField("最小:", minV, GUILayout.ExpandWidth(false));
            maxV = EditorGUILayout.FloatField("最大:", maxV, GUILayout.ExpandWidth(false));
            pl.Set("min", minV);
            pl.Set("max", maxV);
            if (minV == 0 && maxV == 0)
            {
                return(rdl);
            }

            Predicate <RenderData> fun = null;

            if (minV != 0f && maxV != 0f)
            {
                fun = (RenderData x) => { return(x.colliderArea >= minV && x.colliderArea <= maxV); };
            }
            else if (minV != 0)
            {
                fun = (RenderData x) => { return(x.colliderArea <= minV); };
            }
            else if (maxV != 0)
            {
                fun = (RenderData x) => { return(x.colliderArea >= maxV); };
            }

            return(new RenderDataList(rdl.FindAll(fun)));
        }