예제 #1
0
        public void PreLoadAsset(int index, Action <int> onAssetLoaded)
        {
            if (index >= _dialogList.Count)
            {
                return;
            }

            _onAssetLoaded = onAssetLoaded;

            _currentIndex = index;

            _loadCount = 0;
            IsLoading  = true;

            Texture tex = null;

            DialogVo vo = _dialogList[index];

            if (_bgImageCache.ContainsKey(vo.BgImageId) == false)
            {
                tex = ResourceManager.Load <Texture>(AssetLoader.GetStoryBgImage(vo.BgImageId), ModuleConfig.MODULE_STORY);
                _bgImageCache[vo.BgImageId] = tex;
            }

            if (vo.EntityList.Count > 0)
            {
                for (int i = 0; i < vo.EntityList.Count; i++)
                {
                    EntityVo entity = vo.EntityList[i];
                    if (entity.type == EntityVo.EntityType.Role)
                    {
                        tex = ResourceManager.Load <Texture>(AssetLoader.GetStoryRoleImageById(entity.id), ModuleConfig.MODULE_STORY);
                        _roleImageCache[entity.id] = tex;
                    }
                    else if (entity.type == EntityVo.EntityType.DialogFrame)
                    {
                        if (!string.IsNullOrEmpty(entity.headId))
                        {
                            tex = ResourceManager.Load <Texture>(AssetLoader.GetHeadImageById(entity.headId), ModuleConfig.MODULE_STORY);
                            _headImageCache[entity.headId] = tex;
                        }
                    }
                }
            }

            if (_loadCount <= 0)
            {
                LoadComplete();
            }
        }
예제 #2
0
        public DialogVo Clone()
        {
            DialogVo vo = new DialogVo();

            vo.BgImageId        = BgImageId;
            vo.DialogId         = DialogId;
            vo.BgMusicId        = BgMusicId;
            vo.DubbingId        = DubbingId;
            vo.CutScenesType    = CutScenesType;
            vo.ScreenEffectType = ScreenEffectType;
            if (Event != null)
            {
                vo.Event = Event.Clone();
            }

            vo.EntityList = new List <EntityVo>();

            for (int i = 0; i < EntityList.Count; i++)
            {
                vo.EntityList.Add(EntityList[i].Clone());
            }

            return(vo);
        }