| Main/Config/PartialConfigs/ItemCompoundConfig.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/KnapSack/Logic/ComposeGirdCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/KnapSack/Logic/ComposeWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/KnapSack/Logic/RolePackWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/KnapSack/Logic/composeLineCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/KnapSack/PackManager.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/Login/LoginWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Main/System/NewBieGuidance/NewBieWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Main/Config/PartialConfigs/ItemCompoundConfig.cs
@@ -2,11 +2,13 @@ public partial class ItemCompoundConfig : ConfigBase<int, ItemCompoundConfig> { public static Dictionary<int, ItemCompoundConfig> itemCompoundDict = new Dictionary<int, ItemCompoundConfig>(); static Dictionary<int, ItemCompoundConfig> itemCompoundDict = new Dictionary<int, ItemCompoundConfig>(); static Dictionary<int, int> materialToItemDict = new Dictionary<int, int>(); //合成材料到物品的映射 protected override void OnConfigParseCompleted() { itemCompoundDict.Add(makeID, this); materialToItemDict[itemID] = makeID; } public static ItemCompoundConfig GetItemCompoundConfig(int makeID) @@ -21,6 +23,12 @@ return itemCompoundDict.ContainsKey(itemID); } public static int GetMakeIDByMaterial(int itemID) { int makeID = 0; materialToItemDict.TryGetValue(itemID, out makeID); return makeID; } } Main/System/KnapSack/Logic/ComposeGirdCell.cs
@@ -13,27 +13,23 @@ [SerializeField] Image redImg; public void Display(int index) { if (index >= PackManager.Instance.composeItemGuidList.Count) if (index >= PackManager.Instance.composeItemIDList.Count) { return; } var guid = PackManager.Instance.composeItemGuidList[index]; var item = PackManager.Instance.GetItemByGuid(guid); if (item == null) return; itemCell.Init(item); var makeID = PackManager.Instance.composeItemIDList[index]; itemCell.Init(new ItemCellModel(makeID, false, PackManager.Instance.GetItemCountByID(PackType.Item, makeID))); itemCell.button.AddListener(() => { //合成界面 ComposeWin.guid = guid; UIManager.Instance.OpenWindow<ComposeWin>(); UIManager.Instance.OpenWindow<ComposeWin>(makeID); }); var config = ItemCompoundConfig.GetItemCompoundConfig(item.itemId); var targetID = config.itemID; var targetCnt = config.itemCount; var haveCnt = PackManager.Instance.GetItemCountByID(PackType.Item, targetID); if (haveCnt >= targetCnt) var config = ItemCompoundConfig.GetItemCompoundConfig(makeID); var materialID = config.itemID; var materialCnt = config.itemCount; var haveCnt = PackManager.Instance.GetItemCountByID(PackType.Item, materialID); if (haveCnt >= materialCnt) { fullImage.SetActive(true); fillImage.SetActive(false); @@ -44,9 +40,9 @@ fullImage.SetActive(false); fillImage.SetActive(true); redImg.SetActive(false); fillImage.fillAmount = haveCnt / (float)targetCnt; fillImage.fillAmount = haveCnt / (float)materialCnt; } processText.text = haveCnt+ "/" + targetCnt; processText.text = haveCnt + "/" + materialCnt; } } Main/System/KnapSack/Logic/ComposeWin.cs
@@ -17,16 +17,15 @@ [SerializeField] Button composeButton; public static string guid; int useCnt; int targetCnt; int targetID; int itemID; int materialCnt; int materialID; int makeID; protected override void InitComponent() { composeButton.AddListener(() => { if (!ItemLogicUtility.CheckItemCount(PackType.Item, targetID, useCnt * targetCnt, 2)) if (!ItemLogicUtility.CheckItemCount(PackType.Item, materialID, useCnt * materialCnt, 2)) { return; } @@ -34,8 +33,16 @@ CloseWindow(); var pack = new CA303_tagCMItemCompound(); pack.ID = (uint)ItemCompoundConfig.GetItemCompoundConfig(itemID).id; pack.ID = (uint)ItemCompoundConfig.GetItemCompoundConfig(makeID).id; pack.CompoundCnt = (ushort)useCnt; var items = PackManager.Instance.GetItemsById(PackType.Item, materialID); pack.FixedItemIndexCnt = (byte)items.Count; pack.FixedItemIndex = new byte[items.Count]; for (int i = 0; i < items.Count; i++) { pack.FixedItemIndex[i] = (byte)items[i].gridIndex; } GameNetSystem.Instance.SendInfo(pack); }); @@ -44,33 +51,33 @@ protected override void OnPreOpen() { var item = PackManager.Instance.GetItemByGuid(guid); itemID = item.itemId; var config = ItemCompoundConfig.GetItemCompoundConfig(itemID); targetID = config.itemID; targetCnt = config.itemCount; makeID = functionOrder; var makeItem = ItemConfig.Get(makeID); var config = ItemCompoundConfig.GetItemCompoundConfig(makeID); materialID = config.itemID; materialCnt = config.itemCount; itemCell.Init(new ItemCellModel(itemID, false, item.count)); nameText.text = item.config.ItemName; descText.text = item.config.Description; itemCell.Init(new ItemCellModel(makeID, false, PackManager.Instance.GetItemCountByID(PackType.Item, makeID))); nameText.text = makeItem.ItemName; descText.text = makeItem.Description; needItemCell.Init(new ItemCellModel(targetID, false, 0)); needItemCell.Init(new ItemCellModel(materialID, false, 0)); needItemCell.button.AddListener(() => { ItemTipUtility.Show(targetID); ItemTipUtility.Show(materialID); }); var haveCnt = PackManager.Instance.GetItemCountByID(PackType.Item, targetID); var haveStr = Language.Get("storename12", haveCnt + "/" + targetCnt); haveCntText.text = haveCnt < targetCnt ? UIHelper.AppendColor(TextColType.Red, haveStr) : haveStr; var haveCnt = PackManager.Instance.GetItemCountByID(PackType.Item, materialID); var haveStr = Language.Get("storename12", haveCnt + "/" + materialCnt); haveCntText.text = haveCnt < materialCnt ? UIHelper.AppendColor(TextColType.Red, haveStr) : haveStr; useCnt = 1; sliderPanel.Init((value) => { useCnt = value; var haveStr = Language.Get("storename12", haveCnt + "/" + targetCnt * value); haveCntText.text = haveCnt < targetCnt * value ? UIHelper.AppendColor(TextColType.Red, haveStr) : haveStr; var haveStr = Language.Get("storename12", haveCnt + "/" + materialCnt * value); haveCntText.text = haveCnt < materialCnt * value ? UIHelper.AppendColor(TextColType.Red, haveStr) : haveStr; }, Math.Max(1, (int)haveCnt/targetCnt)); }, Math.Max(1, (int)haveCnt/materialCnt)); } Main/System/KnapSack/Logic/RolePackWin.cs
@@ -177,7 +177,7 @@ return; } composeScroller.Refresh(); for (int i = 0; i < PackManager.Instance.composeItemGuidList.Count; i++) for (int i = 0; i < PackManager.Instance.composeItemIDList.Count; i++) { if (i % 5 == 0) { Main/System/KnapSack/Logic/composeLineCell.cs
@@ -10,7 +10,7 @@ { for (int i = 0; i < itemCell.Length; i++) { if (index + i < PackManager.Instance.composeItemGuidList.Count) if (index + i < PackManager.Instance.composeItemIDList.Count) { itemCell[i].SetActive(true); itemCell[i].Display(index + i); Main/System/KnapSack/PackManager.cs
@@ -36,7 +36,8 @@ public Dictionary<int, int> PackMaxCountDict = new Dictionary<int, int>(); //背包类型:背包格子最大数量 public int initBagGridCount { get; private set; } //初始物品背包格子数 public int[] itemPackSortTyps { get; private set; } //背包物品的按类型排序 public List<string> composeItemGuidList = new List<string>(); //合成列表物品guid public List<int> composeItemIDList = new List<int>(); //合成列表物品ID List<int> canComposeItemIDList = new List<int>(); //数量足够合成列表物品ID 排序判断用 //开格子 public Dictionary<int, int> openGirdMoneyDict = new Dictionary<int, int>(); //背包类型:消耗货币类型 @@ -897,11 +898,13 @@ SinglePack singlePack = GetSinglePack(PackType.Item); var items = singlePack.GetAllItems(); redpointComposePack.state = RedPointState.None; foreach (var item in items.Values) { if (ItemCompoundConfig.IsCompoundItem(item.itemId)) int makeID = ItemCompoundConfig.GetMakeIDByMaterial(item.itemId); if (makeID != 0) { var config = ItemCompoundConfig.GetItemCompoundConfig(item.itemId); var config = ItemCompoundConfig.GetItemCompoundConfig(makeID); var targetID = config.itemID; var targetCnt = config.itemCount; if (GetItemCountByID(PackType.Item, targetID) >= targetCnt) @@ -941,35 +944,53 @@ public void RefreshItemComposeList() { //收集合成物品 composeItemGuidList.Clear(); composeItemIDList.Clear(); canComposeItemIDList.Clear(); SinglePack singlePack = GetSinglePack(PackType.Item); var items = singlePack.GetAllItems(); foreach (var item in items.Values) { if (ItemCompoundConfig.IsCompoundItem(item.itemId)) var makeID = ItemCompoundConfig.GetMakeIDByMaterial(item.itemId); if (makeID != 0) { composeItemGuidList.Add(item.guid); } } composeItemIDList.Add(makeID); composeItemGuidList.Sort(SortItemCompose); } int SortItemCompose(string guidA, string guidB) var config = ItemCompoundConfig.GetItemCompoundConfig(makeID); var targetID = config.itemID; var targetCnt = config.itemCount; if (GetItemCountByID(PackType.Item, targetID) >= targetCnt) { var itemA = GetItemByGuid(guidA); var itemB = GetItemByGuid(guidB); canComposeItemIDList.Add(makeID); } } } var colorA = itemA.config.ItemColor; var colorB = itemB.config.ItemColor; composeItemIDList.Sort(SortItemCompose); } int SortItemCompose(int itemIDA, int itemIDB) { // 合成材料够不够 var isEnoughA = canComposeItemIDList.Contains(itemIDA); var isEnoughB = canComposeItemIDList.Contains(itemIDB); if (isEnoughA != isEnoughB) { return isEnoughA ? -1 : 1; } var itemA = ItemConfig.Get(itemIDA); var itemB = ItemConfig.Get(itemIDB); var colorA = itemA.ItemColor; var colorB = itemB.ItemColor; if (colorA != colorB) { return colorB - colorA; } return itemA.itemId - itemB.itemId; return itemA.ID - itemB.ID; } #endregion Main/System/Login/LoginWin.cs
@@ -1,7 +1,3 @@ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics.Tracing; using UnityEngine; using UnityEngine.UI; using System.IO; Main/System/NewBieGuidance/NewBieWin.cs
@@ -63,7 +63,14 @@ //关闭其他可能在主界面显示的窗口等 // UIManager.Instance.CloseWindow<ChatWin>(); NewBieCenter.Instance.guideStepChangeEvent += OnStepChange; Display(); // Display(); } protected override void OnPreClose() { m_NewFunction.SetActive(false); m_NewBieGuide.SetActive(false); m_GuideTalkRect.SetActive(true); } protected override void OnClose() @@ -78,10 +85,10 @@ } // protected override void NextFrameAfterOpen() // { // Display(); // } protected override void NextFrameAfterOpen() { Display(); } #endregion void Display()