| | |
| | | public class StoreModel : GameSystemManager<StoreModel>
|
| | | {
|
| | |
|
| | | public int[] normalBuyCoinsTypes { get; private set; }
|
| | | public string UNIONSTORESAVE_KEY { get; private set; }
|
| | | public string MUSTBUYSAVE_KEY { get; private set; }
|
| | | public string StoreEffectRecord_Key { get; private set; }
|
| | | public Dictionary<int, Dictionary<int, int>> JobReplaceIdDict = new Dictionary<int, Dictionary<int, int>>();
|
| | | public Dictionary<int, string> resetTimeDict { get; private set; }
|
| | | public Dictionary<int, int> showCoinsUIDict { get; private set; }
|
| | | public Dictionary<int, int> showCoinUIDict { get; private set; }
|
| | | public int storeTrailerLv { get; private set; }
|
| | |
|
| | |
|
| | |
| | | //排行榜活动的商店
|
| | | public int rankActStore_MoneyType;
|
| | | public int rankActStore_StoreType;
|
| | | public Operation rankActStore_ActType;
|
| | | public OperationType rankActStore_ActType;
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | ParseFuncConfig();
|
| | | ParseStoreConfig();
|
| | | SetShopRedpoint();
|
| | | FuncConfigConfig buyItemHinit = FuncConfigConfig.Get("BuyItemHinit");
|
| | | normalBuyCoinsTypes = ConfigParse.GetMultipleStr<int>(buyItemHinit.Numerical1);
|
| | | FuncConfigConfig restTimeConfig = FuncConfigConfig.Get("RefreshText");
|
| | | resetTimeDict = ConfigParse.GetDic<int, string>(restTimeConfig.Numerical1);
|
| | | FuncConfigConfig mallCurrency = FuncConfigConfig.Get("MallCurrency");
|
| | | showCoinsUIDict = ConfigParse.GetDic<int, int>(mallCurrency.Numerical1);
|
| | | FuncConfigConfig mallPush = FuncConfigConfig.Get("MallPush");
|
| | | storeTrailerLv = int.Parse(mallPush.Numerical1);
|
| | |
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | |
| | | }
|
| | | #endregion
|
| | |
|
| | | public string GetStoreRefreshTimeByType(int type)
|
| | | {
|
| | | if (resetTimeDict == null || !resetTimeDict.ContainsKey(type)) return string.Empty;
|
| | |
|
| | | switch (type)
|
| | | {
|
| | | case 7:
|
| | | int willRefreshTime = GetWillRefreshTime();
|
| | | return Language.Get(resetTimeDict[type], UIHelper.AppendColor(TextColType.Green, TimeUtility.SecondsToHMS(willRefreshTime), true));
|
| | | default:
|
| | | return Language.Get(resetTimeDict[type]);
|
| | | }
|
| | | }
|
| | |
|
| | | public string GetMysteryStoreRefreshTime()
|
| | | {
|
| | |
| | | public void OnClickShopCell(StoreConfig shopInfo)
|
| | | {
|
| | | int itemId = GetReplaceId(shopInfo.ID, shopInfo.ItemID);
|
| | | ItemTipUtility.ShowGood(shopInfo.ID, itemId);
|
| | | ItemTipUtility.Show(itemId);
|
| | | }
|
| | |
|
| | | public int BuyCnt { get; private set; }
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | private ulong _price;
|
| | | private long _price;
|
| | | public void SendBuyShopItem(StoreConfig model, int count)
|
| | | {
|
| | |
|
| | | _price = (ulong)(model.MoneyNumber * count);
|
| | | _price = model.MoneyNumber * count;
|
| | |
|
| | | if (MoneyIsEnough(model.MoneyType, _price))
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | //仙玉购买物品的二次确认框,一级货币只有仙玉 默认为仙玉即可
|
| | | Dictionary<int, bool> buyItemCheckDict = new Dictionary<int, bool>();
|
| | | //type 对应枚举 BuyStoreItemCheckType 方便记忆
|
| | | public void SendBuyShopItemWithPopCheck(StoreConfig model, int count, int type = 0)
|
| | | Dictionary<int, bool> buyItemCheckDict = new Dictionary<int, bool>(); //记录勾选信息
|
| | | //eventType 二次确认框类型,对应枚举 BuyStoreItemCheckType
|
| | | public void SendBuyShopItemWithPopCheck(StoreConfig model, int count, int eventType = 0)
|
| | | {
|
| | | if (model.MoneyNumber == 0)
|
| | | {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | if (buyItemCheckDict.ContainsKey(type) && buyItemCheckDict[type])
|
| | | if (buyItemCheckDict.ContainsKey(eventType) && buyItemCheckDict[eventType])
|
| | | {
|
| | | SendBuyShopItem(model, count);
|
| | | return;
|
| | |
| | | if (isOk)
|
| | | {
|
| | | SendBuyShopItem(model, count);
|
| | | buyItemCheckDict[type] = isToggle;
|
| | | buyItemCheckDict[eventType] = isToggle;
|
| | | }
|
| | |
|
| | | }));
|
| | | }
|
| | |
|
| | | //花仙玉购买的二次确认框(本次登录) 默认提示 MysticalQG104 是否花费<color=#109d06>{0}</color>仙玉进行购买?
|
| | | //type 对应枚举 BuyStoreItemCheckType 方便记忆
|
| | | public void UseMoneyCheck(int money, Action func, int type = 0, string tip = "MysticalQG104", string fullTip = "")
|
| | | //花仙玉购买的二次确认框(本次登录)
|
| | | //eventType 二次确认框类型,对应枚举 BuyStoreItemCheckType
|
| | | public void UseMoneyCheck(int money, int moneyType, Action func, int eventType = 0, string tip = "CostMoney", string fullTip = "")
|
| | | {
|
| | | if (money == 0)
|
| | | {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | if (buyItemCheckDict.ContainsKey(type) && buyItemCheckDict[type])
|
| | | if (buyItemCheckDict.ContainsKey(eventType) && buyItemCheckDict[eventType])
|
| | | {
|
| | | func?.Invoke();
|
| | | return;
|
| | | }
|
| | |
|
| | | ConfirmCancel.ToggleConfirmCancel(Language.Get("Mail101"), fullTip == "" ? Language.Get(tip, money) : fullTip,
|
| | | ConfirmCancel.ToggleConfirmCancel(Language.Get("Mail101"), fullTip == "" ? Language.Get(tip, money, moneyType) : fullTip,
|
| | | Language.Get("ConfirmCancel102"), (bool isOk, bool isToggle) =>
|
| | | {
|
| | | if (isOk)
|
| | | {
|
| | | func?.Invoke();
|
| | | buyItemCheckDict[type] = isToggle;
|
| | | buyItemCheckDict[eventType] = isToggle;
|
| | | }
|
| | |
|
| | | });
|
| | |
| | | public void GetBuyResult(HA811_tagMCShoppingResult result)
|
| | | {
|
| | |
|
| | | Debug.Log("GetBuyResult");
|
| | | //Debug.Log("GetBuyResult");
|
| | | StoreConfig tagStore = StoreConfig.Get((int)result.ItemIndex);
|
| | |
|
| | | if (tagStore != null)
|
| | | {
|
| | | ItemConfig chinModel = ItemConfig.Get(GetReplaceId(tagStore.ID, tagStore.ItemID));
|
| | | if (!normalBuyCoinsTypes.Contains(tagStore.MoneyType))
|
| | | if (tagStore.RemindSuccess == 0)
|
| | | {
|
| | | if (tagStore.RemindSuccess == 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | // BuySuccessModel.Instance.SetBuySuccessModel(chinModel.ID, (int)result.ItemCnt);
|
| | | // if (!WindowCenter.Instance.IsOpen<BuySuccessWin>())
|
| | | // {
|
| | | // WindowCenter.Instance.Open<BuySuccessWin>();
|
| | | // }
|
| | | }
|
| | | else
|
| | | {
|
| | | float costMoney = tagStore.MoneyNumber;
|
| | | SysNotifyMgr.Instance.ShowTip("BuyItemHinit", costMoney, tagStore.MoneyType, chinModel.ItemName);
|
| | | return;
|
| | | }
|
| | |
|
| | | if (RefreshBuyResultEvent != null)
|
| | |
| | | }
|
| | |
|
| | |
|
| | | public bool MoneyIsEnough(int moneyType, ulong money)
|
| | | public bool MoneyIsEnough(int moneyType, long money)
|
| | | {
|
| | | if (UIHelper.GetMoneyCnt(moneyType) < money)
|
| | | {
|
| | |
| | | UpdateMustBuyRedpoint();
|
| | | UpdateDailyRedpoinit();
|
| | | break;
|
| | | case FuncOpenEnum.BlastFurnace:
|
| | | ControllerRedPoint();
|
| | | break;
|
| | | // case FuncOpenEnum.BlastFurnace:
|
| | | // ControllerRedPoint();
|
| | | // break;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | public void ControllerRedPoint(bool isLook = false)
|
| | | {
|
| | | fairyStoreRemindRedpoint.state = RedPointState.None;
|
| | | if (!FairyModel.Instance.fairyStoreOpen
|
| | | || !FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BlastFurnace))
|
| | | {
|
| | | return;
|
| | | }
|
| | | // if (!FairyModel.Instance.fairyStoreOpen
|
| | | // || !FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BlastFurnace))
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | |
|
| | | int familyLv = PlayerDatas.Instance.fairyData.fairy.FamilyLV;
|
| | | if (!isLook)
|
| | |
| | | {
|
| | | if (!TryGetIsSellOut(storeConfig, out remainNum))
|
| | | {
|
| | | if (UIHelper.GetMoneyCnt(storeConfig.MoneyType) >= (ulong)storeConfig.MoneyNumber)
|
| | | if (UIHelper.GetMoneyCnt(storeConfig.MoneyType) >= storeConfig.MoneyNumber)
|
| | | {
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.Simple;
|
| | | }
|
| | |
| | | {
|
| | | var redable = false;
|
| | | var config = StoreConfig.Get(shopId);
|
| | | if (config == null)
|
| | | {
|
| | | Debug.LogError($"StoreConfig {shopId} is null");
|
| | | continue;
|
| | | }
|
| | | switch (config.ShopType)
|
| | | {
|
| | | case 8:
|
| | |
| | | {
|
| | | break;
|
| | | }
|
| | | if (!MoneyIsEnough(config.MoneyType, (ulong)config.MoneyNumber))
|
| | | if (!MoneyIsEnough(config.MoneyType, config.MoneyNumber))
|
| | | {
|
| | | break;
|
| | | }
|