| | |
| | | needCostItemCnt = treasureSetConfig.CostItemCountList[index]; |
| | | hasItemCnt = PackManager.Instance.GetItemCountByID(PackType.Item, treasureSetConfig.CostItemID); |
| | | |
| | | // 物品不足 && 没超货币招募次数上限 |
| | | if (hasItemCnt < needCostItemCnt && |
| | | nowMoneyCnt + treasureCnt <= dailyMaxCountMoney) |
| | | // 内部读取货币招募开关状态 |
| | | bool isMoneyToggleOn = false; |
| | | var act = manager.GetOperationHeroAppearInfo(); |
| | | if (act != null) |
| | | { |
| | | DisplayByMoney(treasureSetConfig.CostMoneyType, needCostMoneyCnt, moneyCount); |
| | | return; |
| | | var config = ActHeroAppearConfig.Get(act.CfgID); |
| | | if (config != null) |
| | | { |
| | | isMoneyToggleOn = manager.LoadCallMoneyToggleData(config.CfgID, act.startDate, act.endDate); |
| | | } |
| | | } |
| | | DisplayByItem(treasureSetConfig.CostItemID, treasureCnt); |
| | | |
| | | if (isMoneyToggleOn) |
| | | { |
| | | // 勾选:货币优先,没超次数就用货币 |
| | | if (nowMoneyCnt + treasureCnt <= dailyMaxCountMoney) |
| | | { |
| | | DisplayByMoney(treasureSetConfig.CostMoneyType, needCostMoneyCnt, moneyCount); |
| | | } |
| | | else |
| | | { |
| | | DisplayByItem(treasureSetConfig.CostItemID, treasureCnt); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // 没勾选:保持原逻辑 |
| | | if (hasItemCnt < needCostItemCnt && |
| | | nowMoneyCnt + treasureCnt <= dailyMaxCountMoney) |
| | | { |
| | | DisplayByMoney(treasureSetConfig.CostMoneyType, needCostMoneyCnt, moneyCount); |
| | | return; |
| | | } |
| | | DisplayByItem(treasureSetConfig.CostItemID, treasureCnt); |
| | | } |
| | | } |
| | | |
| | | void DisplayByMoney(int moneyType, long needCostMoneyCnt, long moneyCount) |
| | |
| | | [SerializeField] UIEffectPlayer changeUIEffect; |
| | | |
| | | [SerializeField] OwnItemCell ownItemCell; |
| | | [SerializeField] ButtonEx closeBtn; |
| | | [SerializeField] Toggle skipToggle; |
| | | [SerializeField] Toggle moneyToggle; |
| | | [SerializeField] ButtonEx moneyToggleTipButton; |
| | | |
| | | [SerializeField] HeroDebutCallButton xbButton1; |
| | | [SerializeField] HeroDebutCallButton xbButton10; |
| | | [SerializeField] TextEx resMoneyCallCntText; |
| | |
| | | skipToggle.AddListener((value) => |
| | | { |
| | | manager.SaveCallSkipData(config.CfgID, act.startDate, act.endDate, value); |
| | | }); |
| | | moneyToggle.AddListener((value) => |
| | | { |
| | | if (value) |
| | | { |
| | | int treasureType = config.ActTreasureType; |
| | | var info = HappyXBModel.Instance.GetXBInfoByType(treasureType); |
| | | var treasureSetConfig = TreasureSetConfig.Get(treasureType); |
| | | if (info != null && treasureSetConfig != null && |
| | | info.treasureCountTodayGold >= treasureSetConfig.DailyMaxCountMoney) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("CallToggleErr1"); |
| | | moneyToggle.SetIsOnWithoutNotify(false); |
| | | return; |
| | | } |
| | | } |
| | | manager.SaveCallMoneyToggleData(config.CfgID, act.startDate, act.endDate, value); |
| | | Display(); |
| | | }); |
| | | moneyToggleTipButton.AddListener(() => |
| | | { |
| | | SmallTipWin.showText = Language.Get("CallTip01"); |
| | | SmallTipWin.worldPos = moneyToggleTipButton.transform.position; |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | }); |
| | | } |
| | | |
| | |
| | | ownItemCell.itemID = treasureSetConfig.CostItemID; |
| | | skipToggle.isOn = manager.LoadCallSkipData(config.CfgID, act.startDate, act.endDate); |
| | | |
| | | // moneyToggle:加载存档(不触发监听器),次数满时强制取消 |
| | | bool savedToggle = manager.LoadCallMoneyToggleData(config.CfgID, act.startDate, act.endDate); |
| | | if (xbTypeInfo.treasureCountTodayGold >= treasureSetConfig.DailyMaxCountMoney) |
| | | { |
| | | savedToggle = false; |
| | | manager.SaveCallMoneyToggleData(config.CfgID, act.startDate, act.endDate, false); |
| | | } |
| | | moneyToggle.SetIsOnWithoutNotify(savedToggle); |
| | | |
| | | xbButton1.Display(config.ActTreasureType, 0); |
| | | xbButton10.Display(config.ActTreasureType, 1); |
| | | resMoneyCallCntText.text = Language.Get("HeroDebut24", Mathf.Max(treasureSetConfig.DailyMaxCountMoney - xbTypeInfo.treasureCountTodayGold, 0)); |
| | |
| | | LocalSave.SetBool(GetCallSkipKey(cfgID, startDate, endDate), value); |
| | | } |
| | | |
| | | private string GetCallMoneyToggleKey(int cfgID, OperationDate startDate, OperationDate endDate) |
| | | { |
| | | return string.Concat("HeroDebutManager_CallMoneyToggle_", cfgID, "_", ToInt(startDate), "_", ToInt(endDate), "_", PlayerDatas.Instance.PlayerId); |
| | | } |
| | | |
| | | public bool LoadCallMoneyToggleData(int cfgID, OperationDate startDate, OperationDate endDate) |
| | | { |
| | | return LocalSave.GetBool(GetCallMoneyToggleKey(cfgID, startDate, endDate)); |
| | | } |
| | | |
| | | public void SaveCallMoneyToggleData(int cfgID, OperationDate startDate, OperationDate endDate, bool value) |
| | | { |
| | | LocalSave.SetBool(GetCallMoneyToggleKey(cfgID, startDate, endDate), value); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 当前招募选中的武将ID |
| | | /// </summary> |
| | |
| | | needCostItemCnt = treasureSetConfig.CostItemCountList[index]; |
| | | hasItemCnt = PackManager.Instance.GetItemCountByID(PackType.Item, treasureSetConfig.CostItemID); |
| | | |
| | | // 物品不足 && 没超货币招募次数上限 |
| | | if (hasItemCnt < needCostItemCnt && |
| | | nowMoneyCnt + treasureCnt <= dailyMaxCountMoney) |
| | | // 内部读取货币招募开关状态 |
| | | bool isMoneyToggleOn = false; |
| | | var act = manager.GetOperationHeroAppearInfo(); |
| | | if (act != null) |
| | | { |
| | | DisplayByMoney(treasureSetConfig.CostMoneyType, needCostMoneyCnt, moneyCount); |
| | | return; |
| | | var config = ActHeroAppearConfig.Get(act.CfgID); |
| | | if (config != null) |
| | | { |
| | | isMoneyToggleOn = manager.LoadCallMoneyToggleData(config.CfgID, act.startDate, act.endDate); |
| | | } |
| | | } |
| | | DisplayByItem(treasureSetConfig.CostItemID, treasureCnt); |
| | | |
| | | if (isMoneyToggleOn) |
| | | { |
| | | // 勾选:货币优先,没超次数就用货币 |
| | | if (nowMoneyCnt + treasureCnt <= dailyMaxCountMoney) |
| | | { |
| | | DisplayByMoney(treasureSetConfig.CostMoneyType, needCostMoneyCnt, moneyCount); |
| | | } |
| | | else |
| | | { |
| | | DisplayByItem(treasureSetConfig.CostItemID, treasureCnt); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // 没勾选:保持原逻辑 |
| | | if (hasItemCnt < needCostItemCnt && |
| | | nowMoneyCnt + treasureCnt <= dailyMaxCountMoney) |
| | | { |
| | | DisplayByMoney(treasureSetConfig.CostMoneyType, needCostMoneyCnt, moneyCount); |
| | | return; |
| | | } |
| | | DisplayByItem(treasureSetConfig.CostItemID, treasureCnt); |
| | | } |
| | | } |
| | | |
| | | void DisplayByMoney(int moneyType, long needCostMoneyCnt, long moneyCount) |
| | |
| | | [SerializeField] OwnItemCell ownItemCell; |
| | | [SerializeField] ButtonEx closeBtn; |
| | | [SerializeField] Toggle skipToggle; |
| | | [SerializeField] Toggle moneyToggle; |
| | | [SerializeField] ButtonEx moneyToggleTipButton; |
| | | [SerializeField] HeroReturnCallButton xbButton1; |
| | | [SerializeField] HeroReturnCallButton xbButton10; |
| | | [SerializeField] TextEx resMoneyCallCntText; |
| | |
| | | skipToggle.AddListener((value) => |
| | | { |
| | | manager.SaveCallSkipData(config.CfgID, act.startDate, act.endDate, value); |
| | | }); |
| | | moneyToggle.AddListener((value) => |
| | | { |
| | | if (value) |
| | | { |
| | | int treasureType = config.ActTreasureType; |
| | | var info = HappyXBModel.Instance.GetXBInfoByType(treasureType); |
| | | var treasureSetConfig = TreasureSetConfig.Get(treasureType); |
| | | if (info != null && treasureSetConfig != null && |
| | | info.treasureCountTodayGold >= treasureSetConfig.DailyMaxCountMoney) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("CallToggleErr1"); |
| | | moneyToggle.SetIsOnWithoutNotify(false); |
| | | return; |
| | | } |
| | | } |
| | | manager.SaveCallMoneyToggleData(config.CfgID, act.startDate, act.endDate, value); |
| | | Display(); |
| | | }); |
| | | moneyToggleTipButton.AddListener(() => |
| | | { |
| | | SmallTipWin.showText = Language.Get("CallTip01"); |
| | | SmallTipWin.worldPos = moneyToggleTipButton.transform.position; |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | }); |
| | | } |
| | | |
| | |
| | | ownItemCell.itemID = treasureSetConfig.CostItemID; |
| | | skipToggle.isOn = manager.LoadCallSkipData(config.CfgID, act.startDate, act.endDate); |
| | | |
| | | // moneyToggle:加载存档(不触发监听器),次数满时强制取消 |
| | | bool savedToggle = manager.LoadCallMoneyToggleData(config.CfgID, act.startDate, act.endDate); |
| | | if (xbTypeInfo.treasureCountTodayGold >= treasureSetConfig.DailyMaxCountMoney) |
| | | { |
| | | savedToggle = false; |
| | | manager.SaveCallMoneyToggleData(config.CfgID, act.startDate, act.endDate, false); |
| | | } |
| | | moneyToggle.SetIsOnWithoutNotify(savedToggle); |
| | | |
| | | xbButton1.Display(config.ActTreasureType, 0); |
| | | xbButton10.Display(config.ActTreasureType, 1); |
| | | resMoneyCallCntText.text = Language.Get("HeroDebut24", Mathf.Max(treasureSetConfig.DailyMaxCountMoney - xbTypeInfo.treasureCountTodayGold, 0)); |
| | |
| | | LocalSave.SetBool(GetCallSkipKey(cfgID, startDate, endDate), value); |
| | | } |
| | | |
| | | private string GetCallMoneyToggleKey(int cfgID, OperationDate startDate, OperationDate endDate) |
| | | { |
| | | return string.Concat("HeroReturnManager_CallMoneyToggle_", cfgID, "_", ToInt(startDate), "_", ToInt(endDate), "_", PlayerDatas.Instance.PlayerId); |
| | | } |
| | | |
| | | public bool LoadCallMoneyToggleData(int cfgID, OperationDate startDate, OperationDate endDate) |
| | | { |
| | | return LocalSave.GetBool(GetCallMoneyToggleKey(cfgID, startDate, endDate)); |
| | | } |
| | | |
| | | public void SaveCallMoneyToggleData(int cfgID, OperationDate startDate, OperationDate endDate, bool value) |
| | | { |
| | | LocalSave.SetBool(GetCallMoneyToggleKey(cfgID, startDate, endDate), value); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 当前招募选中的武将ID |
| | | /// </summary> |