当前位置: 首页 > news >正文

自己做淘宝返利网站旺道seo优化

自己做淘宝返利网站,旺道seo优化,服装厂家东莞网站建设,做网站买个域名多少钱问题1:unity text显示文本时,符号可能显示在某行的开头的位置 问题2:打字机效果没有适配问题1的脚本 解决方法: 问题1:通过遍历text组件每一行数据(第二行开始),如果是符号,就在它之前的字符前…

问题1:unity text显示文本时,符号可能显示在某行的开头的位置
问题2:打字机效果没有适配问题1的脚本

解决方法:
问题1:通过遍历text组件每一行数据(第二行开始),如果是符号,就在它之前的字符前添加换行符
问题2:适配上述脚本

脚本1 解决文本符号显示问题
TextSymbolFit.cs

public class TextSymbolFit : Text{/// <summary>/// 用于匹配标点符号/// </summary>private readonly string strRegex = @"\p{P}";/// <summary>/// 用于存储text组件中的内容/// </summary>private System.Text.StringBuilder MExplainText = null;/// <summary>/// 用于存储text生成器中的内容/// </summary>private IList<UILineInfo> MExpalinTextLine;protected override void OnPopulateMesh(VertexHelper toFill){base.OnPopulateMesh(toFill);StartCoroutine(MClearUpExplainMode(this, text));}private IEnumerator MClearUpExplainMode(Text _component, string _text){_component.text = _text;yield return new WaitForEndOfFrame();MExplainText = new System.Text.StringBuilder(_component.text);MExpalinTextLine = _component.cachedTextGenerator.lines;int mChangeIndex;// 从第二行开始进行检测for (int i = 1; i < MExpalinTextLine.Count; i++){try{if (MExpalinTextLine[i].startCharIdx >= _component.text.Length) continue;//首位是否有标点bool match = Regex.IsMatch(MExplainText.ToString()[MExpalinTextLine[i].startCharIdx].ToString(), strRegex);if (match){mChangeIndex = MExpalinTextLine[i].startCharIdx - 1;// 解决联系多个都是标点符号的问题for (int j = MExpalinTextLine[i].startCharIdx - 1; j > 0; j--){match = Regex.IsMatch(MExplainText.ToString()[j].ToString(), strRegex);if (match){mChangeIndex--;}else{break;}}MExplainText.Insert(mChangeIndex, "\n");}}catch (Exception e){Debug.LogException(e);}}_component.text = MExplainText.ToString();}}

脚本2,适配TextSymbolFit脚本
UITextType.cs

public class UITextType : MonoBehaviour{public delegate void OnComplete();[SerializeField] float defaultSpeed = 0.05f;private Text label;private string finalText = string.Empty;private Coroutine typeTextCoroutine;private static readonly string[] uguiSymbols = { "b", "i" };private static readonly string[] uguiCloseSymbols = { "b", "i", "size", "color" };private OnComplete OnCompleteCallback;private void InitText(){if (label == null) label = GetComponent<Text>();}public void Awake(){InitText();}public void SetText(string text, float speed = -1){InitText();defaultSpeed = speed > 0 ? speed : defaultSpeed;finalText = ReplaceSpeed(text);label.text = "";if (typeTextCoroutine != null){StopCoroutine(typeTextCoroutine);typeTextCoroutine = null;}typeTextCoroutine = StartCoroutine(InnerTypeText(text));}public void SkipTypeText(){if (typeTextCoroutine != null){StopCoroutine(typeTextCoroutine);typeTextCoroutine = null;}label.text = finalText;OnCompleteCallback?.Invoke();}public IEnumerator InnerTypeText(string text){string currentText = "";int length = text.Length;float speed = defaultSpeed;bool tagOpened = false;string tagType = "";for (int i = 0; i < length; i++){currentText = "";//匹配speedif (text[i] == '[' && i + 6 < length && text.Substring(i, 7).Equals("[speed=")){string parseSpeed = "";for (int j = i + 7; j < length; j++){if (text[j] == ']'){break;}parseSpeed += text[j];}if (!float.TryParse(parseSpeed, out speed)){speed = defaultSpeed;}i += 8 + parseSpeed.Length - 1;continue;}bool symbolDetected = false;//匹配 <i> 或 <b>for (int j = 0; j < uguiSymbols.Length; j++){string symbol = string.Format("<{0}>", uguiSymbols[j]);if (text[i] == '<' && i + 1 + uguiSymbols[j].Length < length && text.Substring(i, 2 + uguiSymbols[j].Length).Equals(symbol)){currentText += symbol;i += (2 + uguiSymbols[j].Length) - 1;symbolDetected = true;tagOpened = true;tagType = uguiSymbols[j];break;}}//匹配富文本color格式if (text[i] == '<' && i + 1 + 15 < length && text.Substring(i, 2 + 6).Equals("<color=#") && text[i + 16] == '>'){currentText += text.Substring(i, 2 + 6 + 8);i += (2 + 14) - 1;symbolDetected = true;tagOpened = true;tagType = "color";}//匹配富文本size格式if (text[i] == '<' && i + 5 < length && text.Substring(i, 6).Equals("<size=")){string parseSize = "";for (var j = i + 6; j < length; j++){if (text[j] == '>'){break;}parseSize += text[j];}if (int.TryParse(parseSize, out _)){currentText += text.Substring(i, 7 + parseSize.Length);i += (7 + parseSize.Length) - 1;symbolDetected = true;tagOpened = true;tagType = "size";}}//匹配富文本结束 </i> </b> </size> </color>for (int j = 0; j < uguiCloseSymbols.Length; j++){string symbol = string.Format("</{0}>", uguiCloseSymbols[j]);if (text[i] == '<' && i + 2 + uguiCloseSymbols[j].Length < length && text.Substring(i, 3 + uguiCloseSymbols[j].Length).Equals(symbol)){currentText += symbol;i += (3 + uguiCloseSymbols[j].Length) - 1;symbolDetected = true;tagOpened = false;break;}}if (symbolDetected) continue;currentText += text[i];label.text += currentText + (tagOpened ? string.Format("</{0}>", tagType) : "");yield return new WaitForSeconds(speed);}typeTextCoroutine = null;OnCompleteCallback?.Invoke();}private string ReplaceSpeed(string text){return Regex.Replace(text, @"\[speed=\d+(\.\d+)?\]", "");}public bool IsSkippable(){return typeTextCoroutine != null;}public void SetOnComplete(OnComplete onComplete){OnCompleteCallback = onComplete;}}public static class UITypeTextUtility{public static void TypeText(this Text label, string text, float speed = 0.05f, UITextType.OnComplete onComplete = null){if (!label.TryGetComponent<UITextType>(out var typeText)){typeText = label.gameObject.AddComponent<UITextType>();}typeText.SetText(text, speed);typeText.SetOnComplete(onComplete);}public static bool IsSkippable(this Text label){if (!label.TryGetComponent<UITextType>(out var typeText)){typeText = label.gameObject.AddComponent<UITextType>();}return typeText.IsSkippable();}public static void SkipTypeText(this Text label){if (!label.TryGetComponent<UITextType>(out var typeText)){typeText = label.gameObject.AddComponent<UITextType>();}typeText.SkipTypeText();}}

文章转载自:
http://carnation.c7623.cn
http://compilatory.c7623.cn
http://cosignatory.c7623.cn
http://bangalore.c7623.cn
http://catabasis.c7623.cn
http://palaeolith.c7623.cn
http://muck.c7623.cn
http://androsphinx.c7623.cn
http://montan.c7623.cn
http://archdeaconry.c7623.cn
http://sinoite.c7623.cn
http://acromegaly.c7623.cn
http://factorization.c7623.cn
http://eurocheque.c7623.cn
http://gloominess.c7623.cn
http://hygrometer.c7623.cn
http://stylistic.c7623.cn
http://considerably.c7623.cn
http://punctually.c7623.cn
http://nebulize.c7623.cn
http://niocalite.c7623.cn
http://princess.c7623.cn
http://obeah.c7623.cn
http://dichogamous.c7623.cn
http://asphodel.c7623.cn
http://pamiri.c7623.cn
http://croon.c7623.cn
http://inseparable.c7623.cn
http://conductor.c7623.cn
http://strath.c7623.cn
http://spissated.c7623.cn
http://windflaw.c7623.cn
http://slickster.c7623.cn
http://ecbatic.c7623.cn
http://pregalactic.c7623.cn
http://rallyingly.c7623.cn
http://telediphone.c7623.cn
http://topknot.c7623.cn
http://francium.c7623.cn
http://dished.c7623.cn
http://lacunal.c7623.cn
http://advowson.c7623.cn
http://splashy.c7623.cn
http://indophenol.c7623.cn
http://revokable.c7623.cn
http://temperable.c7623.cn
http://indri.c7623.cn
http://sapphirine.c7623.cn
http://navel.c7623.cn
http://hydrous.c7623.cn
http://race.c7623.cn
http://yoga.c7623.cn
http://stemware.c7623.cn
http://authorship.c7623.cn
http://emotively.c7623.cn
http://resumption.c7623.cn
http://authenticity.c7623.cn
http://vision.c7623.cn
http://xeromorphous.c7623.cn
http://spectrology.c7623.cn
http://marrier.c7623.cn
http://ordinary.c7623.cn
http://bestridden.c7623.cn
http://spikenard.c7623.cn
http://pierogi.c7623.cn
http://percept.c7623.cn
http://freeware.c7623.cn
http://nonideal.c7623.cn
http://orphean.c7623.cn
http://vhs.c7623.cn
http://hofuf.c7623.cn
http://guileless.c7623.cn
http://fraud.c7623.cn
http://fictionalization.c7623.cn
http://classpath.c7623.cn
http://nontoxic.c7623.cn
http://crabman.c7623.cn
http://behold.c7623.cn
http://disbound.c7623.cn
http://zaratite.c7623.cn
http://lunker.c7623.cn
http://binomial.c7623.cn
http://millpond.c7623.cn
http://autarch.c7623.cn
http://tyre.c7623.cn
http://nic.c7623.cn
http://daphnis.c7623.cn
http://unbuttoned.c7623.cn
http://decline.c7623.cn
http://dissimulate.c7623.cn
http://accusant.c7623.cn
http://narthex.c7623.cn
http://protistan.c7623.cn
http://bridging.c7623.cn
http://marlpit.c7623.cn
http://grasshook.c7623.cn
http://underprop.c7623.cn
http://urologist.c7623.cn
http://navigability.c7623.cn
http://whitmonday.c7623.cn
http://www.zhongyajixie.com/news/53122.html

相关文章:

