diff --git a/popcorn/Assets/MyGame/Scenes/marketing/CustomizationDetails.unity b/popcorn/Assets/MyGame/Scenes/marketing/CustomizationDetails.unity index 87083f25..7e2f026a 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/CustomizationDetails.unity +++ b/popcorn/Assets/MyGame/Scenes/marketing/CustomizationDetails.unity @@ -168,16 +168,16 @@ MonoBehaviour: m_GameObject: {fileID: 14015804} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e9acbaa05b4d40fabd5a33eb7f3ba676, type: 3} + m_Script: {fileID: 11500000, guid: 42a3452121e14d888e110ffbb1f028ff, type: 3} m_Name: m_EditorClassIdentifier: backgroundAnimator: {fileID: 413926629} - closeButton: {fileID: 0} - movieButton: {fileID: 0} - cookerLevelText: {fileID: 783788838} - earnCountText: {fileID: 420456742} - durationText: {fileID: 1136660096} - usesCountText: {fileID: 0} + closeButton: {fileID: 1797194415} + levelText: {fileID: 1456836481} + pointText: {fileID: 1107997070} + salesBonusText: {fileID: 783788838} + customerBonusText: {fileID: 420456742} + adWalkerBonusText: {fileID: 1136660096} --- !u!1 &18675577 GameObject: m_ObjectHideFlags: 0 diff --git a/popcorn/Assets/MyGame/Scenes/marketing/CustomizationPurchase.unity b/popcorn/Assets/MyGame/Scenes/marketing/CustomizationPurchase.unity index 14099ffe..45555157 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/CustomizationPurchase.unity +++ b/popcorn/Assets/MyGame/Scenes/marketing/CustomizationPurchase.unity @@ -274,6 +274,59 @@ RectTransform: type: 3} m_PrefabInstance: {fileID: 628711926} m_PrefabAsset: {fileID: 0} +--- !u!1 &854297736 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 854297737} + - component: {fileID: 854297738} + m_Layer: 5 + m_Name: Button_Purchase + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &854297737 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 854297736} + 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: + - {fileID: 7029507892718514667} + - {fileID: 9029787154552739325} + m_Father: {fileID: 7029507893056145018} + m_RootOrder: 3 + 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: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &854297738 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 854297736} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 24f017f833cd4fb984accf667ea61c9e, type: 3} + m_Name: + m_EditorClassIdentifier: + button: {fileID: 7029507892718514666} + onObject: {fileID: 7029507892718514664} + offObject: {fileID: 8336091249663688558} --- !u!114 &897450330 MonoBehaviour: m_ObjectHideFlags: 0 @@ -438,7 +491,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1420420143 RectTransform: m_ObjectHideFlags: 0 @@ -822,34 +875,6 @@ MonoBehaviour: mGUI_ShowCallback: 0 mLocalizeTarget: {fileID: 1879220092} mLocalizeTargetName: I2.Loc.LocalizeTarget_UnityUI_Image ---- !u!114 &1405160084952091470 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7029507892281395532} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 6bb93eb9b7574ef58a194e4cf5aadb5f, type: 3} - m_Name: - m_EditorClassIdentifier: - backgroundAnimator: {fileID: 7029507892730506303} - name: {fileID: 7029507893250763409} - iconTarget: {fileID: 0} - price: {fileID: 7029507893569539750} - text: {fileID: 7029507893567348588} - stockCount: {fileID: 0} - totalPrice: {fileID: 0} - purchaseCount: {fileID: 0} - subCountButton: {fileID: 0} - addCountButton: {fileID: 0} - closeButton: {fileID: 7029507892046718509} - purchaseOnButton: {fileID: 7029507892718514666} - purchaseOffButton: {fileID: 8336091249663688558} - quantitySelectObject: {fileID: 0} - explanationObject: {fileID: 7029507893567348586} - stockCountObject: {fileID: 0} --- !u!114 &1593993612158978770 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1206,7 +1231,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 7029507892281395535} - - component: {fileID: 1405160084952091470} + - component: {fileID: 7029507892281395533} m_Layer: 5 m_Name: Window m_TagString: Untagged @@ -1214,6 +1239,29 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!114 &7029507892281395533 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7029507892281395532} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6fc32c99bdbb4334aabfa704d278b507, type: 3} + m_Name: + m_EditorClassIdentifier: + backgroundAnimator: {fileID: 7029507892730506303} + closeButton: {fileID: 7029507892046718509} + closeButton2: {fileID: 1400119944} + purchaseButton: {fileID: 854297738} + nameText: {fileID: 7029507893250763409} + textText: {fileID: 7029507893567348588} + priceText: {fileID: 7029507893569539750} + imageTransform: {fileID: 1918230666} + detailImageTransform: {fileID: 628711927} + purchaseObject: {fileID: 7029507893056145019} + detailObject: {fileID: 1420420142} --- !u!224 &7029507892281395535 RectTransform: m_ObjectHideFlags: 0 @@ -1384,12 +1432,12 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 7029507892793546885} - m_Father: {fileID: 7029507893056145018} - m_RootOrder: 3 + m_Father: {fileID: 854297737} + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} - m_AnchoredPosition: {x: 147, y: -381} + m_AnchoredPosition: {x: 147, y: -446} m_SizeDelta: {x: 240, y: 110} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7029507892718514668 @@ -1787,8 +1835,7 @@ RectTransform: - {fileID: 1918230666} - {fileID: 7029507892193930847} - {fileID: 7029507892046718506} - - {fileID: 7029507892718514667} - - {fileID: 9029787154552739325} + - {fileID: 854297737} m_Father: {fileID: 7029507893617468949} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -2470,12 +2517,12 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1073194667543223603} - m_Father: {fileID: 7029507893056145018} - m_RootOrder: 4 + m_Father: {fileID: 854297737} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} - m_AnchoredPosition: {x: 147, y: -381} + m_AnchoredPosition: {x: 147, y: -446} m_SizeDelta: {x: 240, y: 110} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &9119010633734777629 diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizeInfoDialog.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizeInfoDialog.cs new file mode 100644 index 00000000..c82b1820 --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizeInfoDialog.cs @@ -0,0 +1,66 @@ +using System; +using System.Linq; +using I2.Loc; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace MyGame.Scenes.marketing.Scripts +{ + public class ShopCustomizeInfoDialog : MonoBehaviour + { + private static readonly string CustomizeDataTag = "ShopCustomizeInfoDialogCallback"; + private static readonly string CloseCallbackTag = "ShopCustomizeInfoDialogCloseCallback"; + private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger"); + private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger"); + + [SerializeField] private Animator backgroundAnimator; + [SerializeField] private Button closeButton; + [SerializeField] private Text levelText; + [SerializeField] private Text pointText; + [SerializeField] private Text salesBonusText; + [SerializeField] private Text customerBonusText; + [SerializeField] private Text adWalkerBonusText; + + private void Start() + { + closeButton.OnClickAsObservable().Take(1).Subscribe(_ => + { + LocalCacheManager.Load(CloseCallbackTag, null)?.Invoke(); + LocalCacheManager.Remove(CustomizeDataTag); + transform.parent.SetLocalScale(0); + backgroundAnimator.SetTrigger(CloseTrigger); + this.CallWaitForSeconds(.25f, () => + { + TransitionManager.Instance.UnloadScene(GameScenes.CustomizationDetails); + }); + }).AddTo(this); + + var gameData = GameDataManager.GameData; + levelText.text = $"Lv.{gameData.ShopCustomizeLevel}"; + var customizeLevelList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.ShopCustomizeLevelDataSheet); + if (customizeLevelList.FirstOrDefault(data => data.level == gameData.ShopCustomizeLevel + 1) is ShopCustomizeLevelData customizeLevelData) + { + pointText.text = $"{gameData.ShopCustomizePoint}/{customizeLevelData.point}"; + } + else + { + pointText.text = "--"; + } + var list = ShopCustomize.GetBonusList(gameData.ShopCustomizeLevel); + var sales = list.FirstOrDefault(data => data.category == ShopCustomizeBonusCategory.Sales).bonusData.value; + var customer = list.FirstOrDefault(data => data.category == ShopCustomizeBonusCategory.Customer).bonusData.bonusLevel; + var adWalker = list.FirstOrDefault(data => data.category == ShopCustomizeBonusCategory.AdWalker).bonusData.bonusLevel; + salesBonusText.text = sales == 0 ? "--" : $"{sales}"; + customerBonusText.text = customer == 0 ? "--" : $"Lv.{customer}"; + adWalkerBonusText.text = adWalker == 0 ? "--" : $"Lv.{adWalker}"; + + + } + + public static void ShowDialog(Action onClose = null){ + LocalCacheManager.Save(CloseCallbackTag, onClose); + TransitionManager.Instance.LoadSceneAdditive(GameScenes.CustomizationDetails); + } + } +} \ No newline at end of file diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizeInfoDialog.cs.meta b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizeInfoDialog.cs.meta new file mode 100644 index 00000000..3e068ed0 --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizeInfoDialog.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 42a3452121e14d888e110ffbb1f028ff +timeCreated: 1652351459 \ No newline at end of file diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizePurchaseDialog.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizePurchaseDialog.cs new file mode 100644 index 00000000..f4aa2710 --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizePurchaseDialog.cs @@ -0,0 +1,72 @@ +using System; +using I2.Loc; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace MyGame.Scenes.marketing.Scripts +{ + public class ShopCustomizePurchaseDialog : MonoBehaviour + { + private static readonly string CustomizeDataTag = "ShopCustomizePurchaseDialogData"; + private static readonly string DetailModeTag = "ShopCustomizePurchaseDialogDetailMode"; + private static readonly string PurchaseCallbackTag = "ShopCustomizePurchaseDialogCallback"; + private static readonly string CloseCallbackTag = "ShopCustomizePurchaseDialogCloseCallback"; + private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger"); + private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger"); + + [SerializeField] private Animator backgroundAnimator; + [SerializeField] private Button closeButton; + [SerializeField] private Button closeButton2; + [SerializeField] private ButtonOnOff purchaseButton; + [SerializeField] private Text nameText; + [SerializeField] private Text textText; + [SerializeField] private Text priceText; + [SerializeField] private Transform imageTransform; + [SerializeField] private Transform detailImageTransform; + [SerializeField] private GameObject purchaseObject; + [SerializeField] private GameObject detailObject; + + private void Start() + { + var customizeData = LocalCacheManager.Load(CustomizeDataTag); + closeButton.OnClickAsObservable().Merge(closeButton2.OnClickAsObservable()).Take(1).Subscribe(_ => + { + LocalCacheManager.Load(CloseCallbackTag, null)?.Invoke(); + LocalCacheManager.Remove(CloseCallbackTag); + transform.parent.SetLocalScale(0); + backgroundAnimator.SetTrigger(CloseTrigger); + this.CallWaitForSeconds(.25f, () => + { + TransitionManager.Instance.UnloadScene(GameScenes.CustomizationPurchase); + }); + }).AddTo(this); + purchaseButton.OnClickObservable.Take(1).Subscribe(_ => + { + LocalCacheManager.Load(PurchaseCallbackTag, null)?.Invoke(); + LocalCacheManager.Remove(PurchaseCallbackTag); + TransitionManager.Instance.UnloadScene(GameScenes.CustomizationPurchase); + }).AddTo(this); + + var detailMode = LocalCacheManager.Load(DetailModeTag); + purchaseObject.SetActive(!detailMode); + detailObject.SetActive(detailMode); + purchaseButton.SetActive(GameDataManager.GameData.ShopCustomizeCoin >= customizeData.price); + nameText.text = customizeData.Name; + textText.text = customizeData.Text; + priceText.text = customizeData.price.ToString(); + imageTransform.DestroyAllChildrens(); + Instantiate(customizeData.GetPrefab(), imageTransform); + detailImageTransform.DestroyAllChildrens(); + Instantiate(customizeData.GetPrefab(), detailImageTransform); + } + + public static void ShowDialog(ShopCustomizeData customizeData, bool detailMode, Action onPurchase = null, Action onClose = null){ + LocalCacheManager.Save(CustomizeDataTag, customizeData); + LocalCacheManager.Save(DetailModeTag, detailMode); + LocalCacheManager.Save(PurchaseCallbackTag, onPurchase); + LocalCacheManager.Save(CloseCallbackTag, onClose); + TransitionManager.Instance.LoadSceneAdditive(GameScenes.CustomizationPurchase); + } + } +} \ No newline at end of file diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizePurchaseDialog.cs.meta b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizePurchaseDialog.cs.meta new file mode 100644 index 00000000..bc75bea9 --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizePurchaseDialog.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 993373fb07ac44c385c3fa32b744feda +timeCreated: 1652351459 \ No newline at end of file