private IEnumerator DoShow(DialogDeploy info, bool isFirst) { //设置立绘信息 SetDrawImage(Draw, info); //设置对话框信息 Dialog.Alpha = 1f; Dialog.transform.localScale = new Vector3(0, _dialogOriginScale.y, _dialogOriginScale.z); Dialog.rectTransform.sizeDelta = _dialogOriginSize; Text.rectTransform.sizeDelta = _textOriginSize; Text.Alpha = 1f; SetDialogText(Text, Dialog, info.text); if (isFirst) { //首次显示动画 Draw.rectTransform.anchoredPosition = StartPos; Draw.color = new Color(1f, 1f, 1f, 0f); Draw.rectTransform.DOAnchorPos(Vector2.zero, 0.3f); Draw.DOFade(1f, 1f); yield return(new WaitForSeconds(0.4f)); } else { Draw.DOColor(Color.white, 0.3f); Draw.rectTransform.DOAnchorPos(Vector2.zero, 0.3f); yield return(new WaitForSeconds(0.15f)); } Sound.PlayUiAudioOneShot(1006); Dialog.transform.DOScaleX(_dialogOriginScale.x, 0.2f); }
//设置立绘信息 private void SetDrawImage(RawImage image, DialogDeploy info) { //读取立绘 image.SetRawImageTexture(info.drawing); image.SetNativeSize(); var h = 584; var size = image.rectTransform.sizeDelta; var xRatio = h / size.y; image.rectTransform.sizeDelta = new Vector2(size.x * xRatio, h); var euler = Draw.transform.eulerAngles; euler.y = info.revertImage ? 180 : 0; Draw.transform.eulerAngles = euler; }
public void Show(DialogDeploy info, bool isFirst) { Deploy = info; gameObject.SetActiveSafe(true); StartCoroutine(DoShow(info, isFirst)); }