示例#1
0
 public static void CreatePrefabAsync(AssetUri Uri, LiteAction <GameObject> Callback = null)
 {
     Loader_.CreatePrefabAsync(Uri, Callback);
 }
示例#2
0
 public static void CreateDataAsync(AssetUri Uri, LiteAction <byte[]> Callback = null)
 {
     Loader_.CreateDataAsync(Uri, Callback);
 }
示例#3
0
 public static void PreloadedAsset <T>(string AssetPath, LiteAction <bool> Callback) where T : UnityEngine.Object
 {
     Loader_.PreloadedAsset <T>(AssetPath, Callback);
 }
示例#4
0
 public static void CreateAssetAsync <T>(AssetUri Uri, LiteAction <T> Callback = null) where T : UnityEngine.Object
 {
     Loader_.CreateAssetAsync <T>(Uri, Callback);
 }
示例#5
0
        public void PreloadedAsset <T>(string AssetPath, LiteAction <bool> Callback) where T : UnityEngine.Object
        {
            var AssetType = GetAssetTypeWithName <T>(AssetPath);

            LoadAssetAsync <T>(AssetType, AssetPath, Callback);
        }
示例#6
0
        public void Initialize(int TotalCount, int Index, LiteFunc <int, LiteLoopViewItem> CreateItem, LiteAction <LiteLoopViewItem> DeleteItem, LiteAction <int, LiteLoopViewItem> UpdateItem)
        {
            LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent <RectTransform>());
            ViewBounds_       = new Bounds(Viewport.rect.center, Viewport.rect.size);
            ViewItemCount_    = InternalCalculateViewItemCount();
            Content.sizeDelta = InternalCalculateContentSize();
            ContentBounds_    = GetBounds();

            if (ViewItemCount_ > TotalCount)
            {
                ViewItemCount_ = TotalCount;
            }

            this.TotalCount        = TotalCount;
            this.Content.sizeDelta = InternalCalculateContentSize();
            this.CurrentIndex_     = Mathf.Clamp(Index, 0, TotalCount - ViewItemCount_);
            this.PreviousIndex_    = this.CurrentIndex_;
            this.OnCreateItem_     = CreateItem;
            this.OnDeleteItem_     = DeleteItem;
            this.OnUpdateItem_     = UpdateItem;
            this.Dragging_         = false;
            this.PrevPosition_     = Vector2.zero;
            this.Velocity_         = Vector2.zero;
            this.IsInit_           = true;
            FillItemList();
        }
示例#7
0
        protected virtual void LoadAssetAsync <T>(AssetCacheType AssetType, string AssetPath, LiteAction <bool> Callback = null) where T : UnityEngine.Object
        {
            AssetPath = AssetPath.ToLower();
            if (AssetCacheExisted(AssetPath))
            {
                Callback?.Invoke(true);
                return;
            }

            if (!AssetLoadCallbackList_.ContainsKey(AssetPath))
            {
                AssetLoadCallbackList_.Add(AssetPath, new List <LiteAction <bool> > {
                    Callback
                });

                LoadAssetCacheCompletedAsync <T>(AssetType, AssetPath, (IsLoaded) =>
                {
                    foreach (var LoadCallback in AssetLoadCallbackList_[AssetPath])
                    {
                        LoadCallback?.Invoke(IsLoaded);
                    }

                    AssetLoadCallbackList_.Remove(AssetPath);
                });
            }
            else
            {
                AssetLoadCallbackList_[AssetPath].Add(Callback);
            }
        }
示例#8
0
 public static void RemoveEvent(GameEntity Entity, LiteAction <EventSystemData> Callback, EventSystemType Type = EventSystemType.Click)
 {
     EventHelper.RemoveEvent(Entity, Callback, Type);
 }
示例#9
0
 public void AddCallback(LiteAction <EventSystemData> Callback)
 {
     EventCallback_ += Callback;
 }
示例#10
0
 public static void RemoveCallback(Transform Master, EventSystemType Type, LiteAction <EventSystemData> Callback)
 {
     GetOrCreateHandler(Master.gameObject, Type).RemoveCallback(Callback);
 }
示例#11
0
 public void Dispose()
 {
     EventCallback_   = null;
     EventCallbackEx_ = null;
 }
示例#12
0
 public static void RemoveEventFromChild(GameEntity Entity, string ChildPath, LiteAction <EventSystemData> Callback, EventSystemType Type = EventSystemType.Click)
 {
     EventHelper.RemoveEventFromChild(Entity, ChildPath, Callback, Type);
 }
示例#13
0
 public static void RemoveEventFromChild(Transform Parent, string ChildPath, LiteAction <EventSystemData> Callback, EventSystemType Type = EventSystemType.Click)
 {
     EventHelper.RemoveEventFromChild(Parent, ChildPath, Callback, Type);
 }
示例#14
0
 public abstract void Play(string AnimationName, bool IsLoop = false, LiteAction Callback = null);
示例#15
0
        private void LoadAssetCacheCompletedAsync <T>(AssetCacheType AssetType, string AssetPath, LiteAction <bool> Callback = null) where T : UnityEngine.Object
        {
            var Cache = CreateAssetCache <T>(AssetType, AssetPath);

            if (Cache == null)
            {
                Callback?.Invoke(false);
                return;
            }

            AssetCacheList_.Add(AssetPath, Cache);
            LoadAssetCacheDependenciesAsync <UnityEngine.Object>(Cache, (IsLoaded) =>
            {
                if (!IsLoaded)
                {
                    Callback?.Invoke(false);
                    return;
                }

                TaskManager.AddTask(LoadAssetCacheAsync <T>(Cache), () => { Callback?.Invoke(true); });
            });
        }
示例#16
0
        protected override void LoadAssetAsync <T>(AssetCacheType AssetType, string AssetPath, LiteAction <bool> Callback = null)
        {
            AssetPath = AssetPath.ToLower();
            if (!AssetBundlePathList_.Contains(AssetPath))
            {
                Callback?.Invoke(false);
                return;
            }

            base.LoadAssetAsync <T>(AssetType, AssetPath, Callback);
        }
示例#17
0
 public static void RemoveEvent(Transform Obj, LiteAction <EventSystemData> Callback, EventSystemType Type = EventSystemType.Click)
 {
     EventHelper.RemoveEvent(Obj, Callback, Type);
 }