public void SetData(EntityVo vo) { _entity = vo; _isPlaying = true; _lastLineCount = 0; if (_contentTxt != null) { _contentTxt.text = ""; } }
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(); } }
public void AddDialog(object obj, string heroName) { if (stringBuilder == null) { stringBuilder = new StringBuilder(); } Type type = obj.GetType(); if (type == typeof(EntityVo)) { EntityVo entity = (EntityVo)obj; if (entity.id == "0") { stringBuilder.Append("【旁白】"); } else { stringBuilder.Append("【") .Append(heroName) .Append("】"); } stringBuilder.Append(entity.dialog) .Append("\n\n"); } else if (type == typeof(TelephoneDialogVo)) { TelephoneDialogVo telDialogVo = (TelephoneDialogVo)obj; stringBuilder.Append("【") .Append(heroName) .Append("】"); stringBuilder.Append(telDialogVo.Content) .Append("\n\n"); } else if (type == typeof(SmsDialogVo)) { SmsDialogVo smsDialogVo = (SmsDialogVo)obj; stringBuilder.Append("【") .Append(heroName) .Append("】"); stringBuilder.Append(smsDialogVo.ContextText) .Append("\n\n"); } }
public virtual EntityVo Clone() { EntityVo vo = new EntityVo(); vo.index = index; vo.dialog = dialog; vo.height = height; vo.id = id; vo.headId = headId; vo.roleName = roleName; vo.type = type; vo.width = width; vo.x = x; vo.y = y; vo.color = color; vo.lipSpync = lipSpync; vo.shakeDialog = shakeDialog; vo.SelectionIds = SelectionIds; vo.SelectionContents = SelectionContents; if (playableList != null) { List <SpinePlayableVo> list = new List <SpinePlayableVo>(); for (int i = 0; i < playableList.Count; i++) { list.Add(playableList[i].Clone()); } vo.playableList = list; } if (l2dPlayableList != null) { List <Live2dPlayableVo> list = new List <Live2dPlayableVo>(); for (int i = 0; i < l2dPlayableList.Count; i++) { list.Add(l2dPlayableList[i].Clone()); } vo.l2dPlayableList = l2dPlayableList; } vo.L2dScaleDataList = L2dScaleDataList; return(vo); }