Exemplo n.º 1
0
    /// <summary>
    /// 引用计数为 0 时,将数据移除
    /// </summary>
    /// <param name="assetBundleName"></param>
    public void FreeAssetBundle(string assetBundleName)
    {
        Element <AssetBundleData> assetBundleData = null;

        AssetBundleDataCache.TryGetValue(assetBundleName, out assetBundleData);
        if (assetBundleData != null)
        {
            m_assertBundlePool.Push(assetBundleData);
            AssetBundleDataCacheRemvoe(assetBundleName);
        }
    }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        public static void ShowImage(Texture texture, int width, int height)
        {
            var data = DataHolder.GUIReferences;

            var imageObject = NGUITools.AddChild(data.TextTable.gameObject, data.Image.gameObject);
            var image       = imageObject.GetComponent <ImageEntry>();

            image.Image.mainTexture = texture;
            image.Image.aspectRatio = width / (float)height;
            image.Image.width       = width;
            image.Image.height      = height;

            imageObject.transform.SetAsFirstSibling();
            imageObject.SetActive(true);

            var entry = new TerminalEntry();

            entry.EntryType   = TerminalEntryType.Image;
            entry.SceneObject = imageObject;

            SList.Push(DataHolder.TerminalData.AllEntries, entry);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Shows a dual text at the bottom of the terminal.
        /// </summary>
        public static void ShowDualText(GUIReferences data, string leftText, string rightText)
        {
            var dualTextObject = NGUITools.AddChild(data.TextTable.gameObject, data.DualText.gameObject);
            var dualText       = dualTextObject.GetComponent <DualTextEntry>();

            dualText.LeftTextComponent.text  = leftText;
            dualText.RightTextComponent.text = rightText;
            dualText.transform.SetAsFirstSibling();

            var widget = dualText.ParentWidget;

            widget.leftAnchor.target  = data.ScrollView.transform;
            widget.rightAnchor.target = data.ScrollView.transform;

            dualTextObject.SetActive(true);

            var textEntry = new TerminalEntry();

            textEntry.EntryType   = TerminalEntryType.SingleText;
            textEntry.SceneObject = dualTextObject;

            SList.Push(DataHolder.TerminalData.AllEntries, textEntry);
        }