mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
Update FrameworkGlobalSettings.cs
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
#if UNITY_EDITOR
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// APP更新类型。
|
||||
@@ -8,8 +13,10 @@ using UnityEngine;
|
||||
public enum UpdateType
|
||||
{
|
||||
None = 0,
|
||||
|
||||
//资源更新
|
||||
ResourceUpdate = 1,
|
||||
|
||||
//底包更新
|
||||
PackageUpdate = 2,
|
||||
}
|
||||
@@ -186,8 +193,7 @@ public class FrameworkGlobalSettings
|
||||
get { return m_AtlasFolder; }
|
||||
}
|
||||
|
||||
[Header("Hotfix")] [SerializeField]
|
||||
private string m_ResourceVersionFileName = "ResourceVersion.txt";
|
||||
[Header("Hotfix")] [SerializeField] private string m_ResourceVersionFileName = "ResourceVersion.txt";
|
||||
|
||||
public string HostServerURL = "http://127.0.0.1:8081";
|
||||
|
||||
@@ -232,4 +238,76 @@ public class FrameworkGlobalSettings
|
||||
{
|
||||
get { return m_ConfigFolderName; }
|
||||
}
|
||||
|
||||
[LabelText("代码生成脚本命名空间")]
|
||||
[SerializeField] private string @namespace = "GameLogic";
|
||||
|
||||
public string NameSpace => @namespace;
|
||||
|
||||
[SerializeField] [LabelText("代码生成脚本名映射")]
|
||||
private List<ScriptGenerateRuler> scriptGenerateRule = new List<ScriptGenerateRuler>()
|
||||
{
|
||||
new("m_go", "GameObject"),
|
||||
new("m_item", "GameObject"),
|
||||
new("m_tf", "Transform"),
|
||||
new("m_rect", "RectTransform"),
|
||||
#if ENABLE_TEXTMESHPRO
|
||||
{"m_textPro","TextMeshProUGUI"},
|
||||
#else
|
||||
new("m_text", "Text"),
|
||||
#endif
|
||||
new("m_richText", "RichTextItem"),
|
||||
new("m_btn", "Button"),
|
||||
new("m_img", "Image"),
|
||||
new("m_rimg", "RawImage"),
|
||||
new("m_scrollBar", "Scrollbar"),
|
||||
new("m_scroll", "ScrollRect"),
|
||||
new("m_input", "InputField"),
|
||||
new("m_grid", "GridLayoutGroup"),
|
||||
new("m_hlay", "HorizontalLayoutGroup"),
|
||||
new("m_vlay", "VerticalLayoutGroup"),
|
||||
new("m_red", "RedNoteBehaviour"),
|
||||
new("m_slider", "Slider"),
|
||||
new("m_group", "ToggleGroup"),
|
||||
new("m_curve", "AnimationCurve"),
|
||||
new("m_canvasGroup", "CanvasGroup"),
|
||||
#if ENABLE_TEXTMESHPRO
|
||||
new("m_tmp","TextMeshProUGUI"),
|
||||
#endif
|
||||
};
|
||||
|
||||
public List<ScriptGenerateRuler> ScriptGenerateRule => scriptGenerateRule;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class ScriptGenerateRuler
|
||||
{
|
||||
public string uiElementRegex;
|
||||
public string componentName;
|
||||
|
||||
public ScriptGenerateRuler(string uiElementRegex, string componentName)
|
||||
{
|
||||
this.uiElementRegex = uiElementRegex;
|
||||
this.componentName = componentName;
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[CustomPropertyDrawer(typeof(ScriptGenerateRuler))]
|
||||
public class ScriptGenerateRulerDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||||
var indent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
var uiElementRegexRect = new Rect(position.x, position.y, 120, position.height);
|
||||
var componentNameRect = new Rect(position.x + 125, position.y, 150, position.height);
|
||||
EditorGUI.PropertyField(uiElementRegexRect, property.FindPropertyRelative("uiElementRegex"), GUIContent.none);
|
||||
EditorGUI.PropertyField(componentNameRect, property.FindPropertyRelative("componentName"), GUIContent.none);
|
||||
EditorGUI.indentLevel = indent;
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user