From f191a2d48b3a2195fb7c9ed7194576e28cdf45ed Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 31 十月 2025 15:24:42 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/KnapSack/Logic/ComposeWin.cs | 51 +++++++++-------
Main/System/KnapSack/PackManager.cs | 47 +++++++++++----
Main/Config/PartialConfigs/ItemCompoundConfig.cs | 12 +++
Main/System/KnapSack/Logic/RolePackWin.cs | 2
Main/System/KnapSack/Logic/composeLineCell.cs | 2
Main/System/Login/LoginWin.cs | 4 -
Main/System/KnapSack/Logic/ComposeGirdCell.cs | 26 +++-----
Main/System/NewBieGuidance/NewBieWin.cs | 17 ++++-
8 files changed, 98 insertions(+), 63 deletions(-)
diff --git a/Main/Config/PartialConfigs/ItemCompoundConfig.cs b/Main/Config/PartialConfigs/ItemCompoundConfig.cs
index 64d1d64..3324b85 100644
--- a/Main/Config/PartialConfigs/ItemCompoundConfig.cs
+++ b/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)
@@ -20,7 +22,13 @@
{
return itemCompoundDict.ContainsKey(itemID);
}
-
+
+ public static int GetMakeIDByMaterial(int itemID)
+ {
+ int makeID = 0;
+ materialToItemDict.TryGetValue(itemID, out makeID);
+ return makeID;
+ }
}
diff --git a/Main/System/KnapSack/Logic/ComposeGirdCell.cs b/Main/System/KnapSack/Logic/ComposeGirdCell.cs
index 4827c80..724fea2 100644
--- a/Main/System/KnapSack/Logic/ComposeGirdCell.cs
+++ b/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;
}
}
diff --git a/Main/System/KnapSack/Logic/ComposeWin.cs b/Main/System/KnapSack/Logic/ComposeWin.cs
index 52f8344..3ad61d8 100644
--- a/Main/System/KnapSack/Logic/ComposeWin.cs
+++ b/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));
}
diff --git a/Main/System/KnapSack/Logic/RolePackWin.cs b/Main/System/KnapSack/Logic/RolePackWin.cs
index af6fb3b..a106791 100644
--- a/Main/System/KnapSack/Logic/RolePackWin.cs
+++ b/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)
{
diff --git a/Main/System/KnapSack/Logic/composeLineCell.cs b/Main/System/KnapSack/Logic/composeLineCell.cs
index 6625d2d..8eb9553 100644
--- a/Main/System/KnapSack/Logic/composeLineCell.cs
+++ b/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);
diff --git a/Main/System/KnapSack/PackManager.cs b/Main/System/KnapSack/PackManager.cs
index afefa1c..a66d931 100644
--- a/Main/System/KnapSack/PackManager.cs
+++ b/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);
+
+ var config = ItemCompoundConfig.GetItemCompoundConfig(makeID);
+ var targetID = config.itemID;
+ var targetCnt = config.itemCount;
+ if (GetItemCountByID(PackType.Item, targetID) >= targetCnt)
+ {
+ canComposeItemIDList.Add(makeID);
+ }
}
}
- composeItemGuidList.Sort(SortItemCompose);
+ composeItemIDList.Sort(SortItemCompose);
}
- int SortItemCompose(string guidA, string guidB)
+ int SortItemCompose(int itemIDA, int itemIDB)
{
- var itemA = GetItemByGuid(guidA);
- var itemB = GetItemByGuid(guidB);
+ // 鍚堟垚鏉愭枡澶熶笉澶�
+ var isEnoughA = canComposeItemIDList.Contains(itemIDA);
+ var isEnoughB = canComposeItemIDList.Contains(itemIDB);
+ if (isEnoughA != isEnoughB)
+ {
+ return isEnoughA ? -1 : 1;
+ }
- var colorA = itemA.config.ItemColor;
- var colorB = itemB.config.ItemColor;
+ 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
diff --git a/Main/System/Login/LoginWin.cs b/Main/System/Login/LoginWin.cs
index 9d9f3ef..5f565ef 100644
--- a/Main/System/Login/LoginWin.cs
+++ b/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;
diff --git a/Main/System/NewBieGuidance/NewBieWin.cs b/Main/System/NewBieGuidance/NewBieWin.cs
index f0c9307..0831214 100644
--- a/Main/System/NewBieGuidance/NewBieWin.cs
+++ b/Main/System/NewBieGuidance/NewBieWin.cs
@@ -63,7 +63,14 @@
//鍏抽棴鍏朵粬鍙兘鍦ㄤ富鐣岄潰鏄剧ず鐨勭獥鍙g瓑
// 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()
--
Gitblit v1.8.0