895 lines
48 KiB
C#
895 lines
48 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Diagnostics;
|
|||
|
using System.IO;
|
|||
|
using UnityEditor;
|
|||
|
using UnityEngine;
|
|||
|
using PathUtils = UnityEngine.Gonbest.MagicCube.PathUtils;
|
|||
|
using CoroutinePool = UnityEngine.Gonbest.MagicCube.CoroutinePool;
|
|||
|
using StringUtils = UnityEngine.Gonbest.MagicCube.StringUtils;
|
|||
|
using Thousandto.Update.Xml;
|
|||
|
|
|||
|
namespace Thousandto.Package
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 打包工具的额外菜单,比如fls操作,在dll里面不方便定菜单,挪到这里
|
|||
|
/// </summary>
|
|||
|
public class MenuItemExtra
|
|||
|
{
|
|||
|
#region //PackageTool
|
|||
|
[MenuItem("PackageTool/Extra/生成场景对应资源列表", false, 888)]
|
|||
|
public static void MkSceneResList()
|
|||
|
{
|
|||
|
FlsUtils.Test2();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 分fls0首包资源的时候需要这个文件
|
|||
|
/// </summary>
|
|||
|
[MenuItem("PackageTool/Extra/根据MapSetting生成资源列表", false, 888)]
|
|||
|
public static void GenResListForFlsFile()
|
|||
|
{
|
|||
|
FlsUtils.GenResListByMapSetting();
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/测试读取翻译文件", false, 888)]
|
|||
|
public static void TestReadLanConfig()
|
|||
|
{
|
|||
|
string path = AssetDatabase.GetAssetPath(Selection.activeObject);
|
|||
|
ReadLanConfig(path);
|
|||
|
}
|
|||
|
|
|||
|
public static void ReadLanConfig(string savePath)
|
|||
|
{
|
|||
|
FileStream fs = new FileStream(savePath, FileMode.Open);
|
|||
|
Dictionary<string, string> result = new Dictionary<string, string>();
|
|||
|
while (fs.Position < fs.Length)
|
|||
|
{
|
|||
|
string key = ParseString(fs);
|
|||
|
string value = ParseString(fs);
|
|||
|
|
|||
|
result.Add(key, value);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private static string ParseString(FileStream fs)
|
|||
|
{
|
|||
|
byte[] lenBytes = new byte[4];
|
|||
|
fs.Read(lenBytes, 0, 4);
|
|||
|
|
|||
|
int len = BitConverter.ToInt32(lenBytes, 0);
|
|||
|
byte[] valueBytes = new byte[len];
|
|||
|
fs.Read(valueBytes, 0, len);
|
|||
|
string value = System.Text.Encoding.Default.GetString(valueBytes);
|
|||
|
|
|||
|
return value;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/分Fls文件/CH", false, 100)]
|
|||
|
public static void MkFlsCH()
|
|||
|
{
|
|||
|
FlsUtils.Build(Core.Base.LanguageConstDefine.CH);
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/分Fls文件/TW", false, 100)]
|
|||
|
public static void MkFlsTW()
|
|||
|
{
|
|||
|
FlsUtils.Build(Core.Base.LanguageConstDefine.TW);
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/分Fls文件/KR", false, 100)]
|
|||
|
public static void MkFlsKR()
|
|||
|
{
|
|||
|
FlsUtils.Build(Core.Base.LanguageConstDefine.KR);
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/分Fls文件/VIE", false, 100)]
|
|||
|
public static void MkFlsVIE()
|
|||
|
{
|
|||
|
FlsUtils.Build(Core.Base.LanguageConstDefine.VIE);
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/分Fls文件/TG", false, 100)]
|
|||
|
public static void MkFlsTH()
|
|||
|
{
|
|||
|
FlsUtils.Build(Core.Base.LanguageConstDefine.TH);
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/分Fls文件/CH_EN_TH", false, 100)]
|
|||
|
public static void MkFlsCH_EN_TH()
|
|||
|
{
|
|||
|
FlsUtils.Build("CH_EN_TH");
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/生成分段资源", false, 100)]
|
|||
|
public static void GenRes()
|
|||
|
{
|
|||
|
List<string> resList = new List<string>();
|
|||
|
FlsUtils.CreateBinaryRes(System.DateTime.Now.ToString("yyMMddHHmm"), out resList);
|
|||
|
}
|
|||
|
|
|||
|
public static void GenResPackage()
|
|||
|
{
|
|||
|
UnityEngine.Debug.Log("==GenResPackage==");
|
|||
|
string[] args = System.Environment.GetCommandLineArgs();
|
|||
|
string packageName = "test";
|
|||
|
string url = "http://124.220.47.41:99/";
|
|||
|
string versionBase = "9";
|
|||
|
string versionPatch = "1.0.9";
|
|||
|
for (int i = 0; i < args.Length; i++)
|
|||
|
{
|
|||
|
UnityEngine.Debug.Log("args:" + args[i]);
|
|||
|
if (args[i] == "-PackageName" && args.Length > i + 1)
|
|||
|
{
|
|||
|
packageName = args[i + 1];
|
|||
|
}
|
|||
|
if (args[i] == "-URL" && args.Length > i + 1)
|
|||
|
{
|
|||
|
url = args[i + 1];
|
|||
|
}
|
|||
|
if (args[i] == "-VersionBase" && args.Length > i + 1)
|
|||
|
{
|
|||
|
versionBase = args[i + 1];
|
|||
|
}
|
|||
|
if (args[i] == "-VersionPatch" && args.Length > i + 1)
|
|||
|
{
|
|||
|
versionPatch = args[i + 1];
|
|||
|
}
|
|||
|
}
|
|||
|
if (string.IsNullOrEmpty(packageName))
|
|||
|
{
|
|||
|
UnityEngine.Debug.Log("error:Package Name is empty");
|
|||
|
return;
|
|||
|
}
|
|||
|
List<string> resList = new List<string>();
|
|||
|
FlsUtils.CreateBinaryRes(packageName, out resList);
|
|||
|
|
|||
|
var path = resList[0];
|
|||
|
|
|||
|
string PatchFileMD5 = Utils.MD5(path);
|
|||
|
string mapFileMD5 = Utils.MD5(path + ".map");
|
|||
|
|
|||
|
ResourceVersionXml xml = new ResourceVersionXml();
|
|||
|
xml.parseResouceVersionXml("../SubResource/APK/RemoteVersion.xml");
|
|||
|
xml.NormalFollow.SortBaseVersion();
|
|||
|
|
|||
|
xml.NormalFollow.LastVersionPatch.ToVersion = versionPatch;
|
|||
|
xml.NormalFollow.VersionModelBaseList[0].ToVersion = versionBase;
|
|||
|
|
|||
|
xml.NormalFollow.VersionModelBaseList[0].Map_md5 = mapFileMD5;
|
|||
|
xml.NormalFollow.VersionModelBaseList[0].Md5 = PatchFileMD5;
|
|||
|
xml.NormalFollow.VersionModelBaseList[0].Map_url = url + packageName + "_1.map";
|
|||
|
xml.NormalFollow.VersionModelBaseList[0].ResourceUrl = url + packageName + "_1";
|
|||
|
|
|||
|
xml.saveAll("../SubResource/APK/RemoteVersion.xml");
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/fls自动化工具", false, 100)]
|
|||
|
public static void OpenFlsMkTool()
|
|||
|
{
|
|||
|
FlsUtilsUITool.openWindow();
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/修正窗体对atlas的引用", false, 100)]
|
|||
|
public static void ModifyAtlasRefer()
|
|||
|
{
|
|||
|
PackageProxy.ModifyAtlasRefer(Selection.objects[0] as GameObject);
|
|||
|
|
|||
|
AssetDatabase.SaveAssets();
|
|||
|
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/UIItem/查找所有UIItem", false, 1)]
|
|||
|
public static void CheckAllUIItem()
|
|||
|
{
|
|||
|
var cs = Utils.GetFiles(PkgConstDefine.C_FUNCELL_GAME_FORM, "*.prefab", System.IO.SearchOption.AllDirectories);
|
|||
|
List<string> res = new List<string>();
|
|||
|
//foreach (var f in cs)
|
|||
|
//{
|
|||
|
// res.Add(System.IO.Path.GetFileNameWithoutExtension(f));
|
|||
|
//}
|
|||
|
foreach (var f in cs)
|
|||
|
{
|
|||
|
var go = AssetDatabase.LoadAssetAtPath(f, typeof(GameObject)) as GameObject;
|
|||
|
if (go != null)
|
|||
|
{
|
|||
|
var spriteList = go.GetComponentsInChildren<UISprite>(true);
|
|||
|
for (int i = 0; spriteList != null && i < spriteList.Length; ++i)
|
|||
|
{
|
|||
|
if (spriteList[i].name == "Effect1")
|
|||
|
{
|
|||
|
UnityEngine.Debug.LogError(f);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
[MenuItem("PackageTool/Extra/UIItem/修正选中UI中的UIItem布局", false, 2)]
|
|||
|
public static void CheckSelectUIItem()
|
|||
|
{
|
|||
|
List<string> resFileList = new List<string>();
|
|||
|
UnityEngine.Object[] objs = Selection.objects;
|
|||
|
for (int i = 0; objs != null && i < objs.Length; ++i)
|
|||
|
{
|
|||
|
UnityEngine.Object obj = objs[i];
|
|||
|
string path = AssetDatabase.GetAssetOrScenePath(obj);
|
|||
|
var go = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject;
|
|||
|
if (go != null)
|
|||
|
{
|
|||
|
var newGo = UnityEngine.Object.Instantiate(go);
|
|||
|
var spriteList = newGo.GetComponentsInChildren<UISprite>(true);
|
|||
|
for (int j = 0; spriteList != null && j < spriteList.Length; ++j)
|
|||
|
{
|
|||
|
if (spriteList[j].name == "EquipIcon")
|
|||
|
{
|
|||
|
var qusTrans = spriteList[j].transform.parent.Find("Qualty");
|
|||
|
var lvTrans = spriteList[j].transform.parent.Find("LvBg");
|
|||
|
if (qusTrans != null && lvTrans == null)
|
|||
|
{
|
|||
|
var quaSpr = qusTrans.GetComponent<UISprite>();
|
|||
|
if (quaSpr != null && quaSpr.spriteName.Contains("pinzhikuang"))
|
|||
|
{
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Level");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var label = lvTrans.GetComponent<UILabel>();
|
|||
|
label.effectStyle = UILabel.Effect.Outline;
|
|||
|
label.effectColor = new Color(106f / 255, 26f / 255, 26f / 255, 1);
|
|||
|
}
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Bind");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var sprite = lvTrans.GetComponent<UISprite>();
|
|||
|
var length = Math.Floor(quaSpr.height * 0.2222222f + 0.5f);
|
|||
|
sprite.height = (int)length;
|
|||
|
sprite.width = (int)length;
|
|||
|
var x = (int)Math.Floor(quaSpr.transform.localPosition.x - quaSpr.width / 2 * 0.6857 + 0.5f);
|
|||
|
var y = (int)Math.Floor(quaSpr.transform.localPosition.y - quaSpr.height / 2 * 0.6944 + 0.5f);
|
|||
|
lvTrans.localPosition = new Vector2(x, y);
|
|||
|
}
|
|||
|
var bgGo = new GameObject();
|
|||
|
if (bgGo != null)
|
|||
|
{
|
|||
|
var newBgGo = UnityEngine.Object.Instantiate(bgGo);
|
|||
|
var _spr = newBgGo.AddComponent<UISprite>();
|
|||
|
_spr.name = "LvBg";
|
|||
|
_spr.transform.localPosition = Vector3.zero;
|
|||
|
_spr.transform.rotation = Quaternion.identity;
|
|||
|
_spr.transform.localScale = Vector3.one;
|
|||
|
_spr.transform.parent = quaSpr.transform.parent;
|
|||
|
_spr.depth = spriteList[j].depth + 1;
|
|||
|
var atpath = "Assets/GameAssets/Resources/GameUI/Base/Atlas/UINewPublicAtlas/UINewPublicAtlas.prefab";
|
|||
|
var newatlas = AssetDatabase.LoadAssetAtPath<UIAtlas>(atpath);
|
|||
|
if (newatlas != null)
|
|||
|
{
|
|||
|
_spr.atlas = newatlas;
|
|||
|
_spr.spriteName = "n_z_14";
|
|||
|
_spr.width = quaSpr.width - (int)Math.Floor(6f / 70 * quaSpr.width + 0.5f);
|
|||
|
_spr.height = (int)Math.Floor(14f / 72 * quaSpr.height + 0.5f);
|
|||
|
_spr.transform.localPosition = new Vector2(quaSpr.transform.localPosition.x, quaSpr.transform.localPosition.y - (int)Math.Floor(quaSpr.height / 2 * 0.6944444 + 0.5));
|
|||
|
PrefabUtility.ReplacePrefab(newGo, go, ReplacePrefabOptions.ConnectToPrefab);
|
|||
|
GameObject.DestroyImmediate(bgGo);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (spriteList[j].name == "icon")
|
|||
|
{
|
|||
|
var qusTrans = spriteList[j].transform.parent.Find("Qualty");
|
|||
|
var lvTrans = spriteList[j].transform.parent.Find("LvBg");
|
|||
|
if(qusTrans != null && lvTrans == null)
|
|||
|
{
|
|||
|
var quaSpr = qusTrans.GetComponent<UISprite>();
|
|||
|
if (quaSpr != null && quaSpr.spriteName.Contains("pinzhikuang"))
|
|||
|
{
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Level");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var label = lvTrans.GetComponent<UILabel>();
|
|||
|
label.effectStyle = UILabel.Effect.Outline;
|
|||
|
label.effectColor = new Color(106f / 255, 26f / 255, 26f / 255, 1);
|
|||
|
}
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Num");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var label = lvTrans.GetComponent<UILabel>();
|
|||
|
label.effectStyle = UILabel.Effect.Outline;
|
|||
|
label.effectColor = new Color(39f / 255, 39f / 255, 39f / 255, 1);
|
|||
|
label.overflowMethod = UILabel.Overflow.ResizeFreely;
|
|||
|
label.pivot = UIWidget.Pivot.Right;
|
|||
|
label.alignment = NGUIText.Alignment.Automatic;
|
|||
|
var x = (int)Math.Floor(quaSpr.transform.localPosition.x + quaSpr.width / 2 * 0.8571 + 0.5f);
|
|||
|
var y = (int)Math.Floor(quaSpr.transform.localPosition.y - quaSpr.height / 2 * 0.6944 + 0.5f);
|
|||
|
lvTrans.localPosition = new Vector2(x, y);
|
|||
|
}
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Bind");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var sprite = lvTrans.GetComponent<UISprite>();
|
|||
|
var length = Math.Floor(quaSpr.height * 0.2222222f + 0.5f);
|
|||
|
sprite.height = (int)length;
|
|||
|
sprite.width = (int)length;
|
|||
|
var x = (int)Math.Floor(quaSpr.transform.localPosition.x - quaSpr.width / 2 * 0.6857 + 0.5f);
|
|||
|
var y = (int)Math.Floor(quaSpr.transform.localPosition.y - quaSpr.height / 2 * 0.6944 + 0.5f);
|
|||
|
lvTrans.localPosition = new Vector2(x, y);
|
|||
|
}
|
|||
|
var bgGo = new GameObject();
|
|||
|
if(bgGo != null)
|
|||
|
{
|
|||
|
var newBgGo = UnityEngine.Object.Instantiate(bgGo);
|
|||
|
var _spr = newBgGo.AddComponent<UISprite>();
|
|||
|
_spr.name = "LvBg";
|
|||
|
_spr.transform.localPosition = Vector3.zero;
|
|||
|
_spr.transform.rotation = Quaternion.identity;
|
|||
|
_spr.transform.localScale = Vector3.one;
|
|||
|
_spr.transform.parent = quaSpr.transform.parent;
|
|||
|
_spr.depth = spriteList[j].depth + 1;
|
|||
|
var atpath = "Assets/GameAssets/Resources/GameUI/Base/Atlas/UINewPublicAtlas/UINewPublicAtlas.prefab";
|
|||
|
var newatlas = AssetDatabase.LoadAssetAtPath<UIAtlas>(atpath);
|
|||
|
if (newatlas != null)
|
|||
|
{
|
|||
|
_spr.atlas = newatlas;
|
|||
|
_spr.spriteName = "n_z_14";
|
|||
|
_spr.width = quaSpr.width - (int)Math.Floor(6f / 70 * quaSpr.width + 0.5f);
|
|||
|
_spr.height = (int)Math.Floor(14f / 72 * quaSpr.height + 0.5f);
|
|||
|
_spr.transform.localPosition = new Vector2(quaSpr.transform.localPosition.x, quaSpr.transform.localPosition.y - (int)Math.Floor(quaSpr.height / 2 * 0.6944444 + 0.5));
|
|||
|
PrefabUtility.ReplacePrefab(newGo, go, ReplacePrefabOptions.ConnectToPrefab);
|
|||
|
GameObject.DestroyImmediate(bgGo);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (spriteList[j].name == "Icon")
|
|||
|
{
|
|||
|
var qusTrans = spriteList[j].transform.parent.Find("Quality");
|
|||
|
var lvTrans = spriteList[j].transform.parent.Find("LvBg");
|
|||
|
if (qusTrans != null && lvTrans == null)
|
|||
|
{
|
|||
|
var quaSpr = qusTrans.GetComponent<UISprite>();
|
|||
|
if (quaSpr != null && quaSpr.spriteName.Contains("pinzhikuang"))
|
|||
|
{
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Level");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var label = lvTrans.GetComponent<UILabel>();
|
|||
|
label.effectStyle = UILabel.Effect.Outline;
|
|||
|
label.effectColor = new Color(106f / 255, 26f / 255, 26f / 255, 1);
|
|||
|
}
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Num");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var label = lvTrans.GetComponent<UILabel>();
|
|||
|
label.effectStyle = UILabel.Effect.Outline;
|
|||
|
label.effectColor = new Color(39f / 255, 39f / 255, 39f / 255, 1);
|
|||
|
label.overflowMethod = UILabel.Overflow.ResizeFreely;
|
|||
|
label.pivot = UIWidget.Pivot.Right;
|
|||
|
label.alignment = NGUIText.Alignment.Automatic;
|
|||
|
var x = (int)Math.Floor(quaSpr.transform.localPosition.x + quaSpr.width / 2 * 0.8571 + 0.5f);
|
|||
|
var y = (int)Math.Floor(quaSpr.transform.localPosition.y - quaSpr.height / 2 * 0.6944 + 0.5f);
|
|||
|
lvTrans.localPosition = new Vector2(x, y);
|
|||
|
}
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Bind");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var sprite = lvTrans.GetComponent<UISprite>();
|
|||
|
var length = Math.Floor(quaSpr.height * 0.2222222f + 0.5f);
|
|||
|
sprite.height = (int)length;
|
|||
|
sprite.width = (int)length;
|
|||
|
var x = (int)Math.Floor(quaSpr.transform.localPosition.x - quaSpr.width / 2 * 0.6857 + 0.5f);
|
|||
|
var y = (int)Math.Floor(quaSpr.transform.localPosition.y - quaSpr.height / 2 * 0.6944 + 0.5f);
|
|||
|
lvTrans.localPosition = new Vector2(x, y);
|
|||
|
}
|
|||
|
var bgGo = new GameObject();
|
|||
|
if (bgGo != null)
|
|||
|
{
|
|||
|
var newBgGo = UnityEngine.Object.Instantiate(bgGo);
|
|||
|
var _spr = newBgGo.AddComponent<UISprite>();
|
|||
|
_spr.name = "LvBg";
|
|||
|
_spr.transform.localPosition = Vector3.zero;
|
|||
|
_spr.transform.rotation = Quaternion.identity;
|
|||
|
_spr.transform.localScale = Vector3.one;
|
|||
|
_spr.transform.parent = quaSpr.transform.parent;
|
|||
|
_spr.depth = spriteList[j].depth + 1;
|
|||
|
var atpath = "Assets/GameAssets/Resources/GameUI/Base/Atlas/UINewPublicAtlas/UINewPublicAtlas.prefab";
|
|||
|
var newatlas = AssetDatabase.LoadAssetAtPath<UIAtlas>(atpath);
|
|||
|
if (newatlas != null)
|
|||
|
{
|
|||
|
_spr.atlas = newatlas;
|
|||
|
_spr.spriteName = "n_z_14";
|
|||
|
_spr.width = quaSpr.width - (int)Math.Floor(6f / 70 * quaSpr.width + 0.5f);
|
|||
|
_spr.height = (int)Math.Floor(14f / 72 * quaSpr.height + 0.5f);
|
|||
|
_spr.transform.localPosition = new Vector2(quaSpr.transform.localPosition.x, quaSpr.transform.localPosition.y - (int)Math.Floor(quaSpr.height / 2 * 0.6944444 + 0.5));
|
|||
|
PrefabUtility.ReplacePrefab(newGo, go, ReplacePrefabOptions.ConnectToPrefab);
|
|||
|
GameObject.DestroyImmediate(bgGo);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
continue;
|
|||
|
}
|
|||
|
}
|
|||
|
GameObject.DestroyImmediate(newGo);
|
|||
|
AssetDatabase.SaveAssets();
|
|||
|
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/UIItem/修正所有UIItem布局", false, 1)]
|
|||
|
public static void ModefAllUIItem()
|
|||
|
{
|
|||
|
var cs = Utils.GetFiles(PkgConstDefine.C_FUNCELL_GAME_FORM, "*.prefab", System.IO.SearchOption.AllDirectories);
|
|||
|
int index = 0;
|
|||
|
foreach (var f in cs)
|
|||
|
{
|
|||
|
var go = AssetDatabase.LoadAssetAtPath(f, typeof(GameObject)) as GameObject;
|
|||
|
if (go != null)
|
|||
|
{
|
|||
|
EditorUtility.DisplayProgressBar("修正所有UIItem布局", go.name, index / (float)cs.Count);
|
|||
|
var newGo = UnityEngine.Object.Instantiate(go);
|
|||
|
var spriteList = newGo.GetComponentsInChildren<UISprite>(true);
|
|||
|
for (int i = 0; spriteList != null && i < spriteList.Length; ++i)
|
|||
|
{
|
|||
|
for (int j = 0; spriteList != null && j < spriteList.Length; ++j)
|
|||
|
{
|
|||
|
if (spriteList[j].name == "EquipIcon")
|
|||
|
{
|
|||
|
var qusTrans = spriteList[j].transform.parent.Find("Qualty");
|
|||
|
var lvTrans = spriteList[j].transform.parent.Find("LvBg");
|
|||
|
if (qusTrans != null && lvTrans == null)
|
|||
|
{
|
|||
|
var quaSpr = qusTrans.GetComponent<UISprite>();
|
|||
|
if (quaSpr != null && quaSpr.spriteName.Contains("pinzhikuang"))
|
|||
|
{
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Level");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var label = lvTrans.GetComponent<UILabel>();
|
|||
|
label.effectStyle = UILabel.Effect.Outline;
|
|||
|
label.effectColor = new Color(106f / 255, 26f / 255, 26f / 255, 1);
|
|||
|
}
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Bind");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var sprite = lvTrans.GetComponent<UISprite>();
|
|||
|
var length = Math.Floor(quaSpr.height * 0.2222222f + 0.5f);
|
|||
|
sprite.height = (int)length;
|
|||
|
sprite.width = (int)length;
|
|||
|
var x = (int)Math.Floor(quaSpr.transform.localPosition.x - quaSpr.width / 2 * 0.6857 + 0.5f);
|
|||
|
var y = (int)Math.Floor(quaSpr.transform.localPosition.y - quaSpr.height / 2 * 0.6944 + 0.5f);
|
|||
|
lvTrans.localPosition = new Vector2(x, y);
|
|||
|
}
|
|||
|
var bgGo = new GameObject();
|
|||
|
if (bgGo != null)
|
|||
|
{
|
|||
|
var newBgGo = UnityEngine.Object.Instantiate(bgGo);
|
|||
|
var _spr = newBgGo.AddComponent<UISprite>();
|
|||
|
_spr.name = "LvBg";
|
|||
|
_spr.transform.localPosition = Vector3.zero;
|
|||
|
_spr.transform.rotation = Quaternion.identity;
|
|||
|
_spr.transform.localScale = Vector3.one;
|
|||
|
_spr.transform.parent = quaSpr.transform.parent;
|
|||
|
_spr.depth = spriteList[j].depth + 1;
|
|||
|
var atpath = "Assets/GameAssets/Resources/GameUI/Base/Atlas/UINewPublicAtlas/UINewPublicAtlas.prefab";
|
|||
|
var newatlas = AssetDatabase.LoadAssetAtPath<UIAtlas>(atpath);
|
|||
|
if (newatlas != null)
|
|||
|
{
|
|||
|
_spr.atlas = newatlas;
|
|||
|
_spr.spriteName = "n_z_14";
|
|||
|
_spr.width = quaSpr.width - (int)Math.Floor(6f / 70 * quaSpr.width + 0.5f);
|
|||
|
_spr.height = (int)Math.Floor(14f / 72 * quaSpr.height + 0.5f);
|
|||
|
_spr.transform.localPosition = new Vector2(quaSpr.transform.localPosition.x, quaSpr.transform.localPosition.y - (int)Math.Floor(quaSpr.height / 2 * 0.6944444 + 0.5));
|
|||
|
PrefabUtility.ReplacePrefab(newGo, go, ReplacePrefabOptions.ConnectToPrefab);
|
|||
|
GameObject.DestroyImmediate(bgGo);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (spriteList[j].name == "icon")
|
|||
|
{
|
|||
|
var qusTrans = spriteList[j].transform.parent.Find("Qualty");
|
|||
|
var lvTrans = spriteList[j].transform.parent.Find("LvBg");
|
|||
|
if (qusTrans != null && lvTrans == null)
|
|||
|
{
|
|||
|
var quaSpr = qusTrans.GetComponent<UISprite>();
|
|||
|
if (quaSpr != null && quaSpr.spriteName.Contains("pinzhikuang"))
|
|||
|
{
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Level");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var label = lvTrans.GetComponent<UILabel>();
|
|||
|
label.effectStyle = UILabel.Effect.Outline;
|
|||
|
label.effectColor = new Color(106f / 255, 26f / 255, 26f / 255, 1);
|
|||
|
}
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Num");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var label = lvTrans.GetComponent<UILabel>();
|
|||
|
label.effectStyle = UILabel.Effect.Outline;
|
|||
|
label.effectColor = new Color(39f / 255, 39f / 255, 39f / 255, 1);
|
|||
|
label.overflowMethod = UILabel.Overflow.ResizeFreely;
|
|||
|
label.pivot = UIWidget.Pivot.Right;
|
|||
|
label.alignment = NGUIText.Alignment.Automatic;
|
|||
|
var x = (int)Math.Floor(quaSpr.transform.localPosition.x + quaSpr.width / 2 * 0.8571 + 0.5f);
|
|||
|
var y = (int)Math.Floor(quaSpr.transform.localPosition.y - quaSpr.height / 2 * 0.6944 + 0.5f);
|
|||
|
lvTrans.localPosition = new Vector2(x, y);
|
|||
|
}
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Bind");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var sprite = lvTrans.GetComponent<UISprite>();
|
|||
|
var length = Math.Floor(quaSpr.height * 0.2222222f + 0.5f);
|
|||
|
sprite.height = (int)length;
|
|||
|
sprite.width = (int)length;
|
|||
|
var x = (int)Math.Floor(quaSpr.transform.localPosition.x - quaSpr.width / 2 * 0.6857 + 0.5f);
|
|||
|
var y = (int)Math.Floor(quaSpr.transform.localPosition.y - quaSpr.height / 2 * 0.6944 + 0.5f);
|
|||
|
lvTrans.localPosition = new Vector2(x, y);
|
|||
|
}
|
|||
|
var bgGo = new GameObject();
|
|||
|
if (bgGo != null)
|
|||
|
{
|
|||
|
var newBgGo = UnityEngine.Object.Instantiate(bgGo);
|
|||
|
var _spr = newBgGo.AddComponent<UISprite>();
|
|||
|
_spr.name = "LvBg";
|
|||
|
_spr.transform.localPosition = Vector3.zero;
|
|||
|
_spr.transform.rotation = Quaternion.identity;
|
|||
|
_spr.transform.localScale = Vector3.one;
|
|||
|
_spr.transform.parent = quaSpr.transform.parent;
|
|||
|
_spr.depth = spriteList[j].depth + 1;
|
|||
|
var atpath = "Assets/GameAssets/Resources/GameUI/Base/Atlas/UINewPublicAtlas/UINewPublicAtlas.prefab";
|
|||
|
var newatlas = AssetDatabase.LoadAssetAtPath<UIAtlas>(atpath);
|
|||
|
if (newatlas != null)
|
|||
|
{
|
|||
|
_spr.atlas = newatlas;
|
|||
|
_spr.spriteName = "n_z_14";
|
|||
|
_spr.width = quaSpr.width - (int)Math.Floor(6f / 70 * quaSpr.width + 0.5f);
|
|||
|
_spr.height = (int)Math.Floor(14f / 72 * quaSpr.height + 0.5f);
|
|||
|
_spr.transform.localPosition = new Vector2(quaSpr.transform.localPosition.x, quaSpr.transform.localPosition.y - (int)Math.Floor(quaSpr.height / 2 * 0.6944444 + 0.5));
|
|||
|
PrefabUtility.ReplacePrefab(newGo, go, ReplacePrefabOptions.ConnectToPrefab);
|
|||
|
GameObject.DestroyImmediate(bgGo);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (spriteList[j].name == "Icon")
|
|||
|
{
|
|||
|
var qusTrans = spriteList[j].transform.parent.Find("Quality");
|
|||
|
var lvTrans = spriteList[j].transform.parent.Find("LvBg");
|
|||
|
if (qusTrans != null && lvTrans == null)
|
|||
|
{
|
|||
|
var quaSpr = qusTrans.GetComponent<UISprite>();
|
|||
|
if (quaSpr != null && quaSpr.spriteName.Contains("pinzhikuang"))
|
|||
|
{
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Level");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var label = lvTrans.GetComponent<UILabel>();
|
|||
|
label.effectStyle = UILabel.Effect.Outline;
|
|||
|
label.effectColor = new Color(106f / 255, 26f / 255, 26f / 255, 1);
|
|||
|
}
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Num");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var label = lvTrans.GetComponent<UILabel>();
|
|||
|
label.effectStyle = UILabel.Effect.Outline;
|
|||
|
label.effectColor = new Color(39f / 255, 39f / 255, 39f / 255, 1);
|
|||
|
label.overflowMethod = UILabel.Overflow.ResizeFreely;
|
|||
|
label.pivot = UIWidget.Pivot.Right;
|
|||
|
label.alignment = NGUIText.Alignment.Automatic;
|
|||
|
var x = (int)Math.Floor(quaSpr.transform.localPosition.x + quaSpr.width / 2 * 0.8571 + 0.5f);
|
|||
|
var y = (int)Math.Floor(quaSpr.transform.localPosition.y - quaSpr.height / 2 * 0.6944 + 0.5f);
|
|||
|
lvTrans.localPosition = new Vector2(x, y);
|
|||
|
}
|
|||
|
lvTrans = spriteList[j].transform.parent.Find("Bind");
|
|||
|
if (lvTrans)
|
|||
|
{
|
|||
|
var sprite = lvTrans.GetComponent<UISprite>();
|
|||
|
var length = Math.Floor(quaSpr.height * 0.2222222f + 0.5f);
|
|||
|
sprite.height = (int)length;
|
|||
|
sprite.width = (int)length;
|
|||
|
var x = (int)Math.Floor(quaSpr.transform.localPosition.x - quaSpr.width / 2 * 0.6857 + 0.5f);
|
|||
|
var y = (int)Math.Floor(quaSpr.transform.localPosition.y - quaSpr.height / 2 * 0.6944 + 0.5f);
|
|||
|
lvTrans.localPosition = new Vector2(x, y);
|
|||
|
}
|
|||
|
var bgGo = new GameObject();
|
|||
|
if (bgGo != null)
|
|||
|
{
|
|||
|
var newBgGo = UnityEngine.Object.Instantiate(bgGo);
|
|||
|
var _spr = newBgGo.AddComponent<UISprite>();
|
|||
|
_spr.name = "LvBg";
|
|||
|
_spr.transform.localPosition = Vector3.zero;
|
|||
|
_spr.transform.rotation = Quaternion.identity;
|
|||
|
_spr.transform.localScale = Vector3.one;
|
|||
|
_spr.transform.parent = quaSpr.transform.parent;
|
|||
|
_spr.depth = spriteList[j].depth + 1;
|
|||
|
var atpath = "Assets/GameAssets/Resources/GameUI/Base/Atlas/UINewPublicAtlas/UINewPublicAtlas.prefab";
|
|||
|
var newatlas = AssetDatabase.LoadAssetAtPath<UIAtlas>(atpath);
|
|||
|
if (newatlas != null)
|
|||
|
{
|
|||
|
_spr.atlas = newatlas;
|
|||
|
_spr.spriteName = "n_z_14";
|
|||
|
_spr.width = quaSpr.width - (int)Math.Floor(6f / 70 * quaSpr.width + 0.5f);
|
|||
|
_spr.height = (int)Math.Floor(14f / 72 * quaSpr.height + 0.5f);
|
|||
|
_spr.transform.localPosition = new Vector2(quaSpr.transform.localPosition.x, quaSpr.transform.localPosition.y - (int)Math.Floor(quaSpr.height / 2 * 0.6944444 + 0.5));
|
|||
|
PrefabUtility.ReplacePrefab(newGo, go, ReplacePrefabOptions.ConnectToPrefab);
|
|||
|
GameObject.DestroyImmediate(bgGo);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
continue;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
GameObject.DestroyImmediate(newGo);
|
|||
|
}
|
|||
|
index++;
|
|||
|
}
|
|||
|
EditorUtility.ClearProgressBar();
|
|||
|
AssetDatabase.SaveAssets();
|
|||
|
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/清除进度条", false, 100)]
|
|||
|
public static void ClearProgressBar()
|
|||
|
{
|
|||
|
EditorUtility.ClearProgressBar();
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("PackageTool/Extra/清除PlayerPrefs", false, 100)]
|
|||
|
public static void ClearPlayerPrefs()
|
|||
|
{
|
|||
|
PlayerPrefs.DeleteAll();
|
|||
|
PlayerPrefs.Save();
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region //Funcell
|
|||
|
[MenuItem("Funcell/策划专用/检查窗体Z值", false, 900)]
|
|||
|
public static void CheckUIZ()
|
|||
|
{
|
|||
|
CheckZValue.Check();
|
|||
|
UnityEngine.Debug.Log("检查窗体Z值: finish!!!!!!!!!!");
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("Funcell/策划专用/检查优化场景Lightingmap", false, 900)]
|
|||
|
public static void CheckSceneLightingmap()
|
|||
|
{
|
|||
|
CheckSceneLightmap.StartCheck();
|
|||
|
UnityEngine.Debug.Log("检查优化场景Lightingmap: finish!!!!!!!!!!");
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("Funcell/策划专用/检查特效是否含有RGB的shader", false, 901)]
|
|||
|
public static void MkCheckNoRGBShader()
|
|||
|
{
|
|||
|
VFX.CheckWithoutRGBShader();
|
|||
|
UnityEngine.Debug.Log("检查特效是否含有RGB的shader: finish!!!!!!!!!!");
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("Funcell/策划专用/检查Prefab、VFX、Scene上的shader", false, 902)]
|
|||
|
public static void MkCheckResWithShader()
|
|||
|
{
|
|||
|
VFX.CheckRendererWithShader();
|
|||
|
Prefab.CheckRendererWithShader();
|
|||
|
Scene.CheckRendererWithShader();
|
|||
|
UnityEngine.Debug.Log("检查Prefab、VFX、Scene上的shader: finish!!!!!!!!!!");
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("Funcell/策划专用/替换场景中非Ares的shader", false, 903)]
|
|||
|
public static void ChangeNoneAresShaderInScenes()
|
|||
|
{
|
|||
|
Scene.ChangeShaderWithAresShader();
|
|||
|
UnityEngine.Debug.Log("替换场景中非Ares的shader: finish!!!!!!!!!!");
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("Funcell/策划专用/替换选中场景中非Ares的shader", false, 904)]
|
|||
|
public static void ChangeNoneAresShaderInScenes2()
|
|||
|
{
|
|||
|
Scene.ChangeShaderWithAresShader(AssetDatabase.GetAssetPath(Selection.objects[0]));
|
|||
|
UnityEngine.Debug.Log("替换选中场景中非Ares的shader: finish!!!!!!!!!!");
|
|||
|
|
|||
|
AssetDatabase.SaveAssets();
|
|||
|
AssetDatabase.Refresh();
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("Funcell/策划专用/优化场景高度图(size、readable)", false, 905)]
|
|||
|
public static void OptimizeSceneHeightTexture()
|
|||
|
{
|
|||
|
string sceneDirRoot = "Assets/GameAssets/RawResources/scene";
|
|||
|
var dirList = System.IO.Directory.GetDirectories(sceneDirRoot);
|
|||
|
for(int i = 0; i < dirList.Length; ++i)
|
|||
|
{
|
|||
|
dirList[i] = dirList[i].Replace("\\", "/");
|
|||
|
if (dirList[i].IndexOf("scene/map") == -1)
|
|||
|
continue;
|
|||
|
string dirName = dirList[i].Substring(dirList[i].LastIndexOf("/") + 1);
|
|||
|
string texPath = string.Format("{0}/texture/{1}.png", dirName, dirName);
|
|||
|
if (!File.Exists(texPath))
|
|||
|
continue;
|
|||
|
TextureImporter ti = TextureImporter.GetAtPath(texPath) as TextureImporter;
|
|||
|
ti.isReadable = false;
|
|||
|
}
|
|||
|
AssetDatabase.SaveAssets();
|
|||
|
AssetDatabase.Refresh();
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("Funcell/策划专用/优化指定场景高度图(size、readable)", false, 906)]
|
|||
|
public static void OptimizeScene()
|
|||
|
{
|
|||
|
string file = AssetDatabase.GetAssetPath(Selection.objects[0]);
|
|||
|
if (file.EndsWith(".png") || file.EndsWith(".jpg") || file.EndsWith(".tga"))
|
|||
|
{
|
|||
|
OptimizeSceneFile(file);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
UnityEngine.Debug.Log("请选择场景的高度图");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[MenuItem("Test/TestReadRepairRecordData", false, 906)]
|
|||
|
public static void TestReadRepairRecordData()
|
|||
|
{
|
|||
|
PathUtils.Initialize(false, 0);
|
|||
|
UnityEngine.Debug.Log(PathUtils.GetStreamingRootPath("RepairRecord.txt"));
|
|||
|
new Core.Base.RepairRecordFileData().Read();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[MenuItem("Test/testColorStr", false, 906)]
|
|||
|
public static void TestSubstringColor()
|
|||
|
{
|
|||
|
string temp = "123456[111111]sdfsdf[-]sdfsdf[222222]987654[-]456789";
|
|||
|
UnityEngine.Debug.Log(Substring(temp, 0, 3));
|
|||
|
UnityEngine.Debug.Log(Substring(temp, 2, 8));
|
|||
|
UnityEngine.Debug.Log(Substring(temp, 2, 12));
|
|||
|
UnityEngine.Debug.Log(Substring(temp, 2, 14));
|
|||
|
UnityEngine.Debug.Log(Substring(temp, 8, 10));
|
|||
|
UnityEngine.Debug.Log(Substring(temp, 8, 16));
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("Test/TestSvnUpdate", false, 906)]
|
|||
|
public static void TestSvnUpdate()
|
|||
|
{
|
|||
|
string dir = AssetDatabase.GetAssetPath(Selection.objects[0]);
|
|||
|
Tool.SVNTool.Update(dir);
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("Test/TestSvnRevert", false, 906)]
|
|||
|
public static void TestSvnRevert()
|
|||
|
{
|
|||
|
string dir = AssetDatabase.GetAssetPath(Selection.objects[0]);
|
|||
|
Tool.SVNTool.Revert(dir);
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("Test/base64文件", false, 907)]
|
|||
|
public static void TestBase64File()
|
|||
|
{
|
|||
|
var path = AssetDatabase.GetAssetPath(Selection.objects[0]);
|
|||
|
var dir = Path.GetDirectoryName(path);
|
|||
|
var ext = Path.GetExtension(path);
|
|||
|
var name = Path.GetFileNameWithoutExtension(path);
|
|||
|
|
|||
|
var str = Convert.ToBase64String(File.ReadAllBytes(path));
|
|||
|
File.WriteAllText(Path.Combine(dir, name + "_") + ext, str);
|
|||
|
AssetDatabase.SaveAssets();
|
|||
|
AssetDatabase.Refresh();
|
|||
|
}
|
|||
|
|
|||
|
public static string Substring(string displayTextWithOriginalColor, int start, int end)
|
|||
|
{
|
|||
|
List<char> subList = new List<char>();
|
|||
|
var chars = displayTextWithOriginalColor.ToCharArray();
|
|||
|
int colorTagIndex = 0;
|
|||
|
string oldColor = "";
|
|||
|
for (int i = 0; i < chars.Length; ++i)
|
|||
|
{
|
|||
|
if (chars[i] == '[' && chars[i + 1] != '[')
|
|||
|
{
|
|||
|
if (i + 2 < chars.Length)
|
|||
|
{
|
|||
|
if (chars[i + 1] == '-' && chars[i + 2] == ']')
|
|||
|
{
|
|||
|
colorTagIndex += 2;
|
|||
|
start += 2;
|
|||
|
oldColor = "";
|
|||
|
i += 2;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (IsHexChar(chars[i + 1]) &&
|
|||
|
IsHexChar(chars[i + 2]) &&
|
|||
|
IsHexChar(chars[i + 3]) &&
|
|||
|
IsHexChar(chars[i + 4]) &&
|
|||
|
IsHexChar(chars[i + 5]) &&
|
|||
|
IsHexChar(chars[i + 6]))
|
|||
|
{
|
|||
|
colorTagIndex += 7;
|
|||
|
start += i + 7;
|
|||
|
oldColor = displayTextWithOriginalColor.Substring(i, 7);
|
|||
|
i += 7;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (i - colorTagIndex == start)
|
|||
|
{
|
|||
|
subList.AddRange(oldColor.ToCharArray());
|
|||
|
subList.Add(chars[i]);
|
|||
|
}
|
|||
|
if (i - colorTagIndex > start)
|
|||
|
{
|
|||
|
if (end == -1 || i - colorTagIndex != end)
|
|||
|
{
|
|||
|
subList.Add(chars[i]);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(oldColor) && colorTagIndex > 0)
|
|||
|
subList.AddRange("[-]".ToCharArray());
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return new string(subList.ToArray());
|
|||
|
}
|
|||
|
|
|||
|
//是否16进制字符
|
|||
|
private static bool IsHexChar(char c)
|
|||
|
{
|
|||
|
return (c >= '0' && c <= '9') ||
|
|||
|
(c >= 'a' && c <= 'f') ||
|
|||
|
(c >= 'A' && c <= 'F');
|
|||
|
}
|
|||
|
|
|||
|
private static void OptimizeSceneFile(string file)
|
|||
|
{
|
|||
|
TextureImporter ti = TextureImporter.GetAtPath(file) as TextureImporter;
|
|||
|
ti.isReadable = false;
|
|||
|
ti.maxTextureSize = 512;
|
|||
|
|
|||
|
TextureImporterSettings ts = new TextureImporterSettings();
|
|||
|
ti.ReadTextureSettings(ts);
|
|||
|
ti.SetTextureSettings(ts);
|
|||
|
|
|||
|
AssetDatabase.ImportAsset(file, ImportAssetOptions.ForceUpdate);
|
|||
|
//AssetDatabase.SaveAssets();
|
|||
|
}
|
|||
|
|
|||
|
[MenuItem("Funcell/导协议", false, 908)]
|
|||
|
public static void GenProbuf()
|
|||
|
{
|
|||
|
string dir = new FileInfo("../../Tool/_Gadgets/生成协议.bat").DirectoryName;
|
|||
|
string name = "生成协议.bat";
|
|||
|
Process process = new Process();
|
|||
|
process.StartInfo.WorkingDirectory = dir;
|
|||
|
process.StartInfo.FileName = dir + "/" + name;
|
|||
|
process.StartInfo.UseShellExecute = false;
|
|||
|
process.StartInfo.RedirectStandardInput = true;
|
|||
|
process.StartInfo.RedirectStandardOutput = true;
|
|||
|
process.StartInfo.RedirectStandardError = true;
|
|||
|
process.StartInfo.CreateNoWindow = false;
|
|||
|
process.Start();
|
|||
|
string outStr = "";
|
|||
|
while ((outStr = process.StandardOutput.ReadLine()) != null)
|
|||
|
{
|
|||
|
//返回转换后的字符
|
|||
|
Console.WriteLine(outStr);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|