示例#1
0
        protected override void OnFilterRenderDataListEnd(RenderDataList rdl)
        {
            GuiTools.HorizontalField(false, () =>
            {
                if (GUILayout.Button("设置为小物件,不会遮挡别人", GUILayout.Width(200f), GUILayout.Height(50f)))
                {
                    foreach (var data in rdl.dataList)
                    {
                        GF.SetStaticEditorFlags(data.renderer.gameObject, StaticEditorFlags.OccludeeStatic, true);
                        GF.SetStaticEditorFlags(data.renderer.gameObject, StaticEditorFlags.OccluderStatic, false);
                    }
                }

                if (GUILayout.Button("设置为大物件,遮挡别人,不会被别人遮挡", GUILayout.Width(200f), GUILayout.Height(50f)))
                {
                    foreach (var data in rdl.dataList)
                    {
                        GF.SetStaticEditorFlags(data.renderer.gameObject, StaticEditorFlags.OccludeeStatic, false);
                        GF.SetStaticEditorFlags(data.renderer.gameObject, StaticEditorFlags.OccluderStatic, true);
                    }
                }

                if (GUILayout.Button("即会被遮挡也会摭挡别人", GUILayout.Width(200f), GUILayout.Height(50f)))
                {
                    foreach (var data in rdl.dataList)
                    {
                        GF.SetStaticEditorFlags(data.renderer.gameObject, StaticEditorFlags.OccludeeStatic, false);
                        GF.SetStaticEditorFlags(data.renderer.gameObject, StaticEditorFlags.OccluderStatic, true);
                    }
                }
            });
        }
示例#2
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)));
        }
示例#3
0
            public override void render(Display display, RenderTarget rt, AddSpriteDelegate addSprite)
            {
                base.render(display, rt, addSprite);
                RenderDataList renderData    = RenderData as RenderDataList;
                Vector2        iconPosition  = renderData.IconPosition;
                Vector2        barPosition   = renderData.BarPosition;
                float          textPositionY = renderData.TextPositionY;

                // render name
                for (int l = autoScrollLine_; l < (renderData.Lines + autoScrollLine_) && l < renderData.Container.Count; l++)
                {
                    var entry = renderData.Container[l];

                    // draw icon
                    if (iconShow_)
                    {
                        string iconType = $"{entry.type.TypeId}/{entry.type.SubtypeId}";
                        if (RenderTarget.spriteExist(iconType))
                        {
                            addSprite(new MySprite(SpriteType.TEXTURE, iconType, iconPosition + rt.DisplayOffset, renderData.IconSize, Color.White));
                        }
                        iconPosition.Y += renderData.LineHeight;
                    }

                    // draw bar
                    if (barShow_)
                    {
                        barRenderMethod_(addSprite, rt, barPosition, renderData.BarSize, (float)Math.PI * 0.5f, false, renderData.BarTiles,
                                         renderData.BarTileSpacing, IconNameSquareSimple, (float)entry.indicator, Gradient, 0f, Default.BarBorderColor, barBackground_);
                        barPosition.Y += renderData.LineHeight;
                    }

                    // draw text
                    if (textShow_)
                    {
                        renderTextLine(display, rt, addSprite, Template.Font, renderData.FontSize,
                                       new Vector2(renderData.TextLeftPositionX, textPositionY),
                                       getGradientColor((float)entry.indicator), entry.name, TextAlignment.LEFT);

                        if (textStyle_ != TextStyle.OnlyName)
                        {
                            renderTextLine(display, rt, addSprite, Template.Font, renderData.FontSize,
                                           new Vector2(renderData.TextRightPositionX, textPositionY),
                                           getGradientColor((float)entry.indicator), getRightText(entry), TextAlignment.RIGHT);
                        }

                        textPositionY += renderData.LineHeight;
                    }
                }
            }
示例#4
0
        protected override void OnMeshGUI(Mesh mesh, RenderDataList rdl)
        {
            StaticEditorFlags flags = 0;

            foreach (var item in rdl.dataList)
            {
                if (GF.GetStaticEditorFlags(item.renderer.gameObject, StaticEditorFlags.OccludeeStatic))
                {
                    flags |= StaticEditorFlags.OccludeeStatic;
                }

                if (GF.GetStaticEditorFlags(item.renderer.gameObject, StaticEditorFlags.OccluderStatic))
                {
                    flags |= StaticEditorFlags.OccluderStatic;
                }
            }

            string text = "无遮挡";

            if (flags == (StaticEditorFlags.OccluderStatic | StaticEditorFlags.OccludeeStatic))
            {
                text = "双遮";
            }
            else if (flags == StaticEditorFlags.OccludeeStatic)
            {
                text = "小物件";
            }
            else if (flags == StaticEditorFlags.OccluderStatic)
            {
                text = "大物件";
            }

            var text1 = GuiTools.StringPopup(false, text, Ollcusion_items, GUILayout.Width(120));

            if (text1 != text)
            {
                foreach (var item in rdl.dataList)
                {
                    SetStaticEditorFlags(item.renderer.gameObject, text1);
                }
            }
        }
