Exemple #1
0
 void DrawMouseOverItem(WorkshopItem mouseOverItem, W_KIS_Item mouseOverItemKIS)
 {
     // Tooltip
     adjustedProductivity = WorkshopUtils.GetProductivityBonus(part, ExperienceEffect, SpecialistEfficiencyFactor, ProductivityFactor, WorkshopUtils.ProductivityType.recycler);
     if (mouseOverItem != null)
     {
         var blueprint = WorkshopRecipeDatabase.ProcessPart(mouseOverItem.Part);
         foreach (var resource in blueprint)
         {
             resource.Units *= ConversionRate;
         }
         GUI.Box(new Rect(200, 80, 100, 100), mouseOverItem.Icon.texture);
         GUI.Box(new Rect(310, 80, 150, 100), WorkshopUtils.GetKisStats(mouseOverItem.Part), UI.UIStyles.StatsStyle);
         GUI.Box(new Rect(470, 80, 150, 100), blueprint.Print(WorkshopUtils.ProductivityType.recycler, adjustedProductivity), UI.UIStyles.StatsStyle);
         GUI.Box(new Rect(200, 190, 420, 25), mouseOverItem.Part.title, UI.UIStyles.TitleDescriptionStyle);
         GUI.Box(new Rect(200, 220, 420, 110), mouseOverItem.Part.description, UI.UIStyles.TooltipDescriptionStyle);
     }
     else if (mouseOverItemKIS != null)
     {
         var blueprint = WorkshopRecipeDatabase.ProcessPart(mouseOverItemKIS.availablePart);
         foreach (var resource in blueprint)
         {
             resource.Units *= ConversionRate;
         }
         GUI.Box(new Rect(200, 80, 100, 100), mouseOverItemKIS.Icon.texture);
         GUI.Box(new Rect(310, 80, 150, 100), WorkshopUtils.GetKisStats(mouseOverItemKIS.availablePart), UI.UIStyles.StatsStyle);
         GUI.Box(new Rect(470, 80, 150, 100), blueprint.Print(WorkshopUtils.ProductivityType.recycler, adjustedProductivity), UI.UIStyles.StatsStyle);
         GUI.Box(new Rect(200, 190, 420, 25), mouseOverItemKIS.availablePart.title, UI.UIStyles.TitleDescriptionStyle);
         GUI.Box(new Rect(200, 220, 420, 110), mouseOverItemKIS.availablePart.description, UI.UIStyles.TooltipDescriptionStyle);
     }
 }
Exemple #2
0
        W_KIS_Item DrawInventoryItems(W_KIS_Item mouseOverItem)
        {
            // AvailableItems
            const int ItemRows       = 10;
            const int ItemColumns    = 3;
            var       availableItems = KISWrapper.GetInventories(vessel).SelectMany(i => i.items).ToArray();
            var       maxPage        = availableItems.Length / 30;

            for (var y = 0; y < ItemRows; y++)
            {
                for (var x = 0; x < ItemColumns; x++)
                {
                    var left      = 15 + x * 55;
                    var top       = 70 + y * 55;
                    var itemIndex = y * ItemColumns + x;
                    if (availableItems.Length > itemIndex)
                    {
                        var item = availableItems[itemIndex];
                        var icon = item.Value.Icon;
                        if (icon == null)
                        {
                            item.Value.EnableIcon(64);
                            icon = item.Value.Icon;
                        }

                        if (GUI.Button(new Rect(left, top, 50, 50), icon.texture))
                        {
                            _queue.Add(new WorkshopItem(item.Value.availablePart));
                            item.Value.StackRemove(1);
                        }

                        if (item.Value.stackable)
                        {
                            GUI.Label(new Rect(left, top, 50, 50), item.Value.quantity.ToString("x#"), UI.UIStyles.lowerRightStyle);
                        }
                        if (Event.current.type == EventType.Repaint && new Rect(left, top, 50, 50).Contains(Event.current.mousePosition))
                        {
                            mouseOverItem = item.Value;
                        }
                    }
                }
            }

            if (_activePage > 0)
            {
                if (GUI.Button(new Rect(15, 645, 75, 25), "Prev"))
                {
                    _selectedPage = _activePage - 1;
                }
            }

            if (_activePage < maxPage)
            {
                if (GUI.Button(new Rect(100, 645, 75, 25), "Next"))
                {
                    _selectedPage = _activePage + 1;
                }
            }
            return(mouseOverItem);
        }
Exemple #3
0
        private void DrawWindowContents(int windowId)
        {
            WorkshopItem mouseOverItem    = null;
            W_KIS_Item   mouseOverItemKIS = null;

            mouseOverItemKIS = DrawInventoryItems(mouseOverItemKIS);
            mouseOverItem    = DrawQueue(mouseOverItem);
            DrawMouseOverItem(mouseOverItem, mouseOverItemKIS);
            DrawRecyclingProgress();

            if (GUI.Button(new Rect(_windowPos.width - 25, 5, 20, 20), "X"))
            {
                ContextMenuOpenRecycler();
            }

            GUI.DragWindow();
        }