Esempio n. 1
0
        private void handleInspectBlockSelection(BlockType blockType)
        {
            placementType = PlacementType.BlockPlacement;
            placementMode = PlacementMode.Manage;
            manageObjectList.Clear();

            UIElement selectedItem = null;

            foreach (var item in BlockType.lookup)
            {
                var newItem = new BlockListItem(item.Value);

                if (item.Value == blockType)
                {
                    selectedItem = newItem;
                }

                manageObjectList.AddElement(newItem);
            }

            if (SimulationGame.KeyboardState.IsKeyDown(Keys.LeftControl) || SimulationGame.KeyboardState.IsKeyDown(Keys.RightControl))
            {
                manageObjectList.SelectElement(selectedItem);

                placeView.OnClick(placeObjectAtPosition);
            }
            else
            {
                manageObjectList.ScrollToElement(selectedItem);
            }
        }
Esempio n. 2
0
    public void Update_GUI()
    {
        list.Clear();
        Volyme_Text.text = string.Format("Volyme: {0}", !Inventory.Limited_Volyme ? "Unlimited" : string.Format("{0} / {1}", Helper.Float_To_String(Inventory.Current_Volyme, 1), Inventory.Max_Volyme));
        Weight_Text.text = string.Format("Weight: {0}", !Inventory.Limited_Weight ? "Unlimited" : string.Format("{0} / {1}", Helper.Float_To_String(Inventory.Current_Weight, 1), Inventory.Max_Weight));

        foreach (KeyValuePair <string, int> stacked_items in Inventory.Count_Dictionary_Internal_Names)
        {
            Item item = null;
            if (stacked_items.Value == 1)
            {
                item = Inventory.Get_Items(stacked_items.Key)[0];
            }
            else
            {
                item = ItemPrototypes.Instance.Get_Item_Prototype(stacked_items.Key);
            }
            list.Add_Row(item.Internal_Name,
                         new List <ScrollableList.TextData>()
            {
                new ScrollableList.TextData("CountText", string.Format("{0}x", stacked_items.Value), stacked_items.Value != 1),
                new ScrollableList.TextData("NameText", item.Name, true),
                new ScrollableList.TextData("DurabilityText", string.Format("{0}%", item.Unbreaking ? "inf" : Helper.Float_To_String(item.Relative_Durability * 100.0f, 0)), stacked_items.Value == 1)
            },
                         new List <ScrollableList.ImageData>()
            {
                new ScrollableList.ImageData("IconImage", item.UI_Sprite, item.UI_Sprite_Type, true)
            },
                         new List <ScrollableList.ButtonData>()
            {
                new ScrollableList.ButtonData("ExpandButton", ">", delegate() { Expand(item, stacked_items.Value); }, true, stacked_items.Value != 1),
                new ScrollableList.ButtonData("InvisibleButton", null, delegate() { Select_Item(item, stacked_items.Value != 1); }, true, true)
            });
        }
    }