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

番禺建设网站公司哪家好深圳网站搜索优化

番禺建设网站公司哪家好,深圳网站搜索优化,重庆网站建设工作室,南宁推广平台有些单机项目开发的时候没有做本地文本配置文件,全部写死在场景的对象上面,简单记录一下怎么提取场景里面的文本并且写入到配置文件里面using System.Collections.Generic;using System.IO;using TMPro;using UnityEditor;using UnityEngine;using Unity…

有些单机项目开发的时候没有做本地文本配置文件,全部写死在场景的对象上面,简单记录一下怎么提取场景里面的文本并且写入到配置文件里面

using System.Collections.Generic;

using System.IO;

using TMPro;

using UnityEditor;

using UnityEngine;

using UnityEngine.UI;

public class Test : MonoBehaviour

{

static List<string> txtArray = new List<string>();

static string labelStr = "_config_Label_";

[MenuItem("Tools/ÌáÈ¡Îı¾")]

static void GetAllSceneObjectsWithInactive()

{

ReadFile();

var allGos = Resources.FindObjectsOfTypeAll(typeof(GameObject));

var previousSelection = Selection.objects;

Selection.objects = allGos;

var selectedTransforms = Selection.GetTransforms(SelectionMode.Editable | SelectionMode.ExcludePrefab);

Selection.objects = previousSelection;

int index = 0;

foreach (var trans in selectedTransforms)

{

Text text = trans.GetComponent<Text>();

string textContent = "";

if (text == null)

{

TextMeshProUGUI textMeshPro = trans.GetComponent<TextMeshProUGUI>();

if (textMeshPro != null)

{

textContent = textMeshPro.text;

}

}

else

{

textContent = text.text;

}

if (!string.IsNullOrEmpty(textContent)&&!trans.name.Contains("LiberationSans SDF Atlas"))

{

UILanguageText uILanguageText= trans.gameObject.AddComponent<UILanguageText>();

index = index + 1;

string content = "";

if (textContent.Contains("\n"))

{

string[] temp = textContent.Split('\n');

for (int i = 0; i < temp.Length; i++)

{

if (i< temp.Length -1)

{

content = content + temp[i] + "\\n";

}

else

{

content = content + temp[i];

}

}

}

else

{

content = textContent;

}

string languageKey = string.Format("{0}{1}{2}", trans.name, labelStr, index);

uILanguageText.languageKey = languageKey;

txtArray.Add(string.Format("{0},{1}", languageKey, content));

Debug.Log(trans.name+":::"+ textContent);

}

}

WriteFile();

Debug.Log("ÌáÈ¡½áÊø");

}

static void WriteFile()

{

File.WriteAllLines(Application.dataPath + "/Resources/Language/CN.txt", txtArray);

}

static void ReadFile()

{

txtArray.Clear();

string[] strs = File.ReadAllLines(Application.dataPath + "/Resources/Language/CN.txt");

for (int i = 0; i < strs.Length; i++)

{

txtArray.Add(strs[i]);

}

}

}

http://www.yidumall.com/news/86605.html

相关文章:

  • 企业网站建设的成本构成关键词优化排名
  • 网站兼容手机浏览器东莞网站建设制作
  • 网站制作是什么公司广东东莞最新疫情
  • wordpress转换中文南宁百度seo排名公司
  • 温州做企业网站市场营销网络
  • 二级域名怎么做网站备案百度官方客服电话
  • 单页网站是什么样子的百度快速排名优化技术
  • 网站缓存优化怎么做b站推广渠道
  • 自媒体平台培训石家庄百度seo排名
  • 营销型网站定制腾讯会议多少钱一个月
  • 仿京东网站模板韩国日本比分
  • wordpress ubuntu安装教程深圳百度推广优化
  • 长沙做网站建设的百度问答我要提问
  • 江门日报官方网站杭州百度优化
  • 商城网站怎样做东莞百度推广优化
  • 赣州网络台直播seo优化靠谱吗
  • 门户网站建设总结世界十大网站排名出炉
  • 济南网站建设公司晟创未来市场调研报告模板
  • 深圳制作外贸网站网站建设建站在线建站
  • visual2008做网站开鲁视频
  • 河南网站备案地址百度 seo排名查询
  • 建设中的网站备案期间做什娄底seo
  • 做电商网站搭建就业岗位如何优化seo关键词
  • 期货配资网站开发游戏优化大师手机版
  • 网站做重新做_域名不换_空间想转到新网站这边自动收录
  • 网上做问卷调查赚钱哪些网站好关键词排名查询工具有什么作用?
  • 有没有做网页的网站免费发布信息平台有哪些
  • 网站建设信息安全要求重庆电子商务网站seo
  • 宝格丽网站建设策划案品牌推广方案包括哪些
  • 做网站烧钱吗湖南关键词优化排名推广