- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
59 lines
2.4 KiB
C#
59 lines
2.4 KiB
C#
//====================================================================================
|
|
//
|
|
// Purpose: Provide a way of tagging game objects as player specific objects to
|
|
// allow other scripts to identify these specific objects without needing to use tags
|
|
// or without needing to append the name of the game object.
|
|
//
|
|
//====================================================================================
|
|
namespace VRTK
|
|
{
|
|
using UnityEngine;
|
|
public sealed class VRTK_PlayerObject : MonoBehaviour
|
|
{
|
|
public enum ObjectTypes
|
|
{
|
|
Null,
|
|
CameraRig,
|
|
Headset,
|
|
Controller,
|
|
Pointer,
|
|
Highlighter,
|
|
Collider
|
|
}
|
|
|
|
public ObjectTypes objectType;
|
|
|
|
/// <summary>
|
|
/// The SetPlayerObject method tags the given game object with a special player object class for easier identification.
|
|
/// </summary>
|
|
/// <param name="obj">The game object to add the player object class to.</param>
|
|
/// <param name="objType">The type of player object that is to be assigned.</param>
|
|
public static void SetPlayerObject(GameObject obj, ObjectTypes objType)
|
|
{
|
|
var currentPlayerObject = obj.GetComponent<VRTK_PlayerObject>();
|
|
if (currentPlayerObject == null)
|
|
{
|
|
currentPlayerObject = obj.AddComponent<VRTK_PlayerObject>();
|
|
}
|
|
currentPlayerObject.objectType = objType;
|
|
}
|
|
|
|
/// <summary>
|
|
/// The IsPlayerObject method determines if the given game object is a player object and can also check if it's of a specific type.
|
|
/// </summary>
|
|
/// <param name="obj">The GameObjet to check if it's a player object.</param>
|
|
/// <param name="ofType">An optional ObjectType to check if the given GameObject is of a specific player object.</param>
|
|
/// <returns>Returns true if the object is a player object with the optional given type.</returns>
|
|
public static bool IsPlayerObject(GameObject obj, ObjectTypes ofType = ObjectTypes.Null)
|
|
{
|
|
foreach (var playerObject in obj.GetComponentsInParent<VRTK_PlayerObject>(true))
|
|
{
|
|
if (ofType == ObjectTypes.Null || ofType == playerObject.objectType)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
} |