unityzgy/.svn/pristine/c0/c0accc080d4e803862fbffafa872bad7a0ea182d.svn-base
ayuan9957 bf12e02276 feat: 多语言本地化系统 - 支持中/英/法/俄实时切换
- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg)
- LoginPanel: InputField placeholder本地化、字体颜色保持
- HistoryPanel: 用时数据本地化、placeholder本地化
- RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建)
- AppraiseWindowBase: 评价等级本地化、操作消息重建
- EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized
- StudentOperateRecorder: 新增InjectOperateMsgLocalized方法
- LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选
- 字体切换时保留颜色和verticalOverflow
2026-07-16 10:05:59 +08:00

174 lines
4.0 KiB
Plaintext

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DiaoZhuangAnimCtrl : MonoBehaviour
{
float speed = 0;
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 = this.GetComponent<Animation>();
gaibanDefultParent = gaiban.transform.parent;
fadongjiDefultParent = fadongji.transform.parent;
SetSpeed(2);
Play();
}
public void SetSpeed(float speed)
{
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 RevPlay()
{
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();
}
}
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();
}
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);
}
}
public void SetFaDongJiOnFloor()
{
if (speed > 0)
{
//Debug.Log("发动机拆卸完成,开始吊装");
//thisAnimation["Take 001"].speed = 0;
//SetSpeed(-2f);
//Invoke("Play", 2f);
}
else
{
}
}
private void StopAnim()
{
thisAnimation["Take 001"].speed = 0;
thisAnimation.CrossFade("Take 001");
}
private void Update()
{
if (speed > 0 && !thisAnimation.isPlaying)
{
speed = 0;
Debug.Log("拆卸动画播放完成");
}
if (Input.GetKeyDown(KeyCode.Space))
{
Debug.Log("开始安装");
SetSpeed(-2);
Play();
}
if (speed < 0 && !thisAnimation.isPlaying)
{
speed = 0;
Debug.Log("安装动画播放完成");
}
}
}