예제 #1
0
        private void CharacterChoice_Change(object sender, System.EventArgs e)
        {
            SetupInventoryColumns();
            if (!CharacterChoice.Current.Equals(0))
            {
                using (HudStaticText selectedCharacter = (HudStaticText)CharacterChoice[CharacterChoice.Current])
                {
                    CharacterInventory inventory = GetInventory(selectedCharacter.Text);
                    if (inventory != null)
                    {
                        foreach (AcmComponent component in inventory.Components)
                        {
                            HudList.HudListRowAccessor row = InventoryList.AddRow();
                            using (HudStaticText name = new HudStaticText())
                            {
                                name.Text = component.Name;
                                row[0]    = name;
                            }

                            using (HudStaticText quantity = new HudStaticText())
                            {
                                quantity.Text = component.Quantity.ToString();
                                row[1]        = quantity;
                            }
                        }

                        foreach (Gem gem in inventory.Gems)
                        {
                            HudList.HudListRowAccessor row = InventoryList.AddRow();
                            using (HudStaticText name = new HudStaticText())
                            {
                                name.Text = gem.Name;
                                row[0]    = name;
                            }

                            using (HudStaticText quantity = new HudStaticText())
                            {
                                quantity.Text = gem.Quantity.ToString();
                                row[1]        = quantity;
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        private void SetupInventoryColumns()
        {
            try
            {
                InventoryList.ClearRows();
                HudList.HudListRowAccessor row = InventoryList.AddRow();
                using (HudStaticText text = new HudStaticText())
                {
                    text.Text = "Item";
                    row[0]    = text;
                }

                using (HudStaticText text = new HudStaticText())
                {
                    text.Text = "Quantity";
                    row[1]    = text;
                }
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }