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.
117 lines
2.7 KiB
117 lines
2.7 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using DG.Tweening;
|
|
|
|
namespace DisComputer
|
|
{
|
|
/*
|
|
* @func 通用简单零件动画
|
|
*
|
|
* */
|
|
public class SimpleAnimation : SpareAnimationBase
|
|
{
|
|
|
|
[Header("展示位置")]
|
|
public Vector3 showPos;
|
|
|
|
[Header("初始位置")]
|
|
public Vector3 initPos;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
public override void SetLoadState()
|
|
{
|
|
mainGo.SetActive(true);
|
|
mainGo.transform.localPosition = initPos;
|
|
}
|
|
|
|
public override void SetUnloadState()
|
|
{
|
|
mainGo.transform.localPosition = showPos;
|
|
mainGo.SetActive(false);
|
|
}
|
|
|
|
|
|
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 UnloadFocuse()
|
|
{
|
|
yield return StartCoroutine(ProgressFocuse());
|
|
mainGo.transform.DOLocalMove(showPos, 0.5f).SetEase(Ease.Linear).OnComplete(() =>
|
|
{
|
|
CommonTool.WaitTimeAfterDo(this, .35f, () =>
|
|
{
|
|
OnUnLoadFinishHandle?.Invoke();
|
|
mainGo.SetActive(false);
|
|
RewindCameraView();
|
|
});
|
|
|
|
});
|
|
}
|
|
|
|
protected override IEnumerator LoadFocuse()
|
|
{
|
|
yield return StartCoroutine(ProgressFocuse());
|
|
mainGo.SetActive(true);
|
|
mainGo.transform.DOLocalMove(initPos, 0.5f).SetEase(Ease.Linear).OnComplete(() =>
|
|
{
|
|
OnLoadFinishHandle?.Invoke();
|
|
});
|
|
LzFramework.UI.TTUIPage.ShowPage<SparePartsView>();
|
|
OnLoadFinishHandle?.Invoke();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|