Exemplo n.º 1
0
 internal void UpdateGroup(ABGroup group)
 {
     if (group != null)
     {
         _currentGroup = group;
         _assetTreeView.SetFocusAndEnsureSelectedItem();
         _assetTreeView.UpdateGroup(group);
         _currentAsset = null;
     }
 }
Exemplo n.º 2
0
 internal ABAsset CreateAndAddToCollection(UnityEngine.Object assetObject, ABGroup group)
 {
     if (IsCreateAndAddToCollectionValid(assetObject, group))
     {
         ABAsset asset = new ABAsset(assetObject);
         group.Items.Add(asset);
         SaveGroup(group);
         return(asset);
     }
     throw new Exception("Ассет не создался из-за ошибок");
 }
Exemplo n.º 3
0
 public bool IsOpen(ABAsset asset)
 {
     foreach (var baseView in _ListOpenView)
     {
         if (baseView.DataStruct.asset == asset)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 从缓存获取面板
        /// </summary>
        /// <returns></returns>
        BaseView GetBaseViewFromCache(ABAsset asset)
        {
            BaseView baseView = null;

            _DicNormalViews.TryGetValue(asset.ToString(), out baseView);
            if (baseView != null)
            {
                return(baseView);
            }
            _DicFixedViews.TryGetValue(asset.ToString(), out baseView);
            if (baseView != null)
            {
                return(baseView);
            }
            return(baseView);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 只提供给BaseView调用,释放面板,只适用于normal和fixed
        /// </summary>
        public void DisposeView(ABAsset abAsset)
        {
            if (_DicNormalViews.ContainsKey(abAsset.ToString()))
            {
                Destroy(_DicNormalViews[abAsset.ToString()].gameObject);
                _DicNormalViews.Remove(abAsset.ToString());
                AssetBundleMgr.Instance.DisposeAssetBundle(abAsset.ABPath);     // 卸载AB包内存镜像
            }

            if (_DicFixedViews.ContainsKey(abAsset.ToString()))
            {
                Destroy(_DicFixedViews[abAsset.ToString()].gameObject);
                _DicFixedViews.Remove(abAsset.ToString());
                AssetBundleMgr.Instance.DisposeAssetBundle(abAsset.ABPath);     // 卸载AB包内存镜像
            }
        }
Exemplo n.º 6
0
 internal void Delete(ABAsset asset, ABGroup group)
 {
     if (Settings == null)
     {
         throw new FileNotFoundException("Settings is not found", ABNames.FileSettings);
     }
     if (asset == null)
     {
         throw new ArgumentNullException("SimpleAsset", "SimpleAsset is null");
     }
     if (group == null)
     {
         throw new ArgumentNullException("GroupAssetBundlesParent", "GroupAssetBundlesParent is null");
     }
     group.Items.Remove(asset);
     SaveGroup(group);
 }
Exemplo n.º 7
0
        /// <summary>
        /// 把面板加到显示字典中
        /// </summary>
        /// <param name="asset"></param>
        /// <param name="view"></param>
        void AddViewToShowDic(ABAsset asset, BaseView view)
        {
            switch (view.uiType.uiViewType)
            {
            case UIViewType.Normal:
                if (!_DicShowNormalViews.ContainsKey(asset.ToString()))
                {
                    _DicShowNormalViews.Add(asset.ToString(), view);
                }
                break;

            case UIViewType.Fixed:
                if (!_DicShowFixedViews.ContainsKey(asset.ToString()))
                {
                    _DicShowFixedViews.Add(asset.ToString(), view);
                }
                break;
            }
        }
 public ABAssetTreeItem(ABAsset asset, int depth) : base(asset.Name.GetHashCode(), depth, asset.Name)
 {
     Asset = asset;
 }
Exemplo n.º 9
0
 private void OnSelectAsset(ABAsset asset)
 {
     _currentAsset = asset;
 }
Exemplo n.º 10
0
 /// <summary>
 /// 外部调用,跳转到其他面板并且关闭当前面板
 /// </summary>
 /// <param name="fromAsset">哪个面板资源调用的</param>
 /// <param name="asset">ab资源</param>
 /// <param name="data">数据</param>
 public void Jump(ABAsset fromAsset, ABAsset asset, object data = null)
 {
     Close(fromAsset.ToString());
     Open(asset, data);
 }
Exemplo n.º 11
0
 public void Open(ABAsset asset, object data = null)
 {
     Open(asset.ABPath, asset.AssetName, data);
 }
Exemplo n.º 12
0
        /// <summary>
        /// 面板是否显示出来
        /// </summary>
        /// <param name="abName"></param>
        /// <param name="assetName"></param>
        /// <returns></returns>
        public bool IsDisplay(string abName, string assetName)
        {
            ABAsset asset = new ABAsset(abName, assetName);

            return(IsDisplay(asset));
        }
Exemplo n.º 13
0
 /// <summary>
 /// 面板是否显示出来
 /// </summary>
 /// <param name="abName"></param>
 /// <param name="assetName"></param>
 /// <returns></returns>
 public bool IsDisplay(ABAsset asset)
 {
     return(_DicShowFixedViews.ContainsKey(asset.ToString()) || _DicShowNormalViews.ContainsKey(asset.ToString()));
 }
Exemplo n.º 14
0
 public void Close(ABAsset asset)
 {
     Close(asset.ToString());
 }