private List <StoryDlgItem> BuildStoryItems(string storyName) { string str = String.Format("StoryDlg/{0}", storyName.Trim()); TextAsset ta = (TextAsset)Resources.Load(str, typeof(TextAsset)); if (null != ta) { List <StoryDlgItem> itemList = new List <StoryDlgItem>(); string[] lines = null; lines = ta.text.Split('\n'); for (int i = 1; i < lines.Length; ++i) { string lineStr = lines[i]; if (lineStr.Trim() != String.Empty) { string[] data = lines[i].Split('\t'); StoryDlgItem item = new StoryDlgItem(); item.Number = Int32.Parse(data[0]); item.SpeakerName = data[1]; item.ImageLeft = data[2]; item.ImageLeftBig = string.Format("{0}_big", item.ImageLeft); item.ImageLeftSmall = string.Format("{0}_small", item.ImageLeft); item.ImageRight = data[3]; item.ImageRightBig = string.Format("{0}_big", item.ImageRight); item.ImageRightSmall = string.Format("{0}_small", item.ImageRight); item.Words = data[4]; itemList.Add(item); } else { break; } } return(itemList); } return(null); }
private List <StoryDlgItem> BuildStoryItems(string storyName) { DBC storyItems = new DBC(); string str = String.Format("{0}{1}.txt", FilePathDefine_Client.C_DialogPath, storyName.Trim()); if (storyItems.Load(HomePath.GetAbsolutePath(str))) { List <StoryDlgItem> itemList = new List <StoryDlgItem>(); for (int index = 0; index < storyItems.RowNum; index++) { DBC_Row node = storyItems.GetRowByIndex(index); if (null != node) { StoryDlgItem item = new StoryDlgItem(); item.Number = DBCUtil.ExtractNumeric <int>(node, "Number", 0, true); item.UnitId = DBCUtil.ExtractNumeric <int>(node, "UnitId", -1, false); item.IntervalTime = DBCUtil.ExtractNumeric <float>(node, "IntervalTime", 0f, false); item.SpeakerName = DBCUtil.ExtractString(node, "SpeakerName", "", true); if (item.SpeakerName.Contains("player")) { item.SpeakerName = item.SpeakerName.Replace("player", heroname); } item.ImageLeftAtlas = DBCUtil.ExtractString(node, "ImageLeftAtlas", "", false); item.ImageLeft = DBCUtil.ExtractString(node, "ImageLeft", "", true); if (item.ImageLeft.Contains("player")) { item.ImageLeft = item.ImageLeft.Replace("player", herostr); } item.ImageLeftBig = string.Format("{0}_big", item.ImageLeft); item.ImageLeftSmall = string.Format("{0}_small", item.ImageLeft); item.ImageRightAtlas = DBCUtil.ExtractString(node, "ImageRightAtlas", "", false); item.ImageRight = DBCUtil.ExtractString(node, "ImageRight", "", true); if (item.ImageRight.Contains("player")) { item.ImageRight = item.ImageRight.Replace("player", herostr); } item.ImageRightBig = string.Format("{0}_big", item.ImageRight); item.ImageRightSmall = string.Format("{0}_small", item.ImageRight); item.Words = DBCUtil.ExtractString(node, "Words", "", true); if (item.Words.Contains("player")) { item.Words = item.Words.Replace("player", heroname); } item.TextureAnimationPath = DBCUtil.ExtractString(node, "TexturePath", "", false); //TweenPos item.FromOffsetBottom = DBCUtil.ExtractNumeric <float>(node, "FromOffsetBottom", 0, false); item.FromOffsetLeft = DBCUtil.ExtractNumeric <float>(node, "FromOffsetLeft", 0, false); item.ToOffsetBottom = DBCUtil.ExtractNumeric <float>(node, "ToOffsetBottom", 0, false); item.ToOffsetLeft = DBCUtil.ExtractNumeric <float>(node, "ToOffsetLeft", 0, false); item.TweenPosDelay = DBCUtil.ExtractNumeric <float>(node, "TweenPosDelay", 0, false); item.TweenPosDuration = DBCUtil.ExtractNumeric <float>(node, "TweenPosDuration", 0, false); //TweenScale item.FromScale = DBCUtil.ExtractNumeric <float>(node, "FromScale", 1, false); item.ToScale = DBCUtil.ExtractNumeric <float>(node, "ToScale", 1, false); item.TweenScaleDelay = DBCUtil.ExtractNumeric <float>(node, "TweenScaleDelay", 0, false); item.TweenScaleDuration = DBCUtil.ExtractNumeric <float>(node, "TweenScaleDuration", 0, false); //TweenAlpha item.FromAlpha = DBCUtil.ExtractNumeric <float>(node, "FromAlpha", 1, false); item.ToAlpha = DBCUtil.ExtractNumeric <float>(node, "ToAlpha", 1, false); item.TweenAlphaDelay = DBCUtil.ExtractNumeric <float>(node, "TweenAlphaDelay", 0, false); item.TweenAlphaDuration = DBCUtil.ExtractNumeric <float>(node, "TweenAlphaDuration", 0, false); //显示字的速度 item.WordDuration = DBCUtil.ExtractNumeric <float>(node, "WordDuration", 0, false); itemList.Add(item); } } return(itemList); } return(null); }