Main/Component/UI/Common/SliderPanel.cs
@@ -21,32 +21,35 @@ Action<int> OnChangeEvent; void Start() { slider.AddListener((value) => { Refresh(); }); slider.AddListener((value) => { if (value == 0) { slider.value = 1; return; } Refresh(); }); addBtn.AddListener(() => { slider.value += 1; Refresh(); }); addBtn.onPress.AddListener(() => { slider.value += 1; Refresh(); }); decBtn.AddListener(() => { slider.value -= 1; Refresh(); }); decBtn.onPress.AddListener(() => { slider.value -= 1; Refresh(); }); maxBtn.AddListener(() => { slider.value = slider.maxValue; Refresh(); }); } @@ -96,4 +99,12 @@ OnChangeEvent?.Invoke(count); } void OnDestroy() { OnChangeEvent = null; } void OnDisable() { OnChangeEvent = null; } } Main/Config/ConfigManager.cs
@@ -56,6 +56,7 @@ typeof(HeroLineupHaloConfig), typeof(HeroQualityLVConfig), typeof(InvestConfig), typeof(ItemCompoundConfig), typeof(ItemConfig), typeof(MainChapterConfig), typeof(MainLevelConfig), @@ -259,6 +260,8 @@ ClearConfigDictionary<HeroQualityLVConfig>(); // 清空 InvestConfig 字典 ClearConfigDictionary<InvestConfig>(); // 清空 ItemCompoundConfig 字典 ClearConfigDictionary<ItemCompoundConfig>(); // 清空 ItemConfig 字典 ClearConfigDictionary<ItemConfig>(); // 清空 MainChapterConfig 字典 Main/Config/Configs/ChestsConfig.cs
@@ -1,6 +1,6 @@ //-------------------------------------------------------- // [Author]: YYL // [ Date ]: 2025年8月5日 // [ Date ]: 2025年10月30日 //-------------------------------------------------------- using System.Collections.Generic; @@ -19,8 +19,8 @@ public int BoxID; public int ExpendItemID; public int ExpendCount; public int OpenMoneyType; public int OpenMoney; public int OpenShow; public override int LoadKey(string _key) { @@ -38,9 +38,9 @@ int.TryParse(tables[2],out ExpendCount); int.TryParse(tables[3],out OpenMoney); int.TryParse(tables[3],out OpenMoneyType); int.TryParse(tables[4],out OpenShow); int.TryParse(tables[4],out OpenMoney); } catch (Exception exception) { Main/Config/Configs/ItemCompoundConfig.cs
New file @@ -0,0 +1,47 @@ //-------------------------------------------------------- // [Author]: YYL // [ Date ]: Thursday, October 30, 2025 //-------------------------------------------------------- using System.Collections.Generic; using System; using UnityEngine; using LitJson; public partial class ItemCompoundConfig : ConfigBase<int, ItemCompoundConfig> { static ItemCompoundConfig() { // 访问过静态构造函数 visit = true; } public int id; public int makeID; public int itemID; public int itemCount; public override int LoadKey(string _key) { int key = GetKey(_key); return key; } public override void LoadConfig(string input) { try { string[] tables = input.Split('\t'); int.TryParse(tables[0],out id); int.TryParse(tables[1],out makeID); int.TryParse(tables[2],out itemID); int.TryParse(tables[3],out itemCount); } catch (Exception exception) { Debug.LogError(exception); } } } Main/Config/Configs/ItemCompoundConfig.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: cf342cf33d0492143a273cb6282a6d8b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/Config/PartialConfigs/ItemCompoundConfig.cs
New file @@ -0,0 +1,29 @@ using System.Collections.Generic; public partial class ItemCompoundConfig : ConfigBase<int, ItemCompoundConfig> { public static Dictionary<int, ItemCompoundConfig> itemCompoundDict = new Dictionary<int, ItemCompoundConfig>(); protected override void OnConfigParseCompleted() { itemCompoundDict.Add(makeID, this); } public static ItemCompoundConfig GetItemCompoundConfig(int makeID) { ItemCompoundConfig itemCompoundConfig = null; itemCompoundDict.TryGetValue(makeID, out itemCompoundConfig); return itemCompoundConfig; } public static bool IsCompoundItem(int itemID) { return itemCompoundDict.ContainsKey(itemID); } } 
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 736c0787c9619e84ca00569bfac71c4a MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/Core/NetworkPackage/ClientPack/CA3_Item/CA303_tagCMItemCompound.cs
New file @@ -0,0 +1,38 @@ using UnityEngine; using System.Collections; //A3 03 物品合成 #tagCMItemCompound public class CA303_tagCMItemCompound : GameNetPackBasic { public uint ID; // 合成ID public ushort CompoundCnt; //合成数量(次数) public byte UnfixedItemIndexCnt; // 不固定物品在背包中索引个数 public byte[] UnfixedItemIndex; // 不固定物品在背包的索引列表 public byte FixedItemIndexCnt; // 固定物品在背包中索引个数 public byte[] FixedItemIndex; // 固定物品在背包的索引列表 public byte AddonsItemIndexCnt; // 附加物品在背包中索引个数 public byte[] AddonsItemIndex; // 附加物品在背包的索引列表 public byte[] AddonsItemCount; // 附加物品在背包的索引对应扣除数量列表 public byte RateIncreaseItemIndexCnt; // 提升概率物品在背包中索引个数 public byte[] RateIncreaseItemIndex; // 提升概率物品在背包的索引列表 public CA303_tagCMItemCompound () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA303; } public override void WriteToBytes () { WriteBytes (ID, NetDataType.DWORD); WriteBytes (CompoundCnt, NetDataType.WORD); WriteBytes (UnfixedItemIndexCnt, NetDataType.BYTE); WriteBytes (UnfixedItemIndex, NetDataType.BYTE, UnfixedItemIndexCnt); WriteBytes (FixedItemIndexCnt, NetDataType.BYTE); WriteBytes (FixedItemIndex, NetDataType.BYTE, FixedItemIndexCnt); WriteBytes (AddonsItemIndexCnt, NetDataType.BYTE); WriteBytes (AddonsItemIndex, NetDataType.BYTE, AddonsItemIndexCnt); WriteBytes (AddonsItemCount, NetDataType.BYTE, AddonsItemIndexCnt); WriteBytes (RateIncreaseItemIndexCnt, NetDataType.BYTE); WriteBytes (RateIncreaseItemIndex, NetDataType.BYTE, RateIncreaseItemIndexCnt); } } Main/Core/NetworkPackage/ClientPack/CA3_Item/CA303_tagCMItemCompound.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 214c48bd178466b4caaba754e983d8d3 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/ItemTip/BoxItemWin.cs
@@ -69,6 +69,7 @@ sliderPanel.SetActive(true); } useCnt = 1; sliderPanel.Init((value) => { useCnt = value; }, itemCount); 
@@ -10,16 +10,43 @@ [SerializeField] Image fillImage; [SerializeField] Image fullImage; [SerializeField] Text processText; [SerializeField] Image redImg; public void Display(int index) { if (index >= PackManager.Instance.composeItemGuidList.Count) { return; } var guid = PackManager.Instance.composeItemGuidList[index]; var item = PackManager.Instance.GetItemByGuid(guid); if (item == null) return; itemCell.Init(item); itemCell.button.AddListener(()=> itemCell.button.AddListener(() => { //合成界面 ComposeWin.guid = guid; UIManager.Instance.OpenWindow<ComposeWin>(); }); 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) { fullImage.SetActive(true); fillImage.SetActive(false); redImg.SetActive(true); } else { fullImage.SetActive(false); fillImage.SetActive(true); redImg.SetActive(false); fillImage.fillAmount = haveCnt / (float)targetCnt; } processText.text = haveCnt+ "/" + targetCnt; } } Main/System/KnapSack/Logic/ComposeWin.cs
New file @@ -0,0 +1,82 @@ using System; using System.Collections.Generic; using LitJson; using UnityEngine; using UnityEngine.UI; //合成界面 public class ComposeWin : UIBase { [SerializeField] ItemCell itemCell; [SerializeField] Text nameText; [SerializeField] Text descText; [SerializeField] ItemCell needItemCell; [SerializeField] Text haveCntText; [SerializeField] SliderPanel sliderPanel; [SerializeField] Button composeButton; public static string guid; int useCnt; int targetCnt; int targetID; int itemID; protected override void InitComponent() { composeButton.AddListener(() => { if (!ItemLogicUtility.CheckItemCount(PackType.Item, targetID, useCnt * targetCnt, 2)) { return; } CloseWindow(); var pack = new CA303_tagCMItemCompound(); pack.ID = (uint)ItemCompoundConfig.GetItemCompoundConfig(itemID).id; pack.CompoundCnt = (ushort)useCnt; GameNetSystem.Instance.SendInfo(pack); }); } protected override void OnPreOpen() { var item = PackManager.Instance.GetItemByGuid(guid); itemID = item.itemId; var config = ItemCompoundConfig.GetItemCompoundConfig(itemID); targetID = config.itemID; targetCnt = config.itemCount; itemCell.Init(new ItemCellModel(itemID, false, item.count)); nameText.text = item.config.ItemName; descText.text = item.config.Description; needItemCell.Init(new ItemCellModel(targetID, false, 0)); needItemCell.button.AddListener(() => { ItemTipUtility.Show(targetID); }); 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; 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; }, Math.Max(1, (int)haveCnt/targetCnt)); } } Main/System/KnapSack/Logic/ComposeWin.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: fa99a55f62debbe4c9ec44bc91cbc9b2 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/KnapSack/Logic/PackGirdCell.cs
@@ -17,11 +17,19 @@ var item = PackManager.Instance.GetItemByGuid(guid); itemCell.Init(item); itemCell.button.AddListener(()=> itemCell.button.AddListener(() => { ItemTipUtility.Show(guid); }); redPoint.SetActive(false); var chestConfig = ChestsConfig.Get(item.itemId); if (chestConfig != null && chestConfig.ExpendItemID == 0 && chestConfig.OpenMoney == 0) { redPoint.SetActive(true); } else { redPoint.SetActive(false); } } } Main/System/KnapSack/Logic/RolePackWin.cs
@@ -8,7 +8,7 @@ { [SerializeField] ScrollerController packScroller; [SerializeField] ScrollerController composeScroller; //待策划确定 [SerializeField] ScrollerController composeScroller; [SerializeField] GroupButtonEx packBtn; [SerializeField] GroupButtonEx composeBtn; @@ -83,6 +83,7 @@ } //延迟0.2秒刷新 设置 isRefreshPack为true isRefreshPack = true; cdTime = Time.time; } @@ -93,6 +94,7 @@ return; } isRefreshPack = true; cdTime = Time.time; } @@ -199,6 +201,6 @@ void RefreshComposeItemData() { PackManager.Instance.composeItemGuidList.Clear(); PackManager.Instance.RefreshItemComposeList(); } } Main/System/KnapSack/PackManager.cs
@@ -49,7 +49,8 @@ string RoleEquipLocalSave = ""; List<int> LocalSavePlaceArray { get; set; } Dictionary<int, List<int>> sharedUseCountItemDict { get; set; } bool isUpdatePlayerLv = false; // bool isUpdatePlayerLv = false; bool isItemChange = false; //延迟处理物品变化 public int[] gameCashShow; //代金券特殊显示 除以100 public int[] autoUseItemIDs; @@ -102,7 +103,7 @@ public void OnBeforePlayerDataInitialize() { GlobalTimeEvent.Instance.secondEvent -= UpdateSecond; PlayerDatas.Instance.playerDataRefreshEvent -= UpdatePlayerLv; // PlayerDatas.Instance.playerDataRefreshEvent -= UpdatePlayerLv; LocalSave.DeleteKey(RecordKnapsackTitle); playerPackDict.Clear(); itemDayUseCntDict.Clear(); @@ -127,8 +128,8 @@ LocalSavePlaceArray = null; } GlobalTimeEvent.Instance.secondEvent += UpdateSecond; PlayerDatas.Instance.playerDataRefreshEvent += UpdatePlayerLv; isUpdatePlayerLv = true; // PlayerDatas.Instance.playerDataRefreshEvent += UpdatePlayerLv; // isUpdatePlayerLv = true; FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; } @@ -192,8 +193,8 @@ { refrechPackEvent(packType); } UpdatePackRedpoint(packType); DelayNotifyPackChange(packType); } public void UpdateItem(H0704_tagRolePackRefresh serverItem) @@ -236,8 +237,8 @@ // ItemOperateUtility.Instance.ShowPutOnNewEquipRemind(itemInfo.itemId); // } // } UpdatePackRedpoint(type); DelayNotifyPackChange(type); //EquipDecomRedCtrl(); AutoUseItem(itemInfo.itemId, serverItem.ItemGUID); } @@ -302,7 +303,8 @@ gridRefreshEvent(type); } UpdatePackRedpoint(type); DelayNotifyPackChange(type); } @@ -329,6 +331,7 @@ } } DelayNotifyPackChange(type); } @@ -382,7 +385,7 @@ } UpdatePackRedpoint(type); DelayNotifyPackChange(type); if (GetItemByGuid(guid) == null) { @@ -562,18 +565,19 @@ private void UpdateSecond() { if (isUpdatePlayerLv) if (isItemChange) { isUpdatePlayerLv = false; isItemChange = false; DelayRefreshItemPackEvent(); } } private void UpdatePlayerLv(PlayerDataType type) { if (type != PlayerDataType.LV) return; // private void UpdatePlayerLv(PlayerDataType type) // { // if (type != PlayerDataType.LV) return; isUpdatePlayerLv = true; } // isUpdatePlayerLv = true; // } #endregion @@ -871,48 +875,103 @@ return useCnt; } public void GotoWashAttributePoint(string guid) { // ItemModel itemModel = GetItemByGuid(guid); // if (itemModel == null) return; // WashAttrPointWin.itemModel = itemModel; // WindowCenter.Instance.Open<WashAttrPointWin>(); } #region 红点逻辑判断 const int ITEMPACK_REDKEY = 102011003; Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY); Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_MainPackKey, MainRedDot.RedPoint_BagFuncKey); Redpoint redpointComposePack = new Redpoint(MainRedDot.RedPoint_MainPackKey, MainRedDot.RedPoint_ComposeFuncKey); private void UpdatePackRedpoint(PackType type) //延迟通知背包变化,避免在同一帧内多次通知 private void DelayNotifyPackChange(PackType type) { var singlePack = GetSinglePack(type); if (singlePack == null) if (type == PackType.Item) { return; } switch (type) { case PackType.Item: if (singlePack.GetEmptyGridCount() <= 0) { redpointItemPack.state = RedPointState.Full; //SysNotifyMgr.Instance.ShowTip("BagFull"); } else { redpointItemPack.state = RedPointState.None; } break; isItemChange = true; } } void DelayRefreshItemPackEvent() { //合成红点 SinglePack singlePack = GetSinglePack(PackType.Item); var items = singlePack.GetAllItems(); foreach (var item in items.Values) { if (ItemCompoundConfig.IsCompoundItem(item.itemId)) { var config = ItemCompoundConfig.GetItemCompoundConfig(item.itemId); var targetID = config.itemID; var targetCnt = config.itemCount; if (GetItemCountByID(PackType.Item, targetID) >= targetCnt) { redpointComposePack.state = RedPointState.Simple; break; } } } //背包红点 if (singlePack.GetEmptyGridCount() <= 0) { redpointItemPack.state = RedPointState.Full; SysNotifyMgr.Instance.ShowTip("BagFull"); } else { redpointItemPack.state = RedPointState.None; //无条件开启的宝箱红点 foreach (var item in items.Values) { var chestConfig = ChestsConfig.Get(item.itemId); if (chestConfig != null && chestConfig.ExpendItemID == 0 && chestConfig.OpenMoney == 0) { redpointItemPack.state = RedPointState.Simple; break; } } } } public void RefreshItemComposeList() { //收集合成物品 composeItemGuidList.Clear(); SinglePack singlePack = GetSinglePack(PackType.Item); var items = singlePack.GetAllItems(); foreach (var item in items.Values) { if (ItemCompoundConfig.IsCompoundItem(item.itemId)) { composeItemGuidList.Add(item.guid); } } composeItemGuidList.Sort(SortItemCompose); } int SortItemCompose(string guidA, string guidB) { var itemA = GetItemByGuid(guidA); var itemB = GetItemByGuid(guidB); var colorA = itemA.config.ItemColor; var colorB = itemB.config.ItemColor; if (colorA != colorB) { return colorB - colorA; } return itemA.itemId - itemB.itemId; } #endregion #region 查看某个位置的物品 Main/System/Redpoint/MainRedDot.cs
@@ -47,9 +47,10 @@ #region 背包红点 public const int RedPoint_MainPackKey = 102; public const int RedPoint_BagFuncKey = 10201; public Redpoint redPointMainPack = new Redpoint(RedPoint_MainPackKey); public Redpoint redPointBagFunc = new Redpoint(RedPoint_MainPackKey, RedPoint_BagFuncKey); public const int RedPoint_BagFuncKey = 10201; //背包功能 public const int RedPoint_ComposeFuncKey = 10202; //合成 public Redpoint redPointMainPack = new Redpoint(MainAffairsRedpoint, RedPoint_MainPackKey); #endregion //官职 Main/System/Store/BuyItemWin.cs
@@ -17,7 +17,6 @@ [SerializeField] Button buyButton; int itemCount; int useCnt; int maxCnt; protected override void InitComponent()