| System/Compose/New/ComposeWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/GatheringSoul/GatherSoulEquipListWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/GatheringSoul/GatherSoulItemBehaviour.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/GatheringSoul/GatherSoulResolveCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/GatheringSoul/GatherSoulResolveItem.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/GatheringSoul/GatherSoulResolveWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/GatheringSoul/GatheringSoulModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
System/Compose/New/ComposeWin.cs
@@ -33,6 +33,7 @@ private FunctionButton _itemUITitleType; [SerializeField] private FunctionButton _dogzEquipFunc; [SerializeField] FunctionButton m_GatherSoulCompose; [SerializeField] private FunctionButtonGroup _funcBtnGroup; #endregion @@ -59,11 +60,13 @@ _equipUITitleType.onClick.AddListener(OnClickEquipCompose); _itemUITitleType.onClick.AddListener(OnClickItemCompose); _dogzEquipFunc.AddListener(ClickDogzEquipCompose); m_GatherSoulCompose.AddListener(GatherSoulCompose); _prePageBtn.onClick.AddListener(OnClickLeftBtn); _nextPageBtn.onClick.AddListener(OnClickRightBtn); _closeBtn.onClick.AddListener(OnClickCloseBtn); } protected override void OnPreOpen() { ComposeModel.ResetModel(); @@ -265,6 +268,11 @@ functionOrder = _wingsUITitleType.order; } private void GatherSoulCompose() { } private void CloseSubWindows() { System/GatheringSoul/GatherSoulEquipListWin.cs
@@ -88,7 +88,7 @@ var item = equipList[i]; for (int k = i + 1; k < equipList.Count; k++) { var compare = item.IsBetter(equipList[k]); var compare = item.Compare(equipList[k]); if (item.ExistSameProperty(equipList[k].id) && (compare == 1 || compare == 0)) { System/GatheringSoul/GatherSoulItemBehaviour.cs
@@ -10,8 +10,10 @@ public class GatherSoulItemBehaviour : MonoBehaviour { [SerializeField] RectTransform m_ContainerItem; [SerializeField] Image m_ItemBottom; [SerializeField] Image m_Icon; [SerializeField] Text m_Level; [SerializeField] Text m_ItemName; [SerializeField] Button m_Func; VirtualPackModel model @@ -29,47 +31,79 @@ get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } VirtualItem virtualItem; VirtualItem diplayItem; private void Awake() { m_Func.onClick.AddListener(OnFunc); if (m_Func != null) { m_Func.onClick.AddListener(OnFunc); } } /// <summary> /// 背包类型,背包位置索引 /// 背包位置索引 /// </summary> /// <param name="packType"></param> /// <param name="index"></param> public void Display(int index) { virtualItem = default(VirtualItem); diplayItem = default(VirtualItem); GatherSoulItem item; bool exist = model.TryGetItem(PackType.rptGatherSoul, index, out item) && index != -1; m_ContainerItem.gameObject.SetActive(exist); if (exist) { virtualItem = new VirtualItem() diplayItem = new VirtualItem() { packType = PackType.rptGatherSoul, index = index, itemId = item.id, level = item.level, }; Display(); } } var config = Config.Instance.Get<ItemConfig>(item.id); if (config != null) public void Display(int id, int level) { diplayItem = new VirtualItem() { packType = (PackType)0, itemId = id, level = level, }; m_ContainerItem.gameObject.SetActive(true); Display(); } void Display() { var config = Config.Instance.Get<ItemConfig>(diplayItem.itemId); if (config != null) { m_Icon.SetSprite(config.IconKey); if (m_Level != null) { m_Icon.SetSprite(config.IconKey); m_Level.text = Language.Get("Z1024", item.level); m_Level.text = Language.Get("Z1024", diplayItem.level); } if (m_ItemBottom != null) { m_ItemBottom.SetItemBackGround(config.ItemColor); } if (m_ItemName != null) { m_ItemName.text = config.ItemName; } } } void OnFunc() { if ((int)virtualItem.packType != 0) if (diplayItem.packType == PackType.rptGatherSoul) { VirtualPackItem item; if (model.TryGetItem(virtualItem.packType, virtualItem.index, out item)) GatherSoulItem item; if (model.TryGetItem(diplayItem.packType, diplayItem.index, out item)) { var itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>(); var data = new ItemAttrData(item.id); @@ -99,17 +133,21 @@ itemTipsModel.SetItemTipsModel(data); } } else { } } private void OnTipFunc(ItemWinBtnType type, string arg2) { if (virtualItem.Equals(default(VirtualItem))) if (diplayItem.Equals(default(VirtualItem))) { WindowCenter.Instance.Close<GatherSoulTipWin>(); return; } GatherSoulItem item; if (!model.TryGetItem(virtualItem.packType, virtualItem.index, out item)) if (!model.TryGetItem(diplayItem.packType, diplayItem.index, out item)) { WindowCenter.Instance.Close<GatherSoulTipWin>(); return; System/GatheringSoul/GatherSoulResolveCell.cs
@@ -5,8 +5,16 @@ { public class GatherSoulResolveCell : CellView { [SerializeField] GatherSoulResolveItem[] m_Items; public void Display(int line) { for (int i = 0; i < m_Items.Length; i++) { var index = line * m_Items.Length + i; m_Items[i].Display(index); } } } } System/GatheringSoul/GatherSoulResolveItem.cs
@@ -1,5 +1,7 @@ using System.Collections; using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; @@ -7,7 +9,50 @@ { public class GatherSoulResolveItem : MonoBehaviour { [SerializeField] RectTransform m_Container; [SerializeField] Image m_ItemBottom; [SerializeField] Image m_Icon; [SerializeField] Text m_Level; [SerializeField] Button m_Func; GatheringSoulModel model { get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } int index = -1; private void Awake() { m_Func.AddListener(OnFunc); } public void Display(int index) { this.index = index; var item = index < model.resolveItems.Count ? model.resolveItems[index] : null; bool exist = index < model.resolveItems.Count || !item.Equals(default(GatherSoulItem)); m_Container.gameObject.SetActive(exist); if (exist) { var itemConfig = Config.Instance.Get<ItemConfig>(item.id); m_ItemBottom.SetItemBackGround(itemConfig.ItemColor); m_Icon.SetSprite(itemConfig.IconKey); m_Level.text = Language.Get("Z1024", item.level); } } private void OnFunc() { if (index != -1 && index < model.resolveItems.Count) { if (model.resolveItems[index] == null) { return; } model.RemoveOneKeyResolve(index); } } } } System/GatheringSoul/GatherSoulResolveWin.cs
@@ -28,7 +28,10 @@ get { return ModelCenter.Instance.GetModel<GatheringSoulModel>(); } } List<GatherSoulItem> resolveItems = new List<GatherSoulItem>(); VirtualPackModel virtualPack { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } } int selectQuality = 2; @@ -48,12 +51,14 @@ protected override void OnPreOpen() { resolveItems.Clear(); model.resolveItems.Clear(); Display(); PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent; model.gatherSoulPackRefresh += GatherSoulPackRefresh; m_QualitySort.onSelectSortEvent += OnSelectSort; model.oneKeyResolveRefresh += OneKeyResolveRefresh; m_QualitySort.SetDefault(); m_ScrollerControl.JumpIndex(0); } protected override void OnAfterOpen() @@ -62,10 +67,11 @@ protected override void OnPreClose() { resolveItems.Clear(); model.resolveItems.Clear(); PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerDataRefreshInfoEvent; model.gatherSoulPackRefresh -= GatherSoulPackRefresh; m_QualitySort.onSelectSortEvent -= OnSelectSort; model.oneKeyResolveRefresh -= OneKeyResolveRefresh; } protected override void OnAfterClose() @@ -94,6 +100,11 @@ } } private void OneKeyResolveRefresh() { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); } private void Display() { DisplayResolveItems(); @@ -102,34 +113,48 @@ private void GatherSoulPackRefresh() { for (int i = 0; i < resolveItems.Count; i++) bool change = false; for (int i = 0; i < model.resolveItems.Count; i++) { if (!model.CheckExist(resolveItems[i])) if (!model.CheckExist(model.resolveItems[i])) { resolveItems[i] = null; change = true; model.resolveItems[i] = null; } } m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); if (change) { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); } } void DisplayResolveItems() { model.GetOneKeyResolveSouls(selectQuality, ref resolveItems); var line = Mathf.CeilToInt((float)resolveItems.Count / m_LineCount); m_ScrollerControl.Refresh(); for (int i = 0; i < line; i++) model.GetResolveSouls(selectQuality, model.resolveItems); model.resolveItems.Sort(model.CommonSort2); if (m_ScrollerControl.GetNumberOfCells(m_ScrollerControl.m_Scorller) == 0) { m_ScrollerControl.AddCell(ScrollerDataType.Header, i); var count = virtualPack.GetPackCapacity(PackType.rptGatherSoul); var line = Mathf.CeilToInt((float)count / m_LineCount); m_ScrollerControl.Refresh(); for (int i = 0; i < line; i++) { m_ScrollerControl.AddCell(ScrollerDataType.Header, i); } m_ScrollerControl.Restart(); } m_ScrollerControl.Restart(); else { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); } } void DisplayResolveSoulDust() { var result = 0; for (int i = 0; i < resolveItems.Count; i++) for (int i = 0; i < model.resolveItems.Count; i++) { result += model.GetResolveReturnCost(resolveItems[i].id, resolveItems[i].level); result += model.GetResolveReturnCost(model.resolveItems[i].id, model.resolveItems[i].level); } var soulDust = UIHelper.GetMoneyCnt(28); m_SoulDust.text = StringUtility.Contact(soulDust, "+", result); System/GatheringSoul/GatheringSoulModel.cs
@@ -19,11 +19,19 @@ public Dictionary<int, List<int>> gatherSoulPropertys { get; private set; } public List<int> packIndexs { get; private set; } public List<GatherSoulItem> resolveItems { get; private set; } public int holeCount { get { return holeItemTypeDict.Count; } } public bool autoResolve { get; set; } public int autoResolveRemainCount { get; private set; } public event Action<int> gatherSoulHoleRefresh; public event Action gatherSoulPackRefresh; @@ -35,14 +43,15 @@ static readonly IComparer<int> soulPackSort = new GatherSoulPackSort(); static readonly IEqualityComparer<int> holeItemTypeDistinct = new HoleItemTypeDistinct(); VirtualPackModel virtualPackModel { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } } VirtualPackModel virtualPack { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } } public override void Init() { ParseConfig(); packIndexs = new List<int>(); resolveItems = new List<GatherSoulItem>(); virtualPackModel.virtualPackRefresh += VirtualPackRefresh; virtualPack.virtualPackRefresh += VirtualPackRefresh; } public void OnBeforePlayerDataInitialize() @@ -52,12 +61,12 @@ public void OnPlayerLoginOk() { CheckAutoResolve(); } public override void UnInit() { virtualPackModel.virtualPackRefresh -= VirtualPackRefresh; virtualPack.virtualPackRefresh -= VirtualPackRefresh; } void ParseConfig() @@ -134,6 +143,7 @@ if (packType == PackType.rptGatherSoul) { RefreshGatherSoulPack(); CheckAutoResolve(); } } @@ -153,7 +163,7 @@ packIndexs.Sort(CommonSort); var existCount = packIndexs.Count; List<GatherSoulItem> list; if (virtualPackModel.TryGetItems(PackType.rptGatherSoul, out list)) if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { for (int i = 0; i < list.Count; i++) { @@ -173,7 +183,7 @@ void SelectBestEquipSoul(List<int> holes) { List<GatherSoulItem> list; if (virtualPackModel.TryGetItems(PackType.rptGatherSoul, out list)) if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { var error = 0; for (int k = 0; k < holes.Count; k++) @@ -194,7 +204,7 @@ void SelectBestReplaceSoul() { List<GatherSoulItem> list; if (virtualPackModel.TryGetItems(PackType.rptGatherSoul, out list)) if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { for (int i = 0; i < list.Count; i++) { @@ -202,7 +212,7 @@ if (SatisfyReplace(list[i], out hole)) { GatherSoulItem item; if (TryGetItem(hole, out item) && list[i].IsBetter(item) == 1) if (TryGetItem(hole, out item) && list[i].Compare(item) == 1) { packIndexs.Add(list[i].index); } @@ -218,12 +228,12 @@ for (int i = 0; i < packIndexs.Count; i++) { GatherSoulItem item; virtualPackModel.TryGetItem(PackType.rptGatherSoul, packIndexs[i], out item); virtualPack.TryGetItem(PackType.rptGatherSoul, packIndexs[i], out item); for (int k = i + 1; k < packIndexs.Count; k++) { GatherSoulItem compareItem; virtualPackModel.TryGetItem(PackType.rptGatherSoul, packIndexs[k], out compareItem); int compare = item.IsBetter(compareItem); virtualPack.TryGetItem(PackType.rptGatherSoul, packIndexs[k], out compareItem); int compare = item.Compare(compareItem); if (item.ExistSameProperty(compareItem.id) && (compare == 1 || compare == 0)) { @@ -269,7 +279,7 @@ public bool ContainsEquipSoul(int hole) { List<GatherSoulItem> list; if (virtualPackModel.TryGetItems(PackType.rptGatherSoul, out list)) if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { int error = 0; for (int i = 0; i < list.Count; i++) @@ -287,7 +297,7 @@ { equipList.Clear(); List<GatherSoulItem> list; if (virtualPackModel.TryGetItems(PackType.rptGatherSoul, out list)) if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { var error = 0; for (int i = 0; i < list.Count; i++) @@ -436,14 +446,14 @@ continue; } if (!item.ExistSameProperty(compare.id) || item.IsBetter(compare) != 1) || item.Compare(compare) != 1) { return false; } } } List<GatherSoulItem> list; if (virtualPackModel.TryGetItems(PackType.rptGatherSoul, out list)) if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { for (int i = 0; i < list.Count; i++) { @@ -453,7 +463,7 @@ continue; } if (!item.ExistSameProperty(compare.id) || item.IsBetter(compare) != 1) || item.Compare(compare) != 1) { return false; } @@ -525,7 +535,7 @@ if (item.placeType == 0) { GatherSoulItem compare; same = virtualPackModel.TryGetItem(PackType.rptGatherSoul, item.index, out compare) same = virtualPack.TryGetItem(PackType.rptGatherSoul, item.index, out compare) && item.IsEqual(compare); } else if (item.placeType == 1) @@ -576,30 +586,55 @@ { GatherSoulItem lhsItem; GatherSoulItem rhsItem; if (!virtualPackModel.TryGetItem(PackType.rptGatherSoul, lhs, out lhsItem) || !virtualPackModel.TryGetItem(PackType.rptGatherSoul, rhs, out rhsItem)) if (!virtualPack.TryGetItem(PackType.rptGatherSoul, lhs, out lhsItem) || !virtualPack.TryGetItem(PackType.rptGatherSoul, rhs, out rhsItem)) { return 0; } var lhsPropertyCount = gatherSoulPropertys[lhsItem.id].Count; var rhsPropertyCount = gatherSoulPropertys[rhsItem.id].Count; if (lhsPropertyCount != rhsPropertyCount) return CommonSort(lhsItem, rhsItem); } public int CommonSort2(GatherSoulItem lhs, GatherSoulItem rhs) { if (lhs.gatherSoulType != rhs.gatherSoulType) { return -lhsPropertyCount.CompareTo(rhsPropertyCount); return lhs.gatherSoulType.CompareTo(rhs.gatherSoulType); } var lhsConfig = Config.Instance.Get<ItemConfig>(lhsItem.id); var rhsConfig = Config.Instance.Get<ItemConfig>(rhsItem.id); if (lhsConfig.ItemColor != rhsConfig.ItemColor) if (lhs.gatherSoulType != GatherSoulType.Essence && rhs.gatherSoulType != GatherSoulType.Essence) { var lhsPropertys = gatherSoulPropertys[lhs.id]; var rhsPropertys = gatherSoulPropertys[rhs.id]; if (lhsPropertys.Count != rhsPropertys.Count) { return -lhsPropertys.Count.CompareTo(rhsPropertys.Count); } } var lhsConfig = Config.Instance.Get<ItemConfig>(lhs.id); var rhsConfig = Config.Instance.Get<ItemConfig>(rhs.id); if (null == lhsConfig || null == rhsConfig) { return 0; } if (lhsConfig.ItemColor.CompareTo(rhsConfig.ItemColor) != 0) { return -lhsConfig.ItemColor.CompareTo(rhsConfig.ItemColor); } var lhsPropertys = gatherSoulPropertys[lhsItem.id]; var rhsPropertys = gatherSoulPropertys[rhsItem.id]; var lhsPropertySort = GetPropertyHighestSort(lhsPropertys); var rhsPropertySort = GetPropertyHighestSort(rhsPropertys); if (lhsPropertySort != rhsPropertySort) if (lhs.gatherSoulType != GatherSoulType.Essence && rhs.gatherSoulType != GatherSoulType.Essence) { return -lhsPropertySort.CompareTo(rhsPropertySort); var lhsPropertys = gatherSoulPropertys[lhs.id]; var rhsPropertys = gatherSoulPropertys[rhs.id]; var lhsPropertySort = GetPropertyHighestSort(lhsPropertys); var rhsPropertySort = GetPropertyHighestSort(rhsPropertys); if (lhsPropertySort != rhsPropertySort) { return -lhsPropertySort.CompareTo(rhsPropertySort); } } if (lhs.level.CompareTo(rhs.level) != 0) { return -lhs.level.CompareTo(rhs.level); } return 0; } @@ -723,6 +758,7 @@ #endregion #region 分解 public event Action oneKeyResolveRefresh; public int GetResolveReturnCost(int id, int level) { float result = 0; @@ -744,7 +780,7 @@ return (int)result; } public void GetOneKeyResolveSouls(int quality, ref List<GatherSoulItem> list) public void GetResolveSouls(int quality, List<GatherSoulItem> list) { list.Clear(); Dictionary<int, int> dict = new Dictionary<int, int>(); @@ -758,15 +794,24 @@ } } List<GatherSoulItem> packlist; if (virtualPackModel.TryGetItems(PackType.rptGatherSoul, out packlist)) if (virtualPack.TryGetItems(PackType.rptGatherSoul, out packlist)) { for (int i = 0; i < packlist.Count; i++) { if (packlist[i].itemType == GATHERSOUL_ESSENCE_TYPE) { continue; } SetPropertyQuality(packlist[i], ref dict); } } for (int i = 0; i < packlist.Count; i++) { if (packlist[i].itemType == GATHERSOUL_ESSENCE_TYPE) { list.Add(packlist[i]); continue; } var propertys = gatherSoulPropertys[packlist[i].id]; if (propertys.Count > 1) { @@ -793,6 +838,38 @@ { dict[property] = itemConfig.ItemColor; } } } public void RemoveOneKeyResolve(int index) { if (index != -1 && index < resolveItems.Count) { resolveItems[index] = null; if (oneKeyResolveRefresh != null) { oneKeyResolveRefresh(); } } } List<GatherSoulItem> autoResolveList = new List<GatherSoulItem>(); void CheckAutoResolve() { if (!autoResolve) { return; } var capacity = virtualPack.GetPackCapacity(PackType.rptGatherSoul); List<GatherSoulItem> list; if (virtualPack.TryGetItems(PackType.rptGatherSoul, out list)) { if (capacity - list.Count > autoResolveRemainCount) { return; } autoResolveList.Clear(); GetResolveSouls(int.MaxValue, autoResolveList); } } #endregion @@ -871,7 +948,7 @@ return false; } public int IsBetter(GatherSoulItem compare) public int Compare(GatherSoulItem compare) { var comparePropertyCount = model.gatherSoulPropertys[compare.id].Count; var propertyCount = model.gatherSoulPropertys[id].Count; @@ -936,37 +1013,7 @@ { return 0; } if (lhsItem.gatherSoulType.CompareTo(rhsItem.gatherSoulType) != 0) { return lhsItem.gatherSoulType.CompareTo(rhsItem.gatherSoulType); } var lhsPropertys = model.gatherSoulPropertys[lhsItem.id]; var rhsPropertys = model.gatherSoulPropertys[rhsItem.id]; if (lhsPropertys.Count != rhsPropertys.Count) { return -lhsPropertys.Count.CompareTo(rhsPropertys.Count); } var lhsConfig = Config.Instance.Get<ItemConfig>(lhsItem.id); var rhsConfig = Config.Instance.Get<ItemConfig>(rhsItem.id); if (null == lhsConfig || null == rhsConfig) { return 0; } if (lhsConfig.ItemColor.CompareTo(rhsConfig.ItemColor) != 0) { return -lhsConfig.ItemColor.CompareTo(rhsConfig.ItemColor); } var lhsPropertySort = model.GetPropertyHighestSort(lhsPropertys); var rhsPropertySort = model.GetPropertyHighestSort(rhsPropertys); if (lhsPropertySort != rhsPropertySort) { return -lhsPropertySort.CompareTo(rhsPropertySort); } if (lhsItem.level.CompareTo(rhsItem.level) != 0) { return -lhsItem.level.CompareTo(rhsItem.level); } return 0; return model.CommonSort2(lhsItem, rhsItem); } } }