-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Improve appearance for LiquidController and ClockController.
- Loading branch information
1 parent
beff318
commit 671a75d
Showing
347 changed files
with
9,566 additions
and
8,772 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 52 additions & 51 deletions
103
Threeyes/Plugins/ThreeyesPlugin/Core/Base/Attribute/Editor/EnumMaskPropertyDrawer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,82 @@ | ||
// (C) 2014 ERAL | ||
// (C) 2014 ERAL | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#if UNITY_EDITOR | ||
#if !UNITY_2020_1_OR_NEWER//2020以后Unity就可以正常绘制 | ||
using UnityEngine; | ||
using UnityEditor; | ||
using Threeyes.Core; | ||
|
||
namespace Threeyes.Editor | ||
namespace Threeyes.Core.Editor | ||
{ | ||
namespace Threeyes.CommonEditor | ||
|
||
/// <summary> | ||
/// Ref from: https://gist.github.com/eral/773d2b289200528d1216 | ||
/// 功能:Unity2020以前带Flag的Enum,需要这个字段来标识 | ||
/// </summary> | ||
[CustomPropertyDrawer(typeof(EnumMaskAttribute))] | ||
public class EnumMaskPropertyDrawer : PropertyDrawer | ||
{ | ||
/// <summary> | ||
/// Ref from: https://gist.github.com/eral/773d2b289200528d1216 | ||
/// 功能:Unity2020以前带Flag的Enum,需要这个字段来标识 | ||
/// </summary> | ||
[CustomPropertyDrawer(typeof(EnumMaskAttribute))] | ||
public class EnumMaskPropertyDrawer : PropertyDrawer | ||
{ | ||
|
||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | ||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | ||
{ | ||
if (SerializedPropertyType.Enum == property.propertyType) | ||
{ | ||
if (SerializedPropertyType.Enum == property.propertyType) | ||
object current = GetCurrent(property); | ||
if (null != current) | ||
{ | ||
object current = GetCurrent(property); | ||
if (null != current) | ||
EditorGUI.BeginChangeCheck(); | ||
var value = EditorGUI.EnumFlagsField(position, label, (System.Enum)current); | ||
if (EditorGUI.EndChangeCheck()) | ||
{ | ||
EditorGUI.BeginChangeCheck(); | ||
var value = EditorGUI.EnumFlagsField(position, label, (System.Enum)current); | ||
if (EditorGUI.EndChangeCheck()) | ||
{ | ||
property.intValue = System.Convert.ToInt32(value); | ||
} | ||
property.intValue = System.Convert.ToInt32(value); | ||
} | ||
} | ||
else | ||
{ | ||
EditorGUI.LabelField(position, label, new GUIContent("This type has not supported.")); | ||
} | ||
} | ||
else | ||
{ | ||
EditorGUI.LabelField(position, label, new GUIContent("This type has not supported.")); | ||
} | ||
} | ||
|
||
private static object GetCurrent(SerializedProperty property) | ||
private static object GetCurrent(SerializedProperty property) | ||
{ | ||
object result = property.serializedObject.targetObject; | ||
var property_names = property.propertyPath.Replace(".Array.data", ".").Split('.'); | ||
foreach (var property_name in property_names) | ||
{ | ||
object result = property.serializedObject.targetObject; | ||
var property_names = property.propertyPath.Replace(".Array.data", ".").Split('.'); | ||
foreach (var property_name in property_names) | ||
var parent = result; | ||
var indexer_start = property_name.IndexOf('['); | ||
if (-1 == indexer_start) | ||
{ | ||
var parent = result; | ||
var indexer_start = property_name.IndexOf('['); | ||
if (-1 == indexer_start) | ||
{ | ||
var binding_flags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic; | ||
result = parent.GetType().GetField(property_name, binding_flags).GetValue(parent); | ||
} | ||
else if (parent.GetType().IsArray) | ||
var binding_flags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic; | ||
result = parent.GetType().GetField(property_name, binding_flags).GetValue(parent); | ||
} | ||
else if (parent.GetType().IsArray) | ||
{ | ||
var indexer_end = property_name.IndexOf(']'); | ||
var index_string = property_name.Substring(indexer_start + 1, indexer_end - indexer_start - 1); | ||
var index = int.Parse(index_string); | ||
var array = (System.Array)parent; | ||
if (index < array.Length) | ||
{ | ||
var indexer_end = property_name.IndexOf(']'); | ||
var index_string = property_name.Substring(indexer_start + 1, indexer_end - indexer_start - 1); | ||
var index = int.Parse(index_string); | ||
var array = (System.Array)parent; | ||
if (index < array.Length) | ||
{ | ||
result = array.GetValue(index); | ||
} | ||
else | ||
{ | ||
result = null; | ||
break; | ||
} | ||
result = array.GetValue(index); | ||
} | ||
else | ||
{ | ||
throw new System.MissingFieldException(); | ||
result = null; | ||
break; | ||
} | ||
} | ||
return result; | ||
else | ||
{ | ||
throw new System.MissingFieldException(); | ||
} | ||
} | ||
return result; | ||
} | ||
} | ||
} | ||
#endif | ||
#endif |
19 changes: 12 additions & 7 deletions
19
Threeyes/Plugins/ThreeyesPlugin/Core/Base/Attribute/EnumMaskAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
| ||
using UnityEngine; | ||
/// <summary> | ||
/// 针对多选枚举(枚举要有[System.Flags]标识) | ||
/// 功能:Unity2020以前带Flag的Enum,需要这个字段标识才能绘制多选下来框(尽量不使用,如有必要就将项目转为2020) | ||
/// </summary> | ||
public class EnumMaskAttribute : PropertyAttribute | ||
|
||
namespace Threeyes.Core | ||
{ | ||
} | ||
/// <summary> | ||
/// 针对多选枚举(枚举要有[System.Flags]标识) | ||
/// 功能:Unity2020以前带Flag的Enum,需要这个字段标识才能绘制多选下来框 | ||
/// | ||
/// Warning:尽量不使用,如有必要就将项目转为2020 | ||
/// </summary> | ||
public class EnumMaskAttribute : PropertyAttribute | ||
{ | ||
} | ||
} |
46 changes: 25 additions & 21 deletions
46
Threeyes/Plugins/ThreeyesPlugin/Core/Base/Attribute/MaterialPropertyNameAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,42 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
/// <summary> | ||
/// 根据当前RenderingPipeline,返回正确的值 | ||
/// | ||
/// PS: | ||
/// 1.Inspector Debug模式及EditShader可以看到对应的名称 | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Field)] | ||
public class MaterialPropertyNameAttribute : PropertyAttribute | ||
namespace Threeyes.Core | ||
{ | ||
public string PropertyName | ||
|
||
/// <summary> | ||
/// 根据当前RenderingPipeline,返回正确的值 | ||
/// | ||
/// PS: | ||
/// 1.Inspector Debug模式及EditShader可以看到对应的名称 | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Field)] | ||
public class MaterialPropertyNameAttribute : PropertyAttribute | ||
{ | ||
get | ||
public string PropertyName | ||
{ | ||
get | ||
{ | ||
#if UNITY_PIPELINE_URP | ||
return urpPropertyName; | ||
return urpPropertyName; | ||
#elif UNITY_PIPELINE_HDRP | ||
return hdrpPropertyName; | ||
#else | ||
return builtInRPPropertyName; | ||
#endif | ||
} | ||
} | ||
} | ||
|
||
public string builtInRPPropertyName; | ||
public string urpPropertyName; | ||
public string hdrpPropertyName; | ||
public string builtInRPPropertyName; | ||
public string urpPropertyName; | ||
public string hdrpPropertyName; | ||
|
||
public MaterialPropertyNameAttribute(string builtInRPPropertyName, string urpPropertyName, string hdrpPropertyName) | ||
{ | ||
//PS:如果无此字段,直接设置为null | ||
this.builtInRPPropertyName = builtInRPPropertyName; | ||
this.urpPropertyName = urpPropertyName; | ||
this.hdrpPropertyName = hdrpPropertyName; | ||
public MaterialPropertyNameAttribute(string builtInRPPropertyName, string urpPropertyName, string hdrpPropertyName) | ||
{ | ||
//PS:如果无此字段,直接设置为null | ||
this.builtInRPPropertyName = builtInRPPropertyName; | ||
this.urpPropertyName = urpPropertyName; | ||
this.hdrpPropertyName = hdrpPropertyName; | ||
} | ||
} | ||
} |
32 changes: 18 additions & 14 deletions
32
Threeyes/Plugins/ThreeyesPlugin/Core/Base/Attribute/NameAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
/// <summary> | ||
/// 自定义多语言显示名称 | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] | ||
public class NameAttribute : Attribute | ||
namespace Threeyes.Core | ||
{ | ||
public string Name { get; set; } | ||
public string languageCode = "zh";//多语言 | ||
|
||
/// <summary> | ||
/// | ||
/// 自定义多语言显示名称 | ||
/// </summary> | ||
/// <param name="name"></param> | ||
/// <param name="languageCode">(https://www.loc.gov/standards/iso639-2/php/code_list.php)</param> | ||
public NameAttribute(string name, string languageCode = "zh") | ||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] | ||
public class NameAttribute : Attribute | ||
{ | ||
Name = name; | ||
this.languageCode = languageCode; | ||
public string Name { get; set; } | ||
public string languageCode = "zh";//多语言 | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="name"></param> | ||
/// <param name="languageCode">(https://www.loc.gov/standards/iso639-2/php/code_list.php)</param> | ||
public NameAttribute(string name, string languageCode = "zh") | ||
{ | ||
Name = name; | ||
this.languageCode = languageCode; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Threeyes/Plugins/ThreeyesPlugin/Core/Base/Common/DataObjectBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace Threeyes.Base | ||
namespace Threeyes.Core | ||
{ | ||
/// <summary> | ||
/// 普通数据类的基类,带有比较、空检测等功能 | ||
|
60 changes: 32 additions & 28 deletions
60
Threeyes/Plugins/ThreeyesPlugin/Core/Base/Common/DefineSymbol.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,40 @@ | ||
using System; | ||
using System; | ||
|
||
/// <summary> | ||
/// 插件的宏定义 | ||
/// </summary> | ||
[System.Serializable] | ||
public class DefineSymbol : IEquatable<DefineSymbol> | ||
namespace Threeyes.Core | ||
{ | ||
public string name;//宏定义显示名称 | ||
public string description_en;//英文注释 | ||
public string description_cn;//中文注释 | ||
public string rootFolderName;//根文件夹的名称,通过改名称知道相应插件是否存在(用|分割,针对放在多个地方的插件) | ||
public string mainFileName;//主要文件的相对路径(可空,主要是避免开发者自己创建的文件夹重名) | ||
//public string asmdefName;//相应的AsmDef文件名(Warning:因为名称不固定,所以暂不使用) | ||
public string packageName; | ||
|
||
|
||
public bool isUsing = false;//正在使用中 | ||
public DefineSymbol(string name, string description_en, string description_cn, string rootFolderName = "", string mainFileName = "", string asmdefName = "", string packageName = "") | ||
/// <summary> | ||
/// 插件的宏定义 | ||
/// </summary> | ||
[Serializable] | ||
public class DefineSymbol : IEquatable<DefineSymbol> | ||
{ | ||
this.name = name; | ||
this.description_en = description_en; | ||
this.description_cn = description_cn; | ||
public string name;//宏定义显示名称 | ||
public string description_en;//英文注释 | ||
public string description_cn;//中文注释 | ||
public string rootFolderName;//根文件夹的名称,通过改名称知道相应插件是否存在(用|分割,针对放在多个地方的插件) | ||
public string mainFileName;//主要文件的相对路径(可空,主要是避免开发者自己创建的文件夹重名) | ||
//public string asmdefName;//相应的AsmDef文件名(Warning:因为名称不固定,所以暂不使用) | ||
public string packageName; | ||
|
||
this.rootFolderName = rootFolderName; | ||
this.mainFileName = mainFileName; | ||
//this.asmdefName = asmdefName; | ||
this.packageName = packageName; | ||
} | ||
|
||
public bool Equals(DefineSymbol other) | ||
{ | ||
if (other == null) return false; | ||
return (this.name.Equals(other.name)); | ||
public bool isUsing = false;//正在使用中 | ||
public DefineSymbol(string name, string description_en, string description_cn, string rootFolderName = "", string mainFileName = "", string asmdefName = "", string packageName = "") | ||
{ | ||
this.name = name; | ||
this.description_en = description_en; | ||
this.description_cn = description_cn; | ||
|
||
this.rootFolderName = rootFolderName; | ||
this.mainFileName = mainFileName; | ||
//this.asmdefName = asmdefName; | ||
this.packageName = packageName; | ||
} | ||
|
||
public bool Equals(DefineSymbol other) | ||
{ | ||
if (other == null) return false; | ||
return name.Equals(other.name); | ||
} | ||
} | ||
} |
Oops, something went wrong.