Example #1
0
        public GameObject LoadDialogPrefab(string dialogId)
        {
            if (m_DialogPrefabs == null || m_DialogPrefabs.Count == 0)
            {
                return(null);
            }

            BlockObjectParam resParam = m_DialogPrefabs.Find(o => o.IndexName.Equals(dialogId));

            if (resParam == null)
            {
                return(null);
            }

            GameObject dialogPrefab = null;

            switch (m_LoadType)
            {
            case BlockResLoadType.Assetbundle:
                if (mABSyncLoad != null)
                {
                    dialogPrefab = mABSyncLoad(resParam.ResName) as GameObject;
                }
                break;

            case BlockResLoadType.Resources:
                dialogPrefab = Resources.Load <GameObject>(resParam.ResName);
                break;

            case BlockResLoadType.Serialized:
                dialogPrefab = resParam.Prefab;
                break;
            }
            return(dialogPrefab);
        }
Example #2
0
        public void AddBlockViewPrefab(GameObject blockPrefab)
        {
            if (m_BlockViewPrefabs == null)
            {
                m_BlockViewPrefabs = new List <BlockObjectParam>();
            }

            string prefabName = blockPrefab.name.Replace("(Clone)", "");
            string indexName  = prefabName.Substring("Block_".Length);

            if (m_BlockViewPrefabs.Exists(o => o.IndexName.Equals(indexName)))
            {
                return;
            }

            BlockObjectParam resParam = new BlockObjectParam();

            resParam.IndexName = indexName;
            resParam.ResName   = prefabName;
            if (m_LoadType == BlockResLoadType.Serialized)
            {
                resParam.Prefab = blockPrefab;
            }
            m_BlockViewPrefabs.Add(resParam);
        }
Example #3
0
        public void UnloadDialogPrefab(string dialogId)
        {
            if (m_DialogPrefabs == null || m_DialogPrefabs.Count == 0)
            {
                return;
            }

            BlockObjectParam resParam = m_DialogPrefabs.Find(o => o.IndexName.Equals(dialogId));

            if (resParam == null)
            {
                return;
            }

            if (m_LoadType == BlockResLoadType.Assetbundle && mABUnload != null)
            {
                mABUnload(resParam.ResName);
            }
        }