示例#5
0
 protected override void OnCombineRemove(RenderDataList rdl)
 {
 }
示例#6
0
 protected override void OnCommonBtn(RenderDataList rdl, params GUILayoutOption[] objs)
 {
 }
示例#7
0
 protected override RenderDataList OnFilterRenderDataList(RenderDataList rdl, ParamList pl)
 {
     rdl = OnFilterMinMax(rdl, pl);
     return(rdl);
 }
示例#8
0
            public override void prepareRendering(Display display)
            {
                base.prepareRendering(display);
                RenderDataList renderData = RenderData as RenderDataList;
                //Vector2 size = SizeType == ValueType.Relative ? Size * display.RenderArea.Size : Size;
                //Vector2 position = PositionType == ValueType.Relative ? Position * display.RenderArea.Size : Position;
                Vector2 size     = RenderData.InnerSize;
                Vector2 position = RenderData.Position;

                float fontHeight   = textShow_ == true ? Default.CharHeight * Template.FontSize : 0f;
                float barThickness = barThicknessType_ == ValueType.Relative ? barThickness_ * fontHeight : barThickness_;

                renderData.LineHeight = fontHeight + spacing_;
                if (barShow_)
                {
                    renderData.BarSize     = new Vector2(size.X, barThickness);
                    renderData.LineHeight += barEmbedded_ ? 0f : renderData.BarSize.Y;
                }
                else
                {
                    renderData.BarSize = new Vector2();
                }

                if (lines_ > 0)
                {
                    float scale = (size.Y / lines_) / renderData.LineHeight;

                    fontHeight            *= scale;
                    renderData.BarSize.Y  *= scale;
                    renderData.LineHeight *= scale;
                    renderData.Lines       = lines_;
                    renderData.FontSize    = Template.FontSize * scale;
                }
                else
                {
                    renderData.Lines    = (int)(size.Y / renderData.LineHeight);
                    renderData.FontSize = Template.FontSize;
                }

                if (iconShow_ && (!textShow_ || barEmbedded_))
                {
                    renderData.BarSize.X -= renderData.BarSize.Y;
                }

                // calculate bar tiles
                if (barShow_)
                {
                    renderData.BarTiles       = (int)((renderData.BarSize.X / renderData.BarSize.Y) * 2f);
                    renderData.BarTileSpacing = renderData.BarSize.X * 0.01f;
                }

                // calculate Y position
                renderData.TextPositionY = position.Y - (size.Y * 0.5f) + (fontHeight * 0.5f);
                renderData.BarPosition.Y = position.Y - (size.Y * 0.5f) + (renderData.BarSize.Y * 0.5f) + (barEmbedded_ ? 0f : fontHeight);

                // icon
                if (iconShow_)
                {
                    // adjust bar size if no text
                    if (textShow_ == false)
                    {
                        renderData.BarSize.X -= renderData.BarSize.Y;
                        renderData.IconSize   = new Vector2(renderData.BarSize.Y, renderData.BarSize.Y);
                    }
                    else
                    {
                        renderData.IconSize = new Vector2(fontHeight, fontHeight);
                    }

                    renderData.IconPosition.Y = position.Y - (size.Y * 0.5f) + (renderData.IconSize.Y * 0.5f);
                }

                // calculate X position
                renderData.IconPosition.X     = position.X - (size.X * 0.5f) + (renderData.IconSize.X * 0.5f);
                renderData.BarPosition.X      = position.X - (size.X * 0.5f) + (renderData.BarSize.X * 0.5f) + (barEmbedded_ ? renderData.IconSize.X : 0f);
                renderData.TextLeftPositionX  = position.X - (size.X * 0.5f) + renderData.IconSize.X;
                renderData.TextRightPositionX = position.X + (size.X * 0.5f);
                renderData.BarSize            = new Vector2(renderData.BarSize.Y, renderData.BarSize.X);

                // filter list
                DataAccessor.list(out renderData.Container, (item) => isVisible(item.indicator));

                // auto scroll
                if (autoScroll_ == true)
                {
                    if (renderData.Lines >= renderData.Container.Count)
                    {
                        autoScrollLine_ = 0;
                    }
                    else
                    {
                        autoScrollLine_ += autoScrollInc_;

                        if (autoScrollLine_ < 0)
                        {
                            autoScrollLine_ = 0;
                            autoScrollInc_ *= -1;
                        }
                        else if (autoScrollLine_ > (renderData.Container.Count - renderData.Lines))
                        {
                            autoScrollLine_ = renderData.Container.Count - renderData.Lines;
                            autoScrollInc_ *= -1;
                        }
                    }
                }

                if (Gradient.Count == 0)
                {
                    addGradientColor(0.0f, Template.FontColor);
                }
            }