| | |
| | | public class EquipStarWin : Window |
| | | { |
| | | [SerializeField] RectTransform m_LevelContainer; |
| | | [SerializeField] ImageCouple[] m_Stars; |
| | | [SerializeField] Star[] m_Stars; |
| | | [SerializeField] ItemCell m_TargetEquip; |
| | | [SerializeField] Text m_EquipStar; |
| | | [SerializeField] Materials m_Materials; |
| | |
| | | } |
| | | |
| | | DisplayBaseInfo(); |
| | | DisplayDynamicInfo(true); |
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | |
| | | protected override void OnAfterClose() |
| | | { |
| | | model.ResetOperateParams(); |
| | | } |
| | | |
| | | protected override void OnActived() |
| | | { |
| | | base.OnActived(); |
| | | DisplayDynamicInfo(true); |
| | | } |
| | | |
| | | protected override void LateUpdate() |
| | |
| | | var equipPosition = new Int2(model.selectedLevel.value, model.selectedPlace.value); |
| | | var starLevel = model.equipStarLevel.Fetch(); |
| | | var maxStar = model.equipMaxStarLevel.Fetch(); |
| | | DisplayStars(equipPosition, starLevel, maxStar); |
| | | DisplayPropertyPreview(equipPosition, starLevel, EquipStarModel.GetMaxStarLevel(equipPosition.x)); |
| | | DisplayStarUpgradeButton(equipPosition, starLevel); |
| | | } |
| | | |
| | | if (force || model.stars.dirty) |
| | | { |
| | | DisplayStars(model.stars.Fetch()); |
| | | } |
| | | |
| | | if (force || model.starUpgradeProbability.dirty) |
| | |
| | | } |
| | | } |
| | | |
| | | private void DisplayStars(Int2 equipPosition, int currentStar, int maxStar) |
| | | private void DisplayStars(List<EquipStarModel.Star> stars) |
| | | { |
| | | if (equipPosition.y == 0) |
| | | { |
| | | foreach (var behaviour in m_Stars) |
| | | { |
| | | behaviour.Hide(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (var i = 0; i < m_Stars.Length; i++) |
| | | { |
| | | if (i < maxStar) |
| | | { |
| | | m_Stars[i].Display(i < currentStar); |
| | | } |
| | | else |
| | | { |
| | | m_Stars[i].Hide(); |
| | | } |
| | | } |
| | | } |
| | | StopCoroutine("Co_DisplayStars"); |
| | | StartCoroutine("Co_DisplayStars", stars); |
| | | } |
| | | |
| | | private void DisplayMaterialSlots(Int2 equipPosition, int currentStarLevel) |
| | |
| | | m_EffectFailed.Play(); |
| | | } |
| | | |
| | | IEnumerator Co_DisplayStars(List<EquipStarModel.Star> stars) |
| | | { |
| | | var hasNewStar = stars.FindIndex(x => { return x.newGet; }) != -1; |
| | | if (hasNewStar) |
| | | { |
| | | yield return WaitingForSecondConst.WaitMS2000; |
| | | } |
| | | |
| | | for (var i = 0; i < m_Stars.Length; i++) |
| | | { |
| | | if (i < stars.Count) |
| | | { |
| | | var star = stars[i]; |
| | | m_Stars[i].Display(star.actived); |
| | | if (star.newGet) |
| | | { |
| | | m_Stars[i].PlayEffect(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | m_Stars[i].Hide(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void ViewEquipTip() |
| | | { |
| | | var level = model.selectedLevel.value; |
| | |
| | | } |
| | | |
| | | [System.Serializable] |
| | | public class ImageCouple |
| | | public class Star |
| | | { |
| | | public RectTransform container; |
| | | public Image imageBase; |
| | | public Image imageStar; |
| | | public UIEffect newStarEffect; |
| | | |
| | | public void Display(bool active) |
| | | { |
| | |
| | | { |
| | | container.gameObject.SetActive(false); |
| | | } |
| | | |
| | | public void PlayEffect() |
| | | { |
| | | newStarEffect.Play(); |
| | | } |
| | | } |
| | | |
| | | [System.Serializable] |