- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
105 lines
3.2 KiB
C#
105 lines
3.2 KiB
C#
namespace VRTK
|
|
{
|
|
using UnityEngine;
|
|
|
|
public struct VRTKTrackedControllerEventArgs
|
|
{
|
|
public uint currentIndex;
|
|
public uint previousIndex;
|
|
}
|
|
|
|
public delegate void VRTKTrackedControllerEventHandler(object sender, VRTKTrackedControllerEventArgs e);
|
|
|
|
public class VRTK_TrackedController : MonoBehaviour
|
|
{
|
|
public uint index = uint.MaxValue;
|
|
|
|
public event VRTKTrackedControllerEventHandler ControllerEnabled;
|
|
public event VRTKTrackedControllerEventHandler ControllerDisabled;
|
|
public event VRTKTrackedControllerEventHandler ControllerIndexChanged;
|
|
|
|
protected GameObject aliasController;
|
|
|
|
public virtual void OnControllerEnabled(VRTKTrackedControllerEventArgs e)
|
|
{
|
|
if (ControllerEnabled != null)
|
|
{
|
|
ControllerEnabled(this, e);
|
|
}
|
|
}
|
|
|
|
public virtual void OnControllerDisabled(VRTKTrackedControllerEventArgs e)
|
|
{
|
|
if (ControllerDisabled != null)
|
|
{
|
|
ControllerDisabled(this, e);
|
|
}
|
|
}
|
|
|
|
public virtual void OnControllerIndexChanged(VRTKTrackedControllerEventArgs e)
|
|
{
|
|
if (ControllerIndexChanged != null)
|
|
{
|
|
ControllerIndexChanged(this, e);
|
|
}
|
|
}
|
|
|
|
protected virtual VRTKTrackedControllerEventArgs SetEventPayload(uint previousIndex = uint.MaxValue)
|
|
{
|
|
VRTKTrackedControllerEventArgs e;
|
|
e.currentIndex = index;
|
|
e.previousIndex = previousIndex;
|
|
return e;
|
|
}
|
|
|
|
protected virtual void Awake()
|
|
{
|
|
VRTK_SDKManager.instance.AddBehaviourToToggleOnLoadedSetupChange(this);
|
|
}
|
|
|
|
protected virtual void OnEnable()
|
|
{
|
|
aliasController = VRTK_DeviceFinder.GetScriptAliasController(gameObject);
|
|
if (aliasController == null)
|
|
{
|
|
aliasController = gameObject;
|
|
}
|
|
|
|
index = VRTK_DeviceFinder.GetControllerIndex(gameObject);
|
|
OnControllerEnabled(SetEventPayload());
|
|
}
|
|
|
|
protected virtual void OnDisable()
|
|
{
|
|
OnControllerDisabled(SetEventPayload());
|
|
}
|
|
|
|
protected virtual void OnDestroy()
|
|
{
|
|
VRTK_SDKManager.instance.RemoveBehaviourToToggleOnLoadedSetupChange(this);
|
|
}
|
|
|
|
protected virtual void FixedUpdate()
|
|
{
|
|
VRTK_SDK_Bridge.ControllerProcessFixedUpdate(VRTK_ControllerReference.GetControllerReference(index));
|
|
}
|
|
|
|
protected virtual void Update()
|
|
{
|
|
uint checkIndex = VRTK_DeviceFinder.GetControllerIndex(gameObject);
|
|
if (checkIndex != index)
|
|
{
|
|
uint previousIndex = index;
|
|
index = checkIndex;
|
|
OnControllerIndexChanged(SetEventPayload(previousIndex));
|
|
}
|
|
|
|
VRTK_SDK_Bridge.ControllerProcessUpdate(VRTK_ControllerReference.GetControllerReference(index));
|
|
|
|
if (aliasController != null && gameObject.activeInHierarchy && !aliasController.activeSelf)
|
|
{
|
|
aliasController.SetActive(true);
|
|
}
|
|
}
|
|
}
|
|
} |