Exemplo n.º 1
0
        public int AddAssetBundleName(string name, string[] depends, out AssetDataGroup group)
        {
            group = null;

            if (string.IsNullOrEmpty(name))
            {
                return(-1);
            }

            var key = GetKeyFromABName(name);

            if (key == null)
            {
                return(-1);
            }

            group = GetAssetDataGroup(key);

            if (group == null)
            {
                group = new AssetDataGroup(key);
                Log.I("#Create Config Group:" + key);
                m_AllAssetDataGroup.Add(group);
            }

            return(group.AddAssetBundleName(name, depends));
        }
        private static void ProcessAssetBundleRes(ResDatas table)
        {
            AssetDataGroup group = null;


            AssetDatabase.RemoveUnusedAssetBundleNames();

            string[] abNames = AssetDatabase.GetAllAssetBundleNames();
            if (abNames != null && abNames.Length > 0)
            {
                foreach (var abName in abNames)
                {
                    var depends = AssetDatabase.GetAssetBundleDependencies(abName, false);
                    var abIndex = table.AddAssetBundleName(abName, depends, out @group);
                    if (abIndex < 0)
                    {
                        continue;
                    }

                    var assets = AssetDatabase.GetAssetPathsFromAssetBundle(abName);
                    foreach (var cell in assets)
                    {
                        @group.AddAssetData(cell.EndsWith(".unity")
                            ? new AssetData(AssetPath2Name(cell), ResType.ABScene, abIndex, abName)
                            : new AssetData(AssetPath2Name(cell), ResType.ABAsset, abIndex, abName));
                    }
                }
            }
        }
Exemplo n.º 3
0
        private static void ProcessAssetBundleRes(AssetDataTable table)
        {
            AssetDataGroup group = null;

            AssetDatabase.RemoveUnusedAssetBundleNames();

            string[] abNames = AssetDatabase.GetAllAssetBundleNames();
            if (abNames != null && abNames.Length > 0)
            {
                for (int i = 0; i < abNames.Length; ++i)
                {
                    string[] depends = AssetDatabase.GetAssetBundleDependencies(abNames[i], false);
                    var      abIndex = table.AddAssetBundleName(abNames[i], depends, out group);
                    if (abIndex < 0)
                    {
                        continue;
                    }

                    string[] assets = AssetDatabase.GetAssetPathsFromAssetBundle(abNames[i]);
                    foreach (var cell in assets)
                    {
                        if (cell.EndsWith(".unity"))
                        {
                            group.AddAssetData(new AssetData(AssetPath2Name(cell), ResType.ABScene, abIndex, abNames[i]));
                        }
                        else
                        {
                            group.AddAssetData(new AssetData(AssetPath2Name(cell), ResType.ABAsset, abIndex, abNames[i]));
                        }
                    }
                }
            }

            table.Dump();
        }
Exemplo n.º 4
0
        public void SwitchLanguage(string key)
        {
            m_ActiveAssetDataGroup.Clear();

            string languageKey = string.Format("[{0}]", key);

            for (int i = m_AllAssetDataGroup.Count - 1; i >= 0; --i)
            {
                AssetDataGroup group = m_AllAssetDataGroup[i];

                if (!group.key.Contains("i18res"))
                {
                    m_ActiveAssetDataGroup.Add(group);
                }
                else if (group.key.Contains(languageKey))
                {
                    m_ActiveAssetDataGroup.Add(group);
                }
            }
            Log.I("AssetDataTable Switch 2 Language:" + key);
        }