| System/FashionDress/FashionDressCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/FashionDress/FashionDressModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/FashionDress/FashionDressQualityBehaviour.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/FashionDress/FashionDressTypeBehaviour.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/FashionDress/FashionDressWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
System/FashionDress/FashionDressCell.cs
@@ -23,6 +23,8 @@ [SerializeField] Transform m_ContainerSelect; [SerializeField] Transform m_Equiped; [SerializeField] Transform m_Preview; [SerializeField] Transform m_UnlockRedpoint; [SerializeField] Transform m_LevelUpRedpoint; [SerializeField] Button m_Select; int fashionDressId = 0; @@ -50,6 +52,11 @@ m_ContainerDarkMask.gameObject.SetActive(fashionDressLevel == 0); m_ContainerStars.gameObject.SetActive(fashionDressLevel > 0); m_UnlockRedpoint.gameObject.SetActive(model.levelUpRedpoint.state == RedPointState.Simple && model.fashionDressRedpointId == fashionDressId); m_LevelUpRedpoint.gameObject.SetActive(model.levelUpRedpoint.state == RedPointState.Simple && model.fashionDressRedpointId == fashionDressId); if (model.TryGetFashionDress(fashionDressId, out fashionDress)) { var equipItemId = fashionDress.GetEquipItemId(); @@ -70,7 +77,7 @@ var levelUpRequireCount = fashionDress.GetLevelUpRequireCount(fashionDressLevel); var requireCountDisplay = UIHelper.AppendStringColor(count >= levelUpRequireCount ? TextColType.DarkGreen : TextColType.Red, count.ToString()); m_ItemCount.text = isMax ? count.ToString() : StringUtility.Contact(requireCountDisplay, "/", levelUpRequireCount); m_ItemCount.text = isMax ? string.Empty : StringUtility.Contact(requireCountDisplay, "/", levelUpRequireCount); var config = Config.Instance.Get<FashionDressConfig>(fashionDressId); m_ItemName.text = config.name; @@ -91,7 +98,7 @@ m_Unlock.gameObject.SetActive(count >= levelUpRequireCount); m_LevelUp.AddListener(LevelUp); m_Unlock.AddListener(Unlock); m_Unlock.AddListener(LevelUp); m_Select.AddListener(Select); } } @@ -105,14 +112,14 @@ } } private void Unlock() { } private void LevelUp() { var error = 0; if (!model.TryLevelUp(fashionDressId, out error)) { model.DisplayLevelUpError(error); return; } } } } System/FashionDress/FashionDressModel.cs
@@ -13,11 +13,19 @@ Dictionary<int, int> fashionTypeMapPlaceDict = new Dictionary<int, int>(); Dictionary<int, List<int>> fashionDressTypeDict = new Dictionary<int, List<int>>(); Dictionary<int, Dictionary<int, List<int>>> fashionDressQualityDict = new Dictionary<int, Dictionary<int, List<int>>>(); const int FASHIONDRESS_REDPOINT_BASE = 10105; const int FASHIONDRESS_FUNC_ID = 0; public readonly Redpoint redpoint = new Redpoint(101, FASHIONDRESS_REDPOINT_BASE); public readonly Redpoint levelUpRedpoint = new Redpoint(FASHIONDRESS_REDPOINT_BASE, 1010501); public int cabinetLevel { get; private set; } public int cabinetExp { get; private set; } public int cabinetMaxLevel { get; private set; } public Dictionary<int, int> fashionDressSelectDict { get; private set; } public List<int> fashionDressLevelUpItems { get; private set; } int m_SelectType = 1; public int selectType @@ -67,6 +75,8 @@ { ParseConfig(); fashionDressSelectDict = new Dictionary<int, int>(); FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; packModel.RefreshItemCountAct += RefreshItemCountAct; } public void OnBeforePlayerDataInitialize() @@ -78,16 +88,37 @@ public void OnPlayerLoginOk() { UpdateRedpoint(); } public override void UnInit() { } private void OnFuncStateChangeEvent(int id) { if (id == FASHIONDRESS_FUNC_ID) { UpdateRedpoint(); } } private void RefreshItemCountAct(PackType packType, int arg2, int itemId) { if (packType == PackType.rptItem) { if (fashionDressLevelUpItems.Contains(itemId)) { UpdateRedpoint(); } } } void ParseConfig() { { var configs = Config.Instance.GetAllValues<FashionDressConfig>(); fashionDressLevelUpItems = new List<int>(); foreach (var config in configs) { fashionDressDict[config.CoatID] = new FashionDress(config); @@ -99,6 +130,10 @@ fashionDressTypeDict.Add(config.type, list); } list.Add(config.CoatID); } if (!fashionDressLevelUpItems.Contains(config.UnlockItemID)) { fashionDressLevelUpItems.Add(config.UnlockItemID); } { @@ -193,6 +228,11 @@ return false; } public bool TryGetFashionDresses(int type, out List<int> list) { return fashionDressTypeDict.TryGetValue(type, out list); } public bool TryGetFashionDressProperty(int id, int level, out Dictionary<int, int> dict) { dict = null; @@ -201,6 +241,34 @@ return fashionDressDict[id].TryGetProperty(level, out dict); } return false; } public bool TryGetCabinetProperty(int level, out Dictionary<int, int> dict) { return cabinetPropertyDict.TryGetValue(level, out dict); } public bool TryGetSatisfyResolves(ref List<int> list) { if (list == null) { list = new List<int>(); } list.Clear(); foreach (var fashionDress in fashionDressDict.Values) { var level = GetFashionDressLevel(fashionDress.id); if (level < fashionDress.maxLevel) { continue; } var count = packModel.GetItemCountByID(PackType.rptItem, fashionDress.requireLevelUpItem); if (count > 0 && !list.Contains(fashionDress.requireLevelUpItem)) { list.Add(fashionDress.requireLevelUpItem); } } return list != null && list.Count > 0; } public bool TryGetSelect(int type, out int id) @@ -212,6 +280,38 @@ return true; } return false; } public bool TryLevelUp(int id, out int error) { error = 0; FashionDress fashionDress; if (TryGetFashionDress(id, out fashionDress)) { var level = GetFashionDressLevel(id); if (level >= fashionDress.maxLevel) { return false; } var count = packModel.GetItemCountByID(PackType.rptItem, fashionDress.requireLevelUpItem); var levelUpRequireCount = fashionDress.GetLevelUpRequireCount(level); if (count < levelUpRequireCount) { error = 1; return false; } } return true; } public void DisplayLevelUpError(int error) { switch (error) { case 1: SysNotifyMgr.Instance.ShowTip("FashionDressLevelUpError_1"); break; } } public void SetPreviewFashionDress(int type, int id) @@ -231,6 +331,34 @@ WindowCenter.Instance.Open<FashionDetailsWin>(); } #endregion #region 红点 public int fashionDressRedpointId { get; private set; } void UpdateRedpoint() { levelUpRedpoint.state = RedPointState.None; if (!FuncOpen.Instance.IsFuncOpen(FASHIONDRESS_FUNC_ID)) { return; } foreach (var fashionDress in fashionDressDict.Values) { var level = GetFashionDressLevel(fashionDress.id); if (level >= fashionDress.maxLevel) { continue; } var levelUpRequireCount = fashionDress.GetLevelUpRequireCount(level); var count = packModel.GetItemCountByID(PackType.rptItem, fashionDress.requireLevelUpItem); if (count >= levelUpRequireCount) { fashionDressRedpointId = fashionDress.id; levelUpRedpoint.state = RedPointState.Simple; return; } } } #endregion } public class FashionDress System/FashionDress/FashionDressQualityBehaviour.cs
@@ -12,6 +12,7 @@ [SerializeField] int m_Quality = 0; [SerializeField] Transform m_ContainerSelect; [SerializeField] Transform m_ContainerNormal; [SerializeField] Transform m_Redpoint; [SerializeField] Shadow m_QualityShadow; [SerializeField] Button m_Select; @@ -28,7 +29,9 @@ public void Display() { model.selectQualityRefresh += SelectQualityRefresh; RedpointCenter.Instance.redpointValueChangeEvent += RedpointValueChangeEvent; DisplaySelect(); DisplayRedpoint(); } void DisplaySelect() @@ -39,9 +42,31 @@ m_QualityShadow.enabled = selected; } void DisplayRedpoint() { var requireRedpoint = false; List<int> list; if (model.levelUpRedpoint.state == RedPointState.Simple && model.TryGetFashionDresses(model.selectType, m_Quality, out list) && list.Contains(model.fashionDressRedpointId)) { requireRedpoint = true; } m_Redpoint.gameObject.SetActive(requireRedpoint); } public void Dispose() { model.selectQualityRefresh -= SelectQualityRefresh; RedpointCenter.Instance.redpointValueChangeEvent -= RedpointValueChangeEvent; } private void RedpointValueChangeEvent(int id) { if (model.levelUpRedpoint.id == id) { DisplayRedpoint(); } } private void SelectQualityRefresh() System/FashionDress/FashionDressTypeBehaviour.cs
@@ -13,6 +13,8 @@ [SerializeField] Button m_Select; [SerializeField] RectTransform m_ContainerSelect; [SerializeField] RectTransform m_ContainerNormal; [SerializeField] Transform m_SelectRedpoint; [SerializeField] Transform m_NormalRedpoint; FashionDressModel model { @@ -26,9 +28,10 @@ public void Display() { model.selectTypeRefresh -= SelectEquipPlaceRefresh; model.selectTypeRefresh += SelectEquipPlaceRefresh; RedpointCenter.Instance.redpointValueChangeEvent += RedpointValueChangeEvent; DisplaySelect(); DisplayRedpoint(); } void DisplaySelect() @@ -37,9 +40,32 @@ m_ContainerNormal.gameObject.SetActive(m_FashionDressType != model.selectType); } void DisplayRedpoint() { var requireRedpoint = false; List<int> list; if (model.levelUpRedpoint.state == RedPointState.Simple && model.TryGetFashionDresses(m_FashionDressType, out list) && list.Contains(model.fashionDressRedpointId)) { requireRedpoint = true; } m_SelectRedpoint.gameObject.SetActive(requireRedpoint); m_NormalRedpoint.gameObject.SetActive(requireRedpoint); } public void Dispose() { model.selectTypeRefresh -= SelectEquipPlaceRefresh; RedpointCenter.Instance.redpointValueChangeEvent -= RedpointValueChangeEvent; } private void RedpointValueChangeEvent(int id) { if (model.levelUpRedpoint.id == id) { DisplayRedpoint(); } } private void SelectEquipPlaceRefresh() System/FashionDress/FashionDressWin.cs
@@ -31,6 +31,13 @@ { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } } PlayerPackModel packModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } List<int> resolveList = new List<int>(); #region Built-in protected override void BindController() { @@ -53,6 +60,7 @@ model.selectTypeRefresh += SelectTypeRefresh; model.selectQualityRefresh += SelectQualityRefresh; model.previewRefresh += PreviewRefresh; packModel.RefreshItemCountAct += RefreshItemCountAct; for (int i = 0; i < m_FashionDressTypes.Length; i++) { @@ -75,6 +83,7 @@ model.selectTypeRefresh -= SelectTypeRefresh; model.selectQualityRefresh -= SelectQualityRefresh; model.previewRefresh -= PreviewRefresh; packModel.RefreshItemCountAct -= RefreshItemCountAct; for (int i = 0; i < m_FashionDressTypes.Length; i++) { @@ -169,14 +178,36 @@ fashionDressCell.Display(cell.index); } private void RefreshItemCountAct(PackType packType, int index, int itemId) { if (packType == PackType.rptItem && model.fashionDressLevelUpItems.Contains(itemId)) { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); } if (packType == PackType.rptEquip) { if (index == (int)RoleEquipType.retFashionClothes || index == (int)RoleEquipType.retFashionWeapon || index == (int)RoleEquipType.retFashionWeapon2) { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); } } } private void Resolve() { if (!model.TryGetSatisfyResolves(ref resolveList)) { SysNotifyMgr.Instance.ShowTip("FashionDressResolveOpenError"); return; } } private void ViewProperty() { WindowCenter.Instance.Open<FashionSumAttrWin>(); } private void ViewDetail()