- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
187 lines
4.6 KiB
C#
187 lines
4.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DiaoZhuangAnimCtrl : MonoBehaviour
|
|
{
|
|
float speed = 0;
|
|
|
|
[SerializeField] Animation thisAnimation;
|
|
|
|
|
|
public GameObject diaoju1;
|
|
public GameObject gaiban;
|
|
Transform gaibanDefultParent;
|
|
public GameObject fadongji;
|
|
|
|
public Transform diaoGou;
|
|
Transform fadongjiDefultParent;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
thisAnimation = GetComponent<Animation>();
|
|
gaibanDefultParent = gaiban.transform.parent;
|
|
fadongjiDefultParent = fadongji.transform.parent;
|
|
//SetSpeed(2);
|
|
//Play();
|
|
}
|
|
|
|
|
|
public void SetSpeed(float speed)
|
|
{
|
|
if (this.speed == speed) return;//只执行一次避免重复执行
|
|
this.speed = speed;
|
|
if (speed > 0)
|
|
{
|
|
Debug.Log("正常播放");
|
|
thisAnimation["Take 001"].time = 0;
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("倒序播放");
|
|
thisAnimation["Take 001"].time = thisAnimation["Take 001"].clip.length;
|
|
}
|
|
}
|
|
|
|
public void Play()
|
|
{
|
|
thisAnimation["Take 001"].speed = speed;
|
|
thisAnimation.CrossFade("Take 001");
|
|
}
|
|
|
|
public void DiaoGaiBan()
|
|
{
|
|
if (speed > 0)
|
|
{
|
|
Debug.Log("从发动机吊起盖板");
|
|
UpDiaoHuan();
|
|
gaiban.transform.parent = diaoGou;
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("盖板安装吊装完成");
|
|
gaiban.transform.SetParent(gaibanDefultParent);
|
|
DownDiaoHuan();
|
|
gaiban.GetComponent<DiaoZhuangGO>().DiaoZhuangFinished();
|
|
}
|
|
}
|
|
|
|
private void DownDiaoHuan()
|
|
{
|
|
gaiban.transform.Find("dh1").transform.localEulerAngles = new Vector3(0, 0, 0);
|
|
gaiban.transform.Find("dh2").transform.localEulerAngles = new Vector3(0, 0, 0);
|
|
gaiban.transform.Find("dh3").transform.localEulerAngles = new Vector3(0, 0, 0);
|
|
}
|
|
|
|
private void UpDiaoHuan()
|
|
{
|
|
gaiban.transform.Find("dh1").transform.localEulerAngles = new Vector3(0, -45f, 0);
|
|
gaiban.transform.Find("dh2").transform.localEulerAngles = new Vector3(0, 45f, 0);
|
|
gaiban.transform.Find("dh3").transform.localEulerAngles = new Vector3(0, 45f, 0);
|
|
}
|
|
|
|
public void SetGaiBanOnFloor()
|
|
{
|
|
if (speed > 0)
|
|
{
|
|
Debug.Log("盖板拆卸吊装完成");
|
|
diaoju1.gameObject.SetActive(false);
|
|
gaiban.transform.SetParent(null);
|
|
DownDiaoHuan();
|
|
gaiban.GetComponent<DiaoZhuangGO>().DiaoZhuangFinished();
|
|
Invoke("StopAnim", 1f);
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("从地面吊起盖板");
|
|
diaoju1.gameObject.SetActive(true);
|
|
gaiban.transform.parent = diaoGou;
|
|
UpDiaoHuan();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void DiaoFaDongJi()
|
|
{
|
|
if (speed > 0)
|
|
{
|
|
Debug.Log("拆卸环节吊起发动机");
|
|
fadongji.transform.SetParent(diaoGou.transform);
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("安装环节吊装发动机完成");
|
|
fadongji.transform.SetParent(fadongjiDefultParent);
|
|
fadongji.GetComponent<DiaoZhuangGO>().DiaoZhuangFinished();
|
|
Invoke("StopAnim", 2f);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public void SetFaDongJiOnFloor()
|
|
{
|
|
if (speed > 0)
|
|
{
|
|
fadongji.GetComponent<DiaoZhuangGO>().DiaoZhuangFinished();
|
|
}
|
|
else//安装时不做任何处理
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void StopAnim()
|
|
{
|
|
thisAnimation["Take 001"].speed = 0;
|
|
thisAnimation.CrossFade("Take 001");
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
private void Update()
|
|
{
|
|
//if (speed > 0 && !thisAnimation.isPlaying)
|
|
//{
|
|
// speed = 0;
|
|
// Debug.Log("拆卸动画播放完成");
|
|
//}
|
|
|
|
|
|
|
|
//if (Input.GetKeyDown(KeyCode.Q))
|
|
//{
|
|
// //Debug.Log("开始播放动画");
|
|
// ////SetSpeed(-2);
|
|
// //Play();
|
|
// SetSpeed(1);
|
|
//}
|
|
|
|
//if (Input.GetKeyDown(KeyCode.Space))
|
|
//{
|
|
// Debug.Log("开始播放动画");
|
|
// //SetSpeed(-2);
|
|
// Play();
|
|
//}
|
|
|
|
|
|
//if (Input.GetKeyDown(KeyCode.W))
|
|
//{
|
|
// //Debug.Log("开始播放动画");
|
|
// ////SetSpeed(-2);
|
|
// //Play();
|
|
// SetSpeed(-1);
|
|
//}
|
|
|
|
////if (speed < 0 && !thisAnimation.isPlaying)
|
|
////{
|
|
//// speed = 0;
|
|
//// Debug.Log("安装动画播放完成");
|
|
////}
|
|
}
|
|
#endif
|
|
}
|