| System/EquipStar/EquipStarModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/EquipStar/EquipStarWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
System/EquipStar/EquipStarModel.cs
@@ -22,6 +22,8 @@ {5,new LogicString () }, }; public readonly LogicList<Star> stars = new LogicList<Star>(); public readonly LogicInt specialMaterial = new LogicInt(); public readonly LogicInt starResultEffect = new LogicInt(); @@ -52,6 +54,7 @@ public void UpdateStarLevels(HA3B1_tagMCEquipPartStarInfo info) { var selectedEquipOldStar = GetEquipStarLevel(new Int2(selectedLevel.value, selectedPlace.value)); for (var i = 0; i < info.InfoList.Length; i++) { var equipPosition = EquipSet.ServerPlaceToClientPlace(info.InfoList[i].EquipPackIndex); @@ -62,8 +65,12 @@ } } equipStarLevel.value = GetEquipStarLevel(new Int2(selectedLevel.value, selectedPlace.value)); var starLevel = GetEquipStarLevel(new Int2(selectedLevel.value, selectedPlace.value)); equipStarLevel.value = starLevel; selectedPlace.dirty = true; var maxStarLevel = GetMaxStarLevel(selectedLevel.value); UpdateSelelctedEquipStars(selectedEquipOldStar, starLevel, maxStarLevel); foreach (var candidate in candidatePlaces.Values) { @@ -174,6 +181,8 @@ { item.value = string.Empty; } stars.Clear(); } public void SelectLevel(int level) @@ -212,9 +221,12 @@ candidate.selected.value = candidate.equipPosition == equipPosition; } equipStarLevel.value = GetEquipStarLevel(equipPosition); equipMaxStarLevel.value = GetMaxStarLevel(equipPosition.x); var starLevel = GetEquipStarLevel(equipPosition); var maxStarLevel = GetMaxStarLevel(equipPosition.x); equipStarLevel.value = starLevel; equipMaxStarLevel.value = maxStarLevel; UpdateSelelctedEquipStars(starLevel, starLevel, maxStarLevel); AutoAddMaterials(equipPosition); CalculateStarUpgradeProbability(equipPosition); } @@ -558,6 +570,19 @@ return materials.ContainsKey(index) ? materials[index] : null; } private void UpdateSelelctedEquipStars(int oldStarLevel, int newStarLevel, int maxStarLevel) { stars.Clear(); for (var i = 1; i <= maxStarLevel; i++) { stars.Add(new Star() { actived = i <= newStarLevel, newGet = i <= newStarLevel && i > oldStarLevel, }); } } private void ParseConfig() { var configs = EquipStarConfig.GetValues(); @@ -570,6 +595,11 @@ } } public struct Star { public bool actived; public bool newGet; } } } System/EquipStar/EquipStarWin.cs
@@ -15,7 +15,7 @@ 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; @@ -56,7 +56,6 @@ } DisplayBaseInfo(); DisplayDynamicInfo(true); } protected override void OnAfterOpen() @@ -71,6 +70,12 @@ protected override void OnAfterClose() { model.ResetOperateParams(); } protected override void OnActived() { base.OnActived(); DisplayDynamicInfo(true); } protected override void LateUpdate() @@ -143,9 +148,13 @@ 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) @@ -167,29 +176,10 @@ } } 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) @@ -427,6 +417,32 @@ 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; @@ -440,11 +456,12 @@ } [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) { @@ -456,6 +473,11 @@ { container.gameObject.SetActive(false); } public void PlayEffect() { newStarEffect.Play(); } } [System.Serializable]