diff --git a/Assets/Bundles/Prefabs/ProductSlot.prefab b/Assets/Bundles/Prefabs/ProductSlot.prefab index a86a8ba..c217def 100644 --- a/Assets/Bundles/Prefabs/ProductSlot.prefab +++ b/Assets/Bundles/Prefabs/ProductSlot.prefab @@ -1845,9 +1845,9 @@ RectTransform: 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: -100, y: 0} - m_SizeDelta: {x: 200, y: 90} - m_Pivot: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0.000030517578} + m_SizeDelta: {x: 312, y: 68} + m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &8098959201705279916 CanvasRenderer: m_ObjectHideFlags: 0 @@ -1906,9 +1906,9 @@ MonoBehaviour: m_fontSize: 40 m_fontSizeBase: 40 m_fontWeight: 400 - m_enableAutoSizing: 0 - m_fontSizeMin: 18 - m_fontSizeMax: 72 + m_enableAutoSizing: 1 + m_fontSizeMin: 40 + m_fontSizeMax: 40 m_fontStyle: 0 m_HorizontalAlignment: 2 m_VerticalAlignment: 4096 @@ -1918,7 +1918,7 @@ MonoBehaviour: m_lineSpacing: 0 m_lineSpacingMax: 0 m_paragraphSpacing: 0 - m_charWidthMaxAdj: 0 + m_charWidthMaxAdj: 50 m_TextWrappingMode: 0 m_wordWrappingRatios: 0.4 m_overflowMode: 0 @@ -1941,7 +1941,7 @@ MonoBehaviour: m_VertexBufferAutoSizeReduction: 0 m_useMaxVisibleDescender: 0 m_pageToDisplay: 1 - m_margin: {x: 0, y: 0, z: 0, w: 0} + m_margin: {x: 44.173004, y: 0, z: 45.13327, w: 0} m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 m_hasFontAssetChanged: 0 diff --git a/Assets/Easy Save 3/Types/ES3UserType_SaveData.cs b/Assets/Easy Save 3/Types/ES3UserType_SaveData.cs index eafd584..5e65d53 100644 --- a/Assets/Easy Save 3/Types/ES3UserType_SaveData.cs +++ b/Assets/Easy Save 3/Types/ES3UserType_SaveData.cs @@ -26,6 +26,8 @@ namespace ES3Types writer.WriteProperty("GameSpeed", instance.GameSpeed, ES3Type_float.Instance); writer.WriteProperty("ProductAdWatchedNumber", instance.ProductAdWatchedNumber, ES3Type_int.Instance); writer.WriteProperty("ProductAdWatchedTime", instance.ProductAdWatchedTime, ES3Type_DateTime.Instance); + writer.WriteProperty("ShopADDia", instance.ShopADDia, ES3Type_int.Instance); + writer.WriteProperty("ShopADDiaTime", instance.ShopADDiaTime, ES3Type_DateTime.Instance); writer.WriteProperty("FreeHeartCount", instance.FreeHeartCount, ES3Type_int.Instance); writer.WriteProperty("FreeKeyCount", instance.FreeKeyCount, ES3Type_int.Instance); writer.WriteProperty("InterstitialADCount", instance.InterstitialADCount, ES3Type_int.Instance); @@ -78,7 +80,13 @@ namespace ES3Types case "ProductAdWatchedTime": instance.ProductAdWatchedTime = reader.Read(ES3Type_DateTime.Instance); break; - case "FreeHeartCount": + case "ShopADDia": + instance.ShopADDia = reader.Read(ES3Type_int.Instance); + break; + case "ShopADDiaTime": + instance.ShopADDiaTime = reader.Read(ES3Type_DateTime.Instance); + break; + case "FreeHeartCount": instance.FreeHeartCount = reader.Read(ES3Type_int.Instance); break; case "FreeKeyCount": diff --git a/Assets/Memo.txt b/Assets/Memo.txt index 85c9687..3d07f81 100644 --- a/Assets/Memo.txt +++ b/Assets/Memo.txt @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// +광고보고 다이아 100개 (3/3)회 신규 이펙트 적용 (계속) 구글 및 원스토어 이미지 분기 처리 구글 및 원스토어 아이콘 분기 처리 \ No newline at end of file diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 197cbb9..da173a2 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -3579,7 +3579,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} propertyPath: m_AnchoredPosition.x - value: 340 + value: 165 objectReference: {fileID: 0} - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} propertyPath: m_AnchoredPosition.y @@ -3981,6 +3981,123 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 209785960} m_CullTransparentMesh: 1 +--- !u!1001 &220151978 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 265543180} + m_Modifications: + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_SizeDelta.x + value: 330 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_SizeDelta.y + value: 405 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_AnchoredPosition.x + value: -185 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_AnchoredPosition.y + value: -627.5 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950965, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_Name + value: ProductSlot (11) + objectReference: {fileID: 0} + - target: {fileID: 8098959201550950965, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} +--- !u!114 &220151979 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 4591925049727241126, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + m_PrefabInstance: {fileID: 220151978} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ccacf8a867ea9a941ae48389ec8e96b0, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!224 &220151980 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} + m_PrefabInstance: {fileID: 220151978} + m_PrefabAsset: {fileID: 0} --- !u!1 &235903762 GameObject: m_ObjectHideFlags: 0 @@ -9234,12 +9351,13 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1580485050} + - {fileID: 664226118} - {fileID: 201108262} - {fileID: 701663621} - {fileID: 1960801318} - {fileID: 1027540305} - {fileID: 198519601} - - {fileID: 664226118} + - {fileID: 220151980} - {fileID: 503872266} - {fileID: 1620391822} - {fileID: 721665002} @@ -9935,7 +10053,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &302272077 RectTransform: m_ObjectHideFlags: 0 @@ -33023,6 +33141,7 @@ MonoBehaviour: - {fileID: 701993973} - {fileID: 171871159} - {fileID: 897569874} + - {fileID: 220151979} sprites: - {fileID: 21300000, guid: b6a8c7f2de072314babd4892dda62f03, type: 3} - {fileID: 21300000, guid: 5943d49aa8260fd42a04c79f281dc835, type: 3} @@ -50638,7 +50757,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} propertyPath: m_AnchoredPosition.x - value: -10 + value: 515 objectReference: {fileID: 0} - target: {fileID: 8098959201550950962, guid: 78a55bf2b0993cc44b0a5e2496a311be, type: 3} propertyPath: m_AnchoredPosition.y diff --git a/Assets/Scripts/SingletonManagers/Managers/DBManager.cs b/Assets/Scripts/SingletonManagers/Managers/DBManager.cs index 1c0452c..897c199 100644 --- a/Assets/Scripts/SingletonManagers/Managers/DBManager.cs +++ b/Assets/Scripts/SingletonManagers/Managers/DBManager.cs @@ -31,8 +31,8 @@ namespace CodeJay public float GameSpeed; /// Number of Watched Ad In Store(Ad Heart Product). - public int ProductAdWatchedNumber; - public DateTime ProductAdWatchedTime; + public int ProductAdWatchedNumber, ShopADDia; + public DateTime ProductAdWatchedTime, ShopADDiaTime; public int FreeHeartCount, FreeKeyCount; public int InterstitialADCount; @@ -59,7 +59,7 @@ namespace CodeJay this.SFX_Toggle = false; this.IsRemoveADS = false; this.GameSpeed = 1.5f; - this.ProductAdWatchedNumber = Constants.ADS_REWARD_COUNT; + ShopADDia = this.ProductAdWatchedNumber = Constants.ADS_REWARD_COUNT; this.FreeHeartCount = Constants.FREE_HEART_DAY; FreeKeyCount = Constants.FREE_HEART_DAY; this.InterstitialADCount = Constants.INTERSTITIAL_AD_CYCLE; @@ -99,6 +99,8 @@ namespace CodeJay this.GameSpeed = data.GameSpeed; this.ProductAdWatchedNumber = data.ProductAdWatchedNumber; ProductAdWatchedTime = data.ProductAdWatchedTime; + ShopADDiaTime = data.ShopADDiaTime; + ShopADDiaTime = data.ShopADDiaTime; this.FreeHeartCount = data.FreeHeartCount; FreeKeyCount = data.FreeKeyCount; this.InterstitialADCount = data.InterstitialADCount; @@ -246,6 +248,8 @@ public partial class DBManager : MonoBehaviour public float GameSpeed { get => saveData.GameSpeed; set => saveData.GameSpeed = value; } public int ProductAdWatchedNumber { get => saveData.ProductAdWatchedNumber; } public DateTime ProductAdWatchedTime { get => saveData.ProductAdWatchedTime; } + public int ShopADDia { get => saveData.ShopADDia; } + public DateTime ShopADDiaTime { get => saveData.ShopADDiaTime; } public int FreeHeartCount { get => saveData.FreeHeartCount; } public int FreeKeyCount { get => saveData.FreeKeyCount; } public int NormalGameLevel { get => saveData.NormalGameLevel; } @@ -812,6 +816,7 @@ public partial class DBManager : MonoBehaviour if (saveData != null) { saveData.ProductAdWatchedNumber = Constants.ADS_REWARD_COUNT; + saveData.ShopADDia = Constants.ADS_REWARD_COUNT; OnResetADSRewardActionCountEvent?.Invoke(); } } @@ -841,6 +846,31 @@ public partial class DBManager : MonoBehaviour } } + public int MinProductAdDia(int min) + { + if (saveData != null) + { + saveData.ShopADDia -= min; + if (saveData.ShopADDia < 0) + saveData.ShopADDia = 0; + if (saveData.ShopADDia == 0) + saveData.ShopADDiaTime = InternetTime.Ins.Time.AddHours(1); + SaveDatas(); + + return saveData.ShopADDia; + } + + return 0; + } + public void ProductAdDia_Plus() + { + if (saveData != null) + { + saveData.ShopADDia = 1; + SaveDatas(); + } + } + public void ResetFreeHeartCount() { if (saveData != null) diff --git a/Assets/Scripts/UI/ProductSlot.cs b/Assets/Scripts/UI/ProductSlot.cs index b5444d5..7a5c9b2 100644 --- a/Assets/Scripts/UI/ProductSlot.cs +++ b/Assets/Scripts/UI/ProductSlot.cs @@ -146,7 +146,6 @@ public class ProductSlot : CardBase { GameManager.DB.OnResetADSRewardActionCountEvent += OnResetADSRewardActionCountEvent; - SaleGO.SetActive(false); AdButton.SetActive(true); PriceTMP.transform.parent.gameObject.SetActive(false); @@ -174,6 +173,37 @@ public class ProductSlot : CardBase } } } + else if (data.productID == "key_ads") + { + GameManager.DB.OnResetADSRewardActionCountEvent += OnResetADSRewardActionCountEvent; + + SaleGO.SetActive(false); + AdButton.SetActive(true); + PriceTMP.transform.parent.gameObject.SetActive(false); + + AdNumberTMP.text = $"{GameManager.DB.ShopADDia} / 3"; + + SetDiaADSButton(); + + if (GameManager.DB.ShopADDia <= 0) + { + if (AdButton != null) + { + Color c = AdButton.GetComponent().color; + c.a = 0.5f; + AdButton.GetComponent().color = c; + } + } + else + { + if (AdButton != null) + { + Color c = AdButton.GetComponent().color; + c.a = 1.0f; + AdButton.GetComponent().color = c; + } + } + } else if (data.productID == "com.fgb.adsremove") { SaleGO.SetActive(false); @@ -327,6 +357,60 @@ public class ProductSlot : CardBase } } + private void SetDiaADSButton() + { + StopAllCoroutines(); + + // 광고 이벤트 연결하기 + GameManager.ADS.OnCompletedRewardedAd += OnCompletedRewardedAd; + + DateTime loadTime = GameManager.Timer.LoadTime(); + if (loadTime.Day != InternetTime.Ins.Time.Day) + { + GameManager.DB.ResetADSRewardActionCount(); + GameManager.DB.ResetFreeHeartCount(); + GameManager.DB.ResetFreeKeyCount(); + } + else + { + if (GameManager.DB.ShopADDia <= 0) + StartCoroutine(Co_DiaTime()); + else + { + if (AdButton != null) + { + Color c = AdButton.GetComponent().color; + c.a = 1.0f; + AdButton.GetComponent().color = c; + } + SetADSRewardActionCountText(GameManager.DB.ShopADDia); + } + //GameManager.Timer.ActivateLoadSimpleTimer(name, Constants.ADS_TIMER_COUNT, OnStartTimer, OnPauseTimer, OnStopTimer, OnPassedTime); + } + + if (GameManager.DB.Get_SaveData().Month != InternetTime.Ins.Time.Month) + { + GameManager.DB.Set_Month(InternetTime.Ins.Time.Month); + GameManager.DB.ResetTotalCashPerMonth(); + } + } + + IEnumerator Co_DiaTime() + { + while (true) + { + yield return new WaitForSeconds(1f); + var cal = GameManager.DB.ShopADDiaTime - InternetTime.Ins.Time; + if (cal.TotalSeconds > 0) + AdNumberTMP.text = DSUtil.Get_TimeText_MS(cal); + else + { + GameManager.DB.ProductAdDia_Plus(); + SetData(_data); + } + } + } + public void ClickButton() { GameManager.Sound.PlaySFX(ESFXType.Button_Hit); @@ -391,6 +475,21 @@ public class ProductSlot : CardBase GameManager.UI.ShowNStackPopup(EPopupType.NotVaildFreeHaert_ADS_Popup); } } + else if (_data.productID == "key_ads") + { + // 광고 출력 + // 광고 횟수 - + + if (GameManager.DB.ShopADDia > 0) + { + GameManager.ADS.ShowResultRewardedAd(this.name); + } + else + { + // 광고 횟수가 없다는 팝업 or 가만히 두기 + //GameManager.UI.ShowNStackPopup(EPopupType.NotVaildFreeHaert_ADS_Popup); + } + } else if (_data.productID == "heart_cash") { if (GameManager.DB.Key >= _data.price) @@ -618,16 +717,33 @@ public class ProductSlot : CardBase { if (isCompleted) { - GameManager.DB.AddHeart(_data.rewardAmount, this.name); - GameManager.DB.MinProductAdWatchedNumber(1); - GameManager.ADS.OnCompletedRewardedAd -= OnCompletedRewardedAd; - SetData(_data); - - if (GameManager.DB.ProductAdWatchedNumber <= 0 && AdButton != null) + if (name == "ProductSlot (2)") { - Color c = AdButton.GetComponent().color; - c.a = 0.5f; - AdButton.GetComponent().color = c; + GameManager.DB.AddHeart(_data.rewardAmount, this.name); + GameManager.DB.MinProductAdWatchedNumber(1); + GameManager.ADS.OnCompletedRewardedAd -= OnCompletedRewardedAd; + SetData(_data); + + if (GameManager.DB.ProductAdWatchedNumber <= 0 && AdButton != null) + { + Color c = AdButton.GetComponent().color; + c.a = 0.5f; + AdButton.GetComponent().color = c; + } + } + else + { + GameManager.DB.AddKey(_data.rewardAmount, this.name); + GameManager.DB.MinProductAdDia(1); + GameManager.ADS.OnCompletedRewardedAd -= OnCompletedRewardedAd; + SetData(_data); + + if (GameManager.DB.ShopADDia <= 0 && AdButton != null) + { + Color c = AdButton.GetComponent().color; + c.a = 0.5f; + AdButton.GetComponent().color = c; + } } } } diff --git a/Assets/Scripts/UI/StorePanel.cs b/Assets/Scripts/UI/StorePanel.cs index b61ba1e..5193e48 100644 --- a/Assets/Scripts/UI/StorePanel.cs +++ b/Assets/Scripts/UI/StorePanel.cs @@ -60,6 +60,8 @@ public class StorePanel : MonoBehaviour list_item.Add(new ProductData("com.fgb.heart20", EProductType.IAP, "하트 20개", "보너스 없음", 1100, sprites[9], EProductReward.Heart, 20)); list_item.Add(new ProductData("com.fgb.heart150", EProductType.IAP, "하트 150개", "6.7% 보너스", 7700, sprites[10], EProductReward.Heart, 150)); list_item.Add(new ProductData("com.fgb.heart500", EProductType.IAP, "하트 500개", "20% 보너스", 22000, sprites[11], EProductReward.Heart, 500)); + + list_item.Add(new ProductData("key_ads", EProductType.ADS, "일일 다이아 100개", "광고 후 무료 다이아", 0, sprites[4], EProductReward.Key, 100)); } return;