Files

156 lines
4.4 KiB
C#
Raw Permalink Normal View History

2025-01-25 04:38:09 +08:00
using Sirenix.Utilities.Editor;
using System;
using UnityEngine;
using Sirenix.OdinInspector.Editor;
using Sirenix.OdinInspector;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using Thousandto.Package;
namespace Thousandto.DaleSpeace
{
public class PackDll : EditorWindow
{
List<string> ConfigVer = new List<string>();
public PackDll()
{
var basePath = "../../Gamedata";
if (Directory.Exists(basePath))
{
DirectoryInfo theFolder = new DirectoryInfo(basePath);
DirectoryInfo[] files = theFolder.GetDirectories();
foreach (var item in files)
{
if (item.Name.IndexOf("Config") == -1)
continue;
ConfigVer.Add(item.Name);
}
}
}
[DetailedInfoBox("----点击查看使用详情----" , "Language 选择语言,可以多选 默认是CH " +
"Config 打包dll不导表可以不用选择目录默认是Config ")]
[ShowInInspector, DisplayAsString, PropertyOrder(-1)]
public string CurrentTime
{
get
{
GUIHelper.RequestRepaint();
return DateTime.Now.ToString();
}
}
#region //选择打包语言
[BoxGroup("Language", true, false, 0)]
public bool CH = false;
[BoxGroup("Language", true, false, 0)]
public bool TH = false;
[BoxGroup("Language", true, false, 0)]
public bool VIE = false;
[BoxGroup("Language", true, false, 0)]
public bool TW = false;
[BoxGroup("Language", true, false, 0)]
public bool EN = false;
[BoxGroup("Language", true, false, 0)]
public bool KR = false;
[BoxGroup("Language", true, false, 0)]
public bool JP = false;
#endregion
[BoxGroup("Config", true, false, 0)]
[ValueDropdown("ConfigVer")]
public string ConfigVers = "Config";
[PropertySpace(SpaceBefore = 20, SpaceAfter = 20)]
[ButtonGroup]
[GUIColor(0, 1, 0)]
[Button("打包dll带导表" , 30)]
private void HitWithConfig()
{
CheckConfigVer();
if(ConfigCode == "") ConfigCode = "1.0";
if (ConfigLan == "") ConfigLan = "CH";
Debug.Log( "配置表版本 = " + ConfigCode + " 选择的打包语言 = " + CheckLan() + " 配置文件的选择语言 = " + ConfigLan);
Package.Tool.PackageParam.CfgVer = ConfigCode;
CodeAndDllPackage.Test(CheckLan(), true, ConfigLan);
}
[PropertySpace(SpaceBefore = 20, SpaceAfter = 20) ]
[ButtonGroup]
[GUIColor(1, 0.6f, 0.4f)]
[Button("打包dll不带导表" , 30)]
private void HitWithOutConfig()
{
Debug.Log("选择的打包语言 = " + CheckLan());
CodeAndDllPackage.Test(CheckLan(), false);
}
#region //功能函数
private string CheckLan()
{
string lan = "";
if (CH)
lan = lan + "CH_";
if (TH)
lan = lan + "TH_";
if (VIE)
lan = lan + "VIE_";
if (JP)
lan = lan + "JP_";
if (TW)
lan = lan + "TW_";
if (KR)
lan = lan + "KR_";
if (EN)
lan = lan + "EN_";
if (lan == "")
lan = "CH";
if (lan.StartsWith("_"))
lan = lan.Remove(1);
if (lan.EndsWith("_"))
lan = lan.Remove(lan.Length - 1);
return lan;
}
string ConfigCode = "";
string ConfigLan = "";
private void CheckConfigVer()
{
ConfigCode = "";
ConfigLan = "";
string[] _vers = ConfigVers.Split('_');
if (_vers.Length < 3)
{
return;
}
ConfigCode = _vers[_vers.Length - 1];
for (int i = 1; i < _vers.Length - 1; i++)
{
ConfigLan = ConfigLan + _vers[i] + "_";
}
if (ConfigLan.EndsWith("_"))
{
ConfigLan = ConfigLan.Remove(ConfigLan.Length - 1);
}
}
#endregion
}
}