- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
59 lines
2.4 KiB
Plaintext
59 lines
2.4 KiB
Plaintext
namespace VRTK.Examples
|
|
{
|
|
using UnityEngine;
|
|
|
|
public class VRTK_ControllerInteract_ListenerExample : MonoBehaviour
|
|
{
|
|
private void Start()
|
|
{
|
|
if (GetComponent<VRTK_InteractTouch>() == null || GetComponent<VRTK_InteractGrab>() == null)
|
|
{
|
|
VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerInteract_ListenerExample", "VRTK_InteractTouch and VRTK_InteractGrab", "the Controller Alias"));
|
|
return;
|
|
}
|
|
|
|
//Setup controller event listeners
|
|
GetComponent<VRTK_InteractTouch>().ControllerTouchInteractableObject += new ObjectInteractEventHandler(DoInteractTouch);
|
|
GetComponent<VRTK_InteractTouch>().ControllerUntouchInteractableObject += new ObjectInteractEventHandler(DoInteractUntouch);
|
|
GetComponent<VRTK_InteractGrab>().ControllerGrabInteractableObject += new ObjectInteractEventHandler(DoInteractGrab);
|
|
GetComponent<VRTK_InteractGrab>().ControllerUngrabInteractableObject += new ObjectInteractEventHandler(DoInteractUngrab);
|
|
}
|
|
|
|
private void DebugLogger(uint index, string action, GameObject target)
|
|
{
|
|
VRTK_Logger.Info("Controller on index '" + index + "' is " + action + " an object named " + target.name);
|
|
}
|
|
|
|
private void DoInteractTouch(object sender, ObjectInteractEventArgs e)
|
|
{
|
|
if (e.target)
|
|
{
|
|
DebugLogger(VRTK_ControllerReference.GetRealIndex(e.controllerReference), "TOUCHING", e.target);
|
|
}
|
|
}
|
|
|
|
private void DoInteractUntouch(object sender, ObjectInteractEventArgs e)
|
|
{
|
|
if (e.target)
|
|
{
|
|
DebugLogger(VRTK_ControllerReference.GetRealIndex(e.controllerReference), "NO LONGER TOUCHING", e.target);
|
|
}
|
|
}
|
|
|
|
private void DoInteractGrab(object sender, ObjectInteractEventArgs e)
|
|
{
|
|
if (e.target)
|
|
{
|
|
DebugLogger(VRTK_ControllerReference.GetRealIndex(e.controllerReference), "GRABBING", e.target);
|
|
}
|
|
}
|
|
|
|
private void DoInteractUngrab(object sender, ObjectInteractEventArgs e)
|
|
{
|
|
if (e.target)
|
|
{
|
|
DebugLogger(VRTK_ControllerReference.GetRealIndex(e.controllerReference), "NO LONGER GRABBING", e.target);
|
|
}
|
|
}
|
|
}
|
|
} |