Skip to content

Commit

Permalink
- Add namespace for Core scripts;
Browse files Browse the repository at this point in the history
- Improve appearance for LiquidController and ClockController.
  • Loading branch information
wojiuxuihuan committed Feb 23, 2024
1 parent beff318 commit 671a75d
Show file tree
Hide file tree
Showing 347 changed files with 9,566 additions and 8,772 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [4.2.0]
- Add namespace for Core scripts;
- Improve appearance for LiquidController and ClockController.

## [4.1.6]
- Fix: AC_RigBuilderHelper not update joints after size related state change.
- Item Manager add ShowOutputDirectory toggle.
Expand Down
2 changes: 1 addition & 1 deletion ProjectConfig~/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"com.threeyes.alivecursor.sdk": "4.1.6",
"com.threeyes.alivecursor.sdk": "4.2.0",
"com.beans.deform": "1.2.1",
"com.coffee.ui-effect": "4.0.0-preview.9",
"com.dbrizov.naughtyattributes": "2.1.4",
Expand Down
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
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
{
}
}
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;
}
}
}
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;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
using System.Collections.Generic;
using UnityEngine.Events;

namespace Threeyes.Cache
namespace Threeyes.Core
{
//——缓存实例(如加载后的资源)——
public interface IObjectCache<TID, T> where T : class
{
int CountAll { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using System;
namespace Threeyes.Base
namespace Threeyes.Core
{
public interface ICloneableData : ICloneable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Threeyes.Base
namespace Threeyes.Core
{
/// <summary>
/// 普通数据类的基类,带有比较、空检测等功能
Expand Down
60 changes: 32 additions & 28 deletions Threeyes/Plugins/ThreeyesPlugin/Core/Base/Common/DefineSymbol.cs
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);
}
}
}
Loading

0 comments on commit 671a75d

Please sign in to comment.