| | |
| | | public int count;
|
| | | public int isBind;
|
| | |
|
| | | public ShopItemInfo(int id,int count,int isBind)
|
| | | public ShopItemInfo(int id, int count, int isBind)
|
| | | {
|
| | | this.itemId = id;
|
| | | this.count = count;
|
| | |
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public class StoreModel : Model,IBeforePlayerDataInitialize,IAfterPlayerDataInitialize,IPlayerLoginOk
|
| | | public class StoreModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk
|
| | | {
|
| | | 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, 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 int storeTrailerLv { get; private set; }
|
| | |
|
| | | int mysteryRefreshedCount = 0;
|
| | | List<int> mysteryCommondities = new List<int>();
|
| | | bool isLogin = true;
|
| | |
|
| | | public event Action mysteryShopRefreshEvent;
|
| | |
|
| | | RuneModel runeModel { get { return ModelCenter.Instance.GetModel<RuneModel>(); } }
|
| | | PackModel playerPack { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
|
| | | ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
|
| | |
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel
|
| | | {
|
| | | get
|
| | | {
|
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
| | | }
|
| | | }
|
| | | private bool isUpdatePlayerLv;
|
| | |
|
| | | public override void Init()
|
| | |
| | | petAndMountPushlist.Clear();
|
| | | ClearPushData();
|
| | | tagTowerModel = null;
|
| | | storeFuncType = StoreFunc.WeekStore;
|
| | | storeFuncType = StoreFunc.MysteryStore;
|
| | | tcbRefreshDict.Clear();
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | public void OnAfterPlayerDataInitialize()
|
| | | {
|
| | | UNIONSTORESAVE_KEY = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, LocalSaveStoreType.UnionStore);
|
| | | StoreEffectRecord_Key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "StoreEffectRecord");
|
| | | MUSTBUYSAVE_KEY = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID,"MustBuy");
|
| | | MUSTBUYSAVE_KEY = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "MustBuy");
|
| | | }
|
| | |
|
| | | public void OnPlayerLoginOk()
|
| | |
| | | MainInterfaceWin.IsCopyOfThePanel -= OnMoveTopPart;
|
| | | }
|
| | |
|
| | | public void RefreshMysteryShop()
|
| | | {
|
| | | var consumablesOwn = 0;
|
| | | var consumablesNeed = 1;
|
| | | if (consumablesOwn >= consumablesNeed)
|
| | | {
|
| | | var info = new CA232_tagCMRefreshMysticalShop();
|
| | | GameNetSystem.Instance.SendInfo(info);
|
| | | return;
|
| | | }
|
| | |
|
| | | var moneyOwn = 0;
|
| | | var moneyNeed = 0;
|
| | | if (moneyOwn >= moneyNeed)
|
| | | {
|
| | | var info = new CA232_tagCMRefreshMysticalShop();
|
| | | GameNetSystem.Instance.SendInfo(info);
|
| | | return;
|
| | | }
|
| | |
|
| | | //去充值吧
|
| | | }
|
| | |
|
| | | public void UpdateMysteryCommondities(HA816_tagMCMysticalShopInfo info)
|
| | | {
|
| | | mysteryRefreshedCount = info.RefreshCnt;
|
| | | mysteryCommondities.Clear();
|
| | |
|
| | | foreach (var item in info.GoodsList)
|
| | | {
|
| | | mysteryCommondities.Add((int)item.GoodsID);
|
| | | }
|
| | |
|
| | | if (mysteryShopRefreshEvent != null)
|
| | | {
|
| | | mysteryShopRefreshEvent();
|
| | | }
|
| | | }
|
| | |
|
| | | #region 解析本地数据
|
| | | public Dictionary<int, List<int>> storeRedRuleDict { get; private set; } //红点类型 1,免费商品 2,必买商品 3,坐骑灵宠 4,可购买物品(积分兑换)
|
| | | public Dictionary<int, List<int>> storePushDict { get; private set; } //1,每日弹1次2,只弹1次
|
| | |
| | | storeRedRuleDict = new Dictionary<int, List<int>>();
|
| | | storePushDict = new Dictionary<int, List<int>>();
|
| | | FuncConfigConfig storeRedRules = FuncConfigConfig.Get("StoreRedRules");
|
| | | if(storeRedRules != null)
|
| | | if (storeRedRules != null)
|
| | | {
|
| | | JsonData redRules = JsonMapper.ToObject(storeRedRules.Numerical1);
|
| | | foreach(var type in redRules.Keys)
|
| | | foreach (var type in redRules.Keys)
|
| | | {
|
| | | int redType = 0;
|
| | | int.TryParse(type,out redType);
|
| | | int.TryParse(type, out redType);
|
| | | JsonData shops = redRules[type];
|
| | | if (!storeRedRuleDict.ContainsKey(redType))
|
| | | {
|
| | | List<int> shopIdlist = new List<int>();
|
| | | if(shops.IsArray)
|
| | | if (shops.IsArray)
|
| | | {
|
| | | for(int i = 0; i < shops.Count; i++)
|
| | | for (int i = 0; i < shops.Count; i++)
|
| | | {
|
| | | int shopId = 0;
|
| | | int.TryParse(shops[i].ToString(),out shopId);
|
| | | int.TryParse(shops[i].ToString(), out shopId);
|
| | | shopIdlist.Add(shopId);
|
| | | }
|
| | | }
|
| | | storeRedRuleDict.Add(redType,shopIdlist);
|
| | | storeRedRuleDict.Add(redType, shopIdlist);
|
| | | }
|
| | | }
|
| | |
|
| | | JsonData pushRules = JsonMapper.ToObject(storeRedRules.Numerical2);
|
| | | foreach(var type in pushRules.Keys)
|
| | | foreach (var type in pushRules.Keys)
|
| | | {
|
| | | int pushType = 0;
|
| | | int.TryParse(type,out pushType);
|
| | | int.TryParse(type, out pushType);
|
| | | JsonData shops = pushRules[type];
|
| | | if (!storePushDict.ContainsKey(pushType))
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public Dictionary<int,List<StoreData>> storeTypeDict { get; private set; }
|
| | | public Dictionary<int, List<StoreData>> storeTypeDict { get; private set; }
|
| | | public Dictionary<int, List<StoreData>> theOnlyShopDict { get; private set; } //key 物品id
|
| | | public Dictionary<string, List<StoreData>> limitValueShopDict { get; private set; } //key 商品类型和限制条件
|
| | | private void ParseStoreConfig()
|
| | |
| | | theOnlyShopDict = new Dictionary<int, List<StoreData>>();
|
| | | limitValueShopDict = new Dictionary<string, List<StoreData>>();
|
| | | List<StoreConfig> storeConfigs = StoreConfig.GetValues();
|
| | | for(int i = 0; i < storeConfigs.Count; i++)
|
| | | for (int i = 0; i < storeConfigs.Count; i++)
|
| | | {
|
| | | var config = storeConfigs[i];
|
| | | if(config.ShopType != 0)
|
| | | if (config.ShopType != 0)
|
| | | {
|
| | | StoreData storeData = new StoreData();
|
| | | storeData.shopId = config.ID;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | string key = StringUtility.Contact(config.ShopType,config.LimitValue);
|
| | | if(!limitValueShopDict.ContainsKey(key))
|
| | | string key = StringUtility.Contact(config.ShopType, config.LimitValue);
|
| | | if (!limitValueShopDict.ContainsKey(key))
|
| | | {
|
| | | List<StoreData> storeDatas = new List<StoreData>();
|
| | | storeDatas.Add(storeData);
|
| | | limitValueShopDict.Add(key,storeDatas);
|
| | | limitValueShopDict.Add(key, storeDatas);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | foreach(var type in storeTypeDict.Keys)
|
| | | foreach (var type in storeTypeDict.Keys)
|
| | | {
|
| | | var configs = storeTypeDict[type];
|
| | | configs.Sort(CompareByShopSort);
|
| | | }
|
| | | }
|
| | |
|
| | | private Dictionary<int,List<int>> AnalysisJobReplace(StoreConfig storeConfig)
|
| | | private Dictionary<int, List<int>> AnalysisJobReplace(StoreConfig storeConfig)
|
| | | {
|
| | | if (storeConfig == null || string.IsNullOrEmpty(storeConfig.JobItem)) return null;
|
| | |
|
| | | Dictionary<int,List<int>> replaceDict = new Dictionary<int, List<int>>();
|
| | | Dictionary<int, List<int>> replaceDict = new Dictionary<int, List<int>>();
|
| | | JsonData jsonData = JsonMapper.ToObject(storeConfig.JobItem);
|
| | | if (jsonData.IsArray)
|
| | | {
|
| | |
| | | {
|
| | | public int shopId;
|
| | | public StoreConfig storeConfig;
|
| | | public Dictionary<int,List<int>> jobReplaceDict;
|
| | | public Dictionary<int, List<int>> jobReplaceDict;
|
| | | }
|
| | | #endregion
|
| | |
|
| | |
| | | {
|
| | | if (storeData.storeConfig.TheOnlyShop == 1)
|
| | | {
|
| | | if(!CheckTheOnlyShopSellOut(storeData.shopId))
|
| | | if (!CheckTheOnlyShopSellOut(storeData.shopId))
|
| | | {
|
| | | showStoreDatas.Add(storeData);
|
| | | }
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | public List<StoreData> TryGetStoreDatas(int type)
|
| | | public List<StoreData> TryGetStoreDatas(StoreFunc type)
|
| | | {
|
| | | List<StoreData> datas = null;
|
| | | showStoreTypeDict.TryGetValue(type,out datas);
|
| | | if (showStoreTypeDict.TryGetValue((int)type, out datas))
|
| | | {
|
| | | switch (type)
|
| | | {
|
| | | case StoreFunc.MysteryStore:
|
| | | for (var i = datas.Count - 1; i >= 0; i--)
|
| | | {
|
| | | var data = datas[i];
|
| | | if (!mysteryCommondities.Contains(data.storeConfig.ID))
|
| | | {
|
| | | mysteryCommondities.RemoveAt(i);
|
| | | }
|
| | | }
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | return datas;
|
| | | }
|
| | |
|
| | |
| | | storeTypeDict.TryGetValue(storeConfig.ShopType, out storeDatas);
|
| | | if (storeDatas != null)
|
| | | {
|
| | | for(int i = 0; i < storeDatas.Count; i++)
|
| | | for (int i = 0; i < storeDatas.Count; i++)
|
| | | {
|
| | | var storeData = storeDatas[i];
|
| | | if(storeData.shopId == shopId)
|
| | | if (storeData.shopId == shopId)
|
| | | {
|
| | | return storeData;
|
| | | }
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public int GetReplaceId(int shopId,int itemId)
|
| | | public int GetReplaceId(int shopId, int itemId)
|
| | | {
|
| | | var storeData = GetStoreData(shopId);
|
| | | if (storeData == null) return 0;
|
| | |
|
| | | int job = PlayerDatas.Instance.baseData.Job;
|
| | | var replaceDict = storeData.jobReplaceDict;
|
| | | if(replaceDict != null)
|
| | | if (replaceDict != null)
|
| | | {
|
| | | foreach (var index in replaceDict.Keys)
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | return itemId;
|
| | | }
|
| | |
|
| | |
| | | var vipLvs = config.VIPLV;
|
| | | if (vipLvs == null || vipLvs.Length < 1) return false;
|
| | |
|
| | | for(int i = 0; i < vipLvs.Length; i++)
|
| | | for (int i = 0; i < vipLvs.Length; i++)
|
| | | {
|
| | | var vipLv = vipLvs[i];
|
| | | if(vipLv != 0)
|
| | | if (vipLv != 0)
|
| | | {
|
| | | isVipBuy = true;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (isVipBuy)
|
| | | {
|
| | | int playerVip = PlayerDatas.Instance.baseData.VIPLv;
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | public List<StoreData> TryGetStoreDatasByLimit(int type,int limitValue)
|
| | | public List<StoreData> TryGetStoreDatasByLimit(int type, int limitValue)
|
| | | {
|
| | | string key = StringUtility.Contact(type,limitValue);
|
| | | string key = StringUtility.Contact(type, limitValue);
|
| | | List<StoreData> datas = null;
|
| | | limitValueShopDict.TryGetValue(key,out datas);
|
| | | limitValueShopDict.TryGetValue(key, out datas);
|
| | | return datas;
|
| | | }
|
| | | #endregion
|
| | |
| | | {
|
| | | if (resetTimeDict == null || !resetTimeDict.ContainsKey(type)) return string.Empty;
|
| | |
|
| | | switch(type)
|
| | | switch (type)
|
| | | {
|
| | | case 7:
|
| | | int willRefreshTime = GetWillRefreshTime();
|
| | | return Language.Get(resetTimeDict[type],UIHelper.AppendStringColor(TextColType.Green, TimeUtility.SecondsToHMS(willRefreshTime),true));
|
| | | return Language.Get(resetTimeDict[type], UIHelper.AppendStringColor(TextColType.Green, TimeUtility.SecondsToHMS(willRefreshTime), true));
|
| | | default:
|
| | | return Language.Get(resetTimeDict[type]);
|
| | | }
|
| | |
| | | int willRefresh = (3 - TimeUtility.OpenDay % 3);
|
| | | if (willRefresh == 3)
|
| | | {
|
| | | if(TimeUtility.ServerNow.Hour < 5)
|
| | | if (TimeUtility.ServerNow.Hour < 5)
|
| | | {
|
| | | willRefresh = 0;
|
| | | }
|
| | |
| | |
|
| | | private void UpdateSecond()
|
| | | {
|
| | | if(isUpdatePlayerLv)
|
| | | if (isUpdatePlayerLv)
|
| | | {
|
| | | UpdatePlayerLv();
|
| | | isUpdatePlayerLv = false;
|
| | |
| | |
|
| | | private void RefreshPlayerData(PlayerDataRefresh type)
|
| | | {
|
| | | switch(type)
|
| | | switch (type)
|
| | | {
|
| | | case PlayerDataRefresh.LV:
|
| | | isUpdatePlayerLv = true;
|
| | |
| | | private void RefreshFamilyLv()
|
| | | {
|
| | | int familyLv = PlayerDatas.Instance.fairyData.fairy.FamilyLV;
|
| | | if(familyLv > GetSaveFairyLV())
|
| | | if (familyLv > GetSaveFairyLV())
|
| | | {
|
| | | ControllerRedPoint();
|
| | | }
|
| | |
| | | UpdateMustBuyRedpoint();
|
| | | }
|
| | | }
|
| | | if(!PlayerDatas.Instance.fairyData.HasFairy)
|
| | | if (!PlayerDatas.Instance.fairyData.HasFairy)
|
| | | {
|
| | | PlayerPrefs.DeleteKey(UNIONSTORESAVE_KEY);
|
| | | }
|
| | |
| | |
|
| | | public event Action RefreshBuyShopLimitEvent;
|
| | |
|
| | | public StoreFunc storeFuncType = StoreFunc.WeekStore;
|
| | | public StoreFunc storeFuncType = StoreFunc.MysteryStore;
|
| | | private Dictionary<uint, BuyShopItemLimit> shopItemlimitDict = new Dictionary<uint, BuyShopItemLimit>();
|
| | | private Dictionary<string, RuneTowerFloorConfig> tagTowerModel;
|
| | |
|
| | |
| | | else
|
| | | {
|
| | | shopItemlimitDict[buylimit.DayBuyCntList[i].ItemIndex].BuyCnt = buylimit.DayBuyCntList[i].BuyCnt;
|
| | | shopItemlimitDict[buylimit.DayBuyCntList[i].ItemIndex]. isReset = buylimit.DayBuyCntList[i].IsReset;
|
| | | shopItemlimitDict[buylimit.DayBuyCntList[i].ItemIndex].isReset = buylimit.DayBuyCntList[i].IsReset;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | |
| | | if(!isLogin)
|
| | |
|
| | | if (!isLogin)
|
| | | {
|
| | | UpdateShowStore();
|
| | | UpdateFreeShopRedpoint();
|
| | |
| | | if (storeConfig == null) return null;
|
| | |
|
| | | shopItemlist.Clear();
|
| | | if(storeConfig.ItemID != 0)
|
| | | if (storeConfig.ItemID != 0)
|
| | | {
|
| | | int replaceId = GetReplaceId(storeConfig.ID, storeConfig.ItemID);
|
| | | ShopItemInfo shopItem = new ShopItemInfo(replaceId, storeConfig.ItemCnt, storeConfig.IsBind);
|
| | |
| | | int itemId = int.Parse(extraItem[i][0].ToString());
|
| | | int itemCount = int.Parse(extraItem[i][1].ToString());
|
| | | int isBind = int.Parse(extraItem[i][2].ToString());
|
| | | if(itemId != 0)
|
| | | if (itemId != 0)
|
| | | {
|
| | | int extraReplaceId = GetReplaceId(storeConfig.ID, itemId);
|
| | | ShopItemInfo shop = new ShopItemInfo(extraReplaceId, itemCount, isBind);
|
| | |
| | | public bool TryGetShopItemInfo(StoreFunc _type, int _id, out List<ShopItemInfo> _shopItems)
|
| | | {
|
| | | _shopItems = null;
|
| | | var _list = TryGetStoreDatas((int)_type);
|
| | | var _list = TryGetStoreDatas(_type);
|
| | | var _index = _list.FindIndex((x) =>
|
| | | {
|
| | | return x.shopId == _id;
|
| | |
| | | public event Action<PlayerDataRefresh> RefreshTCBPlayerDataEvent;
|
| | | public void RefreshTCBPlayerData(H0418_tagObjInfoRefresh info)
|
| | | {
|
| | | if(!tcbRefreshDict.ContainsKey((PlayerDataRefresh)info.RefreshType))
|
| | | if (!tcbRefreshDict.ContainsKey((PlayerDataRefresh)info.RefreshType))
|
| | | {
|
| | | tcbRefreshDict.Add((PlayerDataRefresh)info.RefreshType,(int)info.Value);
|
| | | tcbRefreshDict.Add((PlayerDataRefresh)info.RefreshType, (int)info.Value);
|
| | | }
|
| | | else
|
| | | {
|
| | | tcbRefreshDict[(PlayerDataRefresh)info.RefreshType] = (int)info.Value;
|
| | | }
|
| | |
|
| | | if(RefreshTCBPlayerDataEvent != null)
|
| | | if (RefreshTCBPlayerDataEvent != null)
|
| | | {
|
| | | RefreshTCBPlayerDataEvent((PlayerDataRefresh)info.RefreshType);
|
| | | }
|
| | |
| | | public int GetTCBPlayerData(PlayerDataRefresh tCDBPlayer)
|
| | | {
|
| | | int value = 0;
|
| | | tcbRefreshDict.TryGetValue(tCDBPlayer,out value);
|
| | | tcbRefreshDict.TryGetValue(tCDBPlayer, out value);
|
| | | return value;
|
| | | }
|
| | |
|
| | |
| | | public void OnClickShopCell(StoreConfig shopInfo)
|
| | | {
|
| | | BuyItemPopModel.Instance.SetModel(shopInfo.ID);
|
| | | int itemId = GetReplaceId(shopInfo.ID,shopInfo.ItemID);
|
| | | ItemAttrData attrData = new ItemAttrData(itemId,true, (ulong)shopInfo.ItemCnt,-1,shopInfo.IsBind,true,PackType.Deleted
|
| | | ,"",null,ItemTipChildType.Buy);
|
| | | itemTipsModel.SetItemTipsModel(attrData,false);
|
| | | attrData.SetTipsFuncBtn(ItemOperateType.buy,(ItemOperateType type ,string id) => { OnClickBuyBtn(ItemOperateType.buy, shopInfo.ID); });
|
| | | int itemId = GetReplaceId(shopInfo.ID, shopInfo.ItemID);
|
| | | ItemAttrData attrData = new ItemAttrData(itemId, true, (ulong)shopInfo.ItemCnt, -1, shopInfo.IsBind, true, PackType.Deleted
|
| | | , "", null, ItemTipChildType.Buy);
|
| | | itemTipsModel.SetItemTipsModel(attrData, false);
|
| | | attrData.SetTipsFuncBtn(ItemOperateType.buy, (ItemOperateType type, string id) => { OnClickBuyBtn(ItemOperateType.buy, shopInfo.ID); });
|
| | | itemTipsModel.ShowUICtrl();
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | }
|
| | | SendBuyShopItem(storeConfig,BuyCnt);
|
| | | SendBuyShopItem(storeConfig, BuyCnt);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | switch(model.MoneyType)
|
| | | switch (model.MoneyType)
|
| | | {
|
| | | case 1:
|
| | | if (VersionConfig.Get().isBanShu)
|
| | |
| | | StoreConfig tagStore = StoreConfig.Get((int)result.ItemIndex);
|
| | | if (tagStore != null)
|
| | | {
|
| | | ItemConfig chinModel = ItemConfig.Get(GetReplaceId(tagStore.ID,tagStore.ItemID));
|
| | | ItemConfig chinModel = ItemConfig.Get(GetReplaceId(tagStore.ID, tagStore.ItemID));
|
| | | if (!normalBuyCoinsTypes.Contains(tagStore.MoneyType))
|
| | | {
|
| | | if (tagStore.RemindSuccess == 0)
|
| | |
| | | else
|
| | | {
|
| | | float costMoney = tagStore.MoneyNumber;
|
| | | SysNotifyMgr.Instance.ShowTip("BuyItemHinit",costMoney,tagStore.MoneyType, chinModel.ItemName);
|
| | | SysNotifyMgr.Instance.ShowTip("BuyItemHinit", costMoney, tagStore.MoneyType, chinModel.ItemName);
|
| | | }
|
| | | |
| | |
|
| | | if (RefreshBuyResultEvent != null)
|
| | | {
|
| | | RefreshBuyResultEvent(chinModel.ID);
|
| | |
| | | {
|
| | | int playerTower = (int)runeModel.RuneTowerOpenLV;
|
| | | int offset = playerTower - limitTower;
|
| | | if (offset >= 0)
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | |
|
| | | return offset >= 0;
|
| | | }
|
| | |
|
| | | public bool MoneyIsEnough(int moneyType, ulong money)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public int jumpToItemId { get;set;}
|
| | | public int jumpToItemId { get; set; }
|
| | | public void SetJumpToModel(int itemId)
|
| | | {
|
| | | jumpToItemId = itemId;
|
| | |
| | |
|
| | | private void FuncStateChange(int funcId)
|
| | | {
|
| | | switch((FuncOpenEnum)funcId)
|
| | | switch ((FuncOpenEnum)funcId)
|
| | | {
|
| | | case FuncOpenEnum.Store:
|
| | | if (StoreFuncOpenAct != null)
|
| | |
| | | ControllerRedPoint();
|
| | | break;
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | |
|
| | | public bool IsNewDay(string recordKey)
|
| | |
| | | if (PlayerPrefs.HasKey(recordKey))
|
| | | {
|
| | | int day = LocalSave.GetInt(recordKey);
|
| | | if(day != TimeUtility.ServerNow.Day)
|
| | | if (day != TimeUtility.ServerNow.Day)
|
| | | {
|
| | | LocalSave.SetInt(recordKey, TimeUtility.ServerNow.Day);
|
| | | return true;
|
| | |
| | | public const int StoreFunc4_RedKey = 2204;
|
| | | public const int StoreFunc5_RedKey = 2205;
|
| | | public Redpoint storeFuncPoint = new Redpoint(StoreFunc_RedKey);
|
| | | public Redpoint storeFunc1Point = new Redpoint(StoreFunc_RedKey,StoreFunc1_RedKey);
|
| | | public Redpoint storeFunc2Point = new Redpoint(StoreFunc_RedKey,StoreFunc2_RedKey);
|
| | | public Redpoint storeFunc3Point = new Redpoint(StoreFunc_RedKey,StoreFunc3_RedKey);
|
| | | public Redpoint storeFunc4Point = new Redpoint(StoreFunc_RedKey,StoreFunc4_RedKey);
|
| | | public Redpoint storeFunc5Point = new Redpoint(StoreFunc_RedKey,StoreFunc5_RedKey);
|
| | | public Redpoint storeFunc1Point = new Redpoint(StoreFunc_RedKey, StoreFunc1_RedKey);
|
| | | public Redpoint storeFunc2Point = new Redpoint(StoreFunc_RedKey, StoreFunc2_RedKey);
|
| | | public Redpoint storeFunc3Point = new Redpoint(StoreFunc_RedKey, StoreFunc3_RedKey);
|
| | | public Redpoint storeFunc4Point = new Redpoint(StoreFunc_RedKey, StoreFunc4_RedKey);
|
| | | public Redpoint storeFunc5Point = new Redpoint(StoreFunc_RedKey, StoreFunc5_RedKey);
|
| | | public Dictionary<int, Redpoint> shopRedDict = new Dictionary<int, Redpoint>();
|
| | | public void SetShopRedpoint()
|
| | | {
|
| | | shopRedDict.Clear();
|
| | | List<StoreConfig> storelist = StoreConfig.GetValues();
|
| | | for(int i = 0; i < storelist.Count; i++)
|
| | | for (int i = 0; i < storelist.Count; i++)
|
| | | {
|
| | | StoreConfig storeConfig = storelist[i];
|
| | | int redKey = 0;
|
| | |
| | | switch (storeConfig.ShopType)
|
| | | {
|
| | | case 1:
|
| | | redKey = StoreFunc1_RedKey*10000 + storeConfig.ID;
|
| | | redpoint = new Redpoint(StoreFunc1_RedKey,redKey);
|
| | | redKey = StoreFunc1_RedKey * 10000 + storeConfig.ID;
|
| | | redpoint = new Redpoint(StoreFunc1_RedKey, redKey);
|
| | | shopRedDict.Add(storeConfig.ID, redpoint);
|
| | | break;
|
| | | case 2:
|
| | | redKey = StoreFunc2_RedKey * 10000 + storeConfig.ID;
|
| | | redpoint = new Redpoint(StoreFunc2_RedKey, redKey);
|
| | | shopRedDict.Add(storeConfig.ID,redpoint);
|
| | | shopRedDict.Add(storeConfig.ID, redpoint);
|
| | | break;
|
| | | case 3:
|
| | | redKey = StoreFunc3_RedKey * 10000 + storeConfig.ID;
|
| | |
| | | public void UpdateFreeShopRedpoint()
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
|
| | | |
| | |
|
| | | foreach (var key in showStoreTypeDict.Keys)
|
| | | {
|
| | | var storeDatas = showStoreTypeDict[key];
|
| | | for(int i = 0; i < storeDatas.Count; i++)
|
| | | for (int i = 0; i < storeDatas.Count; i++)
|
| | | {
|
| | | var storeConfig = storeDatas[i].storeConfig;
|
| | | int type = 0;
|
| | | TryGetRedTypeByShopId(storeConfig.ID,out type);
|
| | | if(type == 1)
|
| | | TryGetRedTypeByShopId(storeConfig.ID, out type);
|
| | | if (type == 1)
|
| | | {
|
| | | int remainNum = 0;
|
| | | if (!TryGetIsSellOut(storeConfig, out remainNum))
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | public void UpdateCanBuyRedpoint()
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
|
| | |
| | | var storeConfig = storeDatas[i].storeConfig;
|
| | | int type = 0;
|
| | | TryGetRedTypeByShopId(storeConfig.ID, out type);
|
| | | if(type == 4)
|
| | | if (type == 4)
|
| | | {
|
| | | int remainNum = 0;
|
| | | if (!TryGetIsSellOut(storeConfig, out remainNum))
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateFairyEquip(PackType type, int index, int id)
|
| | | {
|
| | | if (type != PackType.Equip |
| | | if (type != PackType.Equip
|
| | | && (index != (int)RoleEquipType.FairyCan || index != (int)RoleEquipType.FairyCan2)) return;
|
| | |
|
| | | ClearAllFairyEquipRedpoint();
|
| | |
| | | {
|
| | | var storeData = storeDatas[i];
|
| | | var storeConfig = storeData.storeConfig;
|
| | | int type = 0; |
| | | int type = 0;
|
| | | TryGetRedTypeByShopId(storeConfig.ID, out type);
|
| | | if (type == 5)
|
| | | {
|
| | |
|
| | | string fairySaveKey = string.Empty;
|
| | | bool isGetSave = TryGetFairySaveKey(storeConfig,out fairySaveKey);
|
| | | bool isGetSave = TryGetFairySaveKey(storeConfig, out fairySaveKey);
|
| | | int remainNum = 0;
|
| | | if (!TryGetIsSellOut(storeConfig, out remainNum))
|
| | | {
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if(shopRedDict[storeData.shopId].state != RedPointState.None)
|
| | | if (shopRedDict[storeData.shopId].state != RedPointState.None)
|
| | | {
|
| | | LocalSave.SetBool(fairySaveKey,false);
|
| | | LocalSave.SetBool(fairySaveKey, false);
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.None;
|
| | | }
|
| | | }
|
| | |
| | | string key1 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", key, "EquipPlace:", 9);
|
| | | string key2 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", key, "EquipPlace:", 10);
|
| | |
|
| | | if(LocalSave.GetBool(key1))
|
| | | if (LocalSave.GetBool(key1))
|
| | | {
|
| | | LocalSave.SetBool(key1, false);
|
| | | }
|
| | | else if(LocalSave.GetBool(key2))
|
| | | else if (LocalSave.GetBool(key2))
|
| | | {
|
| | | LocalSave.SetBool(key2, false);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public bool TryGetFairySaveKey(StoreConfig config,out string fairySaveKey)
|
| | | public bool TryGetFairySaveKey(StoreConfig config, out string fairySaveKey)
|
| | | {
|
| | | fairySaveKey = string.Empty;
|
| | | if (config == null) return false;
|
| | |
|
| | | ItemConfig itemConfig = ItemConfig.Get(config.ItemID);
|
| | | if(itemConfig.EquipPlace == (int)RoleEquipType.FairyCan)
|
| | | if (itemConfig.EquipPlace == (int)RoleEquipType.FairyCan)
|
| | | {
|
| | | string key1 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId",config.ID,"EquipPlace:",9);
|
| | | string key2 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", config.ID, "EquipPlace:",10);
|
| | | ItemModel itemModel1 = playerPack.GetItemByIndex(PackType.Equip,9);
|
| | | string key1 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", config.ID, "EquipPlace:", 9);
|
| | | string key2 = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", config.ID, "EquipPlace:", 10);
|
| | | ItemModel itemModel1 = playerPack.GetItemByIndex(PackType.Equip, 9);
|
| | | ItemModel itemModel2 = playerPack.GetItemByIndex(PackType.Equip, 10);
|
| | | if(itemModel1 == null
|
| | | if (itemModel1 == null
|
| | | && (!PlayerPrefs.HasKey(key1) || LocalSave.GetBool(key1)))
|
| | | {
|
| | | fairySaveKey = key1;
|
| | | return true;
|
| | | }
|
| | | else if(itemModel2 == null
|
| | | else if (itemModel2 == null
|
| | | && (!PlayerPrefs.HasKey(key2) || LocalSave.GetBool(key2)))
|
| | | {
|
| | | fairySaveKey = key2;
|
| | |
| | | var storeConfig = storeDatas[i].storeConfig;
|
| | | int type = 0;
|
| | | TryGetRedTypeByShopId(storeConfig.ID, out type);
|
| | | if(type == 2)
|
| | | if (type == 2)
|
| | | {
|
| | | if (CheckIsMustBuy(storeConfig))
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | public void ClearMustBuyRedpoint(StoreConfig storeConfig)
|
| | | {
|
| | | int type = 0;
|
| | | TryGetRedTypeByShopId(storeConfig.ID,out type);
|
| | | if(type == 2)
|
| | | TryGetRedTypeByShopId(storeConfig.ID, out type);
|
| | | if (type == 2)
|
| | | {
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.None;
|
| | | IsMustBuyDay = false;
|
| | |
| | | || TimeUtility.ServerNow.Day != records[0]))
|
| | | {
|
| | | IsMustBuyDay = true;
|
| | | LocalSave.SetIntArray(MUSTBUYSAVE_KEY,saveTimes);
|
| | | LocalSave.SetIntArray(MUSTBUYSAVE_KEY, saveTimes);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | else
|
| | | {
|
| | | IsMustBuyDay = true;
|
| | | LocalSave.SetIntArray(MUSTBUYSAVE_KEY,saveTimes);
|
| | | LocalSave.SetIntArray(MUSTBUYSAVE_KEY, saveTimes);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool CheckIsMustBuy(StoreConfig config)
|
| | | {
|
| | | int remainNum = 0;
|
| | | if(!TryGetIsSellOut(config,out remainNum) && IsMustBuyDay)
|
| | | if (!TryGetIsSellOut(config, out remainNum) && IsMustBuyDay)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
|
| | |
|
| | | List<StoreData> storelist = TryGetStoreDatas((int)StoreFunc.BindStore);
|
| | | List<StoreData> storelist = TryGetStoreDatas(StoreFunc.BindStore);
|
| | | if (storelist == null) return;
|
| | |
|
| | | for(int i = 0; i < storelist.Count; i++)
|
| | | for (int i = 0; i < storelist.Count; i++)
|
| | | {
|
| | | var storeData = storelist[i];
|
| | | ItemConfig itemConfig = ItemConfig.Get(storeData.storeConfig.ItemID);
|
| | | int type = 0;
|
| | | TryGetRedTypeByShopId(storeData.shopId, out type);
|
| | | if(type == 3)
|
| | | if (type == 3)
|
| | | {
|
| | | string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", storeData.shopId);
|
| | | int remainNum = 0;
|
| | |
| | | if (shopRedDict[storeConfig.ID].state == RedPointState.Simple)
|
| | | {
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.None;
|
| | | LocalSave.SetBool(key,false);
|
| | | LocalSave.SetBool(key, false);
|
| | | }
|
| | | break;
|
| | | }
|
| | |
| | | {
|
| | | if (storeFuncType == StoreFunc.BindStore && storeFunc != StoreFunc.BindStore)
|
| | | {
|
| | | foreach(var key in shopRedDict.Keys)
|
| | | foreach (var key in shopRedDict.Keys)
|
| | | {
|
| | | StoreConfig storeConfig = StoreConfig.Get(key);
|
| | | ItemConfig itemConfig = ItemConfig.Get(storeConfig.ItemID);
|
| | |
| | | }
|
| | | break;
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | pushRefreshEvent();
|
| | | }
|
| | | }
|
| | | if(!isLogin)
|
| | | if (!isLogin)
|
| | | {
|
| | | SetPushPetAndMountWinState();
|
| | | }
|
| | |
| | | MapConfig curMapConfig = MapConfig.Get(PlayerDatas.Instance.baseData.MapID);
|
| | | if (curMapConfig == null || curMapConfig.MapFBType != 0)
|
| | | {
|
| | | SetPushPetAndMountWinState(true,true);
|
| | | SetPushPetAndMountWinState(true, true);
|
| | | }
|
| | | }
|
| | |
|
| | | private void GuidBegin()
|
| | | {
|
| | | PetAndMountPushWin pushWin = WindowCenter.Instance.Get<PetAndMountPushWin>();
|
| | | if(pushWin != null)
|
| | | if (pushWin != null)
|
| | | {
|
| | | SetPushPetAndMountWinState(true, true);
|
| | | }
|
| | |
| | |
|
| | | private void OnMoveTopPart(bool isMove)
|
| | | {
|
| | | if(!isLogin)
|
| | | if (!isLogin)
|
| | | {
|
| | | SetPushPetAndMountWinState(!isMove);
|
| | | }
|
| | |
| | | {
|
| | | if (win is FirstTimeRechargeWin)
|
| | | {
|
| | | SetPushPetAndMountWinState(true,true);
|
| | | SetPushPetAndMountWinState(true, true);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | if (isLogin) return;
|
| | |
|
| | | if(win is MainInterfaceWin)
|
| | | if (win is MainInterfaceWin)
|
| | | {
|
| | | SetPushPetAndMountWinState(true);
|
| | | }
|
| | | else if(win is RoleParticularsWin
|
| | | else if (win is RoleParticularsWin
|
| | | || win is FirstTimeRechargeWin)
|
| | | {
|
| | | SetPushPetAndMountWinState();
|
| | |
| | |
|
| | | public void SetPushPetAndMountWinState(bool isMustClose = false, bool isClearData = false)
|
| | | {
|
| | | if(isClearData)
|
| | | if (isClearData)
|
| | | {
|
| | | ClearPushData();
|
| | | WindowCenter.Instance.Close<PetAndMountPushWin>();
|
| | | return;
|
| | | }
|
| | |
|
| | | if(CheckIsShowPush(isMustClose))
|
| | | if (CheckIsShowPush(isMustClose))
|
| | | {
|
| | | if (!WindowCenter.Instance.IsOpen<PetAndMountPushWin>())
|
| | | {
|
| | |
| | | else
|
| | | {
|
| | | MapConfig curMapConfig = MapConfig.Get(PlayerDatas.Instance.baseData.MapID);
|
| | | |
| | |
|
| | | if ((curMapConfig == null || curMapConfig.MapFBType != 0)
|
| | | || !WindowCenter.Instance.IsOpen<MainInterfaceWin>()
|
| | | || NewBieCenter.Instance.inGuiding
|
| | |
| | |
|
| | | public void RemovePetAndMountPush(int shopId)
|
| | | {
|
| | | if(petAndMountPushlist.Contains(shopId))
|
| | | if (petAndMountPushlist.Contains(shopId))
|
| | | {
|
| | | petAndMountPushlist.Remove(shopId);
|
| | | currentPushId = GetPrePetAndMountPushId();
|
| | | if(pushRefreshEvent != null)
|
| | | if (pushRefreshEvent != null)
|
| | | {
|
| | | pushRefreshEvent();
|
| | | }
|
| | |
| | | private int GetPrePetAndMountPushId()
|
| | | {
|
| | | currentPushId = 0;
|
| | | for(int i = petAndMountPushlist.Count - 1; i > -1; i--)
|
| | | for (int i = petAndMountPushlist.Count - 1; i > -1; i--)
|
| | | {
|
| | | currentPushId = petAndMountPushlist[i];
|
| | | break;
|
| | |
| | | #region 处理跳转数据
|
| | | public int funcOrder { get; private set; }
|
| | | public int jumpShopId { get; private set; }
|
| | | public void SetJumpModel(StoreFunc storeFunc,int shopId)
|
| | | public void SetJumpModel(StoreFunc storeFunc, int shopId)
|
| | | {
|
| | | if (shopId == 0) return;
|
| | |
|
| | |
| | |
|
| | | public enum StoreFunc
|
| | | {
|
| | | WeekStore = 1, //1:每周限购
|
| | | MysteryStore = 1, //1:每周限购
|
| | | CommonStore = 2, //2:常用道具
|
| | | GrowStrongerStore = 3, //3:成长变强
|
| | | BindStore = 4, //4:绑玉商城
|