diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Description.prefab b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Description.prefab index e2b4ed55..6a9ea4ed 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Description.prefab +++ b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Description.prefab @@ -237,7 +237,7 @@ MonoBehaviour: price: {fileID: 3856012876438822065} name: {fileID: 3856012875645848067} text: {fileID: 3856012875694233262} - popcornImage: {fileID: 3856012875488019546} + popcornImageTarget: {fileID: 3856012875488019547} raritySummaryView: {fileID: 5342480092941596622} closeButton: {fileID: 3856012876379087773} --- !u!1 &3856012874861365793 @@ -935,7 +935,7 @@ GameObject: - component: {fileID: 3856012875488019549} - component: {fileID: 3856012875488019546} m_Layer: 5 - m_Name: icon + m_Name: packageTarget m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -951,7 +951,8 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0.8999999, y: 0.8999999, z: 0.8999999} - m_Children: [] + m_Children: + - {fileID: 3050691075110241529} m_Father: {fileID: 3856012876432300748} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1928,6 +1929,80 @@ RectTransform: m_AnchoredPosition: {x: -148, y: -160} m_SizeDelta: {x: 185, y: 36} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &7093407406090843726 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3050691075110241529} + - component: {fileID: 9165208529613409335} + - component: {fileID: 3489039418843825509} + m_Layer: 5 + m_Name: package + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3050691075110241529 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7093407406090843726} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3856012875488019547} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 92, y: 136} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9165208529613409335 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7093407406090843726} + m_CullTransparentMesh: 0 +--- !u!114 &3489039418843825509 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7093407406090843726} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 99d426990eeb08d4d85ae03f04609196, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!1001 &3271889073656297700 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/TastingWindow.prefab b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/TastingWindow.prefab index df311ba8..ee1d816b 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/TastingWindow.prefab +++ b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/TastingWindow.prefab @@ -1,5 +1,79 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &135488454937769584 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9203813766162253203} + - component: {fileID: 3875815183124353376} + - component: {fileID: 7943987207919073551} + m_Layer: 5 + m_Name: package + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9203813766162253203 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 135488454937769584} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5089467466839610379} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 92, y: 136} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3875815183124353376 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 135488454937769584} + m_CullTransparentMesh: 0 +--- !u!114 &7943987207919073551 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 135488454937769584} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 99d426990eeb08d4d85ae03f04609196, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!1 &5089467466155668369 GameObject: m_ObjectHideFlags: 0 @@ -542,7 +616,7 @@ MonoBehaviour: tastingButton: {fileID: 5089467466492122904} popcornName: {fileID: 5089467467985140646} popcornImage: {fileID: 5089467466473792397} - packageImage: {fileID: 5089467466839610378} + packageImageTarget: {fileID: 5089467466839610379} --- !u!1 &5089467466576579807 GameObject: m_ObjectHideFlags: 0 @@ -721,10 +795,8 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 5089467466839610379} - - component: {fileID: 5089467466839610377} - - component: {fileID: 5089467466839610378} m_Layer: 5 - m_Name: package + m_Name: packageTarget m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -740,7 +812,8 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] + m_Children: + - {fileID: 9203813766162253203} m_Father: {fileID: 5089467467838188612} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -749,43 +822,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 92, y: 136} m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &5089467466839610377 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5089467466839610380} - m_CullTransparentMesh: 0 ---- !u!114 &5089467466839610378 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5089467466839610380} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 0 - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 21300000, guid: 99d426990eeb08d4d85ae03f04609196, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 --- !u!1 &5089467467032844101 GameObject: m_ObjectHideFlags: 0 diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/detail.prefab b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/detail.prefab index f51622b8..98332b54 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/detail.prefab +++ b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/detail.prefab @@ -1428,7 +1428,7 @@ MonoBehaviour: selectedIndicateObject: {fileID: 8175998082772346535} tankObject: {fileID: 8175998082947913935} popcornImage: {fileID: 8175998082903555689} - packageImage: {fileID: 8175998084009524135} + packageImageTarget: {fileID: 8175998084009524128} tankNumber: {fileID: 8175998082262830091} tankStock: {fileID: 8175998083605669215} rarityView: {fileID: 3091180832490970851} @@ -2288,7 +2288,8 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] + m_Children: + - {fileID: 3111157988928424479} m_Father: {fileID: 8175998084231429043} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -2713,6 +2714,136 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1001 &1706062874430153290 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 8175998084009524128} + m_Modifications: + - target: {fileID: 3426746518987915701, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_Name + value: package + objectReference: {fileID: 0} + - target: {fileID: 3426746518987915701, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_SizeDelta.x + value: 92 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_SizeDelta.y + value: 136 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: -7.7 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 84aaa57282766408683fbb28f556d547, type: 3} +--- !u!224 &3111157988928424479 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 4359531238211889237, guid: 84aaa57282766408683fbb28f556d547, + type: 3} + m_PrefabInstance: {fileID: 1706062874430153290} + m_PrefabAsset: {fileID: 0} --- !u!1001 &2578452183215564572 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs index 11267a65..812b7bbd 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs @@ -47,6 +47,7 @@ public class ProductManagement : MonoBehaviour // タンク設定 var tankList = view.SetTanks(priceList); var rarityDataList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.RarityDataSheet); + var productList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.ProductDataSheet); foreach (var tankView in tankList) { tankView.SetArrow(tankView.TankNumber != 4 && tankView.TankNumber != 7 && tankView.TankNumber != gameData.StorageTanks.Count); @@ -108,12 +109,12 @@ public class ProductManagement : MonoBehaviour var shopStock = gameData.ShopStock.Count(data => data.FlavorId == tankData.FlavorId); var tankStock = gameData.StorageTanks.Where(x => x.FlavorId == tankData.FlavorId).Sum(x => x.Stock); var totalStock = shopStock + tankStock; - var recipe = RecipeData.GetRecipe(tankData.FlavorId); - var price = recipe?.Price ?? 0; + var productData = productList.FirstOrDefault(data => data.id == tankData.FlavorId); + var price = productData?.price ?? 0; List<(ProductRarity rarity, int price, int stock)> raritySummaryData = rarityDataList.Select(x => (x.Rarity, price * x.rate / 100, tankData.Stocks.FirstOrDefault(sd => sd.Rarity == x.Rarity)?.Stock ?? 0) ).ToList(); - LocalCacheManager.Save(TankDetailView.TankDetailDataTag, (tankView.TankNumber, totalStock, tankData, recipe, raritySummaryData)); + LocalCacheManager.Save(TankDetailView.TankDetailDataTag, (tankView.TankNumber, totalStock, tankData, productData, raritySummaryData)); TransitionManager.Instance.LoadSceneAdditive(GameScenes.PopcornDescription); }).AddTo(tankView); state.Subscribe(x => @@ -122,7 +123,7 @@ public class ProductManagement : MonoBehaviour }).AddTo(tankView); } - var selectedTank = new ReactiveProperty<(int num, RecipeData recipe)>().AddTo(this); + var selectedTank = new ReactiveProperty<(int num, ProductData productData)>().AddTo(this); state.Subscribe(mState => { switch (mState) @@ -145,7 +146,7 @@ public class ProductManagement : MonoBehaviour ClearSelectedTank(tankList); tankList[index].SetState(TankState.Selected); var tankData = gameData.StorageTanks[index]; - selectedTank.Value = (tankList[index].TankNumber, RecipeData.GetRecipe(tankData.FlavorId)); + selectedTank.Value = (tankList[index].TankNumber, productList.FirstOrDefault(data => data.id == tankData.FlavorId)); Action tastingAction = () => { Tasting(selectedTank.Value.num); @@ -179,7 +180,7 @@ public class ProductManagement : MonoBehaviour ClearSelectedTank(tankList); tankView.SetState(TankState.Selected); var tankData = gameData.StorageTanks[tankView.TankNumber - 1]; - selectedTank.Value = (tankView.TankNumber, RecipeData.GetRecipe(tankData.FlavorId)); + selectedTank.Value = (tankView.TankNumber, productList.FirstOrDefault(data => data.id == tankData.FlavorId)); break; default: throw new ArgumentOutOfRangeException(); diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagementTankView.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagementTankView.cs index 1fa889b7..41d29c1d 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagementTankView.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagementTankView.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Linq; using UniRx; using UniRx.Triggers; using UnityEngine; @@ -16,7 +18,7 @@ public class ProductManagementTankView : MonoBehaviour [SerializeField] private GameObject selectedIndicateObject; [SerializeField] private GameObject tankObject; [SerializeField] private Image popcornImage; - [SerializeField] private Image packageImage; + [SerializeField] private Transform packageImageTarget; [SerializeField] private Text tankNumber; [SerializeField] private Text tankStock; private string tankStockFormat = "{0}/{1} 個"; @@ -30,6 +32,7 @@ public class ProductManagementTankView : MonoBehaviour [SerializeField] private Text price; [SerializeField] private Button purchaseButton; [SerializeField] private Image buttonSubImage; + private List productList; private int tankNumberInt; private readonly BoolReactiveProperty isEmply = new BoolReactiveProperty(); private readonly BoolReactiveProperty detailButtonActive = new BoolReactiveProperty(); @@ -61,7 +64,7 @@ public class ProductManagementTankView : MonoBehaviour }).AddTo(this); isEmply.Subscribe(active => { - packageImage.gameObject.SetActive(!active); + packageImageTarget.gameObject.SetActive(!active); popcornImage.gameObject.SetActive(!active); rarityView.gameObject.SetActive(!active); }).AddTo(this); @@ -79,6 +82,7 @@ public class ProductManagementTankView : MonoBehaviour tankNumber.text = $"{number}"; lockedTankNumber.text = $"{number}"; price.text = $"{tankPrice}"; + productList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.ProductDataSheet); } public void SetData(StorageTank tank) @@ -86,6 +90,8 @@ public class ProductManagementTankView : MonoBehaviour isEmply.Value = tank.Stock == 0; tankStock.text = isEmply.Value ? tankEmptyText : String.Format(tankStockFormat, tank.Stock, tank.Capacity); rarityView.SetHasRarity(tank.Stocks); + packageImageTarget.DestroyAllChildrens(); + Instantiate(productList.FirstOrDefault(data => data.id == tank.FlavorId).GetIconPrefab(), packageImageTarget); } public void SetState(TankState tankState) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TankDetailView.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TankDetailView.cs index 8f868bed..dc89ab24 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TankDetailView.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TankDetailView.cs @@ -19,13 +19,13 @@ public class TankDetailView : MonoBehaviour [SerializeField] private Text price; [SerializeField] private Text name; [SerializeField] private Text text; - [SerializeField] private Image popcornImage; + [SerializeField] private Transform popcornImageTarget; [SerializeField] private RaritySummaryView raritySummaryView; [SerializeField] private Button closeButton; private void Start() { - var data = LocalCacheManager.Load<(int tankNum, int totalStock, StorageTank tankData, RecipeData recipeData, List<(ProductRarity rarity, int price, int stock)> raritySummaryData)>(TankDetailDataTag); + var data = LocalCacheManager.Load<(int tankNum, int totalStock, StorageTank tankData, ProductData productData, List<(ProductRarity rarity, int price, int stock)> raritySummaryData)>(TankDetailDataTag); closeButton.OnClickAsObservable().Subscribe(_ => { transform.SetLocalScale(0); @@ -39,9 +39,11 @@ public class TankDetailView : MonoBehaviour tankNumber.text = $"{data.tankNum}"; totalStock.text = string.Format(totalStockFormat, data.totalStock); tankStock.text = string.Format(tankStockFormat, data.tankNum, data.tankData.Stock); - price.text = $"{data.recipeData.Price}"; - name.text = $"{data.recipeData.Name}"; - text.text = $""; + price.text = $"{data.productData.price}"; + name.text = $"{data.productData.name}"; + text.text = data.productData.text; + popcornImageTarget.DestroyAllChildrens(); + Instantiate(data.productData.GetIconPrefab(), popcornImageTarget); raritySummaryView.SetHasRarity(data.raritySummaryData); } } diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingView.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingView.cs index 3ca5249e..02fbed26 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingView.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/TastingView.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using UniRx; using UnityEngine; using UnityEngine.UI; @@ -14,14 +15,16 @@ public class TastingView : MonoBehaviour [SerializeField] private Button tastingButton; [SerializeField] private Text popcornName; [SerializeField] private Image popcornImage; - [SerializeField] private Image packageImage; + [SerializeField] private Transform packageImageTarget; private void Start() { - var data = LocalCacheManager.Load<(IObservable<(int tankNum, RecipeData recipe)> selectedObservable, Action closeButtonAction, Action tastingButtonAction)>(TastingDataTag); + var data = LocalCacheManager.Load<(IObservable<(int tankNum, ProductData productData)> selectedObservable, Action closeButtonAction, Action tastingButtonAction)>(TastingDataTag); data.selectedObservable.Subscribe(x => { - popcornName.text = x.recipe.Name; + popcornName.text = x.productData.name; + packageImageTarget.DestroyAllChildrens(); + Instantiate(x.productData.GetIconPrefab(), packageImageTarget); }).AddTo(this); closeButton.OnClickAsObservable().Subscribe(_ => {