- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
118 lines
3.3 KiB
C#
118 lines
3.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using DG.Tweening;
|
|
using System;
|
|
|
|
public class SimplePipe : VRUsableStepActionBase
|
|
{
|
|
private BezierPipe pipeMesh;
|
|
|
|
[Tooltip("与该线路连接的接头是否为固定位置的")]
|
|
public bool connectorIsFixed;
|
|
|
|
[HideInInspector]
|
|
//该线路插头插上时应保持的位置
|
|
public Vector3 thisFixedPos;
|
|
|
|
/// <summary>
|
|
/// 断开时指定位置或者指定移动向量
|
|
/// </summary>
|
|
public bool useMoveDir;
|
|
|
|
[PropertyActive("useMoveDir", true, CompareType.NotEqul)]
|
|
//线路断开时移动Dir
|
|
public Vector3 onFreeMoveDir;
|
|
|
|
[PropertyActive("useMoveDir", false, CompareType.NotEqul)]
|
|
//该线路插头断开时保持的位置
|
|
public Vector3 thisFreePos;
|
|
|
|
//断开时保持角度不变
|
|
public bool keepAngleOnFree = true;
|
|
|
|
//断开后的目标角度值
|
|
[PropertyActive("keepAngleOnFree", false, CompareType.NotEqul)]
|
|
public Vector3 freeAngle;
|
|
|
|
//连接时的角度
|
|
private Vector3 fixedAngle;
|
|
|
|
|
|
[PropertyActive("connectorIsFixed", true, CompareType.Equl)]
|
|
public Transform connector;
|
|
[PropertyActive("connectorIsFixed", true, CompareType.Equl)]
|
|
public Vector3 connectorFixedPos;
|
|
[PropertyActive("connectorIsFixed", true, CompareType.Equl)]
|
|
public Vector3 connectorFreePos;
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
//if (thisFixedPos == Vector3.zero)//未设置安装位置时 按照初始位置作为安装位置
|
|
thisFixedPos = this.transform.localPosition;//默认按照初始位置作为安装位置
|
|
if (useMoveDir)
|
|
{
|
|
thisFreePos = thisFixedPos + onFreeMoveDir;
|
|
}
|
|
if (connector)
|
|
{
|
|
connectorFixedPos = connector.transform.localPosition;
|
|
}
|
|
pipeMesh = this.transform.parent.GetComponentInChildren<BezierPipe>();
|
|
if (pipeMesh)
|
|
pipeMesh.update = false;//接头固定时不计算管路mesh 避免消耗性能
|
|
|
|
if (!keepAngleOnFree)
|
|
{
|
|
fixedAngle = this.transform.localEulerAngles;
|
|
}
|
|
}
|
|
|
|
public override void OnUsed()
|
|
{
|
|
SetUsable(false);
|
|
if (pipeMesh)
|
|
pipeMesh.update = true;
|
|
if (processName == ProcessEnum.teardown)
|
|
{
|
|
this.transform.DOLocalMove(thisFreePos, 1f).OnComplete(UnFixedMoveOver);
|
|
if (!keepAngleOnFree)
|
|
this.transform.DOLocalRotate(freeAngle, 1f);
|
|
|
|
if (!connectorIsFixed)
|
|
{
|
|
connector.DOLocalMove(connectorFreePos, 1f);
|
|
}
|
|
}
|
|
else if (processName == ProcessEnum.assemble)
|
|
{
|
|
this.transform.DOLocalMove(thisFixedPos, 1f).OnComplete(FixedMoveOver);
|
|
if (!keepAngleOnFree)
|
|
this.transform.DOLocalRotate(fixedAngle, 1f);
|
|
|
|
if (!connectorIsFixed)
|
|
{
|
|
connector.DOLocalMove(connectorFixedPos, 1f);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void FixedMoveOver()
|
|
{
|
|
if (pipeMesh)
|
|
pipeMesh.update = false;
|
|
fixedOver?.Invoke();
|
|
fixedOver = null;
|
|
}
|
|
|
|
private void UnFixedMoveOver()
|
|
{
|
|
if (pipeMesh)
|
|
pipeMesh.update = false;
|
|
unFixedOver?.Invoke();
|
|
unFixedOver = null;
|
|
}
|
|
|
|
}
|