325 lines
7.9 KiB
C#
325 lines
7.9 KiB
C#
|
|
using DG.Tweening;
|
|||
|
|
using TMPro;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.UI;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ϷUI_<49><5F>ͼ<EFBFBD><CDBC>
|
|||
|
|
/// </summary>
|
|||
|
|
public partial class GameUI
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public TextMeshProUGUI score;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ʻ<EFBFBD><CABB><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public TextMeshProUGUI operatingRange;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>ʱ
|
|||
|
|
/// </summary>
|
|||
|
|
public TextMeshProUGUI countDown;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
|
/// </summary>
|
|||
|
|
public TextMeshProUGUI addScore;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
|
/// </summary>
|
|||
|
|
public TextMeshProUGUI closeCall;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>漼<EFBFBD><E6BCBC>
|
|||
|
|
/// </summary>
|
|||
|
|
public TextMeshProUGUI tril;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><D7B5><EFBFBD>ʱ
|
|||
|
|
/// </summary>
|
|||
|
|
public TextMeshProUGUI shimmerCountDownText;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>ڵ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Image countDownkeepOut;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><D7B5><EFBFBD>ʱ
|
|||
|
|
/// </summary>
|
|||
|
|
public Image shimmerCountDown;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ٶ<EFBFBD><D9B6><EFBFBD>Ч<EFBFBD><D0A7>
|
|||
|
|
/// </summary>
|
|||
|
|
public Transform speedFXPoint;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Transform leftEarlyWarningPoint;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Transform rightEarlyWarningPoint;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Slider distanceProgress;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Ԥ<><D4A4>
|
|||
|
|
/// </summary>
|
|||
|
|
public GameObject earlyWarning;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public GameObject skillBarObj;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ؿ<EFBFBD><D8BF><EFBFBD><EFBFBD>ȶ<EFBFBD><C8B6><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public GameObject endDistance;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
|
/// </summary>
|
|||
|
|
public GameObject scoreShow;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʾ
|
|||
|
|
/// </summary>
|
|||
|
|
public CanvasGroup countdownEnds;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD>ĻЧ<C4BB><D0A7>
|
|||
|
|
/// </summary>
|
|||
|
|
public CanvasGroup dangerousOvertaking;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Animation addScoreAnim;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Animator countDownAnim;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><D7B5><EFBFBD>ʱ
|
|||
|
|
/// </summary>
|
|||
|
|
private Tween shimmerCountDownTween;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ʾ<EFBFBD><CABE>ʻ<EFBFBD><CABB><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void ShowOperatingRange(float operatingRange, float target)
|
|||
|
|
{
|
|||
|
|
this.operatingRange.text = operatingRange.ToString("0") + "m";
|
|||
|
|
distanceProgress.value = operatingRange / target;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetTotalScore(float value)
|
|||
|
|
{
|
|||
|
|
score.gameObject.SetActive(true);
|
|||
|
|
score.text = value.ToString("0");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>漼<EFBFBD><E6BCBC><EFBFBD><EFBFBD>ʾ
|
|||
|
|
/// </summary>
|
|||
|
|
private void SetTril()
|
|||
|
|
{
|
|||
|
|
tril.gameObject.SetActive(UserDataManager.Instance.IsTrySkill());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetCamear()
|
|||
|
|
{
|
|||
|
|
GetComponent<Canvas>().worldCamera = Camera.main;
|
|||
|
|
GetComponent<Canvas>().planeDistance = 0.5f;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʾ<EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetCountdownEnds(bool isTrue)
|
|||
|
|
{
|
|||
|
|
countdownEnds.DOKill();
|
|||
|
|
if (isTrue)
|
|||
|
|
{
|
|||
|
|
countdownEnds.DOFade(1, 1f);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
countdownEnds.alpha = 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD>ĻЧ<C4BB><D0A7>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetDangerousOvertaking()
|
|||
|
|
{
|
|||
|
|
dangerousOvertaking.DOFade(1, 0.5f).SetUpdate(true).OnComplete(() =>
|
|||
|
|
{
|
|||
|
|
dangerousOvertaking.DOFade(0, 0.3f);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ʱ<EFBFBD>ڵ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetCountDownkeepOut()
|
|||
|
|
{
|
|||
|
|
countDownkeepOut.DOFade(0, 0.8f).OnComplete(() =>
|
|||
|
|
{
|
|||
|
|
countDownkeepOut.DOFade(1, 0.3f);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ʱ<EFBFBD>ڵ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="isTrue"></param>
|
|||
|
|
public void SetCountDownkeepOut(bool isTrue)
|
|||
|
|
{
|
|||
|
|
if (isTrue)
|
|||
|
|
{
|
|||
|
|
countDownkeepOut.gameObject.SetActive(true);
|
|||
|
|
countDownkeepOut.color = new Color(0, 0, 0, 1);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
countDownkeepOut.gameObject.SetActive(false);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ʱ
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetCountDown(string value, E_CountDownType e_CountDownType)
|
|||
|
|
{
|
|||
|
|
countDown.gameObject.SetActive(true);
|
|||
|
|
countDown.text = value;
|
|||
|
|
switch (e_CountDownType)
|
|||
|
|
{
|
|||
|
|
case E_CountDownType.Three:
|
|||
|
|
case E_CountDownType.Two:
|
|||
|
|
case E_CountDownType.One:
|
|||
|
|
countDownAnim.SetTrigger("isCommon");
|
|||
|
|
break;
|
|||
|
|
case E_CountDownType.GO:
|
|||
|
|
countDownAnim.SetTrigger("isGO");
|
|||
|
|
DelayedProcessingManager.Instance.ResetDelayDoSecond("CountDown", this, 1, () =>
|
|||
|
|
{
|
|||
|
|
countDown.gameObject.SetActive(false);
|
|||
|
|
});
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7B5><EFBFBD>ʱ
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetShimmerCountDownSetActive(bool isShow)
|
|||
|
|
{
|
|||
|
|
if (!UserDataManager.Instance.userData.guidance.isOverInitialEntry) return;
|
|||
|
|
shimmerCountDown.gameObject.SetActive(isShow);
|
|||
|
|
if(isShow)
|
|||
|
|
{
|
|||
|
|
float value = 4;
|
|||
|
|
shimmerCountDownTween=DOTween.To(() => value, x => value = x, 0, 4).OnUpdate(() =>
|
|||
|
|
{
|
|||
|
|
shimmerCountDown.fillAmount = value / 4;
|
|||
|
|
shimmerCountDownText.text = value.ToString("0");
|
|||
|
|
if(value<=0)
|
|||
|
|
{
|
|||
|
|
SetShimmerCountDownSetActive(false);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if(shimmerCountDownTween!=null)
|
|||
|
|
{
|
|||
|
|
shimmerCountDownTween.Kill();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>þ<EFBFBD><C3BE>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetCloseCall(int value)
|
|||
|
|
{
|
|||
|
|
SetCloseCall(true);
|
|||
|
|
closeCall.text = "CLOSE CALL" + "x" + value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>þ<EFBFBD><C3BE>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetCloseCall(bool isTrue)
|
|||
|
|
{
|
|||
|
|
if (isTrue)
|
|||
|
|
{
|
|||
|
|
closeCall.transform.DOKill();
|
|||
|
|
closeCall.transform.localScale = Vector3.zero;
|
|||
|
|
closeCall.transform.DOScale(Vector3.one * 1.1f, 0.2f).OnComplete(() =>
|
|||
|
|
{
|
|||
|
|
closeCall.transform.DOScale(Vector3.one * 1, 0.1f);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
closeCall.gameObject.SetActive(isTrue);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ӷ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetExtraScore(float value)
|
|||
|
|
{
|
|||
|
|
addScore.gameObject.SetActive(true);
|
|||
|
|
addScore.text = "+" + value.ToString("0");
|
|||
|
|
addScoreAnim.Play(MyConstant.ShakeShow);
|
|||
|
|
DelayedProcessingManager.Instance.ResetDelayDoSecond("AddScore", this, 2f, () =>
|
|||
|
|
{
|
|||
|
|
addScoreAnim.Play(MyConstant.ShakeHide);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetEarlyWarning(E_DirectionType e_DirectionType)
|
|||
|
|
{
|
|||
|
|
earlyWarning.gameObject.SetActive(true);
|
|||
|
|
switch (e_DirectionType)
|
|||
|
|
{
|
|||
|
|
case E_DirectionType.Left:
|
|||
|
|
earlyWarning.transform.position = leftEarlyWarningPoint.position;
|
|||
|
|
break;
|
|||
|
|
case E_DirectionType.Right:
|
|||
|
|
earlyWarning.transform.position = rightEarlyWarningPoint.position;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
DelayedProcessingManager.Instance.DelayDoSecond(this, 2, () =>
|
|||
|
|
{
|
|||
|
|
earlyWarning.gameObject.SetActive(false);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|