- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
106 lines
3.2 KiB
C#
106 lines
3.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using VRTK;
|
|
using DG.Tweening;
|
|
using XFramework.NetOuter;
|
|
using System;
|
|
/// <summary>
|
|
/// VR触发类型的 步骤行为基类
|
|
/// </summary>
|
|
[RequireComponent(typeof(VRTK_InteractableObject))]
|
|
public abstract class VRUsableStepActionBase : MonoBehaviour, IStepNodeAction
|
|
{
|
|
protected VRTK_InteractableObject interactableObject;
|
|
|
|
public VRTK_InteractableObject InteractableObject
|
|
{
|
|
get { return interactableObject; }
|
|
}
|
|
|
|
protected UnityAction unFixedOver;//拆下动作完成
|
|
protected UnityAction fixedOver;//安装动作完成
|
|
|
|
//外部获取物体开始Use交互事件
|
|
public event UnityAction OnUseEvent;
|
|
|
|
//外部获取物体结束Use交互事件
|
|
public event UnityAction UnUseEvent;
|
|
|
|
|
|
public ProcessEnum processName;
|
|
|
|
// Start is called before the first frame update
|
|
protected virtual void Awake()
|
|
{
|
|
interactableObject = this.GetComponent<VRTK_InteractableObject>();
|
|
interactableObject.touchHighlightColor = Color.green;
|
|
interactableObject.touchHighlightColor.a = 0.5f;
|
|
interactableObject.InteractableObjectUsed += InteractableObjectUsed;
|
|
interactableObject.InteractableObjectUnused += InteractableObjectUnused;
|
|
if (GroupLearnHelper.isGroup)//分组训练时 添加为VRusable 添加Handler
|
|
{
|
|
this.gameObject.AddComponent<VRUsableSyncHandler>();
|
|
this.gameObject.AddComponent<VRUsableSyncSender>();
|
|
|
|
}
|
|
SetUsable(false);
|
|
}
|
|
|
|
protected virtual void InteractableObjectUnused(object sender, InteractableObjectEventArgs e)
|
|
{
|
|
UnUseEvent?.Invoke();
|
|
UnUsed();
|
|
}
|
|
|
|
//主动操作时 若开启分组训练 主动发送信息
|
|
protected virtual void InteractableObjectUsed(object sender, InteractableObjectEventArgs e)
|
|
{
|
|
OnUseEvent?.Invoke();
|
|
OnUsed();
|
|
}
|
|
|
|
/// <summary>
|
|
/// VRStopUsable/同步时时执行
|
|
/// </summary>
|
|
public virtual void UnUsed() { }
|
|
|
|
/// <summary>
|
|
/// VRStartUsable/同步时时执行
|
|
/// </summary>
|
|
public abstract void OnUsed();
|
|
|
|
//protected abstract void InteractableObjectUnused(object sender, InteractableObjectEventArgs e);
|
|
|
|
//是否允许use交互
|
|
protected void SetUsable(bool isUsable)
|
|
{
|
|
interactableObject.isUsable = isUsable;
|
|
}
|
|
|
|
public virtual void Active(ProcessEnum stepName, UnityAction nodeFinishedEvent)
|
|
{
|
|
SetUsable(true);
|
|
interactableObject.usingState = 0;//确保每次激活时 只执行InteractableObjectUsed
|
|
processName = stepName;
|
|
if (stepName == ProcessEnum.assemble)//安装时 完成安装时执行完成事件
|
|
{
|
|
fixedOver = nodeFinishedEvent;
|
|
//interactableObject.usingState = 1;
|
|
}
|
|
else if (stepName == ProcessEnum.teardown)//拆卸时 完成拆卸时执行完成事件
|
|
{
|
|
unFixedOver = nodeFinishedEvent;
|
|
//interactableObject.usingState = 0;
|
|
}
|
|
}
|
|
|
|
public virtual void UnActive(ProcessEnum stepName)
|
|
{
|
|
SetUsable(false);
|
|
unFixedOver = null;
|
|
fixedOver = null;
|
|
}
|
|
}
|