Exemple #1
0
        /// <summary>
        /// Displays the asset list with Toggles and File icons.
        /// </summary>
        private void DisplayAssets()
        {
            if (_path_holder == null)
            {
                RefreshContent();
            }

            List <AssetInfo> assets = _path_holder.GetAssetInfos();

            using (var scrollViewScope = new GUILayout.ScrollViewScope(_scroll_position, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
            {
                _scroll_position = scrollViewScope.scrollPosition;
                GUILayout.BeginVertical();
                foreach (AssetInfo ai in assets)
                {
                    // Display only level 0 assets (DisplayAssetGroup will be in charge of displaying childs).
                    if (ai.depth_level == 0)
                    {
                        // Display specific asset and all its content.
                        DisplayAssetGroup(ai);
                    }
                }
                GUILayout.EndVertical();
            }
        }
        /// <summary>
        /// Displays the asset list with Toggles and File icons.
        /// When entering, exits immediately if it's a Layout or Used event.
        /// </summary>
        private void DisplayAssets()
        {
            if (Event.current.type == EventType.Layout || Event.current.type == EventType.Used)
            {
                return;
            }

            if (_path_holder == null)
            {
                RefreshContent();
            }

            List <AssetInfo> assets = _path_holder.GetAssetInfos();

            _scrollRect.width = _assetsViewArea.width - 16; // This practically disables horizontal scrolling, which is intended behaviour
            using (var scrollViewScope = new GUI.ScrollViewScope(_assetsViewArea, _scroll_position, _scrollRect))
            {
                _scroll_position = scrollViewScope.scrollPosition;
                float currY      = 0;
                float viewHeight = 0;
                foreach (AssetInfo ai in assets)
                {
                    // Display only level 0 assets (DisplayAssetGroup will be in charge of displaying childs).
                    if (ai.depth_level == 0)
                    {
                        // Display specific asset and all its content.
                        DisplayAssetGroup(ai, ref currY, ref viewHeight);
                    }
                }
                _scrollRect.height = viewHeight;
            }
        }
 public void SavePackageConfiguration(AssetInfoHolder asset_holder)
 {
     if (asset_holder != null)
     {
         List <AssetInfo> asset_list = asset_holder.GetAssetInfos();
         if (asset_list != null)
         {
             asset_path_list = new List <string>();
             foreach (AssetInfo asset in asset_list)
             {
                 if (asset.is_directory == false && asset.is_selected == true)
                 {
                     asset_path_list.Add(asset.path);
                 }
             }
         }
     }
 }