You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
3.9 KiB
170 lines
3.9 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using DG.Tweening;
|
|
using System;
|
|
|
|
namespace DisComputer
|
|
{
|
|
/*
|
|
*@func 机箱动画
|
|
*@author LZ
|
|
*@date 2020/06/01
|
|
*/
|
|
public class JiXiangAnimation : SpareAnimationBase
|
|
{
|
|
|
|
|
|
public Vector3 mainShowPos;
|
|
|
|
public Vector3 mainInitPos;
|
|
|
|
|
|
[Header("卡扣")]
|
|
public GameObject buckleGo;
|
|
|
|
public Vector3 openEuler;
|
|
|
|
public Vector3 closeEuler;
|
|
|
|
|
|
public Vector3 buckleShowPos;
|
|
|
|
public Vector3 buckleInitPos;
|
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
public override void SetLoadState()
|
|
{
|
|
mainGo.SetActive(true);
|
|
buckleGo.SetActive(true);
|
|
mainGo.transform.localPosition = mainInitPos;
|
|
buckleGo.transform.localEulerAngles = closeEuler;
|
|
buckleGo.transform.localPosition = buckleInitPos;
|
|
}
|
|
|
|
public override void SetUnloadState()
|
|
{
|
|
mainGo.SetActive(false);
|
|
buckleGo.SetActive(false);
|
|
mainGo.transform.localPosition = mainShowPos;
|
|
buckleGo.transform.localEulerAngles = openEuler;
|
|
buckleGo.transform.localPosition = buckleShowPos;
|
|
}
|
|
|
|
|
|
public override bool IsCompareTag(object data)
|
|
{
|
|
|
|
if (GameConfig.state == GameState.Unload)
|
|
{
|
|
ToolType toolType = ToolType.Hand;
|
|
ToolItem item = (ToolItem)data;
|
|
if (item.toolType == toolType)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
CoolPointTip("请使用合适的工具");
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
Grid grid = (Grid)data;
|
|
if (grid.type == _type)
|
|
{
|
|
return true;
|
|
}
|
|
CoolPointTip("请选择正确的零件");
|
|
return false;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public override void OnLoadAct()
|
|
{
|
|
base.OnLoadAct();
|
|
StartCoroutine(LoadFocuse());
|
|
|
|
}
|
|
|
|
public override void OnUnLoadAct()
|
|
{
|
|
base.OnUnLoadAct();
|
|
StartCoroutine(UnloadFocuse());
|
|
}
|
|
|
|
protected override IEnumerator LoadFocuse()
|
|
{
|
|
yield return StartCoroutine(ProgressFocuse());
|
|
buckleGo.SetActive(true);
|
|
mainGo.SetActive(true);
|
|
mainGo.transform.DOLocalMove(mainInitPos, 0.35f).SetEase(Ease.Linear).OnComplete(() => {
|
|
|
|
buckleGo.transform.DOLocalRotate(closeEuler, 0.35f).SetEase(Ease.Linear).SetDelay(0.5f).OnComplete(() =>
|
|
{
|
|
|
|
});
|
|
|
|
});
|
|
buckleGo.transform.DOLocalMove(buckleInitPos, 0.35f).SetEase(Ease.Linear);
|
|
|
|
yield return new WaitForSeconds(2.0f);
|
|
|
|
OnLoadFinishHandle?.Invoke();
|
|
LzFramework.UI.TTUIPage.ShowPage<SparePartsView>();
|
|
RewindCameraView();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
protected override IEnumerator UnloadFocuse()
|
|
{
|
|
|
|
yield return StartCoroutine(ProgressFocuse());
|
|
buckleGo.transform.DOLocalRotate(openEuler, 0.35f).SetEase(Ease.Linear).SetDelay(0.3f).OnComplete(() =>
|
|
{
|
|
mainGo.transform.DOLocalMove(mainShowPos, 0.35f).SetEase(Ease.Linear).OnComplete(() => {
|
|
|
|
CommonTool.WaitTimeAfterDo(this, 0.35f, () => {
|
|
OnUnLoadFinishHandle?.Invoke();
|
|
mainGo.SetActive(false);
|
|
buckleGo.SetActive(false);
|
|
RewindCameraView();
|
|
});
|
|
|
|
});
|
|
|
|
buckleGo.transform.DOLocalMove(buckleShowPos, 0.35f).SetEase(Ease.Linear);
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|