submodule工具修改

This commit is contained in:
zhang hongbo 2026-02-04 10:33:52 +08:00
parent e1f7ea568b
commit 6413517a4c
12 changed files with 5484 additions and 0 deletions

View File

@ -0,0 +1,5 @@
{
"TableId": 56,
"TableName": "NewAsset",
"Items": []
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ebbe77d306668684f956a5e5e6bc818f
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c3a207709ab52e44890f2994488620cc, type: 3}
m_Name: NewAsset
m_EditorClassIdentifier:
TableId: 56
TableName: NewAsset
Items: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7e690204fdb9fe74fb2d956891e429c6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,6 +3,7 @@
"Assets/Art_SubModule/Art_SO/Collections/EmojiResource.asset",
"Assets/Art_SubModule/Art_SO/Collections/HeadFrameResource.asset",
"Assets/Art_SubModule/Art_SO/Collections/HeadResource.asset",
"Assets/Art_SubModule/Art_SO/Collections/NewAsset.asset",
"Assets/Art_SubModule/Art_SO/DecorateIcon/DecorateIconResource.asset",
"Assets/Art_SubModule/Art_SO/DecorateScene/Scene10Resource.asset",
"Assets/Art_SubModule/Art_SO/DecorateScene/Scene11Resource.asset",

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a77c304dc121327428a0b43f3519b8f4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7ab35bf45404d564cb87c85fac02577f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<engine:UXML
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:engine="UnityEngine.UIElements"
xmlns:editor="UnityEditor.UIElements"
xsi:noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd">
<engine:VisualElement style="flex-grow: 1; padding: 10px;">
<!-- 状态栏 -->
<engine:VisualElement name="StatusBar" style="margin-bottom: 10px; padding: 8px; background-color: rgb(35, 35, 35); border-radius: 5px;">
<engine:Label name="StatusLabel" text="⚪ 待保存状态:无修改" style="font-size: 13px; color: rgb(100, 150, 255); -unity-text-align: middle-left;" />
</engine:VisualElement>
<!-- 顶部配置区域 -->
<engine:VisualElement name="ConfigArea" style="margin-bottom: 10px; padding: 10px; border-width: 2px; border-color: rgb(50, 50, 50); border-radius: 5px;">
<!-- 标题行:配置管理 + 核心操作按钮 + 常用工具 + 折叠按钮 -->
<engine:VisualElement style="flex-direction: row; align-items: center; margin-bottom: 10px;">
<engine:Label text="配置管理" style="font-size: 16px; -unity-font-style: bold; width: 100px;" />
<engine:Button name="LoadConfigButton" text="读取配置" style="width: 90px; height: 28px; margin-right: 5px; background-color: rgb(60, 120, 180);" />
<engine:Button name="SaveConfigButton" text="保存配置" style="width: 90px; height: 28px; margin-right: 5px; background-color: rgb(80, 140, 80);" />
<engine:Button name="RecordInitButton" text="记录初始状态" style="width: 110px; height: 28px; margin-right: 15px; background-color: rgb(180, 100, 60);" />
<!-- 常用工具(高频按钮) -->
<engine:Label text="常用工具:" style="font-size: 12px; margin-right: 5px; color: rgb(150, 200, 255);" />
<engine:Button name="SortNamesButtonTop" text="名称排序" style="width: 85px; height: 28px; margin-right: 5px; background-color: rgb(100, 80, 140);" />
<engine:Button name="ScaleImageButtonTop" text="图片X1.5" style="width: 80px; height: 28px; margin-right: 10px; background-color: rgb(100, 80, 140);" />
<engine:VisualElement style="flex-grow: 1;" />
<engine:Button name="ToggleConfigButton" text="▲ 折叠" style="width: 80px; height: 25px;" />
</engine:VisualElement>
<!-- 可折叠内容区域 -->
<engine:VisualElement name="ConfigContent">
<!-- 基础配置 -->
<engine:VisualElement style="margin-bottom: 10px; padding: 8px; background-color: rgba(0, 0, 0, 0.2); border-radius: 3px;">
<engine:VisualElement style="flex-direction: row; margin-bottom: 5px;">
<engine:Label text="配置文件路径:" style="width: 120px; -unity-text-align: middle-left;" />
<engine:TextField name="ConfigPathField" style="flex-grow: 1; margin-right: 5px;" />
<engine:Button name="BrowseConfigButton" text="浏览..." style="width: 80px;" />
</engine:VisualElement>
<engine:VisualElement style="flex-direction: row; margin-bottom: 5px;">
<engine:Label text="场景AreaId:" style="width: 120px; -unity-text-align: middle-left;" />
<engine:IntegerField name="AreaIdField" value="1" style="width: 100px;" />
<engine:Label text="步骤数量(固定):" style="width: 130px; margin-left: 20px; -unity-text-align: middle-left;" />
<engine:IntegerField name="StepCountField" value="25" style="width: 100px;" />
<engine:Label text="不可修改,如需调整请联系编辑器作者" style="margin-left: 10px; -unity-text-align: middle-left; font-size: 10px; opacity: 0.7;" />
</engine:VisualElement>
<engine:VisualElement style="flex-direction: row;">
<engine:Label text="场景bg节点:" style="width: 120px; -unity-text-align: middle-left;" />
<editor:ObjectField name="BgObjectField" type="UnityEngine.Transform, UnityEngine.CoreModule" style="flex-grow: 1; margin-right: 5px;" />
<engine:Button name="CheckBgButton" text="检测bg格式" style="width: 100px;" />
</engine:VisualElement>
</engine:VisualElement>
<!-- 批量设置 -->
<engine:Label text="批量设置" style="font-size: 13px; -unity-font-style: bold; margin-bottom: 5px; color: rgb(150, 200, 255);" />
<engine:VisualElement style="flex-direction: row; margin-bottom: 5px;">
<engine:Button name="AutoSetTitleButton" text="自动设置标题" style="flex-grow: 1; margin-right: 5px; height: 28px;" />
<engine:Button name="AutoSetIconButton" text="自动设置Icon" style="flex-grow: 1; margin-right: 5px; height: 28px;" />
<engine:Button name="BatchSetIconPosButton" text="批量Icon位置" style="flex-grow: 1; margin-right: 5px; height: 28px;" />
<engine:Button name="AutoSetBuildButton" text="自动建造效果" style="flex-grow: 1; margin-right: 5px; height: 28px;" />
<engine:Button name="AutoSetShineButton" text="全部闪光" style="flex-grow: 1; height: 28px;" />
</engine:VisualElement>
<engine:VisualElement style="flex-direction: row;">
<engine:Button name="BatchSetCostButton" text="批量资源消耗" style="flex-grow: 1; margin-right: 5px; height: 28px;" />
<engine:Button name="BatchSetSkipButton" text="批量设置批次" style="flex-grow: 1; margin-right: 5px; height: 28px;" />
<engine:Button name="ClearSceneButton" text="清空场景" style="flex-grow: 1; margin-right: 5px; height: 28px; background-color: rgb(140, 60, 60);" />
<engine:VisualElement style="flex-grow: 2;" />
</engine:VisualElement>
</engine:VisualElement>
</engine:VisualElement>
<!-- 初始状态编辑区域 -->
<engine:VisualElement style="margin-bottom: 10px; padding: 10px; border-width: 2px; border-color: rgb(50, 50, 50); border-radius: 5px;">
<!-- 标题行带折叠按钮 -->
<engine:VisualElement style="flex-direction: row; align-items: center; margin-bottom: 10px;">
<engine:Label text="初始状态编辑" style="font-size: 14px; -unity-font-style: bold; flex-grow: 1;" />
<engine:Button name="ToggleInitEditButton" text="▲ 折叠" style="width: 80px; height: 25px;" />
</engine:VisualElement>
<!-- 可折叠内容 -->
<engine:VisualElement name="InitEditContent">
<engine:Label text="点击【记录初始状态】后,可在此处编辑各对象的初始属性" style="font-size: 11px; color: rgb(150, 150, 150); margin-bottom: 8px;" />
<engine:ScrollView style="max-height: 300px; border-width: 1px; border-color: rgb(60, 60, 60); border-radius: 3px; background-color: rgba(0, 0, 0, 0.2);">
<engine:VisualElement name="InitEditContainer" style="padding: 5px;">
<engine:Label name="InitEmptyLabel" text="暂无初始状态数据" style="margin: 20px; -unity-text-align: middle-center; color: rgb(128, 128, 128);" />
</engine:VisualElement>
</engine:ScrollView>
</engine:VisualElement>
</engine:VisualElement>
<!-- 步骤操作和编辑区域(双栏布局)-->
<engine:VisualElement style="flex-direction: row; flex-grow: 1; gap: 10px;">
<!-- 左侧:步骤快速选择面板 -->
<engine:VisualElement style="width: 220px; border-width: 2px; border-color: rgb(50, 50, 50); border-radius: 5px; padding: 10px;">
<engine:Label text="步骤导航" style="font-size: 14px; -unity-font-style: bold; margin-bottom: 8px;" />
<!-- 快速跳转 -->
<engine:VisualElement style="flex-direction: row; margin-bottom: 8px; align-items: center;">
<engine:Label text="当前:" style="width: 35px; font-size: 11px;" />
<engine:IntegerField name="CurrentStepField" value="0" style="width: 50px; margin-right: 3px;" />
<engine:Button name="GotoStepButton" text="GO" style="width: 35px; height: 22px; font-size: 11px;" />
</engine:VisualElement>
<!-- 导航按钮组 -->
<engine:VisualElement style="flex-direction: row; gap: 3px; margin-bottom: 10px;">
<engine:Button name="PrevStepButton" text="◀上步" style="flex-grow: 1; height: 24px; font-size: 11px;" />
<engine:Button name="NextStepButton" text="下步▶" style="flex-grow: 1; height: 24px; font-size: 11px;" />
</engine:VisualElement>
<!-- 步骤网格4列布局-->
<engine:ScrollView style="flex-grow: 1; border-width: 1px; border-color: rgb(60, 60, 60); border-radius: 3px; background-color: rgba(0, 0, 0, 0.3);">
<engine:VisualElement name="StepGridContainer" style="padding: 5px; flex-wrap: wrap; flex-direction: row;">
<!-- 这里会动态添加25个步骤按钮每个按钮40x38像素4列布局 -->
</engine:VisualElement>
</engine:ScrollView>
<!-- 预览控制 -->
<engine:VisualElement style="margin-top: 8px; padding-top: 8px; border-top-width: 1px; border-color: rgb(60, 60, 60);">
<engine:Label name="StepInfoLabel" text="初始状态" style="margin-bottom: 5px; -unity-text-align: middle-center; font-size: 11px; color: rgb(180, 180, 180);" />
<engine:Button name="ShowDecorateButton" text="显示装饰按钮" style="width: 100%; height: 24px; margin-bottom: 3px; font-size: 11px;" />
<engine:Button name="HideDecorateButton" text="隐藏装饰按钮" style="width: 100%; height: 24px; font-size: 11px;" />
</engine:VisualElement>
</engine:VisualElement>
<!-- 右侧:步骤编辑区域 -->
<engine:ScrollView name="StepEditScrollView" style="flex-grow: 1; border-width: 2px; border-color: rgb(50, 50, 50); border-radius: 5px;">
<engine:VisualElement name="StepEditContainer" style="padding: 10px;">
<engine:Label text="步骤编辑" style="font-size: 14px; -unity-font-style: bold; margin-bottom: 10px;" />
<!-- 这里会动态添加步骤编辑项 -->
<engine:Label name="EmptyLabel" text="请先读取或创建配置" style="margin: 20px; -unity-text-align: middle-center; color: rgb(128, 128, 128);" />
</engine:VisualElement>
</engine:ScrollView>
</engine:VisualElement>
</engine:VisualElement>
</engine:UXML>

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 18e43c7ee1d33164697d9fbb1076fe3d
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

