Ejemplo n.º 1
0
        private void PopulateAssetList(AssetType type = AssetType.Null, bool select = false, List <uint> selectionAssetIDs = null)
        {
            curType = type;
            listViewAssets.BeginUpdate();
            listViewAssets.Items.Clear();

            if (comboBoxLayers.SelectedItem != null)
            {
                List <uint>         assetIDs = archive.GetAssetIDsOnLayer(comboBoxLayers.SelectedIndex);
                List <ListViewItem> items    = new List <ListViewItem>();

                for (int i = 0; i < assetIDs.Count(); i++)
                {
                    Asset asset = archive.GetFromAssetID(assetIDs[i]);
                    if (type == AssetType.Null || asset.AHDR.assetType == type)
                    {
                        bool selected = (select == true) && selectionAssetIDs.Contains(asset.AHDR.assetID);
                        items.Add(new ListViewItem(asset.ToString())
                        {
                            Checked  = !asset.isInvisible,
                            Selected = selected
                        });
                    }
                }

                listViewAssets.Items.AddRange(items.ToArray());
            }

            listViewAssets.EndUpdate();

            if (select)
            {
                int ensureVisible = -1;

                for (int i = 0; i < listViewAssets.Items.Count; i++)
                {
                    if (listViewAssets.Items[i].Selected)
                    {
                        ensureVisible = i;
                    }
                }

                if (ensureVisible != -1)
                {
                    listViewAssets.EnsureVisible(ensureVisible);
                }
            }

            toolStripStatusLabelSelectionCount.Text = $"{listViewAssets.SelectedItems.Count}/{listViewAssets.Items.Count} assets selected";
        }
Ejemplo n.º 2
0
        public InternalAssetEditor(Asset asset, ArchiveEditorFunctions archive)
        {
            InitializeComponent();
            TopMost = true;

            this.asset   = asset;
            this.archive = archive;

            propertyGridAsset.SelectedObject = asset;
            labelAssetName.Text = $"[{asset.AHDR.assetType.ToString()}] {asset.ToString()}";

            if (asset is AssetMVPT)
            {
                propertyGridAsset.HelpVisible = true;
            }
        }