From a616b214750d21e353fc793a955b9f82705f5a9f Mon Sep 17 00:00:00 2001 From: changyunjia <905640960@qq.com> Date: Mon, 1 Jun 2026 14:48:38 +0800 Subject: [PATCH] =?UTF-8?q?a=E9=9D=A2=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/AdRedeemManager.cs | 15 +- .../ModuleUI/Packreward/PackrewardUI.cs | 166 ++++++++++++++++-- .../Scripts/ModuleUI/PassView/PassViewUI.cs | 2 +- .../Scripts/ModuleUI/Play/RainPlayUICtrl.cs | 8 +- Assets/Scripts/ModuleUI/ShopView/BuygoldUI.cs | 7 +- 5 files changed, 171 insertions(+), 27 deletions(-) diff --git a/Assets/Scripts/AdRedeemManager.cs b/Assets/Scripts/AdRedeemManager.cs index 8dd76c0..4f74357 100644 --- a/Assets/Scripts/AdRedeemManager.cs +++ b/Assets/Scripts/AdRedeemManager.cs @@ -99,22 +99,19 @@ public class AdRedeemManager bool is_get = item.Key == PurchasingManager.GetPaySku(PayType.pack_reward) && SaveData.GetSaveObject().is_get_packreward; bool is_get1 = item.Key == PurchasingManager.GetPaySku(PayType.remove_ad) && SaveData.GetSaveObject().is_get_removead; - if (is_get || is_get1) + if (item.Key == PurchasingManager.GetPaySku(PayType.pack_reward) || item.Key == PurchasingManager.GetPaySku(PayType.remove_ad)) return; + if (GameHelper.GetNowTime() < lastTimes && !checkIsCanReceive(item.Key)) { item.Value.enabled = false; - } - else if (GameHelper.GetNowTime() < lastTimes && !checkIsCanReceive(item.Key)) - { - item.Value.enabled = false; - item.Value.can_buy.selectedIndex = btn_watchAd.Can_buy_cd; item.Value.btn_text.text = CommonHelper.TimeFormat(lastTimes - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + item.Value.can_buy.selectedIndex = btn_watchAd.Can_buy_cd; } else { // stopAction(); item.Value.enabled = true; - item.Value.can_buy.selectedIndex = btn_watchAd.Can_buy_can; checkBtnState(item.Value, item.Key); + item.Value.can_buy.selectedIndex = btn_watchAd.Can_buy_can; } } @@ -370,11 +367,11 @@ public class AdRedeemManager if (type == "success" && successTrackKey != null) { - // TrackKit.SendEvent(Property.adEvent, successTrackKey, Int32.Parse(suffix)); + // TrackKit.SendEvent(Property.adEvent, successTrackKey, Int32.Parse(suffix)); } else if (type == "click" && clickTrackKey != null) { - // TrackKit.SendEvent(Property.adEvent, clickTrackKey, Int32.Parse(suffix)); + // TrackKit.SendEvent(Property.adEvent, clickTrackKey, Int32.Parse(suffix)); } } diff --git a/Assets/Scripts/ModuleUI/Packreward/PackrewardUI.cs b/Assets/Scripts/ModuleUI/Packreward/PackrewardUI.cs index 9baccc4..f5e8ce0 100644 --- a/Assets/Scripts/ModuleUI/Packreward/PackrewardUI.cs +++ b/Assets/Scripts/ModuleUI/Packreward/PackrewardUI.cs @@ -11,6 +11,7 @@ using IgnoreOPS; using SGModule.Net; using IgnoreOPS; using SGModule.NetKit; +using Unity.VisualScripting; namespace ChillConnect { @@ -103,13 +104,38 @@ namespace ChillConnect list = ConfigSystem.GetConfig().DataList; + if (!GameHelper.IsGiftSwitch()) + { + list[0].Paid_price = 1; + list[1].Paid_price = 1; + } if (GameHelper.IsAdModelOfPay()) { - AdRedeemManager.Instance.SetWatchAd(PurchasingManager.GetPaySku(PayType.pack_reward), - ui.panel_parent.panel.btn_buypack as btn_watchAd, SetTextString1); - AdRedeemManager.Instance.SetWatchAd(PurchasingManager.GetPaySku(PayType.remove_ad), - ui.panel_parent.panel.btn_buyremovead as btn_watchAd, SetTextString1); + // if (!GameHelper.IsGiftSwitch()) + // { + // if (SaveData.GetSaveObject().is_get_packreward) + // { + + // } + // ui.panel_parent.panel.btn_buypack.SetClick(() => + // { + // GameDispatcher.Instance.Dispatch(GameMsg.apple_pay_success, PurchasingManager.GetPaySku(PayType.pack_reward)); + // InitView(); + // }); + // ui.panel_parent.panel.btn_buyremovead.SetClick(() => + // { + // GameDispatcher.Instance.Dispatch(GameMsg.apple_pay_success, PurchasingManager.GetPaySku(PayType.remove_ad)); + // InitView(); + // }); + // } + // else + // { + // AdRedeemManager.Instance.SetWatchAd(PurchasingManager.GetPaySku(PayType.pack_reward), + // ui.panel_parent.panel.btn_buypack as btn_watchAd, SetTextString1); + // AdRedeemManager.Instance.SetWatchAd(PurchasingManager.GetPaySku(PayType.remove_ad), + // ui.panel_parent.panel.btn_buyremovead as btn_watchAd, SetTextString1); + // } } HallManager.Instance.UpdateEvent += InitView; InitView(); @@ -218,6 +244,13 @@ namespace ChillConnect private void InitView() { + if (!GameHelper.IsGiftSwitch()) + { + ConfigSystem.GetConfig().DataList[0].Paid_price = 1; + ConfigSystem.GetConfig().DataList[1].Paid_price = 1; + list= ConfigSystem.GetConfig().DataList; + } + gold_num = list[0].coins_quantity; back_num = list[0].props_quantity[1]; out_num = list[0].props_quantity[0]; @@ -302,21 +335,134 @@ namespace ChillConnect SetTextString1(); } ui.panel_parent.panel.btn_max_remove.grayed = false; + if (GameHelper.IsAdModelOfPay()) { - if (SaveData.GetSaveObject()._watch_ad_cd > GameHelper.GetNowTime()) + + if (SaveData.GetSaveObject().is_get_packreward) { - // (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).buy_state.selectedIndex = 0; - (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).can_buy.selectedIndex = 1; - (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).btn_text.text = CommonHelper.TimeFormat((int)SaveData.GetSaveObject()._watch_ad_cd - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + (ui.panel_parent.panel.btn_buypack as btn_watchAd).buy_state.selectedIndex = 1; + (ui.panel_parent.panel.btn_buypack as btn_watchAd).title = "Received"; + (ui.panel_parent.panel.btn_buypack as btn_watchAd).enabled = false; + } + else + { + Debug.Log(AdRedeemManager.Instance.GetLookRewardADNum()); + Debug.Log(ConfigSystem.GetConfig().DataList[0].Paid_price); + if (AdRedeemManager.Instance.GetLookRewardADNum() >= ConfigSystem.GetConfig().DataList[0].Paid_price) + { + (ui.panel_parent.panel.btn_buypack as btn_watchAd).enabled = true; + (ui.panel_parent.panel.btn_buypack as btn_watchAd).buy_state.selectedIndex = 1; + (ui.panel_parent.panel.btn_buypack as btn_watchAd).title = "Receive"; + ui.panel_parent.panel.btn_buypack.SetClick(() => + { + AdRedeemData adRedeemData = new AdRedeemData + { + type = PurchasingManager.GetPaySku(PayType.pack_reward), + ad_count = AdRedeemManager.Instance.GetCeilingNeedAds(PurchasingManager.GetPaySku(PayType.pack_reward)) + }; + AdRedeemManager.Instance.Redeem(adRedeemData); + }); + } + else if (SaveData.GetSaveObject()._watch_ad_cd > GameHelper.GetNowTime()) + { + (ui.panel_parent.panel.btn_buypack as btn_watchAd).enabled = false; + (ui.panel_parent.panel.btn_buypack as btn_watchAd).buy_state.selectedIndex = 0; + (ui.panel_parent.panel.btn_buypack as btn_watchAd).can_buy.selectedIndex = 1; + (ui.panel_parent.panel.btn_buypack as btn_watchAd).btn_text.text = CommonHelper.TimeFormat((int)SaveData.GetSaveObject()._watch_ad_cd - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + } + else + { + (ui.panel_parent.panel.btn_buypack as btn_watchAd).enabled = true; + (ui.panel_parent.panel.btn_buypack as btn_watchAd).buy_state.selectedIndex = 0; + (ui.panel_parent.panel.btn_buypack as btn_watchAd).can_buy.selectedIndex = 0; + ui.panel_parent.panel.btn_buypack.SetClick(() => + { + GameHelper.ShowVideoAd("buy_add_one", isSuccess => + { + if (isSuccess) + { + var ad_times = Convert.ToInt32(GameHelper.GetNowTime()); + SaveData.GetSaveObject()._watch_ad_cd = ad_times + ConfigSystem.GetConfig().exchangeCD; + InitView(); + } + }); + // AdRedeemManager.Instance.SendEventClickByName(PurchasingManager.GetPaySku(PayType.pack_reward), "click"); + // AdRedeemManager.Instance.ShowVideoAd("buy_add_one", () => + // { + // TimerHelper.mEasy.AddTimer(0.1f, () => + // { + // var ad_times = Convert.ToInt32(GameHelper.GetNowTime()); + // SaveData.GetSaveObject()._watch_ad_cd = ad_times + ConfigSystem.GetConfig().exchangeCD; + // InitView(); + // }); + // }); + }); + } } - else if (SaveData.GetSaveObject().remove_ad_time > GameHelper.GetNowTime()) + + if (SaveData.GetSaveObject().is_get_removead && GameHelper.GetNowTime() < SaveData.GetSaveObject().remove_ad_time) { (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).buy_state.selectedIndex = 0; (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).can_buy.selectedIndex = 1; - (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).btn_text.text = CommonHelper.TimeFormat((int)SaveData.GetSaveObject().remove_ad_time - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).btn_text.text = CommonHelper.TimeFormat(SaveData.GetSaveObject().remove_ad_time - (int)GameHelper.GetNowTime(), CountDownType.Hour); + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).enabled = false; } + else + { + + if (AdRedeemManager.Instance.GetLookRewardADNum() >= ConfigSystem.GetConfig().DataList[1].Paid_price) + { + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).enabled = true; + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).buy_state.selectedIndex = 1; + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).title = "Receive"; + ui.panel_parent.panel.btn_buyremovead.SetClick(() => + { + AdRedeemData adRedeemData = new AdRedeemData + { + type = PurchasingManager.GetPaySku(PayType.remove_ad), + ad_count = AdRedeemManager.Instance.GetCeilingNeedAds(PurchasingManager.GetPaySku(PayType.remove_ad)) + }; + AdRedeemManager.Instance.Redeem(adRedeemData); + }); + } + else if (SaveData.GetSaveObject()._watch_ad_cd > GameHelper.GetNowTime()) + { + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).enabled = false; + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).buy_state.selectedIndex = 0; + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).can_buy.selectedIndex = 1; + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).btn_text.text = CommonHelper.TimeFormat((int)SaveData.GetSaveObject()._watch_ad_cd - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + } + else + { + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).enabled = true; + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).buy_state.selectedIndex = 0; + (ui.panel_parent.panel.btn_buyremovead as btn_watchAd).can_buy.selectedIndex = 0; + ui.panel_parent.panel.btn_buyremovead.SetClick(() => + { + GameHelper.ShowVideoAd("buy_add_one", isSuccess => + { + if (isSuccess) + { + var ad_times = Convert.ToInt32(GameHelper.GetNowTime()); + SaveData.GetSaveObject()._watch_ad_cd = ad_times + ConfigSystem.GetConfig().exchangeCD; + InitView(); + } + }); + // AdRedeemManager.Instance.ShowVideoAd("buy_add_one", () => + // { + // TimerHelper.mEasy.AddTimer(0.1f, () => + // { + // var ad_times = Convert.ToInt32(GameHelper.GetNowTime()); + // SaveData.GetSaveObject()._watch_ad_cd = ad_times + ConfigSystem.GetConfig().exchangeCD; + // InitView(); + // }); + // }); + }); + } + } + } else diff --git a/Assets/Scripts/ModuleUI/PassView/PassViewUI.cs b/Assets/Scripts/ModuleUI/PassView/PassViewUI.cs index 0be9765..71aae9d 100644 --- a/Assets/Scripts/ModuleUI/PassView/PassViewUI.cs +++ b/Assets/Scripts/ModuleUI/PassView/PassViewUI.cs @@ -122,7 +122,7 @@ namespace ChillConnect DOVirtual.DelayedCall(0.5f, () => { int gold = 0; - GameHelper.ShowTips("Purchase successful"); + if(!GameHelper.IsGiftSwitch()) GameHelper.ShowTips("Purchase successful"); List Passportrewards_list = ConfigSystem.GetConfig().DataList; for (int i = 0; i < Passportrewards_list.Count; i++) diff --git a/Assets/Scripts/ModuleUI/Play/RainPlayUICtrl.cs b/Assets/Scripts/ModuleUI/Play/RainPlayUICtrl.cs index 230e454..6f7ad0c 100644 --- a/Assets/Scripts/ModuleUI/Play/RainPlayUICtrl.cs +++ b/Assets/Scripts/ModuleUI/Play/RainPlayUICtrl.cs @@ -113,7 +113,7 @@ namespace ChillConnect SaveData.GetSaveObject().have_slot = true; SaveData.saveDataFunc(); GameDispatcher.Instance.Dispatch(GameMsg.Slot_refresh); - GameHelper.ShowTips("Purchase successful"); + if (!GameHelper.IsGiftSwitch()) GameHelper.ShowTips("Purchase successful"); GameHelper.IsTemporaryEnd = false; purch_number = ConfigSystem.GetConfig().addspace2.ToString(); } @@ -128,7 +128,7 @@ namespace ChillConnect GameDispatcher.Instance.Dispatch(GameMsg.Slot_refresh); } GameHelper.IsTemporaryEnd = false; - GameHelper.ShowTips("Purchase successful"); + if (!GameHelper.IsGiftSwitch()) GameHelper.ShowTips("Purchase successful"); } else if (type == PurchasingManager.GetPaySku(PayType.remove_ad)) { @@ -139,7 +139,7 @@ namespace ChillConnect // GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh); GameDispatcher.Instance.Dispatch(GameMsg.noads_refresh); GameDispatcher.Instance.Dispatch(GameMsg.UpdateNoads); - GameHelper.ShowTips("Purchase successful"); + if (!GameHelper.IsGiftSwitch()) GameHelper.ShowTips("Purchase successful"); purch_number = ConfigSystem.GetConfig().DataList[1].Paid_price2.ToString(); } else if (type == PurchasingManager.GetPaySku(PayType.pack_reward)) @@ -160,7 +160,7 @@ namespace ChillConnect GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh); GameDispatcher.Instance.Dispatch(GameMsg.Sheep_item_refresh); GameDispatcher.Instance.Dispatch(GameMsg.UpdateNoads); - GameHelper.ShowTips("Purchase successful"); + if (!GameHelper.IsGiftSwitch()) GameHelper.ShowTips("Purchase successful"); purch_number = ConfigSystem.GetConfig().DataList[0].Paid_price2.ToString(); } else if (type == PurchasingManager.GetPaySku(PayType.battle_pass)) diff --git a/Assets/Scripts/ModuleUI/ShopView/BuygoldUI.cs b/Assets/Scripts/ModuleUI/ShopView/BuygoldUI.cs index 92eac1a..8fbedaa 100644 --- a/Assets/Scripts/ModuleUI/ShopView/BuygoldUI.cs +++ b/Assets/Scripts/ModuleUI/ShopView/BuygoldUI.cs @@ -273,8 +273,9 @@ namespace ChillConnect { if (!GameHelper.IsGiftSwitch()) { - list = list.GetRange(0, 2); - list[1].Payment_amount = 1; + ConfigSystem.GetConfig().DataList = ConfigSystem.GetConfig().DataList.GetRange(0, 2); + ConfigSystem.GetConfig().DataList[1].Payment_amount = 1; + list=ConfigSystem.GetConfig().DataList; } ui.gold_list.itemRenderer = setRemaintime; ui.gold_list.numItems = list.Count > 6 ? 6 : list.Count; @@ -342,7 +343,7 @@ namespace ChillConnect if (myAds >= needAds) { item.btn_buy.can_buy.selectedIndex = 0; - // item.btn_buy.btn_text.text = needAds + "ADs"; + // item.btn_buy.btn_text.text = needAds + "ADs"; item.btn_buy.btn_text.text = "Claim"; } else