View File

@ -0,0 +1,234 @@
using UnityEditor;
using UnityEngine;
using System.IO;
using OfficeOpenXml;
/// <summary>
/// DecorateCost表格转换工具
/// 用于将Icon列的完整路径转换为只保留文件名
/// 例如: Icon/first/s1_icon_renwu_5 -> s1_icon_renwu_5
/// </summary>
public class DecorateCostTableConverter : EditorWindow
{
private string excelPath = "E:\\WorkSpace\\Docs\\config\\DecorateCost.xlsx";
private const string SHEET_NAME = "DecorateCost";
private Vector2 scrollPosition;
private string logMessage = "";
[MenuItem("蹊径/转换DecorateCost表格")]
public static void ShowWindow()
{
var window = GetWindow<DecorateCostTableConverter>("DecorateCost表格转换");
window.minSize = new Vector2(500, 400);
}
private void OnGUI()
{
GUILayout.Label("DecorateCost表格Icon路径转换工具", EditorStyles.boldLabel);
GUILayout.Space(10);
EditorGUILayout.HelpBox(
"此工具会将Icon列的完整路径转换为只保留文件名。\n" +
"例如: Icon/first/s1_icon_renwu_5 → s1_icon_renwu_5\n\n" +
"转换规则:\n" +
"• 如果Icon路径包含'/',则只保留最后一部分\n" +
"• 如果Icon路径为空或不包含'/',则保持不变\n" +
"• 如果Action列包含'init_spine',则跳过该行(不转换)\n" +
"• 会自动备份原文件(添加.backup扩展名",
MessageType.Info);
GUILayout.Space(10);
// Excel文件路径
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Excel路径:", GUILayout.Width(80));
excelPath = EditorGUILayout.TextField(excelPath);
if (GUILayout.Button("浏览", GUILayout.Width(60)))
{
string path = EditorUtility.OpenFilePanel("选择DecorateCost.xlsx", "", "xlsx");
if (!string.IsNullOrEmpty(path))
{
excelPath = path;
}
}
EditorGUILayout.EndHorizontal();
GUILayout.Space(10);
// 转换按钮
if (GUILayout.Button("开始转换", GUILayout.Height(30)))
{
ConvertTable();
}
GUILayout.Space(10);
// 日志显示区域
if (!string.IsNullOrEmpty(logMessage))
{
EditorGUILayout.LabelField("转换日志:", EditorStyles.boldLabel);
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, GUILayout.Height(200));
EditorGUILayout.TextArea(logMessage, GUILayout.ExpandHeight(true));
EditorGUILayout.EndScrollView();
}
}
private void ConvertTable()
{
logMessage = "";
// 检查文件是否存在
if (!File.Exists(excelPath))
{
logMessage = $"❌ 错误: 文件不存在\n路径: {excelPath}";
Debug.LogError(logMessage);
return;
}
try
{
// 设置EPPlus许可证
// 备份原文件
string backupPath = excelPath + ".backup";
File.Copy(excelPath, backupPath, true);
logMessage += $"✓ 已备份原文件到: {backupPath}\n\n";
// 读取Excel
using (var package = new ExcelPackage(new FileInfo(excelPath)))
{
var worksheet = package.Workbook.Worksheets[SHEET_NAME];
if (worksheet == null)
{
logMessage += $"❌ 错误: 找不到工作表 '{SHEET_NAME}'\n";
Debug.LogError(logMessage);
return;
}
// 查找Icon列的索引假设第一行是标题行
int iconColIndex = -1;
int sortIdColIndex = -1;
int actionColIndex = -1;
int totalCols = worksheet.Dimension.End.Column;
for (int col = 1; col <= totalCols; col++)
{
var cellValue = worksheet.Cells[1, col].Text.Trim();
if (cellValue == "Icon" || cellValue == "图标")
{
iconColIndex = col;
}
else if (cellValue == "SortId" || cellValue == "排序Id")
{
sortIdColIndex = col;
}
else if (cellValue == "Action" || cellValue == "行为")
{
actionColIndex = col;
}
}
if (iconColIndex == -1)
{
logMessage += "❌ 错误: 找不到Icon列\n";
Debug.LogError(logMessage);
return;
}
logMessage += $"✓ 找到Icon列: 第{iconColIndex}列\n";
if (sortIdColIndex != -1)
{
logMessage += $"✓ 找到SortId列: 第{sortIdColIndex}列\n";
}
if (actionColIndex != -1)
{
logMessage += $"✓ 找到Action列: 第{actionColIndex}列\n";
}
logMessage += "\n开始转换...\n\n";
int totalRows = worksheet.Dimension.End.Row;
int convertedCount = 0;
int skippedCount = 0;
int emptyCount = 0;
int spineSkippedCount = 0;
// 从第3行开始处理第1行是英文标题第2行是中文标题
for (int row = 3; row <= totalRows; row++)
{
var iconCell = worksheet.Cells[row, iconColIndex];
string originalIcon = iconCell.Text.Trim();
if (string.IsNullOrEmpty(originalIcon))
{
emptyCount++;
continue;
}
// 检查Action列是否包含init_spine
bool hasInitSpine = false;
if (actionColIndex != -1)
{
var actionCell = worksheet.Cells[row, actionColIndex];
string actionValue = actionCell.Text.Trim();
if (!string.IsNullOrEmpty(actionValue) && actionValue.Contains("init_spine"))
{
hasInitSpine = true;
}
}
// 如果包含init_spine跳过这一行
if (hasInitSpine)
{
spineSkippedCount++;
logMessage += $"第{row}行: 跳过(包含init_spine): {originalIcon}\n";
continue;
}
// 如果包含'/',则只保留最后一部分
if (originalIcon.Contains("/"))
{
string newIcon = originalIcon.Substring(originalIcon.LastIndexOf('/') + 1);
iconCell.Value = newIcon;
string sortInfo = "";
if (sortIdColIndex != -1)
{
var sortIdCell = worksheet.Cells[row, sortIdColIndex];
sortInfo = $" [SortId={sortIdCell.Text}]";
}
logMessage += $"第{row}行{sortInfo}: {originalIcon} → {newIcon}\n";
convertedCount++;
}
else
{
skippedCount++;
}
}
// 保存修改
package.Save();
logMessage += $"\n转换完成\n";
logMessage += $"━━━━━━━━━━━━━━━━━━━━━━\n";
logMessage += $"✓ 已转换: {convertedCount} 条\n";
logMessage += $"• 跳过(无需转换): {skippedCount} 条\n";
logMessage += $"• 跳过(init_spine): {spineSkippedCount} 条\n";
logMessage += $"• 空值: {emptyCount} 条\n";
logMessage += $"━━━━━━━━━━━━━━━━━━━━━━\n";
logMessage += $"✓ 文件已保存: {excelPath}\n";
Debug.Log("DecorateCost表格转换完成");
EditorUtility.DisplayDialog("转换完成",
$"Icon路径转换完成\n\n已转换: {convertedCount} 条\n跳过(无需转换): {skippedCount} 条\n跳过(init_spine): {spineSkippedCount} 条\n空值: {emptyCount} 条\n\n原文件已备份",
"确定");
}
}
catch (System.Exception ex)
{
logMessage += $"\n❌ 转换失败:\n{ex.Message}\n\n{ex.StackTrace}";
Debug.LogError($"转换失败: {ex.Message}");
EditorUtility.DisplayDialog("转换失败", $"转换过程中出现错误:\n\n{ex.Message}", "确定");
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 26d566349ea253e4ca0d63d21018f9e5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: