コード例 #1
0
ファイル: AssetBundleManager.cs プロジェクト: Hengle/GameDemo
    public AssetBundleData AddAssetBundle(string assetBundleName)
    {
        Element <AssetBundleData> f_assetBundleData = m_assertBundlePool.Pop();

        f_assetBundleData.baseElement.Init();
        f_assetBundleData.baseElement.m_AssetBundleName = assetBundleName;
        f_assetBundleData.baseElement.Retain();
        assetBundleDataCache[assetBundleName] = f_assetBundleData;
        return(f_assetBundleData.baseElement);
    }
コード例 #2
0
        /// <summary>
        /// Calculates and return the full path of the dir.
        /// </summary>
        public static string GetDirFullPath(HashDir hashDir)
        {
            var    dir = hashDir;
            string path;

            // Root folder is treated differently
            if (dir.ParentDirId == -1)
            {
                DebugUtil.Assert(dir.Name != PathUtil.PathSeparator, string.Format("THE DIR {0} HAS NO PARENT AND IT'S THE ROOT DIR!", dir.DirId));
                path = dir.Name;
            }
            else
            {
#if DEB
                if (dir.ParentDirId == dir.DirId)
                {
                    DebugUtil.Log(string.Format("THE DIR {0} HAS ITSELF AS PARENT!", dir.DirId), Color.red, DebugUtil.DebugCondition.Always,
                                  DebugUtil.LogType.Info);
                    return(null);
                }
#endif
                var pathStack = SList.Create <string>(5);
                SList.Clear(pathStack);
                while (dir.ParentDirId != -1)
                {
                    SList.Push(pathStack, dir.Name);
                    dir = FindDirById(dir.ParentDirId);
                }

                var builder = new StringBuilder(pathStack.Count * 10);
                while (pathStack.Count > 0)
                {
                    var last = SList.Pop(pathStack);
                    builder.Append(PathUtil.AddSeparatorToStart(last));
                }
                path = builder.ToString();

                // since it's a folder, add slash to the end of it
                path = PathUtil.AddSeparatorToEnd(path);
            }

            return(path);
        }
コード例 #3
0
        public static void RemoveTextEntries(int quantity, TerminalEntryRemoveType removeType)
        {
            var allEntries = DataHolder.TerminalData.AllEntries;

            quantity = Math.Min(quantity, allEntries.Count);

            if (quantity == 0)
            {
                return;
            }

            switch (removeType)
            {
            case TerminalEntryRemoveType.OlderEntries:
                for (int i = 0; i < quantity; i++)
                {
                    var item = SList.Dequeue(allEntries);
                    GameObject.Destroy(item.SceneObject);
                }
                break;

            case TerminalEntryRemoveType.NewerEntries:
                for (int i = 0; i < quantity; i++)
                {
                    var item = SList.Pop(allEntries);
                    GameObject.Destroy(item.SceneObject);
                }
                break;

            default:
                DebugUtil.Error(string.Format("TERMINAL ENTRY REMOVE TYPE '{0}' NOT IMPLEMENTED!", removeType));
                break;
            }

            UpdateTableAndScroll();
        }