Пример #1
0
    public override void Draw(IPlatformDrawer platform, float scale)
    {
        base.Draw(platform, scale);

        if (IsSelected)
        {
            var selectedChild = Children.Skip(1).FirstOrDefault(p => p.IsSelected);
            var width         = 85f;
            var buttonHeight  = 25;
            var toolbarRect   = new Rect(this.Bounds.x - width - 4, this.Bounds.y + 8, width, selectedChild == null ? (buttonHeight * 3) + 20 : (buttonHeight * 4) + 20);

            platform.DrawStretchBox(toolbarRect, CachedStyles.WizardSubBoxStyle, 12f);
            toolbarRect.y += 10;

            var x = toolbarRect.x;
            var y = toolbarRect.y;

            if (selectedChild != null)
            {
                platform.DoButton(new Rect(x, y, toolbarRect.width, buttonHeight), "Remove", CachedStyles.WizardListItemBoxStyle,
                                  () =>
                {
                    NodeViewModel.RemoveSelected();
                });
                y += buttonHeight;
            }
            platform.DoButton(new Rect(x, y, toolbarRect.width, buttonHeight), "+ Add Section", CachedStyles.WizardListItemBoxStyle,
                              () =>
            {
                ShowAddPointerMenu <ShellNodeConfigSection>("Section", () =>
                {
                    NodeViewModel.AddSectionItem();
                }, _ => { NodeViewModel.AddSectionPointer(_); });
            });
            y += buttonHeight;
            platform.DoButton(new Rect(x, y, toolbarRect.width, buttonHeight), "+ Input", CachedStyles.WizardListItemBoxStyle,
                              () =>
            {
                ShowAddPointerMenu <ShellNodeConfigInput>("Input", () =>
                {
                    NodeViewModel.AddInputItem();
                }, _ => { NodeViewModel.AddInputPointer(_); });
            });
            y += buttonHeight;
            platform.DoButton(new Rect(x, y, toolbarRect.width, buttonHeight), "+ Output", CachedStyles.WizardListItemBoxStyle,
                              () =>
            {
                ShowAddPointerMenu <ShellNodeConfigOutput>("Output", () =>
                {
                    NodeViewModel.AddOutputItem();
                }, _ => { NodeViewModel.AddOutputPointer(_); });
            });
            y += buttonHeight;
        }
    }