Exemplo n.º 1
0
            public IRes CreateRes(string name)
            {
                AssetData data = AssetDataTable.S.GetAssetData(name);

                switch (data.assetType)
                {
                case eResType.kAssetBundle:
                    return(AssetBundleRes.Allocate(name));

                case eResType.kABAsset:
                    return(AssetRes.Allocate(name));

                case eResType.kABScene:
                    return(SceneRes.Allocate(name));

                default:
                    return(null);
                }
            }
Exemplo n.º 2
0
        private string GetSceneAssetBundleName(string sceneName)
        {
            AssetData config = AssetDataTable.S.GetAssetData(sceneName);

            if (config == null)
            {
                Log.e("Not Find AssetData For Asset:" + sceneName);
                return(string.Empty);
            }

            string assetBundleName = AssetDataTable.S.GetAssetBundleName(config.assetName, config.assetBundleIndex);

            if (string.IsNullOrEmpty(assetBundleName))
            {
                Log.e("Not Find AssetBundle In Config:" + config.assetBundleIndex);
                return(string.Empty);
            }

            return(assetBundleName);
        }
Exemplo n.º 3
0
        protected void InitAssetBundleName()
        {
            m_AssetBundleArray = null;

            AssetData config = AssetDataTable.S.GetAssetData(m_Name);

            if (config == null)
            {
                Log.e("Not Find AssetData For Asset:" + m_Name);
                return;
            }

            string assetBundleName = AssetDataTable.S.GetAssetBundleName(config.assetName, config.assetBundleIndex);

            if (string.IsNullOrEmpty(assetBundleName))
            {
                Log.e("Not Find AssetBundle In Config:" + config.assetBundleIndex);
                return;
            }
            m_AssetBundleArray    = new string[1];
            m_AssetBundleArray[0] = assetBundleName;
        }
Exemplo n.º 4
0
        private void SetSerizlizeData(SerializeData data)
        {
            if (data == null)
            {
                return;
            }

            m_Key         = data.key;
            m_BuildTime   = data.buildTime;
            m_ABUnitArray = new List <ABUnit>(data.abUnitArray);

            if (data.assetDataArray != null)
            {
                m_AssetDataMap = new Dictionary <string, AssetData>();

                for (int i = 0; i < data.assetDataArray.Length; ++i)
                {
                    AssetData config = data.assetDataArray[i];
                    AddAssetData(config);
                }
            }
        }
Exemplo n.º 5
0
        public SerializeData GetSerializeData()
        {
            SerializeData sd = new SerializeData();

            sd.key         = m_Key;
            sd.buildTime   = m_BuildTime;
            sd.abUnitArray = m_ABUnitArray.ToArray();
            if (m_AssetDataMap != null)
            {
                AssetData[] acArray = new AssetData[m_AssetDataMap.Count];

                int index = 0;
                foreach (var item in m_AssetDataMap)
                {
                    acArray[index++] = item.Value;
                }

                sd.assetDataArray = acArray;
            }

            return(sd);
        }
Exemplo n.º 6
0
        public bool AddAssetData(AssetData data)
        {
            if (m_AssetDataMap == null)
            {
                m_AssetDataMap = new Dictionary <string, AssetData>();
            }

            string key = data.assetName.ToLower();

            if (key.EndsWith(" "))
            {
                Log.e("Asset Name Is InValid:" + key);
            }

            if (m_AssetDataMap.ContainsKey(key))
            {
                AssetData old = GetAssetData(data.assetName);

                string msg = string.Format("Already Add AssetData :{0} \n OldAB:{1}      NewAB:{2}", data.assetName, m_ABUnitArray[old.assetBundleIndex].abName, m_ABUnitArray[data.assetBundleIndex].abName);

                if (data.assetName.EndsWith("spritesdata"))
                {
                    Log.w(msg);
                }
                else if (m_ABUnitArray[old.assetBundleIndex].abName.Contains("anim"))
                {
                    Log.w(msg);
                }
                else
                {
                    Log.e(msg);
                }
                return(false);
            }

            m_AssetDataMap.Add(key, data);
            return(true);
        }
Exemplo n.º 7
0
            public bool CheckResType(string name)
            {
                AssetData data = AssetDataTable.S.GetAssetData(name);

                return(data != null);
            }