Beispiel #1
0
        public override void OnSubmenuRequested(IToolbarBuilder builder)
        {
            var itemNames = builder.ItemNames.ToList();
            var index     = itemNames.Count;

            var smartFolderIndex = itemNames.IndexOf("miCreateSmartfoldertype");

            if (smartFolderIndex != -1)
            {
                index = smartFolderIndex - 1;
            }

            if (_selected.Type.IsProject)
            {
                builder.AddButtonItem(Const.COMMAND_UPDATE_NAME, index)
                .WithHeader(Const.COMMAND_UPDATE_TITLE)
                .WithIcon(IconLoader.GetIcon(_projectCloneCreator.Icon));
            }
            else
            {
                builder.AddButtonItem(Const.COMMAND_NAME, index)
                .WithHeader(Const.COMMAND_TITLE)
                .WithIcon(IconLoader.GetIcon(_projectCloneCreator.Icon));
            }
        }
        void onGUIEditorToolbarReady()
        {
            if (icon == null)
            {
                IconLoader iconloader = PartCategorizer.Instance.iconLoader;
                icon = iconloader.GetIcon("R&D_node_icon_fuelsystems");
            }
            PartCategorizer.Category cat    = PartCategorizer.Instance.filters.Find(c => c.button.categoryName == "Filter by Module");
            PartCategorizer.Category subcat = cat.subcategories.Find(c => c.button.categoryName == "Modular Fuel Tank");
            subcat.button.SetIcon(icon);

            cat = PartCategorizer.Instance.filters.Find(c => c.button.categoryName == "Filter by Function");
            PartCategorizer.AddCustomSubcategoryFilter(cat, "MFT Tanks", "MFT Tanks", icon, mftItemFilter);
        }
        public void Build(IMenuBuilder builder, ObjectsViewContext context)
        {
            var objects = context.SelectedObjects.ToList();

            if (objects.Count != 1)
            {
                return;
            }

            var menu = builder.ItemNames.ToList();

            if (!menu.Contains("miCreate"))
            {
                return;
            }

            var subMenu = builder.GetItem("miCreate");
            var index   = subMenu.Count;

            var smartFolderIndex = subMenu.ItemNames.ToList().IndexOf("miCreateSmartfoldertype");

            if (smartFolderIndex != -1)
            {
                index = smartFolderIndex - 1;
            }

            var selected = objects.First();

            if (selected.Type.IsProject)
            {
                subMenu.AddItem(Const.COMMAND_UPDATE_NAME, index)
                .WithHeader(Const.COMMAND_UPDATE_TITLE)
                .WithIcon(IconLoader.GetIcon(_projectCloneCreator.Icon));
            }
            else
            {
                subMenu.AddItem(Const.COMMAND_NAME, index)
                .WithHeader(Const.COMMAND_TITLE)
                .WithIcon(IconLoader.GetIcon(_projectCloneCreator.Icon));
            }
        }
Beispiel #4
0
        public ShopPanel(Hero hero, ScreenForm form, Rectangle borders)
        {
            GetOptionsWidth  = () => Width * 2 / 10;
            GetChoosingWidth = () => Width * 3 / 10;
            GetInfoWidth     = () => Width * 5 / 10;

            Items = new List <Item>();

            Customer   = hero;
            Shop       = hero.S;
            ChosenItem = Shop.Items[0];
            Bounds     = borders;

            OptionsPanel = new TableLayoutPanel()
            {
                Location  = new Point(0, 0),
                BackColor = Color.Black,
            };
            OptionsPanel.Size        = new Size(GetOptionsWidth(), Height);
            OptionsPanel.RowCount    = 8;
            OptionsPanel.ColumnCount = 2;

            for (int t = 0; t <= 3; ++t)
            {
                var tier = t;
                var b    = new Button()
                {
                    Size      = new Size(GetOptionsWidth() / OptionsPanel.ColumnCount, Height / OptionsPanel.RowCount),
                    Margin    = new Padding(0),
                    Padding   = new Padding(0),
                    Text      = "T" + (tier).ToString(),
                    Font      = new Font(FontFamily.GenericSansSerif, 36),
                    ForeColor = Colors.ItemTierColors[tier]
                };
                b.Click += (sender, args) =>
                {
                    Items = Shop.GetItemsWithTier(tier);
                    UpdateItems();
                };
                OptionsPanel.Controls.Add(b);
            }

            for (var r = (int)StatType.MaxHP; r < (int)StatType.STOP; ++r)
            {
                var stat = r;
                var b    = new Button()
                {
                    Size    = new Size(GetOptionsWidth() / OptionsPanel.ColumnCount, Height / OptionsPanel.RowCount),
                    Margin  = new Padding(0),
                    Padding = new Padding(0),
                    //Text = "+" + ((StatType)stat).ToString(),
                    Image = IconLoader.GetIcon((StatType)r, new Size(64, 64)),
                };
                b.Click += (sender, args) =>
                {
                    Items = Shop.GetItemsWithSortedStat((StatType)stat);
                    UpdateItems();
                };
                OptionsPanel.Controls.Add(b);
            }

            ItemChoosingPanel = new FlowLayoutPanel()
            {
                Location      = new Point(GetOptionsWidth(), 0),
                FlowDirection = FlowDirection.LeftToRight,
                AutoScroll    = true,
            };
            ItemChoosingPanel.Size = new Size(GetChoosingWidth(), Height);

            InfoPanel = new FlowLayoutPanel()
            {
                Location  = new Point(GetOptionsWidth() + GetChoosingWidth(), 0),
                BackColor = Color.Black
            };
            InfoPanel.Size = new Size(GetInfoWidth(), Height - 128);

            BuyButton = new Button()
            {
                Font = new Font(FontFamily.GenericSansSerif, 32),
            };
            BuyButton.Size     = new Size(GetInfoWidth(), 128);
            BuyButton.Location = new Point(GetOptionsWidth() + GetChoosingWidth(), Height - 128);
            BuyButton.Click   += (sender, args) =>
            {
                Customer.BuyItem(ChosenItem);
                form.StatPanelUpdate();
                form.PlayerPanelUpdate();
            };

            ExplanationPanel             = new FlowLayoutPanel();
            ExplanationPanel.BackColor   = Color.Black;
            ExplanationPanel.MinimumSize = new Size(GetInfoWidth(), 36);
            ExplanationPanel.AutoSize    = true;

            RecipePanel = new TableLayoutPanel()
            {
                RowStyles = { new RowStyle(SizeType.AutoSize) }
            };
            RecipePanel.Size = new Size(GetInfoWidth() / 2, 64);

            UpgradePanel = new TableLayoutPanel()
            {
                RowStyles = { new RowStyle(SizeType.AutoSize) }
            };
            UpgradePanel.Size = new Size(GetInfoWidth() / 2, 64);

            Controls.Add(OptionsPanel);
            Controls.Add(ItemChoosingPanel);
            Controls.Add(InfoPanel);
            Controls.Add(BuyButton);

            UpdateInfo();

            /*
             * SizeChanged += (sender, args) =>
             * {
             *  RecipePanel.Size = new Size(Width * 3 / 10, 64);
             *  ExplanationPanel.Size = new Size(Width * 3 / 10, 36);
             *  ItemChoosingPanel.Size = new Size(Width * 7 / 10, Height);
             *  BuyButton.Size = new Size(Width * 3 / 10, 128);
             *  UpdateInfo();
             * };
             */
        }