UI界面工具
This commit is contained in:
parent
d1270a5565
commit
4d6e0dbe45
@ -16,95 +16,56 @@ using System.Text.RegularExpressions;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using UnityEditor.PackageManager.UI;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class FrameCodeGenerate
|
||||
{
|
||||
public enum ComponentType
|
||||
{
|
||||
Image,
|
||||
Go,
|
||||
Btn,
|
||||
BtnEx,
|
||||
Text,
|
||||
SRContent,
|
||||
ScrollRect,
|
||||
Animator,
|
||||
Trans,
|
||||
}
|
||||
private static string templeteBaseFileName = Application.dataPath + $"/Ether/Editor/Frames/FrameBaseTemplete.txt";
|
||||
|
||||
private static Dictionary<ComponentType, string> relationDic = new Dictionary<ComponentType, string>()
|
||||
public static string GenerateFrameBaseCode(string prefabPath, string baseDirectoryPath, Dictionary<string, string> componentTypeDic)
|
||||
{
|
||||
{ ComponentType.Image, "Image" },
|
||||
{ ComponentType.Go, "GameObject" },
|
||||
{ ComponentType.Trans, "Transform" },
|
||||
{ ComponentType.Btn, "Button" },
|
||||
{ ComponentType.BtnEx, "ButtonEx" },
|
||||
{ ComponentType.Text, "TextMeshProUGUI" },
|
||||
{ ComponentType.SRContent, "ScrollContent" },
|
||||
{ ComponentType.ScrollRect, "ScrollRect" },
|
||||
{ ComponentType.Animator, "Animator" },
|
||||
};
|
||||
// 加载预制体
|
||||
GameObject prefab = AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath);
|
||||
|
||||
[MenuItem("Assets/生成FrameBase(=-=)", false, 19)]
|
||||
private static void CodeGenerate()
|
||||
{
|
||||
GameObject selectedPrefab = Selection.activeGameObject;
|
||||
if (selectedPrefab != null && PrefabUtility.IsPartOfAnyPrefab(selectedPrefab))
|
||||
if (prefab && PrefabUtility.IsPartOfAnyPrefab(prefab))
|
||||
{
|
||||
Transform[] childs = prefab.GetComponentsInChildren<Transform>(true);
|
||||
|
||||
Transform[] childs = selectedPrefab.GetComponentsInChildren<Transform>(true);
|
||||
|
||||
Dictionary<string, (string, List<ComponentType>)> componentDic = new Dictionary<string, (string, List<ComponentType>)>();
|
||||
// 子物体路径 子物体名称 组件列表
|
||||
Dictionary<string, (string, List<string>)> componentDic = new Dictionary<string, (string, List<string>)>();
|
||||
|
||||
foreach (Transform child in childs)
|
||||
{
|
||||
if (child.name == selectedPrefab.name)
|
||||
if (child.name == prefab.name)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
(string, List<ComponentType>) childComponent = CheckClildName(child);
|
||||
(string, List<string>) childComponent = CheckClildName(child, componentTypeDic);
|
||||
string childPath = GetChildPath(child);
|
||||
if (!componentDic.ContainsKey(childPath))
|
||||
{
|
||||
componentDic.Add(childPath, childComponent);
|
||||
}
|
||||
|
||||
}
|
||||
GenerateFrameBase(prefabPath, baseDirectoryPath, componentTypeDic, componentDic);
|
||||
}
|
||||
|
||||
GenerateFrameBase(selectedPrefab, componentDic);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("当前没有选中预制体!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
[MenuItem("Assets/生成FrameBase(=-=)", true, 19)]
|
||||
public static bool CodeGenerateShow()
|
||||
{
|
||||
GameObject selectedPrefab = Selection.activeGameObject;
|
||||
if (selectedPrefab != null && PrefabUtility.IsPartOfAnyPrefab(selectedPrefab))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查子物体的名字,获取对应的组件
|
||||
/// </summary>
|
||||
/// <param name="child"></param>
|
||||
/// <returns></returns>
|
||||
private static (string, List<ComponentType>) CheckClildName(Transform child)
|
||||
private static (string, List<string>) CheckClildName(Transform child, Dictionary<string, string> componentTypeDic)
|
||||
{
|
||||
string input = child.name;
|
||||
string pattern = @"<(.*?)>";
|
||||
|
||||
List<ComponentType> childTypeList = new List<ComponentType>();
|
||||
List<string> childTypeList = new List<string>();
|
||||
string childName = input;
|
||||
|
||||
MatchCollection matches = Regex.Matches(input, pattern);
|
||||
@ -113,18 +74,16 @@ namespace Ether
|
||||
childName = childName.Replace(match.Groups[0].Value, "");
|
||||
string content = match.Groups[1].Value;
|
||||
|
||||
if (Enum.TryParse(content, out ComponentType parsedEnum))
|
||||
if (componentTypeDic.ContainsKey(content))
|
||||
{
|
||||
if (Enum.IsDefined(typeof(ComponentType), parsedEnum))
|
||||
{
|
||||
childTypeList.Add(parsedEnum);
|
||||
}
|
||||
childTypeList.Add(content);
|
||||
}
|
||||
}
|
||||
|
||||
return (childName, childTypeList);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取子物体的路径
|
||||
/// </summary>
|
||||
@ -150,75 +109,10 @@ namespace Ether
|
||||
return path;
|
||||
}
|
||||
|
||||
private static string templeteFileName = Application.dataPath + $"/Ether/Editor/Frames/FrameTemplete.txt";
|
||||
|
||||
/// <summary>
|
||||
/// 生成FrameBase
|
||||
/// </summary>
|
||||
/// <param name="componentDic"></param>
|
||||
private static void GenerateFrameBase(GameObject selectedPrefab, Dictionary<string, (string, List<ComponentType>)> componentDic)
|
||||
private static void GenerateFrameBase(string prefabPath, string baseDirectoryPath, Dictionary<string, string> componentTypeDic, Dictionary<string, (string, List<string>)> componentDic)
|
||||
{
|
||||
string selectPath = AssetDatabase.GetAssetPath(selectedPrefab);
|
||||
string framePart = "Prefabs";
|
||||
string relativePrefabPath = PathTools.GetRelativePathToResources(prefabPath);
|
||||
|
||||
int selectIndex = selectPath.IndexOf(framePart);
|
||||
string framePrefabPath = selectPath.Substring(selectIndex).Replace(".prefab", "");
|
||||
|
||||
Debug.Log($"selectPath:{selectPath}");
|
||||
|
||||
string frameTemplete = FileTools.ReadFile(templeteFileName);
|
||||
|
||||
Debug.Log(frameTemplete);
|
||||
|
||||
(string, string) generateComponentCode = GenerateComponentCodeStr(componentDic);
|
||||
|
||||
string pattern = @"\$(.*?)\$";
|
||||
|
||||
MatchCollection matches = Regex.Matches(frameTemplete, pattern);
|
||||
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
string property = match.Groups[0].Value; //带$的原字符串
|
||||
string content = match.Groups[1].Value; //仅两个$中的内容
|
||||
|
||||
string replaceStr = "";
|
||||
|
||||
switch (content)
|
||||
{
|
||||
case "FrameBaseName":
|
||||
replaceStr = $"{selectedPrefab.name}Base";
|
||||
break;
|
||||
case "PrefabPath":
|
||||
replaceStr = framePrefabPath;
|
||||
break;
|
||||
case "PropertyList":
|
||||
replaceStr = generateComponentCode.Item1;
|
||||
break;
|
||||
case "PropertyInitList":
|
||||
replaceStr = generateComponentCode.Item2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//Debug.Log(content);
|
||||
|
||||
frameTemplete = frameTemplete.Replace(property, replaceStr);
|
||||
}
|
||||
|
||||
string basePath = Application.dataPath + $"/Scripts/AutoGenerated/FrameBase/{selectedPrefab.name}Base.cs";
|
||||
|
||||
if (File.Exists(basePath)) File.Delete(basePath);
|
||||
|
||||
FileTools.WriteFile(basePath, frameTemplete);
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
private static (string, string) GenerateComponentCodeStr(Dictionary<string, (string, List<ComponentType>)> componentDic)
|
||||
{
|
||||
string define = "";
|
||||
string code = "";
|
||||
|
||||
@ -230,9 +124,9 @@ namespace Ether
|
||||
foreach (var type in component.Value.Item2)
|
||||
{
|
||||
string tempType;
|
||||
if (relationDic.ContainsKey(type))
|
||||
if (componentTypeDic.ContainsKey(type))
|
||||
{
|
||||
tempType = relationDic[type];
|
||||
tempType = componentTypeDic[type];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -242,27 +136,228 @@ namespace Ether
|
||||
code += GetCodeByComponentType(type, tempType, name, component.Key);
|
||||
}
|
||||
}
|
||||
string tempFileStr = FileTools.ReadFile(templeteBaseFileName);
|
||||
|
||||
return (define, code);
|
||||
if (!string.IsNullOrEmpty(tempFileStr))
|
||||
{
|
||||
tempFileStr = tempFileStr.Replace("$FrameBaseName$", $"{Path.GetFileNameWithoutExtension(prefabPath)}Base");
|
||||
tempFileStr = tempFileStr.Replace("$PrefabPath$", relativePrefabPath);
|
||||
tempFileStr = tempFileStr.Replace("$PropertyList$", define);
|
||||
tempFileStr = tempFileStr.Replace("$PropertyInitList$", code);
|
||||
|
||||
string basePath = $"{Application.dataPath}/{baseDirectoryPath}/{Path.GetFileNameWithoutExtension(prefabPath)}Base.cs";
|
||||
|
||||
if (File.Exists(basePath)) File.Delete(basePath);
|
||||
|
||||
FileTools.WriteFile(basePath, tempFileStr);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetCodeByComponentType(ComponentType type, string componentName, string name, string path)
|
||||
private static string GetCodeByComponentType(string type, string componentName, string name, string path)
|
||||
{
|
||||
string code = "";
|
||||
switch (type)
|
||||
if (type == "Go")
|
||||
{
|
||||
case ComponentType.Go:
|
||||
code = $"_{type}{name} = GetChild(\"{path}\").gameObject;\n\t\t\t";
|
||||
break;
|
||||
case ComponentType.Image:
|
||||
case ComponentType.Btn:
|
||||
case ComponentType.BtnEx:
|
||||
case ComponentType.Text:
|
||||
default:
|
||||
code = $"_{type}{name} = GetComponent<{componentName}>(\"{path}\");\n\t\t\t";
|
||||
break;
|
||||
code = $"_{type}{name} = GetChild(\"{path}\").gameObject;\n\t\t\t";
|
||||
}
|
||||
else
|
||||
{
|
||||
code = $"_{type}{name} = GetComponent<{componentName}>(\"{path}\");\n\t\t\t";
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
[MenuItem("Assets/生成FrameBase(=-=)", false, 19)]
|
||||
private static void CodeGenerate()
|
||||
{
|
||||
GameObject selectedPrefab = Selection.activeGameObject;
|
||||
if (selectedPrefab != null && PrefabUtility.IsPartOfAnyPrefab(selectedPrefab))
|
||||
{
|
||||
//string tempPath = AssetDatabase.GetAssetPath(selectedPrefab);
|
||||
//if (tempPath.StartsWith("Assets"))
|
||||
//{
|
||||
// tempPath = tempPath.Replace("Assets/", "");
|
||||
//}
|
||||
string prefabPath = AssetDatabase.GetAssetPath(selectedPrefab); //Path.Combine(Application.dataPath, tempPath);
|
||||
|
||||
string basePath = "";
|
||||
|
||||
Dictionary<string, string> componentTypeDic;
|
||||
|
||||
if (FileTools.ReadFileForJson<FrameEditorCfg>(PathTools.FrameEditorCfgPath, out var editorCfg))
|
||||
{
|
||||
basePath = editorCfg.frameBaseScriptPath;
|
||||
componentTypeDic = editorCfg.componentTypeDic;
|
||||
GenerateFrameBaseCode(prefabPath, basePath, componentTypeDic);
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("请先设置界面配置");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("当前没有选中预制体!");
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("Assets/生成FrameBase(=-=)", true, 19)]
|
||||
public static bool CodeGenerateShow()
|
||||
{
|
||||
GameObject selectedPrefab = Selection.activeGameObject;
|
||||
if (selectedPrefab != null && PrefabUtility.IsPartOfAnyPrefab(selectedPrefab))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//=================================== 以下是老代码 =========================================
|
||||
//public enum ComponentType
|
||||
//{
|
||||
// Image,
|
||||
// Go,
|
||||
// Btn,
|
||||
// BtnEx,
|
||||
// Text,
|
||||
// SRContent,
|
||||
// ScrollRect,
|
||||
// Animator,
|
||||
// Trans,
|
||||
//}
|
||||
|
||||
//private static Dictionary<ComponentType, string> relationDic = new Dictionary<ComponentType, string>()
|
||||
//{
|
||||
// { ComponentType.Image, "Image" },
|
||||
// { ComponentType.Go, "GameObject" },
|
||||
// { ComponentType.Trans, "Transform" },
|
||||
// { ComponentType.Btn, "Button" },
|
||||
// { ComponentType.BtnEx, "ButtonEx" },
|
||||
// { ComponentType.Text, "TextMeshProUGUI" },
|
||||
// { ComponentType.SRContent, "ScrollContent" },
|
||||
// { ComponentType.ScrollRect, "ScrollRect" },
|
||||
// { ComponentType.Animator, "Animator" },
|
||||
//};
|
||||
|
||||
//private static string templeteFileName = Application.dataPath + $"/Ether/Editor/Frames/FrameBaseTemplete.txt";
|
||||
|
||||
///// <summary>
|
||||
///// 生成FrameBase
|
||||
///// </summary>
|
||||
///// <param name="componentDic"></param>
|
||||
//private static void GenerateFrameBase(GameObject selectedPrefab, Dictionary<string, (string, List<ComponentType>)> componentDic)
|
||||
//{
|
||||
// string selectPath = AssetDatabase.GetAssetPath(selectedPrefab);
|
||||
// string framePart = "Prefabs";
|
||||
|
||||
// int selectIndex = selectPath.IndexOf(framePart);
|
||||
// string framePrefabPath = selectPath.Substring(selectIndex).Replace(".prefab", "");
|
||||
|
||||
// Debug.Log($"selectPath:{selectPath}");
|
||||
|
||||
// string frameTemplete = FileTools.ReadFile(templeteFileName);
|
||||
|
||||
// Debug.Log(frameTemplete);
|
||||
|
||||
// (string, string) generateComponentCode = GenerateComponentCodeStr(componentDic);
|
||||
|
||||
// string pattern = @"\$(.*?)\$";
|
||||
|
||||
// MatchCollection matches = Regex.Matches(frameTemplete, pattern);
|
||||
|
||||
// foreach (Match match in matches)
|
||||
// {
|
||||
// string property = match.Groups[0].Value; //带$的原字符串
|
||||
// string content = match.Groups[1].Value; //仅两个$中的内容
|
||||
|
||||
// string replaceStr = "";
|
||||
|
||||
// switch (content)
|
||||
// {
|
||||
// case "FrameBaseName":
|
||||
// replaceStr = $"{selectedPrefab.name}Base";
|
||||
// break;
|
||||
// case "PrefabPath":
|
||||
// replaceStr = framePrefabPath;
|
||||
// break;
|
||||
// case "PropertyList":
|
||||
// replaceStr = generateComponentCode.Item1;
|
||||
// break;
|
||||
// case "PropertyInitList":
|
||||
// replaceStr = generateComponentCode.Item2;
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
|
||||
// //Debug.Log(content);
|
||||
|
||||
// frameTemplete = frameTemplete.Replace(property, replaceStr);
|
||||
// }
|
||||
|
||||
// string basePath = Application.dataPath + $"/Scripts/AutoGenerated/FrameBase/{selectedPrefab.name}Base.cs";
|
||||
|
||||
// if (File.Exists(basePath)) File.Delete(basePath);
|
||||
|
||||
// FileTools.WriteFile(basePath, frameTemplete);
|
||||
|
||||
// AssetDatabase.Refresh();
|
||||
// return;
|
||||
|
||||
//}
|
||||
|
||||
//private static (string, string) GenerateComponentCodeStr(Dictionary<string, (string, List<ComponentType>)> componentDic)
|
||||
//{
|
||||
// string define = "";
|
||||
// string code = "";
|
||||
|
||||
// string name = "";
|
||||
// foreach (var component in componentDic)
|
||||
// {
|
||||
// name = component.Value.Item1;
|
||||
|
||||
// foreach (var type in component.Value.Item2)
|
||||
// {
|
||||
// string tempType;
|
||||
// if (relationDic.ContainsKey(type))
|
||||
// {
|
||||
// tempType = relationDic[type];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// tempType = type.ToString();
|
||||
// }
|
||||
// define += $"protected {tempType} _{type}{name};\n\t\t";
|
||||
// code += GetCodeByComponentType(type, tempType, name, component.Key);
|
||||
// }
|
||||
// }
|
||||
|
||||
// return (define, code);
|
||||
//}
|
||||
|
||||
//private static string GetCodeByComponentType(ComponentType type, string componentName, string name, string path)
|
||||
//{
|
||||
// string code = "";
|
||||
// switch (type)
|
||||
// {
|
||||
// case ComponentType.Go:
|
||||
// code = $"_{type}{name} = GetChild(\"{path}\").gameObject;\n\t\t\t";
|
||||
// break;
|
||||
// case ComponentType.Image:
|
||||
// case ComponentType.Btn:
|
||||
// case ComponentType.BtnEx:
|
||||
// case ComponentType.Text:
|
||||
// default:
|
||||
// code = $"_{type}{name} = GetComponent<{componentName}>(\"{path}\");\n\t\t\t";
|
||||
// break;
|
||||
// }
|
||||
// return code;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
19
client/Assets/Ether/Editor/Frames/FrameEditor.cs
Normal file
19
client/Assets/Ether/Editor/Frames/FrameEditor.cs
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class FrameEditor
|
||||
{
|
||||
//[MenuItem("工具/界面/新建UI界面")]
|
||||
//public static void CreateFrame()
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
11
client/Assets/Ether/Editor/Frames/FrameEditor.cs.meta
Normal file
11
client/Assets/Ether/Editor/Frames/FrameEditor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6a3eab5541b58f42b422db2ba7d145b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
1
client/Assets/Ether/Editor/Frames/FrameEditorCfg.json
Normal file
1
client/Assets/Ether/Editor/Frames/FrameEditorCfg.json
Normal file
@ -0,0 +1 @@
|
||||
{"framePrefabPath":"Resources/Prefabs/Frames","frameScriptPath":"Scripts/Frame","frameBaseScriptPath":"Scripts/AutoGenerated/FrameBase","componentTypeDic":{"BtnEx":"ButtonEx","Btn":"Btn","Image":"Image","Go":"GameObject","Trans":"Transform","Text":"TextMeshProUGUI","SRContent":"ScrollContent","ScrollRect":"ScrollRect","Animator":"Animator"}}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 175d42a1e8373b94d84e5e51dd7a5d86
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
238
client/Assets/Ether/Editor/Frames/FrameEditorWindow.cs
Normal file
238
client/Assets/Ether/Editor/Frames/FrameEditorWindow.cs
Normal file
@ -0,0 +1,238 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using Sirenix.OdinInspector.Editor;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEditor.PackageManager.UI;
|
||||
using Sirenix.OdinInspector;
|
||||
using System.IO;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class FrameEditorWindow : OdinEditorWindow
|
||||
{
|
||||
|
||||
private static string templeteFramePrefabPath = Application.dataPath + $"/Ether/Editor/Frames/TempFrame.prefab"; //预制体模板路径
|
||||
|
||||
static FrameEditorWindow window;
|
||||
|
||||
[MenuItem("工具/界面/UI界面设置 %/")]
|
||||
//[Shortcut("打开全局配置", KeyCode.F1)]
|
||||
private static void OpenWindow()
|
||||
{
|
||||
window = GetWindow<FrameEditorWindow>();
|
||||
window.titleContent = new GUIContent("UI界面设置");
|
||||
window.Show();
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
if (!window)
|
||||
{
|
||||
window = GetWindow<FrameEditorWindow>();
|
||||
}
|
||||
if (FileTools.ReadFileForJson<FrameEditorCfg>(PathTools.FrameEditorCfgPath, out var editorCfg))
|
||||
{
|
||||
framePrefabPath = editorCfg.framePrefabPath;
|
||||
frameScriptPath = editorCfg.frameScriptPath;
|
||||
frameBaseScriptPath = editorCfg.frameBaseScriptPath;
|
||||
componentTypeDic = editorCfg.componentTypeDic;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Frame路径设置")]
|
||||
|
||||
[FolderPath(ParentFolder = "Assets"), PropertyOrder(0)]
|
||||
[OnValueChanged(nameof(OnFolderPathChanged))]
|
||||
[LabelText("预制体路径")]
|
||||
public string framePrefabPath = "";
|
||||
|
||||
[FolderPath(ParentFolder = "Assets"), PropertyOrder(1)]
|
||||
[OnValueChanged(nameof(OnFolderPathChanged))]
|
||||
[LabelText("Frame路径")]
|
||||
public string frameScriptPath = "";
|
||||
|
||||
[FolderPath(ParentFolder = "Assets"), PropertyOrder(2)]
|
||||
[OnValueChanged(nameof(OnFolderPathChanged))]
|
||||
[LabelText("FrameBase路径")]
|
||||
public string frameBaseScriptPath = "";
|
||||
|
||||
private void OnFolderPathChanged()
|
||||
{
|
||||
if (FileTools.WriteFileForJson<FrameEditorCfg>(PathTools.FrameEditorCfgPath, new FrameEditorCfg()
|
||||
{
|
||||
framePrefabPath = framePrefabPath,
|
||||
frameScriptPath = frameScriptPath,
|
||||
frameBaseScriptPath = frameBaseScriptPath,
|
||||
componentTypeDic = componentTypeDic
|
||||
}))
|
||||
{
|
||||
window.ShowNotification(new GUIContent("已保存当前配置!"));
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
[Space(20)]
|
||||
|
||||
[Header("组件类型映射表")]
|
||||
[DictionaryDrawerSettings(KeyLabel = "组件简称", ValueLabel = "组件全称")]
|
||||
[ShowInInspector]
|
||||
[OnValueChanged(nameof(OnFolderPathChanged))]
|
||||
[LabelText("组件列表")]
|
||||
[PropertyOrder(3)]
|
||||
public Dictionary<string, string> componentTypeDic = new Dictionary<string, string>();
|
||||
|
||||
[Button("保存配置", ButtonSizes.Medium)]
|
||||
[PropertyOrder(4)]
|
||||
public void OnComponentTypeChanged()
|
||||
{
|
||||
OnFolderPathChanged();
|
||||
}
|
||||
|
||||
[Space(20)]
|
||||
|
||||
[Header("Frame创建")]
|
||||
|
||||
[LabelText("系统名称")]
|
||||
[PropertyOrder(10)]
|
||||
public string createSystemName;
|
||||
|
||||
[LabelText("界面名称")]
|
||||
[PropertyOrder(11)]
|
||||
public string createFrameName;
|
||||
|
||||
[Button("创建界面", ButtonSizes.Medium)]
|
||||
[PropertyOrder(12)]
|
||||
private void CreateFrame()
|
||||
{
|
||||
//创建Prefab
|
||||
string prefabPath = $"{Application.dataPath}/{framePrefabPath}/{createSystemName}/{createFrameName}.prefab";
|
||||
if (!File.Exists(prefabPath))
|
||||
{
|
||||
string directoryPath = $"{Application.dataPath}/{framePrefabPath}/{createSystemName}/";
|
||||
if (!Directory.Exists(directoryPath))
|
||||
{
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
}
|
||||
File.Copy(templeteFramePrefabPath, prefabPath, true);
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
//创建FrameBase
|
||||
prefabPath = "Assets" + prefabPath.Substring(Application.dataPath.Length);
|
||||
FrameCodeGenerate.GenerateFrameBaseCode(prefabPath, frameBaseScriptPath, componentTypeDic);
|
||||
|
||||
//创建Frame
|
||||
string framePath = $"{Application.dataPath}/{frameScriptPath}/{createSystemName}/{createFrameName}.cs";
|
||||
|
||||
if (!File.Exists(framePath))
|
||||
{
|
||||
string directoryPath = $"{Application.dataPath}/{frameScriptPath}/{createSystemName}/";
|
||||
if (!Directory.Exists(directoryPath))
|
||||
{
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
}
|
||||
TempTools.GenerateClass(createFrameName, $"{createFrameName}Base", "", framePath);
|
||||
|
||||
}
|
||||
|
||||
window.ShowNotification(new GUIContent("创建界面成功!"));
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
//打开预制体
|
||||
PrefabStageUtility.OpenPrefab(prefabPath);
|
||||
|
||||
|
||||
//选中界面脚本
|
||||
// 将脚本路径转换为GUID
|
||||
string guid = AssetDatabase.AssetPathToGUID($"Assets/{frameScriptPath}/{createSystemName}/{createFrameName}.cs");
|
||||
|
||||
// 如果找到了对应的GUID
|
||||
if (!string.IsNullOrEmpty(guid))
|
||||
{
|
||||
// 使用GUID获取asset路径
|
||||
string assetPath = AssetDatabase.GUIDToAssetPath(guid);
|
||||
|
||||
// 选中该asset
|
||||
Selection.activeObject = AssetDatabase.LoadAssetAtPath<Object>(assetPath);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Space(20)]
|
||||
|
||||
[Header("Frame删除")]
|
||||
|
||||
[LabelText("系统名称")]
|
||||
[PropertyOrder(15)]
|
||||
public string deleteSystemName;
|
||||
|
||||
[LabelText("界面名称")]
|
||||
[PropertyOrder(16)]
|
||||
public string deleteFrameName;
|
||||
[Button("删除界面", ButtonSizes.Medium)]
|
||||
[PropertyOrder(17)]
|
||||
private void DeleteFrame()
|
||||
{
|
||||
string prefabPath = $"{Application.dataPath}/{framePrefabPath}/{deleteSystemName}/{deleteFrameName}.prefab";
|
||||
if (File.Exists(prefabPath))
|
||||
{
|
||||
File.Delete(prefabPath);
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
string frameBasePath = $"{Application.dataPath}/{frameBaseScriptPath}/{deleteSystemName}/{deleteFrameName}.cs";
|
||||
if (File.Exists(frameBasePath))
|
||||
{
|
||||
File.Delete(frameBasePath);
|
||||
}
|
||||
|
||||
string framePath = $"{Application.dataPath}/{frameScriptPath}/{deleteSystemName}/{deleteFrameName}.cs";
|
||||
if (File.Exists(framePath))
|
||||
{
|
||||
File.Delete(framePath);
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
string directoryPath = $"Assets/{framePrefabPath}/{deleteSystemName}";
|
||||
if (FileTools.CheckIfDirectoryIsEmpty(directoryPath))
|
||||
{
|
||||
Directory.Delete(directoryPath);
|
||||
if (File.Exists(directoryPath + ".meta"))
|
||||
{
|
||||
File.Delete(directoryPath + ".meta");
|
||||
}
|
||||
}
|
||||
|
||||
directoryPath = $"Assets/{frameScriptPath}/{deleteSystemName}";
|
||||
if (FileTools.CheckIfDirectoryIsEmpty(directoryPath))
|
||||
{
|
||||
Directory.Delete(directoryPath);
|
||||
if (File.Exists(directoryPath + ".meta"))
|
||||
{
|
||||
File.Delete(directoryPath + ".meta");
|
||||
}
|
||||
}
|
||||
|
||||
window.ShowNotification(new GUIContent("删除界面成功!"));
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class FrameEditorCfg
|
||||
{
|
||||
public string framePrefabPath;
|
||||
public string frameScriptPath;
|
||||
public string frameBaseScriptPath;
|
||||
|
||||
public Dictionary<string, string> componentTypeDic = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
}
|
11
client/Assets/Ether/Editor/Frames/FrameEditorWindow.cs.meta
Normal file
11
client/Assets/Ether/Editor/Frames/FrameEditorWindow.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7210f7ace53d37944ba10f0b34b30f08
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
113
client/Assets/Ether/Editor/Frames/TempFrame.prefab
Normal file
113
client/Assets/Ether/Editor/Frames/TempFrame.prefab
Normal file
@ -0,0 +1,113 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1703080056135353327
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5211158822168324289}
|
||||
m_Layer: 0
|
||||
m_Name: TempFrame
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5211158822168324289
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1703080056135353327}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5802661914892923637}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &4372829903781501600
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5802661914892923637}
|
||||
- component: {fileID: 5459735667113016427}
|
||||
- component: {fileID: 7219598427896711725}
|
||||
m_Layer: 0
|
||||
m_Name: Bg
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5802661914892923637
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4372829903781501600}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5211158822168324289}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5459735667113016427
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4372829903781501600}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7219598427896711725
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4372829903781501600}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
7
client/Assets/Ether/Editor/Frames/TempFrame.prefab.meta
Normal file
7
client/Assets/Ether/Editor/Frames/TempFrame.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91f94925d94e06d4d819f1f34c35058a
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Editor/Templete.meta
Normal file
8
client/Assets/Ether/Editor/Templete.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eeb473c3562f27a45ad17e243b207d09
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
12
client/Assets/Ether/Editor/Templete/TempClass.txt
Normal file
12
client/Assets/Ether/Editor/Templete/TempClass.txt
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class $ClassName$ : $BaseClassName$
|
||||
{
|
||||
$Content$
|
||||
}
|
||||
}
|
7
client/Assets/Ether/Editor/Templete/TempClass.txt.meta
Normal file
7
client/Assets/Ether/Editor/Templete/TempClass.txt.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 496cc31fa5cad6548af4a386511db62b
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Editor/Templete/TempEnum.txt
Normal file
8
client/Assets/Ether/Editor/Templete/TempEnum.txt
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public enum $EnumName$
|
||||
{
|
||||
$Content$
|
||||
}
|
||||
}
|
7
client/Assets/Ether/Editor/Templete/TempEnum.txt.meta
Normal file
7
client/Assets/Ether/Editor/Templete/TempEnum.txt.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 482b64f193aff83419aac21b7dc219dd
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
23
client/Assets/Ether/Editor/Templete/TempTools.cs
Normal file
23
client/Assets/Ether/Editor/Templete/TempTools.cs
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public static class TempTools
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成类
|
||||
/// </summary>
|
||||
public static void GenerateClass(string className, string baseClassName, string content, string generatePath)
|
||||
{
|
||||
string tempClassStr = FileTools.ReadFile(PathTools.TempClassPath);
|
||||
tempClassStr = tempClassStr.Replace("$ClassName$", className);
|
||||
tempClassStr = tempClassStr.Replace("$BaseClassName$", baseClassName);
|
||||
tempClassStr = tempClassStr.Replace("$Content$", content);
|
||||
|
||||
FileTools.WriteFile(generatePath, tempClassStr);
|
||||
}
|
||||
}
|
||||
}
|
11
client/Assets/Ether/Editor/Templete/TempTools.cs.meta
Normal file
11
client/Assets/Ether/Editor/Templete/TempTools.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91397027642d14e489b44fd46b30e63d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -15,12 +15,12 @@ using UnityEngine;
|
||||
public class SceneEditor : OdinEditorWindow
|
||||
{
|
||||
|
||||
[MenuItem("工具/场景/场景设置")]
|
||||
[Shortcut("场景设置", KeyCode.F6)]
|
||||
[MenuItem("工具/场景/场景跳转设置")]
|
||||
[Shortcut("场景跳转设置", KeyCode.F6)]
|
||||
private static void OpenWindow()
|
||||
{
|
||||
var window = GetWindow<SceneEditor>();
|
||||
window.titleContent = new GUIContent("场景设置");
|
||||
window.titleContent = new GUIContent("场景跳转设置");
|
||||
window.Show();
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -186,4 +186,35 @@ public static class FileTools
|
||||
FindAllFileInDirectory(dir, saveList, types);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断文件夹是否为空
|
||||
/// </summary>
|
||||
/// <param name="dirPath"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckIfDirectoryIsEmpty(string dirPath)
|
||||
{
|
||||
// 检查文件夹是否存在
|
||||
if (Directory.Exists(dirPath))
|
||||
{
|
||||
// 获取文件夹中的所有文件和子文件夹
|
||||
string[] files = Directory.GetFiles(dirPath, "*.*", SearchOption.AllDirectories);
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(dirPath);
|
||||
DirectoryInfo[] subDirs = dirInfo.GetDirectories();
|
||||
|
||||
// 判断文件和子文件夹的数量
|
||||
if (files.Length == 0 && subDirs.Length == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
|
||||
using Codice.Utils;
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
@ -17,5 +20,52 @@ namespace Ether
|
||||
|
||||
|
||||
public static string SceneAudioCfg = Application.streamingAssetsPath + "/Config/Audio/SceneAudioCfg.json";
|
||||
|
||||
public static string TempEnumPath = Application.dataPath + "/Ether/Editor/Templete/TempEnum.txt";
|
||||
public static string TempClassPath = Application.dataPath + "/Ether/Editor/Templete/TempClass.txt";
|
||||
|
||||
public static string FrameEditorCfgPath = Application.dataPath + $"/Ether/Editor/Frames/FrameEditorCfg.json";
|
||||
|
||||
|
||||
|
||||
|
||||
// 获取相对于 Resources 文件夹的路径
|
||||
public static string GetRelativePathToResources(string absolutePath)
|
||||
{
|
||||
// 获取 Resources 文件夹的绝对路径
|
||||
string resourcesPath = Path.Combine(Application.dataPath, "Resources");
|
||||
|
||||
|
||||
if (absolutePath.StartsWith("Assets"))
|
||||
{
|
||||
absolutePath = absolutePath.Replace("Assets/", "");
|
||||
absolutePath = Path.Combine(Application.dataPath, absolutePath);
|
||||
}
|
||||
|
||||
// 检查给定的路径是否在 Resources 文件夹内
|
||||
if (absolutePath.StartsWith(resourcesPath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// 计算相对路径
|
||||
string relativePathWithExtension = absolutePath.Substring(resourcesPath.Length + 1); // +1 是为了去掉开头的斜杠
|
||||
|
||||
// 去掉 .prefab 扩展名
|
||||
string relativePathWithoutExtension = Path.GetFileNameWithoutExtension(relativePathWithExtension);
|
||||
|
||||
// 如果相对路径中有目录结构,需要保留
|
||||
int lastSlashIndex = relativePathWithExtension.LastIndexOf('/');
|
||||
if (lastSlashIndex != -1)
|
||||
{
|
||||
string directoryPath = relativePathWithExtension.Substring(0, lastSlashIndex + 1);
|
||||
relativePathWithoutExtension = directoryPath + relativePathWithoutExtension;
|
||||
}
|
||||
|
||||
return relativePathWithoutExtension;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Given path is not within the Resources folder.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de41a70ead12af544a4e99a925b269d2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
8
client/Assets/Resources/Prefabs/Frames/Setting.meta
Normal file
8
client/Assets/Resources/Prefabs/Frames/Setting.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7db7dcb21519b014b937f3997d53b813
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,113 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1703080056135353327
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5211158822168324289}
|
||||
m_Layer: 0
|
||||
m_Name: TempFrame
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5211158822168324289
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1703080056135353327}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5802661914892923637}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &4372829903781501600
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5802661914892923637}
|
||||
- component: {fileID: 5459735667113016427}
|
||||
- component: {fileID: 7219598427896711725}
|
||||
m_Layer: 0
|
||||
m_Name: Bg
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5802661914892923637
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4372829903781501600}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5211158822168324289}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5459735667113016427
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4372829903781501600}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7219598427896711725
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4372829903781501600}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 458a37930a6ee1945a411ddb31500ebc
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,19 @@
|
||||
//=================================================== 代码自动创建,禁止手动修改 ===================================================
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class SettingFrameBase : FrameBase
|
||||
{
|
||||
public override string PrefabPath { get; } = "Prefabs/Frames/Setting/SettingFrame";
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a15696b9610ceeb43a6c73d2da514cc3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,19 @@
|
||||
//=================================================== 代码自动创建,禁止手动修改 ===================================================
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class TestSettingBase : FrameBase
|
||||
{
|
||||
public override string PrefabPath { get; } = "Prefabs/Frames/Setting/SubSetting/TestSetting";
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18dc170856458a44ea2d21ddcfce4d95
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Scripts/Frame/Setting.meta
Normal file
8
client/Assets/Scripts/Frame/Setting.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa1e7688246b43947beec4c37ffcf536
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
12
client/Assets/Scripts/Frame/Setting/SettingFrame.cs
Normal file
12
client/Assets/Scripts/Frame/Setting/SettingFrame.cs
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class SettingFrame : SettingFrameBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
client/Assets/Scripts/Frame/Setting/SettingFrame.cs.meta
Normal file
11
client/Assets/Scripts/Frame/Setting/SettingFrame.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 370a46ff30cb18f4b896c9dd860070d1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
29
client/Scripts/AutoGenerated/FrameBase/LoginFrameBase.cs
Normal file
29
client/Scripts/AutoGenerated/FrameBase/LoginFrameBase.cs
Normal file
@ -0,0 +1,29 @@
|
||||
//=================================================== 代码自动创建,禁止手动修改 ===================================================
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class LoginFrameBase : FrameBase
|
||||
{
|
||||
public override string PrefabPath { get; } = "Prefabs/Frames/Login/LoginFrame";
|
||||
$protected ButtonEx _BtnExContinuGame;
|
||||
protected TextMeshProUGUI _TextContinuGame;
|
||||
protected ButtonEx _BtnExStartGame;
|
||||
protected ButtonEx _BtnExSetting;
|
||||
protected ButtonEx _BtnExExit;
|
||||
$
|
||||
protected override void OnInit()
|
||||
{
|
||||
$_BtnExContinuGame = GetComponent<ButtonEx>("BtnList/<BtnEx><Text>ContinuGame");
|
||||
_TextContinuGame = GetComponent<TextMeshProUGUI>("BtnList/<BtnEx><Text>ContinuGame");
|
||||
_BtnExStartGame = GetComponent<ButtonEx>("BtnList/<BtnEx>StartGame");
|
||||
_BtnExSetting = GetComponent<ButtonEx>("BtnList/<BtnEx>Setting");
|
||||
_BtnExExit = GetComponent<ButtonEx>("BtnList/<BtnEx>Exit");
|
||||
$
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user