From 45f7442afa3b25cc79c76898224e48d6aed1a2ee Mon Sep 17 00:00:00 2001 From: liuzhiwei <liuzhiwei@qq.com> Date: Thu, 24 Dec 2020 15:22:55 +0800 Subject: [PATCH] Merge branch 'master' of http://47.95.218.140:8090/r/GemBattle into master --- Assets/Scripts/UI/FinalPanel/FinalPanelItem.cs | 106 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 91 insertions(+), 15 deletions(-) diff --git a/Assets/Scripts/UI/FinalPanel/FinalPanelItem.cs b/Assets/Scripts/UI/FinalPanel/FinalPanelItem.cs index 9a16539..25e9791 100644 --- a/Assets/Scripts/UI/FinalPanel/FinalPanelItem.cs +++ b/Assets/Scripts/UI/FinalPanel/FinalPanelItem.cs @@ -1,43 +1,119 @@ -using UnityEngine.UI; +using UnityEngine; +using UnityEngine.UI; using EnhancedUI.EnhancedScroller; using TMPro; using DG.Tweening; +using KTGMGemClient; + public class FinalPanelItem : EnhancedScrollerCellView { public Text playerNameTxt; + public Text playerWaveTxt; public TextMeshProUGUI playerScoreTxt; + public TextMeshProUGUI indexTxt; - public Image icon; + //public Image icon; public Image backGround; + public Sprite tmpBackGround;//自己的背景 + public Sprite otherBackGround;//其他人的背景 + public Color tmpColor;//自己的字体颜色 + public Color otherColor;//其他人的字体颜色 + Vector3 offect; + + private RectTransform rt; + + //public TextMeshProUGUI rankUpbj; + + //bool isSelfPlayer; + + /// <summary> + /// Start is called on the frame when a script is enabled just before + /// any of the Update methods is called the first time. + /// </summary> + void Awake() + { + offect = Vector3.zero; + rt = transform.GetComponent<RectTransform>(); + } + public void SetData(FinalPanelItemData data) { - playerNameTxt.text = data.playerName; - playerScoreTxt.text = data.score.ToString(); - if (data.spriteIcon != null) + playerNameTxt.text = data.httpInfo.nickname; + playerScoreTxt.text = data.httpInfo.score.ToString(); + playerWaveTxt.text = data.httpInfo.waveInfo; + + if (data.index > 3)//前三名的手动隐藏了 { - if (!icon.gameObject.activeSelf) icon.gameObject.SetActive(true); - icon.sprite = data.spriteIcon; - indexTxt.text = ""; + indexTxt.text = data.index.ToString(); + } + + if (data.httpInfo.username.Equals(GameConfig.Imei)) + { + //isSelfPlayer = true; + //是自己 + if (backGround.sprite != tmpBackGround) + backGround.sprite = tmpBackGround; + if (playerNameTxt.color != tmpColor) + { + playerNameTxt.color = tmpColor; + playerScoreTxt.color = tmpColor; + playerWaveTxt.color = tmpColor; + } } else { - icon.gameObject.SetActive(false); - indexTxt.text = data.index.ToString(); - } - backGround.sprite = data.spriteBackGround; + //isSelfPlayer = false; + if (backGround.sprite != otherBackGround) + backGround.sprite = otherBackGround; + if (playerNameTxt.color != otherColor) + { + playerNameTxt.color = otherColor; + playerScoreTxt.color = otherColor; + playerWaveTxt.color = otherColor; + } + } + if (rt != null) + { + offect.x = rt.anchoredPosition3D.x; + offect.y = rt.anchoredPosition3D.y; + + rt.anchoredPosition3D = offect; + } } + + // /// <summary> + // /// 检查排名上升 + // /// </summary> + // /// <param name="rankUp"></param> + // public void CheckRank(int rankUp) + // { + // if (rankUp > 0) + // { + // Debug.Log($"排名上升:{rankUp} isSelfPlayer:{isSelfPlayer} rankUpbj.gameObject.activeSelf:{rankUpbj.gameObject.activeSelf}"); + // if (isSelfPlayer && !rankUpbj.gameObject.activeSelf) + // { + // rankUpbj.gameObject.SetActive(true); + // rankUpbj.text = rankUp.ToString(); + // } + // } + // else if (rankUpbj.gameObject.activeSelf) + // { + // rankUpbj.gameObject.SetActive(false); + // } + // } public void SetPos() { - backGround.rectTransform.anchoredPosition = new UnityEngine.Vector2(720, 0); + backGround.rectTransform.anchoredPosition = new UnityEngine.Vector2(-796, 0); } public void PlayDoTween(float duration) { - Sequence agentTweenSeq = DOTween.Sequence(); - agentTweenSeq.Append(backGround.rectTransform.DOAnchorPosX(0, duration)); + //Sequence agentTweenSeq = DOTween.Sequence(); + //agentTweenSeq.Join(backGround.rectTransform.DOAnchorPosX(0, duration)); + backGround.rectTransform.DOAnchorPosX(0, duration); } } -- Gitblit v1.9.1