Merge branch 'feature/mall' into develop
This commit is contained in:
@@ -12,7 +12,7 @@ public class ShopCategoryManager : MonoBehaviour
|
||||
{
|
||||
"Category 1", // Original category 1
|
||||
"Category 2", // Original category 2
|
||||
"Categories 3-5", // Merged categories 3, 4, 5
|
||||
"Categories 1, 3, 4", // Merged categories 1, 3, 4
|
||||
"Category 6", // Original category 6
|
||||
"Category 7", // Original category 7
|
||||
"Category 8" // Original category 8
|
||||
@@ -27,7 +27,7 @@ public class ShopCategoryManager : MonoBehaviour
|
||||
public Color disabledButtonColor = Color.gray;
|
||||
|
||||
private int currentSelectedCategory = 0;
|
||||
private ShopUIManager shopManager;
|
||||
public ShopUIManager shopManager;
|
||||
|
||||
void Start()
|
||||
{
|
||||
@@ -68,13 +68,9 @@ public class ShopCategoryManager : MonoBehaviour
|
||||
currentSelectedCategory = categoryIndex;
|
||||
UpdateCategoryDisplay();
|
||||
|
||||
// Notify shop manager
|
||||
// Notify shop manager to actually update the item list
|
||||
if (shopManager != null)
|
||||
{
|
||||
// Use reflection to call the private method, or make it public
|
||||
// For now, we'll assume there's a public method to handle category change
|
||||
Debug.Log($"Category {categoryIndex} selected: {categoryNames[categoryIndex]}");
|
||||
}
|
||||
shopManager.SetCategoryIndex(categoryIndex);
|
||||
}
|
||||
|
||||
void UpdateCategoryDisplay()
|
||||
@@ -124,12 +120,12 @@ public class ShopCategoryManager : MonoBehaviour
|
||||
|
||||
public bool IsItemInCategory(GShopItem item, int categoryIndex)
|
||||
{
|
||||
// Category mapping: 0=1, 1=2, 2=3+4+5, 3=6, 4=7, 5=8
|
||||
// Category mapping: 0=1, 1=2, 2=1+3+4, 3=6, 4=7, 5=8
|
||||
switch (categoryIndex)
|
||||
{
|
||||
case 0: return item.mainType == 0; // Category 1
|
||||
case 1: return item.mainType == 1; // Category 2
|
||||
case 2: return item.mainType >= 2 && item.mainType <= 4; // Categories 3, 4, 5 merged
|
||||
case 2: return item.mainType == 0 || item.mainType == 2 || item.mainType == 3; // Categories 1, 3, 4 merged
|
||||
case 3: return item.mainType == 5; // Category 6
|
||||
case 4: return item.mainType == 6; // Category 7
|
||||
case 5: return item.mainType == 7; // Category 8
|
||||
@@ -146,8 +142,8 @@ public class ShopCategoryManager : MonoBehaviour
|
||||
{
|
||||
int originalCategory = item.mainType;
|
||||
|
||||
if (originalCategory >= 2 && originalCategory <= 4)
|
||||
return "Categories 3-5";
|
||||
if (originalCategory == 0 || originalCategory == 2 || originalCategory == 3)
|
||||
return "Categories 1, 3, 4";
|
||||
|
||||
if (originalCategory < categoryNames.Length)
|
||||
return categoryNames[originalCategory];
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ShopUIManager : MonoBehaviour
|
||||
{
|
||||
if (shopMainPanel != null)
|
||||
{
|
||||
shopMainPanel.SetActive(true);
|
||||
OnCategorySelected(0);
|
||||
RefreshShopDisplay();
|
||||
}
|
||||
}
|
||||
@@ -129,6 +129,12 @@ public class ShopUIManager : MonoBehaviour
|
||||
Debug.Log($"Category switch to {categoryIndex} completed in {switchTime * 1000f:F2}ms");
|
||||
}
|
||||
|
||||
// Allow external components (e.g., ShopCategoryManager) to switch category
|
||||
public void SetCategoryIndex(int categoryIndex)
|
||||
{
|
||||
OnCategorySelected(categoryIndex);
|
||||
}
|
||||
|
||||
public void RefreshShopDisplay()
|
||||
{
|
||||
// Return all current panels to pool
|
||||
@@ -144,9 +150,11 @@ public class ShopUIManager : MonoBehaviour
|
||||
List<GShopItem> categoryItems = GetItemsForCategory(currentCategory);
|
||||
|
||||
// Create item panels using pooling
|
||||
int siblingIndexCounter = 0;
|
||||
foreach (GShopItem item in categoryItems)
|
||||
{
|
||||
CreateItemPanelFromPool(item);
|
||||
CreateItemPanelFromPool(item, siblingIndexCounter);
|
||||
siblingIndexCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,20 +178,20 @@ public class ShopUIManager : MonoBehaviour
|
||||
|
||||
bool IsItemInCategory(GShopItem item, int categoryIndex)
|
||||
{
|
||||
// Category mapping: 0=1, 1=2, 2=3+4+5, 3=6, 4=7, 5=8
|
||||
// Category mapping: 0=1, 1=2, 2=1+3+4, 3=6, 4=7, 5=8
|
||||
switch (categoryIndex)
|
||||
{
|
||||
case 0: return item.mainType == 0; // Category 1
|
||||
case 1: return item.mainType == 1; // Category 2
|
||||
case 2: return item.mainType >= 2 && item.mainType <= 4; // Categories 3, 4, 5 merged
|
||||
case 3: return item.mainType == 5; // Category 6
|
||||
case 1: return item.mainType == 2; // Category 2
|
||||
case 2: return item.mainType == 5; // Categories 1, 3, 4 merged
|
||||
case 3: return item.mainType == 1 || item.mainType == 3 || item.mainType == 4; // Category 6
|
||||
case 4: return item.mainType == 6; // Category 7
|
||||
case 5: return item.mainType == 7; // Category 8
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
void CreateItemPanelFromPool(GShopItem item)
|
||||
void CreateItemPanelFromPool(GShopItem item, int targetSiblingIndex)
|
||||
{
|
||||
GameObject itemPanel = null;
|
||||
|
||||
@@ -204,8 +212,10 @@ public class ShopUIManager : MonoBehaviour
|
||||
if (itemPanel != null && itemContainer != null)
|
||||
{
|
||||
// Set parent and position
|
||||
itemPanel.transform.SetParent(itemContainer);
|
||||
itemPanel.transform.SetParent(itemContainer, false);
|
||||
itemPanel.transform.localScale = Vector3.one;
|
||||
// Ensure deterministic ordering regardless of pool retrieval order
|
||||
itemPanel.transform.SetSiblingIndex(targetSiblingIndex);
|
||||
|
||||
// Setup the panel
|
||||
ShopItemPanel itemPanelScript = itemPanel.GetComponent<ShopItemPanel>();
|
||||
|
||||
@@ -368,9 +368,9 @@ RectTransform:
|
||||
- {fileID: 8761838049529348566}
|
||||
m_Father: {fileID: 6279944142683492433}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 73.5, y: -82.4}
|
||||
m_SizeDelta: {x: 147, y: 116.8}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &424813723601076052
|
||||
@@ -974,9 +974,9 @@ RectTransform:
|
||||
- {fileID: 2635347666608474034}
|
||||
m_Father: {fileID: 6279944142683492433}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 73.5, y: -557.43335}
|
||||
m_SizeDelta: {x: 147, y: 115}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2783001383898350917
|
||||
@@ -1458,9 +1458,9 @@ RectTransform:
|
||||
- {fileID: 3465129417775596107}
|
||||
m_Father: {fileID: 6921900574306804872}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 253.67606, y: -34.225502}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 166.4507, y: 61.887}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2471496789853926854
|
||||
@@ -1750,9 +1750,9 @@ RectTransform:
|
||||
- {fileID: 6607009122237547209}
|
||||
m_Father: {fileID: 6921900574306804872}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 753.02814, y: -34.225502}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 166.4507, y: 61.887}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6604777758543866085
|
||||
@@ -2132,9 +2132,9 @@ RectTransform:
|
||||
- {fileID: 7453030741144867795}
|
||||
m_Father: {fileID: 6279944142683492433}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 73.5, y: -438.9}
|
||||
m_SizeDelta: {x: 147, y: 115}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5113860492054378637
|
||||
@@ -2253,9 +2253,9 @@ RectTransform:
|
||||
- {fileID: 7881121413444915257}
|
||||
m_Father: {fileID: 6279944142683492433}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 73.5, y: -675.9667}
|
||||
m_SizeDelta: {x: 147, y: 115}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &188443220859053986
|
||||
@@ -2670,11 +2670,11 @@ MonoBehaviour:
|
||||
m_Content: {fileID: 720995613977598853}
|
||||
m_Horizontal: 0
|
||||
m_Vertical: 1
|
||||
m_MovementType: 0
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.91
|
||||
m_ScrollSensitivity: 4
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 7377597886310921903}
|
||||
m_HorizontalScrollbar: {fileID: 0}
|
||||
m_VerticalScrollbar: {fileID: 0}
|
||||
@@ -2871,9 +2871,9 @@ RectTransform:
|
||||
- {fileID: 3953026038879993000}
|
||||
m_Father: {fileID: 6279944142683492433}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 73.5, y: -201.83334}
|
||||
m_SizeDelta: {x: 147, y: 115}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5160228589296753130
|
||||
@@ -3302,9 +3302,9 @@ RectTransform:
|
||||
- {fileID: 7368110207669039191}
|
||||
m_Father: {fileID: 6921900574306804872}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 420.12674, y: -34.225502}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 166.4507, y: 61.887}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5818043599573700572
|
||||
@@ -3695,7 +3695,7 @@ RectTransform:
|
||||
m_Father: {fileID: 4310760051865461200}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -0.22351074, y: 0.023500443}
|
||||
m_SizeDelta: {x: -24.1577, y: -6.6333}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
@@ -3846,9 +3846,9 @@ RectTransform:
|
||||
- {fileID: 1824832118339051429}
|
||||
m_Father: {fileID: 6921900574306804872}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 87.22535, y: -34.225502}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 166.4507, y: 61.887}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5876619622367789936
|
||||
@@ -3967,9 +3967,9 @@ RectTransform:
|
||||
- {fileID: 1529712157810231189}
|
||||
m_Father: {fileID: 6921900574306804872}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 586.57745, y: -34.225502}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 166.4507, y: 61.887}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4405492307389281063
|
||||
@@ -5158,6 +5158,7 @@ GameObject:
|
||||
- component: {fileID: 720995613977598853}
|
||||
- component: {fileID: 6400593268502276303}
|
||||
- component: {fileID: 5246174072855755290}
|
||||
- component: {fileID: 2179490036099150762}
|
||||
m_Layer: 5
|
||||
m_Name: Content
|
||||
m_TagString: Untagged
|
||||
@@ -5225,6 +5226,20 @@ MonoBehaviour:
|
||||
maxPoolSize: 100
|
||||
expandPool: 1
|
||||
poolParent: {fileID: 720995613977598853}
|
||||
--- !u!114 &2179490036099150762
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6592005461581952019}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 0
|
||||
m_VerticalFit: 2
|
||||
--- !u!1 &6608932894056258649
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -5529,7 +5544,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &1845571473519222713
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -5886,9 +5901,9 @@ RectTransform:
|
||||
- {fileID: 5424053570241907517}
|
||||
m_Father: {fileID: 6279944142683492433}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 73.5, y: -320.36667}
|
||||
m_SizeDelta: {x: 147, y: 115}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6316976477275547731
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f08a2358f441f066ff36ff6a98d580219dcd8b7629d6675b97643a1f3e09953b
|
||||
size 33030989
|
||||
oid sha256:951300c91d8eb0444ef6f6d4231547c757908cba80c036bc743d186711fca527
|
||||
size 33032375
|
||||
|
||||
Reference in New Issue
Block a user