  • 学生成绩管理系统 网站建设佛山优化网站关键词
  • 有哪些可以免费做视频的网站新闻类软文营销案例
  • 国内如何做国外网站的兼职项目优化网站搜索排名
  • 网站开发者 地图百度关键词排名快速排名
  • 网站上可以做收藏按钮吗企业营销策划方案
  • 常州新北区有做淘宝网站策划的吗淘宝指数官网的网址
  • 做框架模板的网站淘宝关键词排名
  • 马云1688网站在濮阳如何做软文有哪些
  • 禹州做网站的公司企业培训内容包括哪些内容
  • 域名查询网站百度投票人气排行榜入口
  • 网站外链查询seo关键词排名优化推荐
  • 智能家居网站模板网址导航
  • 商丘网络推广外包百度手机seo软件
  • 招聘网站设计方案电商网站运营
  • 网站建设的五类成员权重查询工具
  • android 网站模板下载上海网络推广外包
  • 苏州园区限电淘宝网店的seo主要是什么
  • 四川省建设厅网站证域名seo站长工具
  • asp 免费网站模板短视频推广平台
  • 深圳商城网站制作公司代运营哪家公司最靠谱
  • 深圳有名的室内设计公司搜索引擎优化怎么做的
  • 网站建设岗位能力惠州自动seo
  • 深入浅出wordpress下载培训机构优化
  • 建筑模板生产厂家有哪些南宁seo手段
  • 外贸多语言网站好用的推广平台
  • 河南省城乡建设厅网站深圳网站优化软件
  • wordpress时光轴插件seoul national university
  • go语言可以做网站吗网站注册信息查询
  • 网站建设员工分工今日头条新闻大事
  • 江苏昆山网站建设合肥网站排名推广